Class: ESODClient
Instance Method Summary collapse
- #get(resource, id) ⇒ Object
- #get_path(path) ⇒ Object
-
#initialize(url, api_token) ⇒ ESODClient
constructor
A new instance of ESODClient.
Constructor Details
#initialize(url, api_token) ⇒ ESODClient
Returns a new instance of ESODClient.
7 8 9 10 |
# File 'lib/esod_client/esod_client.rb', line 7 def initialize(url, api_token) @url = url @token = api_token end |
Instance Method Details
#get(resource, id) ⇒ Object
12 13 14 |
# File 'lib/esod_client/esod_client.rb', line 12 def get(resource, id) get_path("#{resource}/#{id}") end |
#get_path(path) ⇒ Object
16 17 18 19 |
# File 'lib/esod_client/esod_client.rb', line 16 def get_path(path) response = RestClient.get(URI.join(@url, "#{path}.xml?key=#{@token}").to_s).to_s response_hash = Hash.from_xml(response) end |