Sha256: aef36a70c95345df91d530e6287fc45b8a1840618134cbb902cbf807c4d6a494

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

require 'httparty'

module Viglink
  class HTTPClient
    include HTTParty
    base_uri 'https://publishers.viglink.com'
    headers Authorization: -> { "secret #{Viglink.configuration.secret_key}" }
    # format :json
    debug_output Viglink.configuration.debug_output

    def self.get(path:, query: {})
      response = super(path, query: query)

      unless response.success?
        raise Viglink::APIError.new(status: response.code, body: response.body)
      end

      response
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
viglink-rb-0.1.1 lib/viglink/http_client.rb
viglink-rb-0.1.0 lib/viglink/http_client.rb