Class: Io::Flow::V0::Models::PaymentMethodSummaryCard

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

Instance Attribute Summary collapse

Attributes inherited from PaymentMethodSummary

#type

Instance Method Summary collapse

Methods inherited from PaymentMethodSummary

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PaymentMethodSummaryCard

Returns a new instance of PaymentMethodSummaryCard.



51277
51278
51279
51280
51281
51282
51283
51284
51285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51277

def initialize(incoming={})
  super(:type => PaymentMethodSummary::Types::PAYMENT_METHOD_SUMMARY_CARD)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:merchant_of_record, :last_four, :card_type, :id], 'PaymentMethodSummaryCard')
  @merchant_of_record = (x = opts.delete(:merchant_of_record); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x))
  @last_four = HttpClient::Preconditions.assert_class('last_four', opts.delete(:last_four), String)
  @card_type = (x = opts.delete(:card_type); x.is_a?(::Io::Flow::V0::Models::CardType) ? x : ::Io::Flow::V0::Models::CardType.apply(x))
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
end

Instance Attribute Details

#card_typeObject (readonly)

Returns the value of attribute card_type.



51275
51276
51277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51275

def card_type
  @card_type
end

#idObject (readonly)

Returns the value of attribute id.



51275
51276
51277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51275

def id
  @id
end

#last_fourObject (readonly)

Returns the value of attribute last_four.



51275
51276
51277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51275

def last_four
  @last_four
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



51275
51276
51277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51275

def merchant_of_record
  @merchant_of_record
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51291
51292
51293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51291

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

#subtype_to_hashObject



51295
51296
51297
51298
51299
51300
51301
51302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51295

def subtype_to_hash
  {
    :merchant_of_record => merchant_of_record.value,
    :last_four => last_four,
    :card_type => card_type.value,
    :id => id
  }
end

#to_jsonObject



51287
51288
51289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51287

def to_json
  JSON.dump(to_hash)
end