Module: Citrulu

Defined in:
lib/citrulu/error.rb,
lib/citrulu.rb

Overview

:nodoc:

Defined Under Namespace

Classes: AccessDenied, Error, InternalServerError, NotFound

Constant Summary collapse

BASE_URL =

The address of the Citrulu API

"https://app.citrulu.com/api/v1"

Class Method Summary collapse

Class Method Details

.connectionObject

Sets up the connection to the Citrulu API using the api key, which must already have been set to CITRULU_API_KEY



10
11
12
13
14
15
16
17
18
19
# File 'lib/citrulu.rb', line 10

def self.connection
  Faraday.new(:url => BASE_URL) do |connection|
    connection.request  :url_encoded             # form-encode POST params
    connection.response :logger                  # log requests to STDOUT
    connection.adapter  Faraday.default_adapter  # make requests with Net::HTTP
    connection.use      FaradayMiddleware::RaiseHttpException
    
    connection.params[:auth_token] = CITRULU_API_KEY # Authenticate using the user's API key
  end
end