Sha256: 94e1d5462210349c170d383cc01aa3ac635692aade7eb2bed2d8bc50b2aaceb4

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

require 'faraday_middleware'
require_relative 'version'

module Marvel
  module Connection

    BASE_API_URL = 'https://gateway.marvel.com/v1/public/'
    HEADERS = {
                accept: 'application/json',
                user_agent: "marvel_api gem #{Marvel::Version}"
              }

    private

    def connection
      options = {
        headers: HEADERS,
        ssl: { verify: false },
        url: BASE_API_URL
      }

      Faraday.new(options) do |connection|
        connection.use Faraday::Request::UrlEncoded
        connection.use Faraday::Response::Mashify
        connection.use Faraday::Response::ParseJson
        connection.adapter(Faraday.default_adapter)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marvel_api-0.2.1 lib/marvel/connection.rb