Class: CurrencyLayer::LiveRequest

Inherits:
Object
  • Object
show all
Includes:
Hashable
Defined in:
lib/currency_conversion/live/live_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query = {}) ⇒ LiveRequest

Returns a new instance of LiveRequest.



11
12
13
14
15
16
17
18
# File 'lib/currency_conversion/live/live_request.rb', line 11

def initialize(query = {})

  # Ruby passes by reference, so we can manipulate the object, and we check if the currencies is an array, and if so, we convert to string according to API
  query.currencies = query.currencies.kind_of?(String) ? query.currencies : query.currencies.join(',')

  self.query = query

end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



9
10
11
# File 'lib/currency_conversion/live/live_request.rb', line 9

def query
  @query
end