class UPS::Builders::InternationalInvoiceProductBuilder
The {InternationalProductInvoiceBuilder} class builds UPS
XML International invoice Produt Objects.
@author Calvin Hughes @since 0.9.3 @attr [String] name The Containing XML Element Name @attr [Hash] opts The international invoice product parts
Attributes
name[RW]
opts[RW]
Public Class Methods
new(name, opts = {})
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 16 def initialize(name, opts = {}) self.name = name self.opts = opts end
Public Instance Methods
commodity_code()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 41 def commodity_code element_with_value('CommodityCode', opts[:commodity_code]) end
description()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 21 def description element_with_value('Description', opts[:description]) end
dimensions_unit()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 33 def dimensions_unit unit_of_measurement(opts[:dimensions_unit]) end
number()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 25 def number element_with_value('Number', opts[:number]) end
origin_country_code()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 45 def origin_country_code element_with_value('OriginCountryCode', opts[:origin_country_code][0..2]) end
part_number()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 37 def part_number element_with_value('PartNumber', opts[:part_number][0..9]) end
product_unit()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 49 def product_unit Element.new('Unit').tap do |unit| unit << number unit << value unit << dimensions_unit end end
to_xml()
click to toggle source
Returns an XML representation of the current object
@return [Ox::Element] XML representation of the current object
# File lib/ups/builders/international_invoice_product_builder.rb, line 60 def to_xml Element.new(name).tap do |product| product << description product << commodity_code if opts[:commodity_code] product << part_number if opts[:part_number] product << origin_country_code product << product_unit end end
value()
click to toggle source
# File lib/ups/builders/international_invoice_product_builder.rb, line 29 def value element_with_value('Value', opts[:value]) end