Class: Io::Flow::V0::Models::CardReference

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

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

Returns a new instance of CardReference.



18377
18378
18379
18380
18381
18382
18383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18377

def initialize(incoming={})
  super(:discriminator => ExpandableCard::Types::CARD_REFERENCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :token], 'CardReference')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



18375
18376
18377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18375

def id
  @id
end

#tokenObject (readonly)

Returns the value of attribute token.



18375
18376
18377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18375

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18389
18390
18391
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18389

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

#subtype_to_hashObject



18393
18394
18395
18396
18397
18398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18393

def subtype_to_hash
  {
    :id => id,
    :token => token
  }
end

#to_jsonObject



18385
18386
18387
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18385

def to_json
  JSON.dump(to_hash)
end