Sha256: cddc23968ed409b40376bc5c915a027473854131d4b6dd2a64461ad702f09de2

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

require 'faraday'
require 'faraday/request/url_encoded'
require 'faraday/response/raise_error'
require 'faraday/response/raise_mtgox_error'
require 'mtgox/response/parse_json'
require 'mtgox/version'

module MtGox
  module Connection
  private

    def connection
      options = {
        headers:  {
          accept: 'application/json',
          user_agent: "mtgox gem #{MtGox::Version}",
        },
        url: 'https://data.mtgox.com',
      }

      Faraday.new(options) do |connection|
        connection.request :url_encoded
        connection.use Faraday::Response::RaiseError
        connection.use MtGox::Response::ParseJson
        connection.use Faraday::Response::RaiseMtGoxError
        connection.adapter(Faraday.default_adapter)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mtgox-1.1.0 lib/mtgox/connection.rb
mtgox-1.0.0 lib/mtgox/connection.rb
mtgox-0.9.1 lib/mtgox/connection.rb