Sha256: 008047287df634268828cedb799dc7047075c9d6f50b49ea4ac5cd8f62034c86

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

Dir[File.expand_path('../citrulu/*.rb', __FILE__)].each{|f| require f}
Dir[File.expand_path('../faraday/*.rb', __FILE__)].each{|f| require f}
require 'faraday'

module Citrulu
  # The address of the Citrulu API
  BASE_URL = "https://app.citrulu.com/api/v1"
  
  # Sets up the connection to the Citrulu API using the api key, which must already have been set to CITRULU_API_KEY
  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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
citrulu-0.2.3 lib/citrulu.rb
citrulu-0.2.2 lib/citrulu.rb
citrulu-0.2.1 lib/citrulu.rb
citrulu-0.2.0 lib/citrulu.rb