Class: Io::Flow::V0::Models::Contact
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Contact
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Defines structured fields for a contact person. Typically used for specifying contact person for an account, shipment, or organization representative
Instance Attribute Summary collapse
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Contact
constructor
A new instance of Contact.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Contact
Returns a new instance of Contact.
16410 16411 16412 16413 16414 16415 16416 16417 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16410 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name], 'Contact') @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::Name) ? x : ::Io::Flow::V0::Models::Name.new(x)) @company = (x = opts.delete(:company); x.nil? ? nil : HttpClient::Preconditions.assert_class('company', x, String)) @email = (x = opts.delete(:email); x.nil? ? nil : HttpClient::Preconditions.assert_class('email', x, String)) @phone = (x = opts.delete(:phone); x.nil? ? nil : HttpClient::Preconditions.assert_class('phone', x, String)) end |
Instance Attribute Details
#company ⇒ Object (readonly)
Returns the value of attribute company.
16408 16409 16410 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16408 def company @company end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
16408 16409 16410 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16408 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16408 16409 16410 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16408 def name @name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
16408 16409 16410 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16408 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
16423 16424 16425 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16423 def copy(incoming={}) Contact.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
16427 16428 16429 16430 16431 16432 16433 16434 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16427 def to_hash { :name => name.to_hash, :company => company, :email => email, :phone => phone } end |
#to_json ⇒ Object
16419 16420 16421 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16419 def to_json JSON.dump(to_hash) end |