class Io::Flow::V0::Models::CardPaymentSource

Represents a saved credit card payment method.

Attributes

actions[R]
id[R]
summary[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 33506
def initialize(incoming={})
  super(:discriminator => PaymentSource::Types::CARD_PAYMENT_SOURCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :summary], 'CardPaymentSource')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @actions = (x = opts.delete(:actions); x.nil? ? nil : HttpClient::Preconditions.assert_class('actions', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentSourceConfirmationAction) ? x : ::Io::Flow::V0::Models::PaymentSourceConfirmationAction.new(x)) })
  @summary = (x = opts.delete(:summary); x.is_a?(::Io::Flow::V0::Models::CardPaymentSourceSummary) ? x : ::Io::Flow::V0::Models::CardPaymentSourceSummary.new(x))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 33519
def copy(incoming={})
  CardPaymentSource.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 33523
def subtype_to_hash
  {
    :id => id,
    :actions => actions.nil? ? nil : actions.map { |o| o.to_hash },
    :summary => summary.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 33515
def to_json
  JSON.dump(to_hash)
end