Module: PactasItero::Configurable

Included in:
PactasItero, Client
Defined in:
lib/pactas_itero/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject



40
41
42
43
44
45
# File 'lib/pactas_itero/configurable.rb', line 40

def api_endpoint
  endpoint = @api_endpoint ||
    (production && production_api_endpoint) ||
    sandbox_api_endpoint
  File.join(endpoint, "")
end

#bearer_tokenObject

Returns the value of attribute bearer_token.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def bearer_token
  @bearer_token
end

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def client_secret
  @client_secret
end

#default_media_typeObject

Returns the value of attribute default_media_type.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def default_media_type
  @default_media_type
end

Returns the value of attribute legal_entity_id.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def legal_entity_id
  @legal_entity_id
end

#middlewareObject

Returns the value of attribute middleware.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def middleware
  @middleware
end

#productionObject

Returns the value of attribute production.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def production
  @production
end

#user_agentObject

Returns the value of attribute user_agent.



5
6
7
# File 'lib/pactas_itero/configurable.rb', line 5

def user_agent
  @user_agent
end

Class Method Details

.keysObject

List of configurable keys for PactasItero::Client



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pactas_itero/configurable.rb', line 11

def keys
  @_keys ||= [
    :bearer_token,
    :api_endpoint,
    :client_id,
    :client_secret,
    :user_agent,
    :default_media_type,
    :middleware,
    :production,
    :legal_entity_id
  ]
end

Instance Method Details

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

Set configuration options using a block

Yields:

  • (_self)

Yield Parameters:



27
28
29
# File 'lib/pactas_itero/configurable.rb', line 27

def configure
  yield self
end

#production_api_endpointObject



51
52
53
# File 'lib/pactas_itero/configurable.rb', line 51

def production_api_endpoint
  PactasItero::Default.production_api_endpoint
end

#reset!Object Also known as: setup

Reset configuration options to default values



32
33
34
35
36
37
# File 'lib/pactas_itero/configurable.rb', line 32

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

#sandbox_api_endpointObject



47
48
49
# File 'lib/pactas_itero/configurable.rb', line 47

def sandbox_api_endpoint
  PactasItero::Default.sandbox_api_endpoint
end