class UPS::Builders::ShipperBuilder
The {ShipperBuilder} class builds UPS
XML Organization Objects.
@author Paul Trippett @since 0.1.0 @attr [String] name The Containing XML Element Name @attr [Hash] opts The Shipper and Address Parts
Attributes
Public Class Methods
Initializes a new {ShipperBuilder} object
@param [Hash] opts The Shipper and Address Parts @option opts [String] :company_name Company Name @option opts [String] :phone_number Phone Number @option opts [String] :address_line_1 Address Line 1 @option opts [String] :city City @option opts [String] :state State @option opts [String] :postal_code Zip or Postal Code @option opts [String] :country Country
# File lib/ups/builders/shipper_builder.rb, line 26 def initialize(opts = {}) self.name = name self.opts = opts end
Public Instance Methods
Returns an XML representation of the associated Address
@return [Ox::Element] XML object of the associated Address
# File lib/ups/builders/shipper_builder.rb, line 62 def address AddressBuilder.new(opts).to_xml end
Returns an XML representation of attention_name
@return [Ox::Element] XML representation of attention_name
# File lib/ups/builders/shipper_builder.rb, line 69 def attention_name element_with_value('AttentionName', opts[:attention_name] || '') end
Returns an XML representation of company_name
@return [Ox::Element] XML representation of company_name
# File lib/ups/builders/shipper_builder.rb, line 41 def company_name element_with_value('CompanyName', opts[:company_name]) end
Returns an XML representation of company_name
@return [Ox::Element] XML representation of phone_number
# File lib/ups/builders/shipper_builder.rb, line 48 def phone_number element_with_value('PhoneNumber', opts[:phone_number]) end
Returns an XML representation of shipper_name
@return [Ox::Element] XML representation of shipper_name
# File lib/ups/builders/shipper_builder.rb, line 34 def shipper_name element_with_value('Name', opts[:company_name]) end
Returns an XML representation of company_name
@return [Ox::Element] XML representation of shipper_number
# File lib/ups/builders/shipper_builder.rb, line 55 def shipper_number element_with_value('ShipperNumber', opts[:shipper_number] || '') end
Returns an XML representation of sender_vat_number
@return [Ox::Element] XML representation of sender_vat_number
# File lib/ups/builders/shipper_builder.rb, line 76 def tax_identification_number element_with_value('TaxIdentificationNumber', opts[:sender_vat_number] || '') end
Returns an XML representation of the current object
@return [Ox::Element] XML representation of the current object
# File lib/ups/builders/shipper_builder.rb, line 83 def to_xml Element.new('Shipper').tap do |org| org << shipper_name org << attention_name org << company_name org << phone_number org << shipper_number org << address org << tax_identification_number end end