Class: GpWebpay::Http::BaseSignedRequest
- Defined in:
- lib/gp_webpay/http/base_signed_request.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#url_attributes ⇒ Object
readonly
Returns the value of attribute url_attributes.
Instance Method Summary collapse
- #call ⇒ Object
- #callback_url ⇒ Object
-
#initialize(attributes, locale, operation, merchant_number: :default, url_attributes: {}) ⇒ BaseSignedRequest
constructor
A new instance of BaseSignedRequest.
Constructor Details
#initialize(attributes, locale, operation, merchant_number: :default, url_attributes: {}) ⇒ BaseSignedRequest
Returns a new instance of BaseSignedRequest.
19 20 21 22 23 24 25 26 27 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 19 def initialize(attributes, locale, operation, merchant_number: :default, url_attributes: {}) super() @attributes = attributes @locale = locale @merchant_number = merchant_number @operation = operation @url_attributes = url_attributes @config = GpWebpay.config[@merchant_number] || GpWebpay.config.default end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
17 18 19 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 17 def attributes @attributes end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
17 18 19 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 17 def config @config end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
17 18 19 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 17 def locale @locale end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
17 18 19 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 17 def operation @operation end |
#url_attributes ⇒ Object (readonly)
Returns the value of attribute url_attributes.
17 18 19 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 17 def url_attributes @url_attributes end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 29 def call request = HttpRequest.new( attributes.merge( merchant_number: @config.merchant_number, operation: operation, url: callback_url ) ).to_gpwebpay attrs_with_digest = payment_attributes_with_digest(request) uri = URI(@config.http_url) ExternalUrl.new( url: uri.to_s, full_url: build_full_url(uri, attrs_with_digest), params: attrs_with_digest ) end |
#callback_url ⇒ Object
48 49 50 |
# File 'lib/gp_webpay/http/base_signed_request.rb', line 48 def callback_url raise NotImplementedError end |