Class: Exchange::ExternalAPI::Configuration

Inherits:
Configurable show all
Defined in:
lib/exchange/external_api/configuration.rb

Overview

A Class that handles api configuration options

Author:

  • Beat Richartz

Since:

  • 0.9

Version:

  • 0.9

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Configurable

#reset, #set, #subclass_with_constantize

Instance Attribute Details

#app_idObject

Since:

  • 0.9


12
13
14
# File 'lib/exchange/external_api/configuration.rb', line 12

def app_id
  @app_id
end

#fallback=(value) ⇒ Object

Since:

  • 0.9


12
13
14
# File 'lib/exchange/external_api/configuration.rb', line 12

def fallback=(value)
  @fallback = value
end

#protocolObject

Since:

  • 0.9


12
13
14
# File 'lib/exchange/external_api/configuration.rb', line 12

def protocol
  @protocol
end

#retriesObject

Since:

  • 0.9


12
13
14
# File 'lib/exchange/external_api/configuration.rb', line 12

def retries
  @retries
end

Instance Method Details

#fallback_with_constantizeObject Also known as: fallback

Constantize fallback apis on the fly

Since:

  • 0.9


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/exchange/external_api/configuration.rb', line 18

def fallback_with_constantize
  self.fallback = Array(fallback_without_constantize).map do |fb|
    unless !fb || fb.is_a?(Class)
      parent_module.const_get camelize(fb)
    else
      fb
    end
  end
  
  fallback_without_constantize
end

#keySymbol

The configuration key

Returns:

  • (Symbol)

    :api, always

Since:

  • 0.9


42
43
44
# File 'lib/exchange/external_api/configuration.rb', line 42

def key
  :api
end

#parent_moduleClass

The configuration parent module

Returns:

  • (Class)

    ExternalAPI, always

Since:

  • 0.9


35
36
37
# File 'lib/exchange/external_api/configuration.rb', line 35

def parent_module
  ExternalAPI
end