Sha256: befa37495e021e5526435577171e8985c34604da7ec2fdf9896d1969dde396c7

Contents?: true

Size: 588 Bytes

Versions: 5

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_endpoint'

module Panoptes
  module Endpoints
    class JsonEndpoint < BaseEndpoint
      # Automatically configured connection to use JSON requests/responses
      # @see Panoptes::Endpoints::BaseEndpoint#initialize
      def initialize(auth: {}, url: nil, prefix: nil, &config)
        super auth: auth, url: url, prefix: prefix do |faraday|
          yield(faraday) if config
          faraday.request :json
          faraday.response :json
          faraday.adapter Faraday.default_adapter
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
panoptes-client-1.2.1 lib/panoptes/endpoints/json_endpoint.rb
panoptes-client-1.2.0 lib/panoptes/endpoints/json_endpoint.rb
panoptes-client-1.1.1 lib/panoptes/endpoints/json_endpoint.rb
panoptes-client-1.1.0 lib/panoptes/endpoints/json_endpoint.rb
panoptes-client-1.0.0 lib/panoptes/endpoints/json_endpoint.rb