Sha256: 69aa6ebf3c8832e5664b6ad8c0a256e61e99ceb14be074b182b5df2caa784144
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require "forwardable" require "sqoot/offer" require "sqoot/category" require "sqoot/provider" require "sqoot/commission" require "sqoot/click" require "sqoot/request" require "sqoot/response/parse_gzip" module Sqoot class Client extend Forwardable include Offer include Category include Provider include Commission include Click include Request attr_reader :affiliate_token, :authentication_token def initialize(options={}) @affiliate_token = options[:affiliate_token] || Sqoot.affiliate_token @authentication_token = options[:authentication_token] || Sqoot.authentication_token end # Provides the URL for accessing the API # # @return [String] def api_url "http://api.sqoot.com" end # Raw HTTP connection with Faraday::Connection # # @return [Faraday::Connection] def connection params = {} @connection = Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder| builder.use Faraday::Response::ParseGzip builder.adapter Faraday.default_adapter end end private def default_headers headers = { :authorization => @authentication_token, :accept => '*/*', :accept_encoding => 'gzip', :user_agent => 'Ruby gem' } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sqoot-0.0.1 | lib/sqoot/client.rb |