Class: Moip::Address
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#complement ⇒ Object
Returns the value of attribute complement.
-
#country ⇒ Object
Returns the value of attribute country.
-
#district ⇒ Object
Returns the value of attribute district.
-
#number ⇒ Object
Returns the value of attribute number.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Instance Method Summary collapse
Methods inherited from Model
build, #set_parameters, #to_json, #validate_response
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def city @city end |
#complement ⇒ Object
Returns the value of attribute complement.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def complement @complement end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def country @country end |
#district ⇒ Object
Returns the value of attribute district.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def district @district end |
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def number @number end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def street @street end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
3 4 5 |
# File 'lib/moip/models/address.rb', line 3 def zipcode @zipcode end |
Instance Method Details
#attributes ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/moip/models/address.rb', line 28 def attributes { "street" => street, "number" => number, "complement" => complement, "district" => district, "city" => city, "state" => state, "country" => country, "zipcode" => zipcode } end |
#validates_format_of_number ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/moip/models/address.rb', line 12 def validates_format_of_number if self.number.to_s.match /[0-9]{2}/ true else self.errors.add :number, I18n.t("moip.errors.invalid_format") end end |
#validates_format_of_zipcode ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/moip/models/address.rb', line 20 def validates_format_of_zipcode if self.zipcode.to_s.match /[0-9]{8}/ true else self.errors.add :zipcode, I18n.t("moip.errors.invalid_format") end end |