Class: Io::Flow::V0::Models::OrderCustomer
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderCustomer
- 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
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#invoice ⇒ Object
readonly
Returns the value of attribute invoice.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderCustomer
constructor
A new instance of OrderCustomer.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderCustomer
Returns a new instance of OrderCustomer.
37437 37438 37439 37440 37441 37442 37443 37444 37445 37446 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37437 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
#address ⇒ Object (readonly)
Returns the value of attribute address.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def address @address end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def email @email end |
#invoice ⇒ Object (readonly)
Returns the value of attribute invoice.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def invoice @invoice end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def number @number end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
37435 37436 37437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37435 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37452 37453 37454 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37452 def copy(incoming={}) OrderCustomer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37456 37457 37458 37459 37460 37461 37462 37463 37464 37465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37456 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_json ⇒ Object
37448 37449 37450 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37448 def to_json JSON.dump(to_hash) end |