Class: Cloudmate::Connection
- Inherits:
-
Object
- Object
- Cloudmate::Connection
- Defined in:
- lib/cloudmate/connection.rb
Instance Method Summary collapse
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #request(method, url, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 10 11 |
# File 'lib/cloudmate/connection.rb', line 6 def initialize @faraday = Faraday.new do |faraday| faraday.response :json faraday.adapter Faraday.default_adapter end end |
Instance Method Details
#request(method, url, options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/cloudmate/connection.rb', line 13 def request(method, url, ={}) response = @faraday.public_send(method) do |request| request.url(url, ) end response.body end |