Class: Io::Flow::V0::Models::Customer
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Customer
- 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.
-
#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 = {}) ⇒ Customer
constructor
A new instance of Customer.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Customer
Returns a new instance of Customer.
23488 23489 23490 23491 23492 23493 23494 23495 23496 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23488 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name], 'Customer') @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))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
23486 23487 23488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23486 def address @address end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
23486 23487 23488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23486 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23486 23487 23488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23486 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
23486 23487 23488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23486 def number @number end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
23486 23487 23488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23486 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23502 23503 23504 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23502 def copy(incoming={}) Customer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
23506 23507 23508 23509 23510 23511 23512 23513 23514 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23506 def to_hash { :name => name.to_hash, :number => number, :phone => phone, :email => email, :address => address.nil? ? nil : address.to_hash } end |
#to_json ⇒ Object
23498 23499 23500 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23498 def to_json JSON.dump(to_hash) end |