Class: FriendlyShipping::Services::Ups::LabelOptions

Inherits:
FriendlyShipping::ShipmentOptions show all
Defined in:
lib/friendly_shipping/services/ups/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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(shipping_method:, shipper_number:, shipper: nil, 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, **kwargs) ⇒ LabelOptions

Returns a new instance of LabelOptions.



102
103
104
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
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 102

def initialize(
  shipping_method:,
  shipper_number:,
  shipper: nil,
  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,
  **kwargs
)
  @shipping_method = shipping_method
  @shipper_number = shipper_number
  @shipper = shipper
  @customer_context = customer_context
  @validate_address = validate_address
  @negotiated_rates = negotiated_rates
  @billing_options = 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
  super(**kwargs.merge(package_options_class: package_options_class))
end

Instance Attribute Details

#billing_optionsObject (readonly)

Returns the value of attribute billing_options.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def billing_options
  @billing_options
end

#carbon_neutralObject (readonly)

Returns the value of attribute carbon_neutral.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def carbon_neutral
  @carbon_neutral
end

#customer_contextObject (readonly)

Returns the value of attribute customer_context.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def customer_context
  @customer_context
end

#invoice_dateObject (readonly)

Returns the value of attribute invoice_date.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def invoice_date
  @invoice_date
end

#label_formatObject (readonly)

Returns the value of attribute label_format.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def label_format
  @label_format
end

#label_sizeObject (readonly)

Returns the value of attribute label_size.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def label_size
  @label_size
end

#negotiated_ratesObject (readonly)

Returns the value of attribute negotiated_rates.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def negotiated_rates
  @negotiated_rates
end

#paperless_invoiceObject (readonly)

Returns the value of attribute paperless_invoice.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def paperless_invoice
  @paperless_invoice
end

#reason_for_exportObject (readonly)

Returns the value of attribute reason_for_export.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def reason_for_export
  @reason_for_export
end

#saturday_deliveryObject (readonly)

Returns the value of attribute saturday_delivery.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def saturday_delivery
  @saturday_delivery
end

#shipperObject (readonly)

Returns the value of attribute shipper.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def shipper
  @shipper
end

#shipper_numberObject (readonly)

Returns the value of attribute shipper_number.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def shipper_number
  @shipper_number
end

#shipping_methodObject (readonly)

Returns the value of attribute shipping_method.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def shipping_method
  @shipping_method
end

#sold_toObject (readonly)

Returns the value of attribute sold_to.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def sold_to
  @sold_to
end

#validate_addressObject (readonly)

Returns the value of attribute validate_address.



86
87
88
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 86

def validate_address
  @validate_address
end

Instance Method Details

#delivery_confirmation_codeObject



145
146
147
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 145

def delivery_confirmation_code
  SHIPMENT_DELIVERY_CONFIRMATION_CODES[delivery_confirmation]
end

#return_service_codeObject



153
154
155
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 153

def return_service_code
  RETURN_SERVICE_CODES[return_service]
end

#terms_of_shipment_codeObject



149
150
151
# File 'lib/friendly_shipping/services/ups/label_options.rb', line 149

def terms_of_shipment_code
  TERMS_OF_SHIPMENT_CODES[terms_of_shipment]
end