Class: TutumApi
- Inherits:
-
Object
show all
- Defined in:
- lib/tutum_api.rb
Constant Summary
collapse
- BASE_API_PATH =
'https://dashboard.tutum.co/api'
- API_VERSION =
'v1'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(headers) ⇒ TutumApi
Returns a new instance of TutumApi.
9
10
11
|
# File 'lib/tutum_api.rb', line 9
def initialize()
@headers =
end
|
Instance Attribute Details
Returns the value of attribute headers.
4
5
6
|
# File 'lib/tutum_api.rb', line 4
def
@headers
end
|
Instance Method Details
#http_delete(path) ⇒ Object
35
36
37
38
|
# File 'lib/tutum_api.rb', line 35
def http_delete(path)
response = RestClient.delete(url(path), )
JSON.parse(response)
end
|
#http_get(path, params = {}) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/tutum_api.rb', line 17
def http_get(path, params={})
query = "?" + params.map { |k,v| "#{k}=#{v}"}.join("&")
full_path = path
full_path += query unless params.empty?
response = RestClient.get(url(full_path), )
JSON.parse(response)
end
|
#http_patch(path, content = {}) ⇒ Object
30
31
32
33
|
# File 'lib/tutum_api.rb', line 30
def http_patch(path, content={})
response = RestClient.patch(url(path), content.to_json, )
JSON.parse(response)
end
|
#http_post(path, content = {}) ⇒ Object
25
26
27
28
|
# File 'lib/tutum_api.rb', line 25
def http_post(path, content={})
response = RestClient.post(url(path), content.to_json, )
JSON.parse(response)
end
|