Module: Bettery::Configurable
Instance Attribute Summary collapse
-
#api_base_endpoint ⇒ Object
Returns the value of attribute api_base_endpoint.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#default_media_type ⇒ Object
Returns the value of attribute default_media_type.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
Instance Attribute Details
#api_base_endpoint ⇒ Object
Returns the value of attribute api_base_endpoint.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def api_base_endpoint @api_base_endpoint end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def @connection_options end |
#default_media_type ⇒ Object
Returns the value of attribute default_media_type.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def default_media_type @default_media_type end |
#locale ⇒ Object
Returns the value of attribute locale.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def locale @locale end |
#middleware ⇒ Object
Returns the value of attribute middleware.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def middleware @middleware end |
#per_page ⇒ Object
Returns the value of attribute per_page.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def per_page @per_page end |
#proxy ⇒ Object
Returns the value of attribute proxy.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def proxy @proxy end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
3 4 5 |
# File 'lib/bettery/configurable.rb', line 3 def user_agent @user_agent end |
Class Method Details
.keys ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bettery/configurable.rb', line 7 def keys @keys ||= [ :api_base_endpoint, :connection_options, :default_media_type, :locale, :middleware, :per_page, :proxy, :user_agent ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
22 23 24 |
# File 'lib/bettery/configurable.rb', line 22 def configure yield self end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
27 28 29 30 31 32 |
# File 'lib/bettery/configurable.rb', line 27 def reset! Bettery::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Bettery::Default.[key]) end self end |