Class: Io::Flow::V0::Models::CardPaymentSourceForm

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 = {}) ⇒ CardPaymentSourceForm

Returns a new instance of CardPaymentSourceForm.



22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22319

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:customer_number], 'CardPaymentSourceForm')
  @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.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def billing_address
  @billing_address
end

#customer_numberObject (readonly)

Returns the value of attribute customer_number.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def customer_number
  @customer_number
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def expiration_year
  @expiration_year
end

#last4Object (readonly)

Returns the value of attribute last4.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def last4
  @last4
end

#tokenObject (readonly)

Returns the value of attribute token.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type.



22317
22318
22319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22317

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22335
22336
22337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22335

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

#to_hashObject



22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22339

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



22331
22332
22333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22331

def to_json
  JSON.dump(to_hash)
end