Class: OEXRWrapper::LatestResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/oexrwrapper/resources/latest.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #initialize

Constructor Details

This class inherits a constructor from OEXRWrapper::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/oexrwrapper/resources/latest.rb', line 7

def method_missing(symbol, *args)
  if symbol !~ /^[a-zA-Z]{3}$/
    super
  else
    get_request('latest').body['rates'][symbol.to_s.upcase]
  end
end

Instance Method Details

#respond_to_missing(symbol) ⇒ Object



15
16
17
# File 'lib/oexrwrapper/resources/latest.rb', line 15

def respond_to_missing symbol
  true
end

#retrieveObject



3
4
5
# File 'lib/oexrwrapper/resources/latest.rb', line 3

def retrieve
  Latest.new get_request('latest').body['rates']
end