Class: Io::Flow::V0::Models::PaymentMethodDataAuthorizeApplepayResult

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PaymentMethodDataAuthorizeApplepayResult

Returns a new instance of PaymentMethodDataAuthorizeApplepayResult.



13838
13839
13840
13841
13842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13838

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentMethodDataAuthorizeApplepayResult')
  @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String)
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



13836
13837
13838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13836

def type
  @type
end

Class Method Details

.from_json(hash) ⇒ Object



13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13852

def PaymentMethodDataAuthorizeApplepayResult.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[payment_method_data_authorize_applepay_result] requires a field named 'type'"
  end
  case discriminator
    when Types::PAYMENT_METHOD_DATA_AUTHORIZE_APPLEPAY_RESULT_SUCCESS; PaymentMethodDataAuthorizeApplepayResultSuccess.new(hash)
    when Types::PAYMENT_METHOD_DATA_AUTHORIZE_APPLEPAY_RESULT_FAILURE; PaymentMethodDataAuthorizeApplepayResultFailure.new(hash)
    else PaymentMethodDataAuthorizeApplepayResultUndefinedType.new(:type => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



13844
13845
13846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13844

def subtype_to_hash
  raise 'Cannot serialize an instance of payment_method_data_authorize_applepay_result directly - must use one of the specific types: payment_method_data_authorize_applepay_result_success, payment_method_data_authorize_applepay_result_failure'
end

#to_hashObject



13848
13849
13850
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13848

def to_hash
  subtype_to_hash.merge(:type => @type)
end