Class: Io::Flow::V0::Models::CardSummary

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

Overview

Card Summary is the card without the token

Instance Attribute Summary collapse

Attributes inherited from ExpandableCard

#discriminator

Instance Method Summary collapse

Methods inherited from ExpandableCard

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CardSummary

Returns a new instance of CardSummary.



22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22426

def initialize(incoming={})
  super(:discriminator => ExpandableCard::Types::CARD_SUMMARY)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :type, :expiration, :iin, :last4, :name], 'CardSummary')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::CardType) ? x : ::Io::Flow::V0::Models::CardType.apply(x))
  @expiration = (x = opts.delete(:expiration); x.is_a?(::Io::Flow::V0::Models::Expiration) ? x : ::Io::Flow::V0::Models::Expiration.new(x))
  @iin = HttpClient::Preconditions.assert_class('iin', opts.delete(:iin), String)
  @issuer = (x = opts.delete(:issuer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::IssuerSummary) ? x : ::Io::Flow::V0::Models::IssuerSummary.new(x)))
  @last4 = HttpClient::Preconditions.assert_class('last4', opts.delete(:last4), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @address = (x = opts.delete(: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

#addressObject (readonly)

Returns the value of attribute address.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def address
  @address
end

#expirationObject (readonly)

Returns the value of attribute expiration.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def expiration
  @expiration
end

#idObject (readonly)

Returns the value of attribute id.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def id
  @id
end

#iinObject (readonly)

Returns the value of attribute iin.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def iin
  @iin
end

#issuerObject (readonly)

Returns the value of attribute issuer.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def issuer
  @issuer
end

#last4Object (readonly)

Returns the value of attribute last4.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def last4
  @last4
end

#nameObject (readonly)

Returns the value of attribute name.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



22424
22425
22426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22424

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22444
22445
22446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22444

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

#subtype_to_hashObject



22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22448

def subtype_to_hash
  {
    :id => id,
    :type => type.value,
    :expiration => expiration.to_hash,
    :iin => iin,
    :issuer => issuer.nil? ? nil : issuer.to_hash,
    :last4 => last4,
    :name => name,
    :address => address.nil? ? nil : address.to_hash
  }
end

#to_jsonObject



22440
22441
22442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22440

def to_json
  JSON.dump(to_hash)
end