Class: AmazonFlexPay::Pipelines::Base

Inherits:
Model
  • Object
show all
Defined in:
lib/amazon_flex_pay/pipelines/base.rb

Overview

:nodoc:

Direct Known Subclasses

EditToken, MultiUse, Recipient, SingleUse

Instance Method Summary collapse

Methods inherited from Model

attribute, attribute_names, collection_attribute, complex_attribute, enumerated_attribute, #initialize

Constructor Details

This class inherits a constructor from AmazonFlexPay::Model

Instance Method Details

#to_hashObject



25
26
27
28
29
30
# File 'lib/amazon_flex_pay/pipelines/base.rb', line 25

def to_hash
  super().merge(
    'pipelineName' => pipeline_name,
    'version' => AmazonFlexPay::PIPELINE_VERSION
  )
end

#to_paramObject

Converts the Pipeline object into parameters and signs them.



15
16
17
18
19
20
21
22
23
# File 'lib/amazon_flex_pay/pipelines/base.rb', line 15

def to_param
  params = to_hash.merge(
    'callerKey' => AmazonFlexPay.access_key,
    'signatureVersion' => 2,
    'signatureMethod' => 'HmacSHA256'
  )
  params['signature'] = AmazonFlexPay.sign(AmazonFlexPay.pipeline_endpoint, params)
  AmazonFlexPay::Util.query_string(params)
end

#to_urlObject

Returns a full redirectable URL for this pipeline.



10
11
12
# File 'lib/amazon_flex_pay/pipelines/base.rb', line 10

def to_url
  AmazonFlexPay.pipeline_endpoint + '?' + self.to_param
end