Module: Bettery::Configurable

Included in:
Bettery, Client
Defined in:
lib/bettery/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_base_endpointObject

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_optionsObject

Returns the value of attribute connection_options.



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

def connection_options
  @connection_options
end

#default_media_typeObject

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

#localeObject

Returns the value of attribute locale.



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

def locale
  @locale
end

#middlewareObject

Returns the value of attribute middleware.



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

def middleware
  @middleware
end

#per_pageObject

Returns the value of attribute per_page.



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

def per_page
  @per_page
end

#proxyObject

Returns the value of attribute proxy.



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

def proxy
  @proxy
end

#user_agentObject

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

.keysObject



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

Yields:

  • (_self)

Yield Parameters:



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.options[key])
  end
  self
end