Module: CodesWholesale::Configurable

Included in:
CodesWholesale, Client
Defined in:
lib/codes_wholesale/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



3
4
5
# File 'lib/codes_wholesale/configurable.rb', line 3

def api_version
  @api_version
end

#client_idObject

Returns the value of attribute client_id.



3
4
5
# File 'lib/codes_wholesale/configurable.rb', line 3

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



3
4
5
# File 'lib/codes_wholesale/configurable.rb', line 3

def client_secret
  @client_secret
end

#environmentObject

Returns the value of attribute environment.



3
4
5
# File 'lib/codes_wholesale/configurable.rb', line 3

def environment
  @environment
end

#user_agentObject

Returns the value of attribute user_agent.



3
4
5
# File 'lib/codes_wholesale/configurable.rb', line 3

def user_agent
  @user_agent
end

Class Method Details

.keysObject



7
8
9
10
11
12
13
14
15
# File 'lib/codes_wholesale/configurable.rb', line 7

def keys
  @keys ||= [
    :client_id,
    :client_secret,
    :environment,
    :user_agent,
    :api_version
  ]
end

Instance Method Details

#api_endpointObject



30
31
32
# File 'lib/codes_wholesale/configurable.rb', line 30

def api_endpoint
  "https://#{api_subdomain}.codeswholesale.com/#{@api_version}"
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
# File 'lib/codes_wholesale/configurable.rb', line 18

def configure
  yield self
end

#reset!Object Also known as: setup



22
23
24
25
26
27
# File 'lib/codes_wholesale/configurable.rb', line 22

def reset!
  CodesWholesale::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", CodesWholesale::Default.options[key])
  end
  self
end