Class: Cloudmate::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmate/connection.rb

Instance Method Summary collapse

Constructor Details

#initializeConnection

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, options={})
  response = @faraday.public_send(method) do |request|
    request.url(url, options)
  end

  response.body
end