Class: FriendlyShipping::Services::ShipEngine::LabelOptions

Inherits:
FriendlyShipping::ShipmentOptions show all
Defined in:
lib/friendly_shipping/services/ship_engine/label_options.rb

Overview

Options for generating shipping labels.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(shipping_method:, label_download_type: :url, label_format: :pdf, label_image_id: nil, customs_options: LabelCustomsOptions.new, customs_items_serializer: CustomsItemsSerializer, **kwargs) ⇒ LabelOptions

Returns a new instance of LabelOptions.

Options Hash (**kwargs):

  • :package_options (Array<LabelPackageOptions>)

    package options for the packages in the shipment

  • :package_options_class (Class)

    the class to use for package options when none are provided



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 35

def initialize(
  shipping_method:,
  label_download_type: :url,
  label_format: :pdf,
  label_image_id: nil,
  customs_options: LabelCustomsOptions.new,
  customs_items_serializer: CustomsItemsSerializer,
  **kwargs
)
  @shipping_method = shipping_method
  @label_download_type = label_download_type
  @label_format = label_format
  @label_image_id = label_image_id
  @customs_options = customs_options
  @customs_items_serializer = customs_items_serializer
  super(**kwargs.reverse_merge(package_options_class: LabelPackageOptions))
end

Instance Attribute Details

#customs_items_serializerProc, #call (readonly)



24
25
26
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 24

def customs_items_serializer
  @customs_items_serializer
end

#customs_optionsLabelCustomsOptions (readonly)



21
22
23
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 21

def customs_options
  @customs_options
end

#label_download_typeSymbol (readonly)



12
13
14
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 12

def label_download_type
  @label_download_type
end

#label_formatSymbol (readonly)



15
16
17
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 15

def label_format
  @label_format
end

#label_image_idString (readonly)



18
19
20
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 18

def label_image_id
  @label_image_id
end

#shipping_methodShippingMethod (readonly)



9
10
11
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 9

def shipping_method
  @shipping_method
end