Class: UPS::Builders::ShipConfirmBuilder
- Inherits:
-
BuilderBase
- Object
- BuilderBase
- UPS::Builders::ShipConfirmBuilder
- Includes:
- Ox
- Defined in:
- lib/ups/builders/ship_confirm_builder.rb
Overview
The ShipConfirmBuilder class builds UPS XML ShipConfirm Objects.
Instance Attribute Summary collapse
-
#name ⇒ String
The Containing XML Element Name.
-
#opts ⇒ Hash
The Organization and Address Parts.
Attributes inherited from BuilderBase
#access_request, #document, #license_number, #password, #root, #shipment_root, #user_id
Instance Method Summary collapse
-
#add_description(description) ⇒ void
Adds Description to XML document being built.
-
#add_international_invoice(opts = {}) ⇒ void
Adds a InternationalForms section to the XML document being built according to user inputs.
-
#add_label_specification(format, size) ⇒ void
Adds a LabelSpecification section to the XML document being built according to user inputs.
-
#add_reference_number(opts = {}) ⇒ void
Adds ReferenceNumber to the XML document being built.
-
#add_service(service_code, service_description = '') ⇒ void
Adds a Service section to the XML document being built.
-
#initialize ⇒ ShipConfirmBuilder
constructor
Initializes a new ShipConfirmBuilder object.
Methods inherited from BuilderBase
#add_access_request, #add_package, #add_payment_information, #add_rate_information, #add_request, #add_ship_from, #add_ship_to, #add_shipper, #add_sold_to, #to_xml
Constructor Details
#initialize ⇒ ShipConfirmBuilder
Initializes a new UPS::Builders::ShipConfirmBuilder object
16 17 18 19 20 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 16 def initialize super 'ShipmentConfirmRequest' add_request 'ShipConfirm', 'validate' end |
Instance Attribute Details
#name ⇒ String
The Containing XML Element Name
11 12 13 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 11 def name @name end |
#opts ⇒ Hash
The Organization and Address Parts
11 12 13 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 11 def opts @opts end |
Instance Method Details
#add_description(description) ⇒ void
This method returns an undefined value.
Adds Description to XML document being built
63 64 65 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 63 def add_description(description) shipment_root << element_with_value('Description', description) end |
#add_international_invoice(opts = {}) ⇒ void
This method returns an undefined value.
Adds a InternationalForms section to the XML document being built according to user inputs
39 40 41 42 43 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 39 def add_international_invoice(opts = {}) shipment_root << Element.new('ShipmentServiceOptions').tap do || << InternationalInvoiceBuilder.new('InternationalForms', opts).to_xml end end |
#add_label_specification(format, size) ⇒ void
This method returns an undefined value.
Adds a LabelSpecification section to the XML document being built according to user inputs
26 27 28 29 30 31 32 33 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 26 def add_label_specification(format, size) root << Element.new('LabelSpecification').tap do |label_spec| label_spec << label_print_method(format) label_spec << label_image_format(format) label_spec << label_stock_size(size) label_spec << http_user_agent if gif?(format) end end |
#add_reference_number(opts = {}) ⇒ void
This method returns an undefined value.
Adds ReferenceNumber to the XML document being built
74 75 76 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 74 def add_reference_number(opts = {}) shipment_root << reference_number(opts[:code], opts[:value]) end |
#add_service(service_code, service_description = '') ⇒ void
This method returns an undefined value.
Adds a Service section to the XML document being built
52 53 54 55 56 |
# File 'lib/ups/builders/ship_confirm_builder.rb', line 52 def add_service(service_code, service_description = '') shipment_root << code_description('Service', service_code, service_description) end |