Class: Strikeiron::Address
- Inherits:
-
Object
- Object
- Strikeiron::Address
- Defined in:
- lib/strikeiron2/address.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street_address ⇒ Object
Returns the value of attribute street_address.
-
#zip_code ⇒ Object
Returns the value of attribute zip_code.
Class Method Summary collapse
-
.from_soap(hash = {}) ⇒ Object
Convert the object from a SOAP response to an Address object.
Instance Method Summary collapse
-
#initialize(default_values = {}) ⇒ Address
constructor
Creates an Address with the supplied attributes.
-
#to_soap ⇒ Object
Convert the object to a Hash for SOAP.
Constructor Details
#initialize(default_values = {}) ⇒ Address
Creates an Address with the supplied attributes.
6 7 8 9 10 11 12 13 |
# File 'lib/strikeiron2/address.rb', line 6 def initialize(default_values = {}) safe_keys = %w(street_address city state zip_code) default_values.each do |key, value| next unless safe_keys.include? key.to_s # Only permit the keys defined in safe_keys self.send "#{key}=", value end end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/strikeiron2/address.rb', line 3 def city @city end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/strikeiron2/address.rb', line 3 def state @state end |
#street_address ⇒ Object
Returns the value of attribute street_address.
3 4 5 |
# File 'lib/strikeiron2/address.rb', line 3 def street_address @street_address end |
#zip_code ⇒ Object
Returns the value of attribute zip_code.
3 4 5 |
# File 'lib/strikeiron2/address.rb', line 3 def zip_code @zip_code end |
Class Method Details
.from_soap(hash = {}) ⇒ Object
Convert the object from a SOAP response to an Address object
26 27 28 29 30 31 32 33 34 |
# File 'lib/strikeiron2/address.rb', line 26 def self.from_soap(hash = {}) default_values = { :street_address => hash['StreetAddress'], :city => hash['City'], :state => hash['State'], :zip_code => hash['ZIPCode'] } new(default_values) end |
Instance Method Details
#to_soap ⇒ Object
Convert the object to a Hash for SOAP
16 17 18 19 20 21 22 23 |
# File 'lib/strikeiron2/address.rb', line 16 def to_soap { 'StreetAddress' => street_address, 'City' => city, 'State' => state, 'ZIPCode' => zip_code } end |