Sha256: 9bc007feab6fcfe504e4876ba1c33ff1abdcc1fe179eef0117b79224052b8e42

Contents?: true

Size: 446 Bytes

Versions: 5

Compression:

Stored size: 446 Bytes

Contents

module PayuAPI
  class ApiRequest < Request
    extend Dry::Initializer::Mixin

    param :client
    param :method
    param :url
    param :params, default: proc { nil }

    private

    def sandbox?
      client.sandbox
    end

    def headers
      {
        'Content-Type' => 'application/json',
        'Authorization' => "Bearer #{client.auth_token}"
      }
    end

    def body
      JSON.generate(params) if params
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
payu_api-0.1.5 lib/payu_api/api_request.rb
payu_api-0.1.4 lib/payu_api/api_request.rb
payu_api-0.1.3 lib/payu_api/api_request.rb
payu_api-0.1.2 lib/payu_api/api_request.rb
payu_api-0.1.1 lib/payu_api/api_request.rb