Class: KondutoAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/konduto-ruby/konduto_address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#address1Object

Returns the value of attribute address1


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def address1
  @address1
end

#address2Object

Returns the value of attribute address2


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def address2
  @address2
end

#cityObject

Returns the value of attribute city


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def city
  @city
end

#countryObject

Returns the value of attribute country


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def country
  @country
end

#nameObject

Returns the value of attribute name


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def name
  @name
end

#stateObject

Returns the value of attribute state


2
3
4
# File 'lib/konduto-ruby/konduto_address.rb', line 2

def state
  @state
end

#zipObject

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_hashObject


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_jsonObject


25
26
27
# File 'lib/konduto-ruby/konduto_address.rb', line 25

def to_json
  self.to_hash.to_json
end