Class: Tracky::BaseAPI
- Inherits:
-
Object
- Object
- Tracky::BaseAPI
- Defined in:
- lib/tracky/base_api.rb
Constant Summary collapse
- URI =
"http://tracky.com/api/#{Tracky::API_VERSION}"
Class Method Summary collapse
Class Method Details
.get(path) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/tracky/base_api.rb', line 9 def self.get(path) response = HTTP.get(path) json = JSON.parse(response.to_s) if json.has_key? "error" raise "#{json["error"]["type"]}: #{json["error"]["message"]}" end end |
.url(path) ⇒ Object
5 6 7 |
# File 'lib/tracky/base_api.rb', line 5 def self.url(path) [URI, "#{path}.json"].join('/') end |