Module: LookerSDK::Default

Defined in:
lib/looker-sdk/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

API_ENDPOINT =

Default API endpoint look TODO update this as needed

"https://localhost:19999/api/3.0/".freeze
USER_AGENT =

Default User Agent header string

"Looker Ruby Gem #{LookerSDK::VERSION}".freeze
MEDIA_TYPE =

Default media type

"application/json"
WEB_ENDPOINT =

Default WEB endpoint

"https://localhost:9999".freeze
RACK_BUILDER_CLASS =

In Faraday 0.9, Faraday::Builder was renamed to Faraday::RackBuilder

defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder
MIDDLEWARE =

Default Faraday middleware stack

RACK_BUILDER_CLASS.new do |builder|
  builder.use LookerSDK::Response::RaiseError
  builder.adapter Faraday.default_adapter
end

Class Method Summary collapse

Class Method Details

.access_tokenString

Default access token from ENV

Returns:

  • (String)


64
65
66
# File 'lib/looker-sdk/default.rb', line 64

def access_token
  ENV['LOOKER_ACCESS_TOKEN']
end

.api_endpointString

Default API endpoint from ENV or API_ENDPOINT

Returns:

  • (String)


70
71
72
# File 'lib/looker-sdk/default.rb', line 70

def api_endpoint
  ENV['LOOKER_API_ENDPOINT'] || API_ENDPOINT
end

.auto_paginateString

Default pagination preference from ENV

Returns:

  • (String)


76
77
78
# File 'lib/looker-sdk/default.rb', line 76

def auto_paginate
  ENV['LOOKER_AUTO_PAGINATE']
end

.client_idString

Default OAuth app key from ENV

Returns:

  • (String)


82
83
84
# File 'lib/looker-sdk/default.rb', line 82

def client_id
  ENV['LOOKER_CLIENT_ID']
end

.client_secretString

Default OAuth app secret from ENV

Returns:

  • (String)


88
89
90
# File 'lib/looker-sdk/default.rb', line 88

def client_secret
  ENV['LOOKER_SECRET']
end

.connection_optionsHash

Default options for Faraday::Connection

Returns:

  • (Hash)


94
95
96
97
98
99
100
101
# File 'lib/looker-sdk/default.rb', line 94

def connection_options
  {
    :headers => {
      :accept => default_media_type,
      :user_agent => user_agent
    }
  }
end

.default_media_typeString

Default media type from ENV or MEDIA_TYPE

Returns:

  • (String)


105
106
107
# File 'lib/looker-sdk/default.rb', line 105

def default_media_type
  ENV['LOOKER_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE
end

.faradayObject



116
117
118
# File 'lib/looker-sdk/default.rb', line 116

def faraday
  nil
end

.lazy_swaggerBoolean

Default behavior for loading swagger during initialization or at first call

Returns:

  • (Boolean)


130
131
132
# File 'lib/looker-sdk/default.rb', line 130

def lazy_swagger
  false
end

.middlewareString

Default middleware stack for Faraday::Connection from MIDDLEWARE

Returns:

  • (String)


112
113
114
# File 'lib/looker-sdk/default.rb', line 112

def middleware
  MIDDLEWARE
end

.netrcBoolean

Default behavior for reading .netrc file

Returns:

  • (Boolean)


166
167
168
# File 'lib/looker-sdk/default.rb', line 166

def netrc
  ENV['LOOKER_NETRC'] || false
end

.netrc_fileString

Default path for .netrc file

Returns:

  • (String)


172
173
174
# File 'lib/looker-sdk/default.rb', line 172

def netrc_file
  ENV['LOOKER_NETRC_FILE'] || File.join(ENV['HOME'].to_s, '.netrc')
end

.optionsHash

Configuration options

Returns:

  • (Hash)


58
59
60
# File 'lib/looker-sdk/default.rb', line 58

def options
  Hash[LookerSDK::Configurable.keys.map{|key| [key, send(key)]}]
end

.per_pageFixnum

Default pagination page size from ENV

Returns:

  • (Fixnum)

    Page size



140
141
142
143
144
# File 'lib/looker-sdk/default.rb', line 140

def per_page
  page_size = ENV['LOOKER_PER_PAGE']

  page_size.to_i if page_size
end

.proxyString

Default proxy server URI for Faraday connection from ENV

Returns:

  • (String)


148
149
150
# File 'lib/looker-sdk/default.rb', line 148

def proxy
  ENV['LOOKER_PROXY']
end

.raw_responsesObject



134
135
136
# File 'lib/looker-sdk/default.rb', line 134

def raw_responses
  false
end

.shared_swaggerObject



124
125
126
# File 'lib/looker-sdk/default.rb', line 124

def shared_swagger
  false
end

.swaggerObject



120
121
122
# File 'lib/looker-sdk/default.rb', line 120

def swagger
  nil
end

.user_agentString

Default User-Agent header string from ENV or USER_AGENT

Returns:

  • (String)


154
155
156
# File 'lib/looker-sdk/default.rb', line 154

def user_agent
  ENV['LOOKER_USER_AGENT'] || USER_AGENT
end

.web_endpointString

Default web endpoint from ENV or WEB_ENDPOINT

Returns:

  • (String)


160
161
162
# File 'lib/looker-sdk/default.rb', line 160

def web_endpoint
  ENV['LOOKER_WEB_ENDPOINT'] || WEB_ENDPOINT
end