Class: FriendlyShipping::Services::UpsJson::LabelOptions
- Inherits:
-
FriendlyShipping::ShipmentOptions
- Object
- FriendlyShipping::ShipmentOptions
- FriendlyShipping::Services::UpsJson::LabelOptions
- Defined in:
- lib/friendly_shipping/services/ups_json/label_options.rb
Constant Summary collapse
- SHIPMENT_DELIVERY_CONFIRMATION_CODES =
{ delivery_confirmation_signature_required: 1, delivery_confirmation_adult_signature_required: 2 }.freeze
- TERMS_OF_SHIPMENT_CODES =
{ cost_and_freight: 'CFR', cost_insurance_and_freight: 'CIF', carriage_and_insurance_paid: 'CIP', carriage_paid_to: 'CPT', delivered_at_frontier: 'DAF', delivery_duty_paid: 'DDP', delivery_duty_unpaid: 'DDU', delivered_ex_quay: 'DEQ', delivered_ex_ship: 'DES', ex_works: 'EXW', free_alongside_ship: 'FAS', free_carrier: 'FCA', free_on_board: 'FOB' }.freeze
- RETURN_SERVICE_CODES =
{ ups_print_and_mail: 2, # UPS Print and Mail (PNM) ups_return_1_attempt: 3, # UPS Return Service 1-Attempt ups_return_3_attempt: 5, # UPS Return Service 3-Attempt (RS3) ups_electronic_return_label: 8, # UPS Electronic Return Label (ERL) ups_print_return_label: 9, # UPS Print Return Label (PRL) ups_exchange_print_return: 10, # UPS Exchange Print Return Label ups_pack_collect_1_attemt_box_1: 11, # UPS Pack & Collect Service 1-Attempt Box 1 ups_pack_collect_1_attemt_box_2: 12, # UPS Pack & Collect Service 1-Attempt Box 2 ups_pack_collect_1_attemt_box_3: 13, # UPS Pack & Collect Service 1-Attempt Box 3 ups_pack_collect_1_attemt_box_4: 14, # UPS Pack & Collect Service 1-Attempt Box 4 ups_pack_collect_1_attemt_box_5: 15, # UPS Pack & Collect Service 1-Attempt Box 5 ups_pack_collect_3_attemt_box_1: 16, # UPS Pack & Collect Service 1-Attempt Box 1 ups_pack_collect_3_attemt_box_2: 17, # UPS Pack & Collect Service 1-Attempt Box 2 ups_pack_collect_3_attemt_box_3: 18, # UPS Pack & Collect Service 1-Attempt Box 3 ups_pack_collect_3_attemt_box_4: 19, # UPS Pack & Collect Service 1-Attempt Box 4 ups_pack_collect_3_attemt_box_5: 20 # UPS Pack & Collect Service 1-Attempt Box 5 }.freeze
- SUB_VERSIONS =
%w[1601 1607 1701 1707 1801 1807 2108 2205].freeze
Instance Attribute Summary collapse
-
#billing_options ⇒ Object
readonly
Returns the value of attribute billing_options.
-
#carbon_neutral ⇒ Object
readonly
Returns the value of attribute carbon_neutral.
-
#customer_context ⇒ Object
readonly
Returns the value of attribute customer_context.
-
#declaration_statement ⇒ Object
readonly
Returns the value of attribute declaration_statement.
-
#invoice_date ⇒ Object
readonly
Returns the value of attribute invoice_date.
-
#label_format ⇒ Object
readonly
Returns the value of attribute label_format.
-
#label_size ⇒ Object
readonly
Returns the value of attribute label_size.
-
#negotiated_rates ⇒ Object
readonly
Returns the value of attribute negotiated_rates.
-
#paperless_invoice ⇒ Object
readonly
Returns the value of attribute paperless_invoice.
-
#reason_for_export ⇒ Object
readonly
Returns the value of attribute reason_for_export.
-
#saturday_delivery ⇒ Object
readonly
Returns the value of attribute saturday_delivery.
-
#shipper ⇒ Object
readonly
Returns the value of attribute shipper.
-
#shipper_number ⇒ Object
readonly
Returns the value of attribute shipper_number.
-
#shipping_method ⇒ Object
readonly
Returns the value of attribute shipping_method.
-
#sold_to ⇒ Object
readonly
Returns the value of attribute sold_to.
-
#sub_version ⇒ Object
readonly
Returns the value of attribute sub_version.
-
#validate_address ⇒ Object
readonly
Returns the value of attribute validate_address.
Instance Method Summary collapse
- #delivery_confirmation_code ⇒ Object
-
#initialize(shipping_method:, shipper_number:, shipper: nil, sub_version: '2205', customer_context: nil, validate_address: true, negotiated_rates: false, billing_options: LabelBillingOptions.new, sold_to: nil, saturday_delivery: false, label_format: 'GIF', label_size: [4, 6], delivery_confirmation: nil, carbon_neutral: true, return_service: nil, paperless_invoice: false, terms_of_shipment: nil, reason_for_export: 'SALE', invoice_date: nil, package_options_class: LabelPackageOptions, declaration_statement: nil, **kwargs) ⇒ LabelOptions
constructor
A new instance of LabelOptions.
- #return_service_code ⇒ Object
- #terms_of_shipment_code ⇒ Object
Methods inherited from FriendlyShipping::ShipmentOptions
Constructor Details
#initialize(shipping_method:, shipper_number:, shipper: nil, sub_version: '2205', customer_context: nil, validate_address: true, negotiated_rates: false, billing_options: LabelBillingOptions.new, sold_to: nil, saturday_delivery: false, label_format: 'GIF', label_size: [4, 6], delivery_confirmation: nil, carbon_neutral: true, return_service: nil, paperless_invoice: false, terms_of_shipment: nil, reason_for_export: 'SALE', invoice_date: nil, package_options_class: LabelPackageOptions, declaration_statement: nil, **kwargs) ⇒ LabelOptions
Returns a new instance of LabelOptions.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 105 def initialize( shipping_method:, shipper_number:, shipper: nil, sub_version: '2205', customer_context: nil, validate_address: true, negotiated_rates: false, billing_options: LabelBillingOptions.new, sold_to: nil, saturday_delivery: false, label_format: 'GIF', label_size: [4, 6], delivery_confirmation: nil, carbon_neutral: true, return_service: nil, paperless_invoice: false, terms_of_shipment: nil, reason_for_export: 'SALE', invoice_date: nil, package_options_class: LabelPackageOptions, declaration_statement: nil, **kwargs ) raise ArgumentError, "Invalid sub-version: #{sub_version}" unless sub_version.in?(SUB_VERSIONS) @shipping_method = shipping_method @shipper_number = shipper_number @shipper = shipper @sub_version = sub_version @customer_context = customer_context @validate_address = validate_address @negotiated_rates = negotiated_rates @billing_options = @sold_to = sold_to @saturday_delivery = saturday_delivery @label_format = label_format @label_size = label_size @delivery_confirmation = delivery_confirmation @carbon_neutral = carbon_neutral @return_service = return_service @paperless_invoice = paperless_invoice @terms_of_shipment = terms_of_shipment @reason_for_export = reason_for_export @invoice_date = invoice_date @declaration_statement = declaration_statement super(**kwargs.reverse_merge(package_options_class: )) end |
Instance Attribute Details
#billing_options ⇒ Object (readonly)
Returns the value of attribute billing_options.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def @billing_options end |
#carbon_neutral ⇒ Object (readonly)
Returns the value of attribute carbon_neutral.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def carbon_neutral @carbon_neutral end |
#customer_context ⇒ Object (readonly)
Returns the value of attribute customer_context.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def customer_context @customer_context end |
#declaration_statement ⇒ Object (readonly)
Returns the value of attribute declaration_statement.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def declaration_statement @declaration_statement end |
#invoice_date ⇒ Object (readonly)
Returns the value of attribute invoice_date.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def invoice_date @invoice_date end |
#label_format ⇒ Object (readonly)
Returns the value of attribute label_format.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def label_format @label_format end |
#label_size ⇒ Object (readonly)
Returns the value of attribute label_size.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def label_size @label_size end |
#negotiated_rates ⇒ Object (readonly)
Returns the value of attribute negotiated_rates.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def negotiated_rates @negotiated_rates end |
#paperless_invoice ⇒ Object (readonly)
Returns the value of attribute paperless_invoice.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def paperless_invoice @paperless_invoice end |
#reason_for_export ⇒ Object (readonly)
Returns the value of attribute reason_for_export.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def reason_for_export @reason_for_export end |
#saturday_delivery ⇒ Object (readonly)
Returns the value of attribute saturday_delivery.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def saturday_delivery @saturday_delivery end |
#shipper ⇒ Object (readonly)
Returns the value of attribute shipper.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def shipper @shipper end |
#shipper_number ⇒ Object (readonly)
Returns the value of attribute shipper_number.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def shipper_number @shipper_number end |
#shipping_method ⇒ Object (readonly)
Returns the value of attribute shipping_method.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def shipping_method @shipping_method end |
#sold_to ⇒ Object (readonly)
Returns the value of attribute sold_to.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def sold_to @sold_to end |
#sub_version ⇒ Object (readonly)
Returns the value of attribute sub_version.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def sub_version @sub_version end |
#validate_address ⇒ Object (readonly)
Returns the value of attribute validate_address.
87 88 89 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 87 def validate_address @validate_address end |
Instance Method Details
#delivery_confirmation_code ⇒ Object
154 155 156 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 154 def delivery_confirmation_code SHIPMENT_DELIVERY_CONFIRMATION_CODES[delivery_confirmation] end |
#return_service_code ⇒ Object
162 163 164 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 162 def return_service_code RETURN_SERVICE_CODES[return_service] end |
#terms_of_shipment_code ⇒ Object
158 159 160 |
# File 'lib/friendly_shipping/services/ups_json/label_options.rb', line 158 def terms_of_shipment_code TERMS_OF_SHIPMENT_CODES[terms_of_shipment] end |