Class: Io::Flow::V0::Models::CustomerToken
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CustomerToken
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a mapping between a customer number and a token
Instance Attribute Summary collapse
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CustomerToken
constructor
A new instance of CustomerToken.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CustomerToken
Returns a new instance of CustomerToken.
29341 29342 29343 29344 29345 29346 29347 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29341 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :customer, :token], 'CustomerToken') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::CustomerReference) ? x : ::Io::Flow::V0::Models::CustomerReference.new(x)) @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String) end |
Instance Attribute Details
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
29339 29340 29341 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29339 def customer @customer end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29339 29340 29341 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29339 def id @id end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
29339 29340 29341 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29339 def token @token end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29353 29354 29355 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29353 def copy(incoming={}) CustomerToken.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29357 29358 29359 29360 29361 29362 29363 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29357 def to_hash { :id => id, :customer => customer.to_hash, :token => token } end |
#to_json ⇒ Object
29349 29350 29351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29349 def to_json JSON.dump(to_hash) end |