Class: SynapsePayments::Request
- Inherits:
-
Object
- Object
- SynapsePayments::Request
- Defined in:
- lib/synapse_payments/request.rb
Constant Summary collapse
- HEADERS =
{ 'User-Agent' => "SynapsePaymentsRubyGem/#{SynapsePayments::VERSION}", 'X-Ruby-Version' => RUBY_VERSION, 'X-Ruby-Platform' => RUBY_PLATFORM }
Instance Method Summary collapse
-
#initialize(client:, method:, path:, oauth_key: nil, fingerprint: nil, json: nil, idempotency_key: nil) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
Constructor Details
#initialize(client:, method:, path:, oauth_key: nil, fingerprint: nil, json: nil, idempotency_key: nil) ⇒ Request
Returns a new instance of Request.
10 11 12 13 14 15 16 17 18 |
# File 'lib/synapse_payments/request.rb', line 10 def initialize(client:, method:, path:, oauth_key: nil, fingerprint: nil, json: nil, idempotency_key: nil) @client = client @method = method @path = path @oauth_key = oauth_key @fingerprint = fingerprint @json = json @idempotency_key = idempotency_key end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 |
# File 'lib/synapse_payments/request.rb', line 20 def perform = @method == :get ? :params : :json response = http_client.public_send(@method, "#{@client.api_base}#{@path}", => @json) response_body = @client.symbolize_keys!(response.parse) fail_or_return_response_body(response.code, response_body) end |