Module: EmpireAvenue::Configurable

Extended by:
Forwardable
Included in:
EmpireAvenue, Client
Defined in:
lib/empireavenue/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



7
8
9
# File 'lib/empireavenue/configurable.rb', line 7

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



7
8
9
# File 'lib/empireavenue/configurable.rb', line 7

def client_secret
  @client_secret
end

#connection_optionsObject

Returns the value of attribute connection_options.



8
9
10
# File 'lib/empireavenue/configurable.rb', line 8

def connection_options
  @connection_options
end

#endpointObject

Returns the value of attribute endpoint.



8
9
10
# File 'lib/empireavenue/configurable.rb', line 8

def endpoint
  @endpoint
end

#identity_mapObject

Returns the value of attribute identity_map.



8
9
10
# File 'lib/empireavenue/configurable.rb', line 8

def identity_map
  @identity_map
end

#middlewareObject

Returns the value of attribute middleware.



8
9
10
# File 'lib/empireavenue/configurable.rb', line 8

def middleware
  @middleware
end

#oauth_tokenObject

Returns the value of attribute oauth_token.



7
8
9
# File 'lib/empireavenue/configurable.rb', line 7

def oauth_token
  @oauth_token
end

#oauth_token_secretObject

Returns the value of attribute oauth_token_secret.



7
8
9
# File 'lib/empireavenue/configurable.rb', line 7

def oauth_token_secret
  @oauth_token_secret
end

Class Method Details

.keysObject



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

def keys
  @keys ||= [
    :client_id,
    :client_secret,
    :oauth_token,
    :oauth_token_secret,
    :endpoint,
    :connection_options,
	  :identity_map,
    :middleware,
  ]
end

Instance Method Details

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

Convenience method to allow configuration options to be set in a block

Yields:

  • (_self)

Yield Parameters:

Raises:



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

def configure
  yield self
  validate_credential_type!
  self
end

#credentials?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/empireavenue/configurable.rb', line 39

def credentials?
  credentials.values.all?
end

#reset!Object Also known as: setup



43
44
45
46
47
48
# File 'lib/empireavenue/configurable.rb', line 43

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