Class: Io::Flow::V0::Models::CustomerBundle

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

Overview

A bundle of all the content needed to render customer data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CustomerBundle

Returns a new instance of CustomerBundle.



28441
28442
28443
28444
28445
28446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28441

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:customer], 'CustomerBundle')
  @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
  @last_used = (x = opts.delete(:last_used); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CustomerLastUsed) ? x : ::Io::Flow::V0::Models::CustomerLastUsed.new(x)))
end

Instance Attribute Details

#customerObject (readonly)

Returns the value of attribute customer.



28439
28440
28441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28439

def customer
  @customer
end

#last_usedObject (readonly)

Returns the value of attribute last_used.



28439
28440
28441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28439

def last_used
  @last_used
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28452
28453
28454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28452

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

#to_hashObject



28456
28457
28458
28459
28460
28461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28456

def to_hash
  {
    :customer => customer.to_hash,
    :last_used => last_used.nil? ? nil : last_used.to_hash
  }
end

#to_jsonObject



28448
28449
28450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28448

def to_json
  JSON.dump(to_hash)
end