Class: Whatsapp::Messages::Contacts::Address
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Contacts::Address
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/contacts/address.rb
Overview
Represents a physical address entry in a contact message. All fields are optional.
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
- #city ⇒ String?
- #country ⇒ String?
- #country_code ⇒ String?
- #state ⇒ String?
- #street ⇒ String?
- #type ⇒ String?
- #zip ⇒ String?
Instance Method Summary collapse
-
#initialize(street: nil, city: nil, state: nil, zip: nil, country: nil, country_code: nil, type: nil) ⇒ Address
constructor
A new instance of Address.
-
#serialize ⇒ Hash
The serialized address payload.
Constructor Details
#initialize(street: nil, city: nil, state: nil, zip: nil, country: nil, country_code: nil, type: nil) ⇒ Address
Returns a new instance of Address.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 57 def initialize(street: nil, city: nil, state: nil, zip: nil, country: nil, country_code: nil, type: nil) @street = street @city = city @state = state @zip = zip @country = country @country_code = country_code @type = type validate! end |
Instance Attribute Details
#city ⇒ String?
25 26 27 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 25 def city @city end |
#country ⇒ String?
37 38 39 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 37 def country @country end |
#country_code ⇒ String?
41 42 43 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 41 def country_code @country_code end |
#state ⇒ String?
29 30 31 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 29 def state @state end |
#street ⇒ String?
21 22 23 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 21 def street @street end |
#type ⇒ String?
45 46 47 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 45 def type @type end |
#zip ⇒ String?
33 34 35 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 33 def zip @zip end |
Instance Method Details
#serialize ⇒ Hash
Returns The serialized address payload.
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ruby/whatsapp/messages/contacts/address.rb', line 70 def serialize { street:, city:, state:, zip:, country:, country_code:, type:, }.compact end |