Class: PoxyClient::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/poxy_client/configuration.rb

Constant Summary collapse

OPTIONS =
[:api_key, :origin, :destination, :mode, :retriever_version].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
14
15
16
# File 'lib/poxy_client/configuration.rb', line 11

def initialize
  @origin               = 'http://poxy.ws'
  @destination          = 'http://home.herokuapp.com/'
  @mode                 = 'development'
  @retriever_version    = VERSION
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/poxy_client/configuration.rb', line 5

def api_key
  @api_key
end

#destinationObject

Returns the value of attribute destination.



7
8
9
# File 'lib/poxy_client/configuration.rb', line 7

def destination
  @destination
end

#modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/poxy_client/configuration.rb', line 8

def mode
  @mode
end

#originObject

Returns the value of attribute origin.



6
7
8
# File 'lib/poxy_client/configuration.rb', line 6

def origin
  @origin
end

#retriever_versionObject

Returns the value of attribute retriever_version.



9
10
11
# File 'lib/poxy_client/configuration.rb', line 9

def retriever_version
  @retriever_version
end

Instance Method Details

#[](option) ⇒ Object



18
19
20
# File 'lib/poxy_client/configuration.rb', line 18

def [](option)
  send(option)
end

#merge(hash) ⇒ Object



29
30
31
# File 'lib/poxy_client/configuration.rb', line 29

def merge(hash)
  to_hash.merge(hash)
end

#to_hashObject



22
23
24
25
26
27
# File 'lib/poxy_client/configuration.rb', line 22

def to_hash
  OPTIONS.inject({}) do |hash, option|
    hash[option.to_sym] = self.send(option)
    hash
  end
end