Class: Io::Flow::V0::Models::PaymentMethodSummaryCard

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

Instance Attribute Summary collapse

Attributes inherited from PaymentMethodSummary

#type

Instance Method Summary collapse

Methods inherited from PaymentMethodSummary

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PaymentMethodSummaryCard

Returns a new instance of PaymentMethodSummaryCard.



58009
58010
58011
58012
58013
58014
58015
58016
58017
58018
58019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58009

def initialize(incoming={})
  super(:type => PaymentMethodSummary::Types::PAYMENT_METHOD_SUMMARY_CARD)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:merchant_of_record, :last_four, :card_type, :id], 'PaymentMethodSummaryCard')
  @merchant_of_record = (x = opts.delete(:merchant_of_record); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x))
  @last_four = HttpClient::Preconditions.assert_class('last_four', opts.delete(:last_four), String)
  @card_type = (x = opts.delete(:card_type); x.is_a?(::Io::Flow::V0::Models::CardType) ? x : ::Io::Flow::V0::Models::CardType.apply(x))
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @reference = (x = opts.delete(:reference); x.nil? ? nil : HttpClient::Preconditions.assert_class('reference', x, String))
  @transaction_details = (x = opts.delete(:transaction_details); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TransactionDetailsCard) ? x : ::Io::Flow::V0::Models::TransactionDetailsCard.new(x)))
end

Instance Attribute Details

#card_typeObject (readonly)

Returns the value of attribute card_type.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def card_type
  @card_type
end

#idObject (readonly)

Returns the value of attribute id.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def id
  @id
end

#last_fourObject (readonly)

Returns the value of attribute last_four.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def last_four
  @last_four
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def merchant_of_record
  @merchant_of_record
end

#referenceObject (readonly)

Returns the value of attribute reference.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def reference
  @reference
end

#transaction_detailsObject (readonly)

Returns the value of attribute transaction_details.



58007
58008
58009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58007

def transaction_details
  @transaction_details
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58025
58026
58027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58025

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

#subtype_to_hashObject



58029
58030
58031
58032
58033
58034
58035
58036
58037
58038
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58029

def subtype_to_hash
  {
    :merchant_of_record => merchant_of_record.value,
    :last_four => last_four,
    :card_type => card_type.value,
    :id => id,
    :reference => reference,
    :transaction_details => transaction_details.nil? ? nil : transaction_details.to_hash
  }
end

#to_jsonObject



58021
58022
58023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58021

def to_json
  JSON.dump(to_hash)
end