Class: Staccato::Adapter::Faraday

Inherits:
Object
  • Object
show all
Defined in:
lib/staccato/adapter/faraday.rb

Overview

The Faraday Adapter

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Faraday

Returns a new instance of Faraday.



6
7
8
9
10
11
12
13
# File 'lib/staccato/adapter/faraday.rb', line 6

def initialize(uri)
  @connection = ::Faraday.new(uri) do |faraday|
    faraday.request  :url_encoded             # form-encode POST params
    faraday.adapter  ::Faraday.default_adapter  # make requests with Net::HTTP

    yield faraday if block_given?
  end
end

Instance Method Details

#post(params) ⇒ Object



15
16
17
# File 'lib/staccato/adapter/faraday.rb', line 15

def post(params)
  @connection.post(nil, params)
end