Class: DPay::GooglePayRequest
- Inherits:
-
Object
- Object
- DPay::GooglePayRequest
- Defined in:
- lib/dpay/card/google_pay_request.rb,
sig/dpay/card/google_pay_request.rbs
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token, device_info) ⇒ GooglePayRequest
constructor
A new instance of GooglePayRequest.
- #to_body ⇒ Hash[String, untyped]
- #with_channel_id(channel_id) ⇒ self
- #with_email(email) ⇒ self
Constructor Details
#initialize(token, device_info) ⇒ GooglePayRequest
Returns a new instance of GooglePayRequest.
9 10 11 12 13 |
# File 'lib/dpay/card/google_pay_request.rb', line 9 def initialize(token, device_info) @token = token @device_info = device_info @leading = {} end |
Class Method Details
.create(token, device_info) ⇒ GooglePayRequest
5 6 7 |
# File 'lib/dpay/card/google_pay_request.rb', line 5 def self.create(token, device_info) new(token, device_info) end |
Instance Method Details
#to_body ⇒ Hash[String, untyped]
25 26 27 28 29 30 31 32 33 |
# File 'lib/dpay/card/google_pay_request.rb', line 25 def to_body body = {} %w[email channelId].each { |key| body[key] = @leading[key] if @leading.key?(key) } body["xPayType"] = "GOOGLE_PAY" body["xPayToken"] = @token body["deviceInfo"] = @device_info.to_h body end |
#with_channel_id(channel_id) ⇒ self
20 21 22 23 |
# File 'lib/dpay/card/google_pay_request.rb', line 20 def with_channel_id(channel_id) @leading["channelId"] = channel_id self end |
#with_email(email) ⇒ self
15 16 17 18 |
# File 'lib/dpay/card/google_pay_request.rb', line 15 def with_email(email) @leading["email"] = email self end |