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.



22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22358

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:customer_number], 'CardPaymentSourceSummary')
  @customer_number = HttpClient::Preconditions.assert_class('customer_number', opts.delete(:customer_number), String)
  @token = (x = opts.delete(:token); x.nil? ? nil : HttpClient::Preconditions.assert_class('token', x, String))
  @last4 = (x = opts.delete(:last4); x.nil? ? nil : HttpClient::Preconditions.assert_class('last4', x, String))
  @expiration_month = (x = opts.delete(:expiration_month); x.nil? ? nil : HttpClient::Preconditions.assert_class('expiration_month', x, Integer))
  @expiration_year = (x = opts.delete(:expiration_year); x.nil? ? nil : HttpClient::Preconditions.assert_class('expiration_year', x, Integer))
  @type = (x = opts.delete(:type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CardType) ? x : ::Io::Flow::V0::Models::CardType.apply(x)))
  @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x)))
end

Instance Attribute Details

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def billing_address
  @billing_address
end

#customer_numberObject (readonly)

Returns the value of attribute customer_number.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def customer_number
  @customer_number
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def expiration_year
  @expiration_year
end

#last4Object (readonly)

Returns the value of attribute last4.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def last4
  @last4
end

#tokenObject (readonly)

Returns the value of attribute token.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type.



22356
22357
22358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22356

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22374
22375
22376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22374

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

#to_hashObject



22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22378

def to_hash
  {
    :customer_number => customer_number,
    :token => token,
    :last4 => last4,
    :expiration_month => expiration_month,
    :expiration_year => expiration_year,
    :type => type.nil? ? nil : type.value,
    :billing_address => billing_address.nil? ? nil : billing_address.to_hash
  }
end

#to_jsonObject



22370
22371
22372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22370

def to_json
  JSON.dump(to_hash)
end