Class: Io::Flow::V0::Models::CardPaymentSourceSummary

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

Overview

Contains a summary of a card, which is useful for displaying to a customer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CardPaymentSourceSummary

Returns a new instance of CardPaymentSourceSummary.



25062
25063
25064
25065
25066
25067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25062

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:customer_number, :card], 'CardPaymentSourceSummary')
  @customer_number = HttpClient::Preconditions.assert_class('customer_number', opts.delete(:customer_number), String)
  @card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::CardSummary) ? x : ::Io::Flow::V0::Models::CardSummary.new(x))
end

Instance Attribute Details

#cardObject (readonly)

Returns the value of attribute card.



25060
25061
25062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25060

def card
  @card
end

#customer_numberObject (readonly)

Returns the value of attribute customer_number.



25060
25061
25062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25060

def customer_number
  @customer_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25073
25074
25075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25073

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

#to_hashObject



25077
25078
25079
25080
25081
25082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25077

def to_hash
  {
    :customer_number => customer_number,
    :card => card.to_hash
  }
end

#to_jsonObject



25069
25070
25071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25069

def to_json
  JSON.dump(to_hash)
end