Class: CepFacil::Address
- Inherits:
-
Object
- Object
- CepFacil::Address
- Defined in:
- lib/cep_facil/api.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#type ⇒ Object
Returns the value of attribute type.
-
#zip_code ⇒ Object
Returns the value of attribute zip_code.
Instance Method Summary collapse
-
#full_format ⇒ Object
Returns the address in its extense format.
-
#initialize(zip_code, type, city, state, neighborhood, street) ⇒ Address
constructor
A new instance of Address.
- #valid? ⇒ Boolean
Constructor Details
#initialize(zip_code, type, city, state, neighborhood, street) ⇒ Address
Returns a new instance of Address.
31 32 33 34 35 36 37 38 |
# File 'lib/cep_facil/api.rb', line 31 def initialize(zip_code, type, city, state, neighborhood, street) @zip_code = zip_code @type = type @city = city @state = state @neighborhood = neighborhood @street = street end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def city @city end |
#neighborhood ⇒ Object
Returns the value of attribute neighborhood.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def neighborhood @neighborhood end |
#state ⇒ Object
Returns the value of attribute state.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def street @street end |
#type ⇒ Object
Returns the value of attribute type.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def type @type end |
#zip_code ⇒ Object
Returns the value of attribute zip_code.
29 30 31 |
# File 'lib/cep_facil/api.rb', line 29 def zip_code @zip_code end |
Instance Method Details
#full_format ⇒ Object
Returns the address in its extense format
47 48 49 |
# File 'lib/cep_facil/api.rb', line 47 def full_format "#{self.type} #{self.street}, #{self.city} - #{self.state} #{self.zip_code}, Brasil" end |
#valid? ⇒ Boolean
40 41 42 43 44 |
# File 'lib/cep_facil/api.rb', line 40 def valid? answ = false answ = true if (self.zip_code && type && city) return true end |