class Io::Flow::V0::Models::Action
Attributes
type[R]
Public Class Methods
from_json(hash)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 9328 def Action.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:type].to_s.strip if discriminator.empty? raise "Union type[action] requires a field named 'type'" end case discriminator when Types::ACTION_REDIRECT; ActionRedirect.new(hash) when Types::ACTION_USE_SDK_KLARNA_V1; ActionUseSdkKlarnaV1.new(hash) when Types::ACTION_USE_SDK_APPLEPAY_JS_CREATE_SESSION; ActionUseSdkApplepayJsCreateSession.new(hash) when Types::ACTION_USE_SDK_APPLEPAY_JS_COMPLETE_VALIDATION; ActionUseSdkApplepayJsCompleteValidation.new(hash) when Types::ACTION_USE_SDK_GOOGLEPAY; ActionUseSdkGooglepay.new(hash) when Types::ACTION_USE_SDK_PAYPAL; ActionUseSdkPaypal.new(hash) when Types::ACTION_USE_SDK_STRIPE_V3; ActionUseSdkStripeV3.new(hash) when Types::ACTION_USE_SDK_ADYEN_V3; ActionUseSdkAdyenV3.new(hash) when Types::ACTION_USE_SDK_ADYEN_V4; ActionUseSdkAdyenV4.new(hash) when Types::ACTION_SELECT_PAYMENT_OPTION; ActionSelectPaymentOption.new(hash) when Types::ACTION_EXECUTE_SCRIPT; ActionExecuteScript.new(hash) when Types::ACTION_DISPLAY_INLINE_WINDOW; ActionDisplayInlineWindow.new(hash) when Types::ACTION_WAIT; ActionWait.new(hash) else ActionUndefinedType.new(:type => discriminator) end end
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 9314 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'Action') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end
Public Instance Methods
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 9320 def subtype_to_hash raise 'Cannot serialize an instance of action directly - must use one of the specific types: action_redirect, action_use_sdk_klarna_v1, action_use_sdk_applepay_js_create_session, action_use_sdk_applepay_js_complete_validation, action_use_sdk_googlepay, action_use_sdk_paypal, action_use_sdk_stripe_v3, action_use_sdk_adyen_v3, action_use_sdk_adyen_v4, action_select_payment_option, action_execute_script, action_display_inline_window, action_wait' end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 9324 def to_hash subtype_to_hash.merge(:type => @type) end