looker-open-source / looker-sdk-ruby

Looker SDK for Ruby
MIT License
14 stars 12 forks source link

Reduce output volume of sdk.inspect #7

Closed pbstriker38 closed 1 month ago

pbstriker38 commented 2 years ago

https://github.com/looker/looker-sdk-ruby/issues/69

drstrangelooker commented 1 year ago

Can you add some details about what should be included?

pbstriker38 commented 1 year ago

I would expect it not to include the entire swagger response. It's so large that I probably couldn't even paste it here

pbstriker38 commented 1 year ago

It's 1,154,479 characters long.

Here's an example of the output that I have formatted to make it easier to see what it includes. I left out the 2 sections with all of the swagger data.

#<LookerSDK::Client:0x000000011635f0e0
  @access_token=\"************************************Dm3B\",
  @api_endpoint=\"https://***.cloud.looker.com:443/api/3.1\",
  @auto_paginate=nil,
  @client_id=\"*****************JmJG\",
  @client_secret=\"********************59DC\",
  @connection_options={:request=>{:timeout=>25, :open_timeout=>35}},
  @default_media_type=\"application/json\",
  @middleware=#<Faraday::RackBuilder:0x0000000111f095f8
    @adapter=Faraday::Adapter::NetHttp,
    @handlers=[LookerSDK::Response::RaiseError, Datadog::Tracing::Contrib::Faraday::Middleware],
    @app=#<LookerSDK::Response::RaiseError:0x0000000121f7ef50
      @app=#<Datadog::Tracing::Contrib::Faraday::Middleware:0x0000000121f7f068
        @app=#<Faraday::Adapter::NetHttp:0x00000001226f8c68
          @ssl_cert_store=#<OpenSSL::X509::Store:0x0000000121f7ab08
            @verify_callback=nil,
            @error=nil,
            @error_string=nil,
            @chain=nil,
            @time=nil,
            @_httpclient_cert_store_items=[:default]
          >,
          @app=#<Proc:0x0000000121f7f158 /Users/pbstriker38/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/adapter.rb:29 (lambda)>,
          @connection_options={},
          @config_block=nil
        >,
        @options={}
      >,
      @options={}
    >
  >,
  @netrc=false,
  @netrc_file=\"/Users/pbstriker38/.netrc\",
  @per_page=nil,
  @proxy=nil,
  @user_agent=\"Looker Ruby Gem 0.1.4\",
  @faraday=nil,
  @shared_swagger=false,
  ###### GIANT SWAGGER RESPONSE ######
  @swagger={...},
  ###################################
  @raw_responses=true,
  @web_endpoint=\"https://localhost:9999\",
  @lazy_swagger=true,
  @original_options={
    :access_token=>nil,
    :api_endpoint=>\"https://***.cloud.looker.com:443/api/3.1\",
    :auto_paginate=>nil,
    :client_id=>\"*****************JmJG\",
    :client_secret=>\"********************59DC\",
    :connection_options=>{:request=>{:timeout=>25, :open_timeout=>35}},
    :default_media_type=>\"application/json\",
    :middleware=>#<Faraday::RackBuilder:0x0000000111f095f8
      @adapter=Faraday::Adapter::NetHttp,
      @handlers=[LookerSDK::Response::RaiseError, Datadog::Tracing::Contrib::Faraday::Middleware],
      @app=#<LookerSDK::Response::RaiseError:0x0000000121f7ef50
        @app=#<Datadog::Tracing::Contrib::Faraday::Middleware:0x0000000121f7f068
          @app=#<Faraday::Adapter::NetHttp:0x00000001226f8c68
            @ssl_cert_store=#<OpenSSL::X509::Store:0x0000000121f7ab08
              @verify_callback=nil,
              @error=nil,
              @error_string=nil,
              @chain=nil,
              @time=nil,
              @_httpclient_cert_store_items=[:default]
            >,
            @app=#<Proc:0x0000000121f7f158 /Users/pbstriker38/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/adapter.rb:29 (lambda)>,
            @connection_options={},
            @config_block=nil
          >,
          @options={}
        >,
        @options={}
      >
    >,
    :netrc=>false,
    :netrc_file=>\"/Users/pbstriker38/.netrc\",
    :per_page=>nil,
    :proxy=>nil,
    :user_agent=>\"Looker Ruby Gem 0.1.4\",
    :faraday=>nil,
    :shared_swagger=>false,
    :swagger=>nil,
    :raw_responses=>true,
    :web_endpoint=>\"https://localhost:9999\",
    :lazy_swagger=>true
  },
  @dynamic=true,
  @skip_authenticate=false,
  @last_error=#<LookerSDK::BadRequest:\"POST https://***.cloud.looker.com/api/3.1/queries/run/json?cache=true&timeout=30: 400 - unexpected token at ''\\n // See: https://cloud.google.com/looker/docs/r/err/3.1/400/post/queries/run/:result_format\\n // And: https://marketplace-api.looker.com/errorcodes/400.md\">,
  @last_response=nil,
  @serializer=#<LookerSDK::Client::Serializer:0x0000000121f12d78
    @format=JSON,
    @dump=#<Method: JSON.dump(obj, anIO=..., limit=...) /Users/pbstriker38/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:631>,
    @load=#<Method: JSON.load(source, proc=..., options=...) /Users/pbstriker38/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:557>
  >,
  @agent=<Sawyer::Agent https://***.cloud.looker.com:443/api/3.1/>,
  ### ALL OF THE OPERATIONS FROM THE SWAGGER AGAIN ###
  @operations={...},
  ###################################################
  @access_token_expires_at=2023-03-23 09:35:50.654429 -0700,
  @access_token_type=\"Bearer\"
>