Class: Incognia::Address::Structured

Inherits:
Object
  • Object
show all
Defined in:
lib/incognia_api/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale: nil, country_name: nil, country_code: nil, state: nil, city: nil, borough: nil, neighborhood: nil, postal_code: nil, street: nil, number: nil, complements: nil) ⇒ Structured

Returns a new instance of Structured.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/incognia_api/address.rb', line 32

def initialize(locale: nil, country_name: nil, country_code: nil, \
               state: nil, city: nil, borough: nil, neighborhood: nil, \
               postal_code: nil, street: nil, number: nil, complements: nil)

  @locale = locale
  @country_name = country_name
  @country_code = country_code
  @state = state
  @city = city
  @borough = borough
  @neighborhood = neighborhood
  @postal_code = postal_code
  @street = street
  @number = number
  @complements = complements
end

Instance Attribute Details

#boroughObject (readonly)

Returns the value of attribute borough.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def borough
  @borough
end

#cityObject (readonly)

Returns the value of attribute city.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def city
  @city
end

#complementsObject (readonly)

Returns the value of attribute complements.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def complements
  @complements
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def country_code
  @country_code
end

#country_nameObject (readonly)

Returns the value of attribute country_name.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def country_name
  @country_name
end

#localeObject (readonly)

Returns the value of attribute locale.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def locale
  @locale
end

#neighborhoodObject (readonly)

Returns the value of attribute neighborhood.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def neighborhood
  @neighborhood
end

#numberObject (readonly)

Returns the value of attribute number.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def number
  @number
end

#postal_codeObject (readonly)

Returns the value of attribute postal_code.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def postal_code
  @postal_code
end

#stateObject (readonly)

Returns the value of attribute state.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def state
  @state
end

#streetObject (readonly)

Returns the value of attribute street.



28
29
30
# File 'lib/incognia_api/address.rb', line 28

def street
  @street
end

Instance Method Details

#to_hashObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/incognia_api/address.rb', line 49

def to_hash
  {
    structured_address: {
      locale: locale,
      country_name: country_name,
      country_code: country_code,
      state: state,
      city: city,
      borough: borough,
      neighborhood: neighborhood,
      street: street,
      number: number,
      complements: complements,
      postal_code: postal_code
    }.select { |_,v| !v.nil? }
  }
end