Class: Whatsapp::Webhook::Message::Contacts::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/message/contacts/address.rb

Overview

A physical address entry within an inbound contact card.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.



37
38
39
40
41
42
43
44
45
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 37

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
end

Instance Attribute Details

#cityString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 15

def city
  @city
end

#countryString?

Returns:

  • (String, nil)


27
28
29
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 27

def country
  @country
end

#country_codeString?

Returns:

  • (String, nil)


31
32
33
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 31

def country_code
  @country_code
end

#stateString?

Returns:

  • (String, nil)


19
20
21
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 19

def state
  @state
end

#streetString?

Returns:

  • (String, nil)


11
12
13
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 11

def street
  @street
end

#typeString?

Returns:

  • (String, nil)


35
36
37
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 35

def type
  @type
end

#zipString?

Returns:

  • (String, nil)


23
24
25
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 23

def zip
  @zip
end

Class Method Details

.deserialize(data) ⇒ Address

Parameters:

  • data (Hash)

    A raw addresses[] entry.

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ruby/whatsapp/webhook/message/contacts/address.rb', line 50

def deserialize(data)
  data ||= {}

  new(
    street: data["street"],
    city: data["city"],
    state: data["state"],
    zip: data["zip"],
    country: data["country"],
    country_code: data["country_code"],
    type: data["type"]
  )
end