Module: Flix::Configurable

Included in:
Flix, Client
Defined in:
lib/flix/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_optionsObject

Returns the value of attribute connection_options.



6
7
8
# File 'lib/flix/configurable.rb', line 6

def connection_options
  @connection_options
end

#consumer_key=(value) ⇒ Object (writeonly)

Sets the attribute consumer_key

Parameters:

  • value

    the value to set the attribute consumer_key to.



5
6
7
# File 'lib/flix/configurable.rb', line 5

def consumer_key=(value)
  @consumer_key = value
end

#consumer_secret=(value) ⇒ Object (writeonly)

Sets the attribute consumer_secret

Parameters:

  • value

    the value to set the attribute consumer_secret to.



5
6
7
# File 'lib/flix/configurable.rb', line 5

def consumer_secret=(value)
  @consumer_secret = value
end

#endpointObject

Returns the value of attribute endpoint.



6
7
8
# File 'lib/flix/configurable.rb', line 6

def endpoint
  @endpoint
end

#identity_mapObject

Returns the value of attribute identity_map.



6
7
8
# File 'lib/flix/configurable.rb', line 6

def identity_map
  @identity_map
end

#middlewareObject

Returns the value of attribute middleware.



6
7
8
# File 'lib/flix/configurable.rb', line 6

def middleware
  @middleware
end

#oauth_token=(value) ⇒ Object (writeonly)

Sets the attribute oauth_token

Parameters:

  • value

    the value to set the attribute oauth_token to.



5
6
7
# File 'lib/flix/configurable.rb', line 5

def oauth_token=(value)
  @oauth_token = value
end

#oauth_token_secret=(value) ⇒ Object (writeonly)

Sets the attribute oauth_token_secret

Parameters:

  • value

    the value to set the attribute oauth_token_secret to.



5
6
7
# File 'lib/flix/configurable.rb', line 5

def oauth_token_secret=(value)
  @oauth_token_secret = value
end

Class Method Details

.keysObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flix/configurable.rb', line 10

def keys
  @keys ||= [
    :consumer_key,
    :consumer_secret,
    :oauth_token,
    :oauth_token_secret,
    :endpoint,
    :connection_options,
    :middleware,
    :identity_map,
    # :media_endpoint,
    # :search_endpoint,
  ]
end

Instance Method Details

#cache_keyFixnum

Returns:

  • (Fixnum)


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

def cache_key
  options.hash
end

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

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

Yields:

  • (_self)

Yield Parameters:



28
29
30
31
# File 'lib/flix/configurable.rb', line 28

def configure
  yield self
  self
end

#credentials?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/flix/configurable.rb', line 34

def credentials?
  credentials.values.all?
end

#reset!Object Also known as: setup



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

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