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.



53624
53625
53626
53627
53628
53629
53630
53631
53632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53624

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.



53622
53623
53624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53622

def card_type
  @card_type
end

#idObject (readonly)

Returns the value of attribute id.



53622
53623
53624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53622

def id
  @id
end

#last_fourObject (readonly)

Returns the value of attribute last_four.



53622
53623
53624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53622

def last_four
  @last_four
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



53622
53623
53624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53622

def merchant_of_record
  @merchant_of_record
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53638
53639
53640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53638

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

#subtype_to_hashObject



53642
53643
53644
53645
53646
53647
53648
53649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53642

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



53634
53635
53636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53634

def to_json
  JSON.dump(to_hash)
end