Module: OpConnect::Configurable

Included in:
OpConnect, Client
Defined in:
lib/op_connect/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



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

def access_token
  @access_token
end

#adapterObject

Returns the value of attribute adapter.



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

def adapter
  @adapter
end

#api_endpointObject



35
36
37
# File 'lib/op_connect/configurable.rb', line 35

def api_endpoint
  ::File.join(@api_endpoint, "")
end

#stubsObject

Returns the value of attribute stubs.



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

def stubs
  @stubs
end

#user_agentObject

Returns the value of attribute user_agent.



3
4
5
# File 'lib/op_connect/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/op_connect/configurable.rb', line 7

def keys
  @keys ||= [
    :access_token,
    :adapter,
    :api_endpoint,
    :stubs,
    :user_agent
  ]
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end

#reset!Object Also known as: setup



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

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

  self
end

#same_options?(opts) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/op_connect/configurable.rb', line 31

def same_options?(opts)
  opts.hash == options.hash
end