Sha256: b924efe9891fb0733cad82e79114676f6820d133ff8222ed73bc731e4fe48242

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

class RocketfuelApi::Connection
  def initialize(config)
    @config = config
    @config[:uri] ||= 'https://api-sandbox.rocketfuel.com/2016'

    @connection = Faraday.new(@config[:uri]) do |conn|
      conn.request :json
      conn.response :json, content_type: /\bjson$/
      conn.use RocketfuelApi::Faraday::Response::RaiseHttpError
      conn.adapter Faraday.default_adapter
      conn.headers['X-Auth-Token'] = @config[:auth_token]
    end
  end

  def get(uri_suffix, params = {})
    @connection.get(uri_suffix, params)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rocketfuel_api-0.1.3 lib/rocketfuel_api/connection.rb
rocketfuel_api-0.1.2 lib/rocketfuel_api/connection.rb
rocketfuel_api-0.1.1 lib/rocketfuel_api/connection.rb
rocketfuel_api-0.1.0 lib/rocketfuel_api/connection.rb