Module: EyApi
- Defined in:
- lib/ey-flex/ey-api.rb
Instance Method Summary collapse
Instance Method Details
#call_api(path, opts = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/ey-flex/ey-api.rb', line 2 def call_api(path, opts={}) response = @rest["/api/#{path}"].post(@keys.merge(opts), {"Accept" => "application/json"}) JSON.parse(response.body) rescue RestClient::RequestFailed => e case e.http_code when 503 sleep 10 # Nanite, save us... retry else raise "API call to Engine Yard failed with status #{e.http_code}." end end |
#get_envs ⇒ Object
15 16 17 |
# File 'lib/ey-flex/ey-api.rb', line 15 def get_envs @_envs ||= call_api("environments") end |
#get_json(instance_id) ⇒ Object
19 20 21 |
# File 'lib/ey-flex/ey-api.rb', line 19 def get_json(instance_id) call_api("json_for_instance", :instance_id => instance_id) end |