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
-
#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.
14226 14227 14228 14229 14230 14231 14232 14233 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14226 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)) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
14224 14225 14226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14224 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14224 14225 14226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14224 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
14224 14225 14226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14224 def number @number end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
14224 14225 14226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14224 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14239 14240 14241 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14239 def copy(incoming={}) Customer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14243 14244 14245 14246 14247 14248 14249 14250 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14243 def to_hash { :name => name.to_hash, :number => number, :phone => phone, :email => email } end |
#to_json ⇒ Object
14235 14236 14237 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14235 def to_json JSON.dump(to_hash) end |