class Io::Flow::V0::Models::CustomerToken

Represents a mapping between a customer number and a token

Attributes

customer[R]
id[R]
token[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 38653
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 38665
def copy(incoming={})
  CustomerToken.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 38669
def to_hash
  {
    :id => id,
    :customer => customer.to_hash,
    :token => token
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 38661
def to_json
  JSON.dump(to_hash)
end