Class: Io::Flow::V0::Models::AuthorizationPayloadParameters
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AuthorizationPayloadParameters
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
ApplePayMerchantValidationPayload, AuthorizationPayloadParametersUndefinedType, GooglePayAuthorizationPayload
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#discriminator ⇒ Object
readonly
Returns the value of attribute discriminator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ AuthorizationPayloadParameters
constructor
A new instance of AuthorizationPayloadParameters.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AuthorizationPayloadParameters
Returns a new instance of AuthorizationPayloadParameters.
9723 9724 9725 9726 9727 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9723 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'AuthorizationPayloadParameters') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
9721 9722 9723 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9721 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9737 def AuthorizationPayloadParameters.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip if discriminator.empty? raise "Union type[authorization_payload_parameters] requires a field named 'discriminator'" end case discriminator when Types::GOOGLE_PAY_AUTHORIZATION_PAYLOAD; GooglePayAuthorizationPayload.new(hash) when Types::APPLE_PAY_MERCHANT_VALIDATION_PAYLOAD; ApplePayMerchantValidationPayload.new(hash) else AuthorizationPayloadParametersUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
9729 9730 9731 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9729 def subtype_to_hash raise 'Cannot serialize an instance of authorization_payload_parameters directly - must use one of the specific types: google_pay_authorization_payload, apple_pay_merchant_validation_payload' end |
#to_hash ⇒ Object
9733 9734 9735 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9733 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |