Class: Io::Flow::V0::Models::OrderCustomer

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

Overview

A customer represents the actual person purchasing from you. This information is needed primarily to support logistics (delivery to this person), fraud management (verification of who the person is), and reporting. We also recommend including your customer number whenever possible as doing so will allow Flow to link up transactions for this customer making customer service easier.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderCustomer

Returns a new instance of OrderCustomer.



35457
35458
35459
35460
35461
35462
35463
35464
35465
35466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35457

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name], 'OrderCustomer')
  @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x))
  @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String))
  @phone = (x = opts.delete(:phone); x.nil? ? nil : HttpClient::Preconditions.assert_class('phone', x, String))
  @email = (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String))
  @address = (x = opts.delete(:address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x)))
  @invoice = (x = opts.delete(:invoice); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CustomerInvoice) ? x : ::Io::Flow::V0::Models::CustomerInvoice.new(x)))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def address
  @address
end

#emailObject (readonly)

Returns the value of attribute email.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def email
  @email
end

#invoiceObject (readonly)

Returns the value of attribute invoice.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def invoice
  @invoice
end

#nameObject (readonly)

Returns the value of attribute name.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def number
  @number
end

#phoneObject (readonly)

Returns the value of attribute phone.



35455
35456
35457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35455

def phone
  @phone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35472
35473
35474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35472

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

#to_hashObject



35476
35477
35478
35479
35480
35481
35482
35483
35484
35485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35476

def to_hash
  {
    :name => name.to_hash,
    :number => number,
    :phone => phone,
    :email => email,
    :address => address.nil? ? nil : address.to_hash,
    :invoice => invoice.nil? ? nil : invoice.to_hash
  }
end

#to_jsonObject



35468
35469
35470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35468

def to_json
  JSON.dump(to_hash)
end