Class: Io::Flow::V0::Models::ActionSelectPaymentOption

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

Overview

Present the user with a list of options for the Client to choose from.

Instance Attribute Summary collapse

Attributes inherited from Action

#type

Instance Method Summary collapse

Methods inherited from Action

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ActionSelectPaymentOption

Returns a new instance of ActionSelectPaymentOption.



26984
26985
26986
26987
26988
26989
26990
26991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26984

def initialize(incoming={})
  super(:type => Action::Types::ACTION_SELECT_PAYMENT_OPTION)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:options, :option_type], 'ActionSelectPaymentOption')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @options = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodDataPaymentOption) ? x : ::Io::Flow::V0::Models::PaymentMethodDataPaymentOption.new(x)) }
  @option_type = (x = opts.delete(:option_type); x.is_a?(::Io::Flow::V0::Models::PaymentMethodDataOptionType) ? x : ::Io::Flow::V0::Models::PaymentMethodDataOptionType.apply(x))
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



26982
26983
26984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26982

def expires_at
  @expires_at
end

#option_typeObject (readonly)

Returns the value of attribute option_type.



26982
26983
26984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26982

def option_type
  @option_type
end

#optionsObject (readonly)

Returns the value of attribute options.



26982
26983
26984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26982

def options
  @options
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26997
26998
26999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26997

def copy(incoming={})
  ActionSelectPaymentOption.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



27001
27002
27003
27004
27005
27006
27007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27001

def subtype_to_hash
  {
    :expires_at => expires_at,
    :options => options.map { |o| o.to_hash },
    :option_type => option_type.value
  }
end

#to_jsonObject



26993
26994
26995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26993

def to_json
  JSON.dump(to_hash)
end