Class: ESODClient

Inherits:
Object show all
Defined in:
lib/esod_client/esod_client.rb

Instance Method Summary collapse

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