Class: KondutoAddress
- Inherits:
-
Object
- Object
- KondutoAddress
- Defined in:
- lib/konduto-ruby/konduto_address.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#address2 ⇒ Object
Returns the value of attribute address2.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
-
#initialize(*args) ⇒ KondutoAddress
constructor
A new instance of KondutoAddress.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(*args) ⇒ KondutoAddress
Returns a new instance of KondutoAddress.
4 5 6 7 8 9 10 |
# File 'lib/konduto-ruby/konduto_address.rb', line 4 def initialize(*args) unless args[0].nil? args[0].each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end end |
Instance Attribute Details
#address1 ⇒ Object
Returns the value of attribute address1.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def address1 @address1 end |
#address2 ⇒ Object
Returns the value of attribute address2.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def address2 @address2 end |
#city ⇒ Object
Returns the value of attribute city.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def country @country end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def state @state end |
#zip ⇒ Object
Returns the value of attribute zip.
2 3 4 |
# File 'lib/konduto-ruby/konduto_address.rb', line 2 def zip @zip end |
Instance Method Details
#to_hash ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/konduto-ruby/konduto_address.rb', line 12 def to_hash hash = { name: self.name, address1: self.address1, address2: self.address2, city: self.city, state: self.state, country: self.country, zip: self.zip } KondutoUtils.remove_nil_keys_from_hash(hash) end |
#to_json ⇒ Object
25 26 27 |
# File 'lib/konduto-ruby/konduto_address.rb', line 25 def to_json self.to_hash.to_json end |