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.
14023 14024 14025 14026 14027 14028 14029 14030 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14023 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.
14021 14022 14023 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14021 def company @company end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
14021 14022 14023 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14021 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14021 14022 14023 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14021 def name @name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
14021 14022 14023 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14021 def phone @phone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14036 14037 14038 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14036 def copy(incoming={}) Contact.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14040 14041 14042 14043 14044 14045 14046 14047 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14040 def to_hash { :name => name.to_hash, :company => company, :email => email, :phone => phone } end |
#to_json ⇒ Object
14032 14033 14034 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14032 def to_json JSON.dump(to_hash) end |