Class: Apis::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/apis/client.rb

Overview

Client for the Apis API

Constant Summary collapse

URL_PREFIX =

Apis.is url prefix

'http://apis.is'

Instance Method Summary collapse

Instance Method Details

#agentFaraday::Connection

Apis.is Farafay Connection

Returns:

  • (Faraday::Connection)


15
16
17
18
19
20
# File 'lib/apis/client.rb', line 15

def agent
  Faraday.new(URL_PREFIX) do |fara|
    fara.use Apis::Response::FeedParser
    fara.adapter Faraday.default_adapter
  end
end

#get(path) ⇒ Faraday::Response

Make a HTTP GET request

Parameters:

  • url (String)

    The path, relative to the url prefix

Returns:

  • (Faraday::Response)


26
27
28
# File 'lib/apis/client.rb', line 26

def get(path)
  agent.get(path).body
end