class Io::Flow::V0::Models::PaymentMethodSummaryCard

Attributes

card_type[R]
id[R]
last_four[R]
merchant_of_record[R]
reference[R]
transaction_details[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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_hash() click to toggle source
# 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_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 58021
def to_json
  JSON.dump(to_hash)
end