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 placing an order.
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#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.
34914 34915 34916 34917 34918 34919 34920 34921 34922 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34914 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number], 'Customer') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @email = (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String)) @name = (x = opts.delete(:name); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x))) @phone = (x = opts.delete(:phone); x.nil? ? nil : HttpClient::Preconditions.assert_class('phone', x, String)) end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
34912 34913 34914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34912 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
34912 34913 34914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34912 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34912 34913 34914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34912 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
34912 34913 34914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34912 def number @number end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
34912 34913 34914 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34912 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
34928 34929 34930 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34928 def copy(incoming={}) Customer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
34932 34933 34934 34935 34936 34937 34938 34939 34940 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34932 def to_hash { :id => id, :number => number, :email => email, :name => name.nil? ? nil : name.to_hash, :phone => phone } end |
#to_json ⇒ Object
34924 34925 34926 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34924 def to_json JSON.dump(to_hash) end |