Module: Putio::Api::Client

Included in:
Object
Defined in:
lib/putio-ruby/api/client.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/putio-ruby/api/client.rb', line 4

def client
  Faraday.new :url => "https://api.put.io/v2/" do |connection|
    # Request
    connection.request :url_encoded
    connection.use Putio::Middleware::OauthToken

    # Response
    connection.use Putio::Middleware::ParseRoot
    connection.use Putio::Middleware::ErrorHandler
    connection.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/

    # Adapter
    connection.adapter :excon
  end
end