Class: FriendlyShipping::Services::Ups::LabelPackageOptions

Inherits:
PackageOptions
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups/label_package_options.rb

Overview

Package properties relevant for generating a UPS shipping label

Constant Summary collapse

PACKAGE_DELIVERY_CONFIRMATION_CODES =
{
  delivery_confirmation: 1,
  delivery_confirmation_signature_required: 2,
  delivery_confirmation_adult_signature_required: 3
}.freeze

Instance Attribute Summary collapse

Attributes inherited from PackageOptions

#package_id

Instance Method Summary collapse

Methods inherited from PackageOptions

#options_for_item

Constructor Details

#initialize(reference_numbers: {}, delivery_confirmation: nil, shipper_release: false, declared_value: false, **kwargs) ⇒ LabelPackageOptions

Returns a new instance of LabelPackageOptions.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/friendly_shipping/services/ups/label_package_options.rb', line 25

def initialize(
  reference_numbers: {},
  delivery_confirmation: nil,
  shipper_release: false,
  declared_value: false,
  **kwargs
)
  @reference_numbers = reference_numbers
  @delivery_confirmation = delivery_confirmation
  @shipper_release = shipper_release
  @declared_value = declared_value
  super(**kwargs.reverse_merge(item_options_class: LabelItemOptions))
end

Instance Attribute Details

#declared_valueObject (readonly)

Returns the value of attribute declared_value.



23
24
25
# File 'lib/friendly_shipping/services/ups/label_package_options.rb', line 23

def declared_value
  @declared_value
end

#reference_numbersObject (readonly)

Returns the value of attribute reference_numbers.



23
24
25
# File 'lib/friendly_shipping/services/ups/label_package_options.rb', line 23

def reference_numbers
  @reference_numbers
end

#shipper_releaseObject (readonly)

Returns the value of attribute shipper_release.



23
24
25
# File 'lib/friendly_shipping/services/ups/label_package_options.rb', line 23

def shipper_release
  @shipper_release
end

Instance Method Details

#delivery_confirmation_codeObject



39
40
41
# File 'lib/friendly_shipping/services/ups/label_package_options.rb', line 39

def delivery_confirmation_code
  PACKAGE_DELIVERY_CONFIRMATION_CODES[delivery_confirmation]
end