Class: Shipping::Organization
- Inherits:
-
Object
- Object
- Shipping::Organization
- Defined in:
- lib/ups_shipping/organization.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#shipper_number ⇒ Object
Returns the value of attribute shipper_number.
Instance Method Summary collapse
- #build(xml, rootname) ⇒ Object
-
#initialize(options = {}) ⇒ Organization
constructor
A new instance of Organization.
- #to_xml(rootname) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Organization
Returns a new instance of Organization.
7 8 9 10 11 12 13 14 |
# File 'lib/ups_shipping/organization.rb', line 7 def initialize(={}) @name = [:name] @phone = [:phone] @address = [:address] if [:shipper_number] @shipper_number = [:shipper_number] end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/ups_shipping/organization.rb', line 5 def address @address end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/ups_shipping/organization.rb', line 5 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/ups_shipping/organization.rb', line 5 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/ups_shipping/organization.rb', line 5 def phone @phone end |
#shipper_number ⇒ Object
Returns the value of attribute shipper_number.
5 6 7 |
# File 'lib/ups_shipping/organization.rb', line 5 def shipper_number @shipper_number end |
Instance Method Details
#build(xml, rootname) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ups_shipping/organization.rb', line 16 def build(xml, rootname) xml.send(rootname) { xml.CompanyName @name xml.PhoneNumber @phone if @shipper_number xml.ShipperNumber @shipper_number end @address.build(xml) } end |
#to_xml(rootname) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/ups_shipping/organization.rb', line 27 def to_xml(rootname) builder = Nokogiri::XML::Builder.new do |xml| build(xml, rootname) end builder.to_xml end |