Module: PactasItero::Configurable
- Included in:
- PactasItero, Client
- Defined in:
- lib/pactas_itero/configurable.rb
Instance Attribute Summary collapse
- #api_endpoint ⇒ Object
-
#bearer_token ⇒ Object
Returns the value of attribute bearer_token.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#default_media_type ⇒ Object
Returns the value of attribute default_media_type.
-
#legal_entity_id ⇒ Object
Returns the value of attribute legal_entity_id.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#production ⇒ Object
Returns the value of attribute production.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Class Method Summary collapse
-
.keys ⇒ Object
List of configurable keys for PactasItero::Client.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
- #production_api_endpoint ⇒ Object
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
- #sandbox_api_endpoint ⇒ Object
Instance Attribute Details
#api_endpoint ⇒ Object
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_token ⇒ Object
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_id ⇒ Object
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_secret ⇒ Object
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_type ⇒ Object
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 |
#legal_entity_id ⇒ Object
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 |
#middleware ⇒ Object
Returns the value of attribute middleware.
5 6 7 |
# File 'lib/pactas_itero/configurable.rb', line 5 def middleware @middleware end |
#production ⇒ Object
Returns the value of attribute production.
5 6 7 |
# File 'lib/pactas_itero/configurable.rb', line 5 def production @production end |
#user_agent ⇒ Object
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
.keys ⇒ Object
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
27 28 29 |
# File 'lib/pactas_itero/configurable.rb', line 27 def configure yield self end |
#production_api_endpoint ⇒ Object
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.[key]) end self end |
#sandbox_api_endpoint ⇒ Object
47 48 49 |
# File 'lib/pactas_itero/configurable.rb', line 47 def sandbox_api_endpoint PactasItero::Default.sandbox_api_endpoint end |