class CirroIO::Client::Base

Public Class Methods

custom_connection() click to toggle source
# File lib/cirro_io/client/base.rb, line 23
def self.custom_connection
  Faraday.new(url: "#{CirroIO::Client.configuration.site}/#{CirroIO::Client.configuration.api_version}") do |conn|
    conn.request :json
    conn.response :json
    conn.use CirroIO::Client::JwtAuthentication
    conn.use JsonApiClient::Middleware::Status, {}
  end
end
custom_post(endpoint, payload) click to toggle source
# File lib/cirro_io/client/base.rb, line 19
def self.custom_post(endpoint, payload)
  custom_connection.post(endpoint, payload.to_json)
end
site=(url) click to toggle source

HACK: github.com/JsonApiClient/json_api_client/issues/215 Used for initialization as well

Calls superclass method
# File lib/cirro_io/client/base.rb, line 9
def self.site=(url)
  super.tap do
    connection true do |connection|
      connection.use JwtAuthentication
      connection.use Faraday::Response::Logger
      # connection.use ResponseDebuggingMiddleware # for debugging or while adding new specs
    end
  end
end