Module: GogoKit::Configuration

Included in:
Client
Defined in:
lib/gogokit/configuration.rb

Overview

Configuration options for Client or falls back to Default

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def access_token
  @access_token
end

#api_root_endpointObject

Returns the value of attribute api_root_endpoint.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def api_root_endpoint
  @api_root_endpoint
end

#authorization_endpointObject

Returns the value of attribute authorization_endpoint.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def authorization_endpoint
  @authorization_endpoint
end

#client_idObject

Returns the value of attribute client_id.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def client_secret
  @client_secret
end

#oauth_token_endpointObject

Returns the value of attribute oauth_token_endpoint.



8
9
10
# File 'lib/gogokit/configuration.rb', line 8

def oauth_token_endpoint
  @oauth_token_endpoint
end

Instance Method Details

#api_environmentSymbol

Gets the current API environment in use

environment is not :production or :sandbox.

Returns:

  • (Symbol)

Raises:

  • (GogoKit::Error::ConfigurationError)

    Error is raised when supplied



28
29
30
# File 'lib/gogokit/configuration.rb', line 28

def api_environment
  @api_environment
end

#api_environment=(api_environment) ⇒ Object

Sets the API environment to be used. Setting this value will configure the values for #api_root_endpoint, #oauth_token_endpoint and #authorization_endpoint. See developer.viagogo.net/#sandbox-environment



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gogokit/configuration.rb', line 37

def api_environment=(api_environment)
  @api_environment = api_environment.to_sym
  validate_configuration_api_environment!

  self.api_root_endpoint =
    GogoKit::Default::API_ROOT_ENDPOINTS[@api_environment]
  self.oauth_token_endpoint =
    GogoKit::Default::OAUTH_TOKEN_ENDPOINTS[@api_environment]
  self.authorization_endpoint =
    GogoKit::Default::AUTHORIZATION_ENDPOINTS[@api_environment]
end

#reset!Object

Reset configuration options to default values



16
17
18
19
20
21
# File 'lib/gogokit/configuration.rb', line 16

def reset!
  keys.each do |key|
    instance_variable_set(:"@#{key}", GogoKit::Default.send(key))
  end
  self
end