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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CardReference

Returns a new instance of CardReference.



10423
10424
10425
10426
10427
10428
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10423

def initialize(incoming={})
  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

#id ⇒ Object (readonly)

Returns the value of attribute id.



10421
10422
10423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10421

def id
  @id
end

#token ⇒ Object (readonly)

Returns the value of attribute token.



10421
10422
10423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10421

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10434
10435
10436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10434

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

#to_hash ⇒ Object



10438
10439
10440
10441
10442
10443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10438

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

#to_json ⇒ Object



10430
10431
10432
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10430

def to_json
  JSON.dump(to_hash)
end