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 ShipEngine labels

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(shipping_method:, label_format: :pdf, label_download_type: :url, **kwargs) ⇒ LabelOptions

Returns a new instance of LabelOptions.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 20

def initialize(
  shipping_method:,
  label_format: :pdf,
  label_download_type: :url,
  **kwargs
)
  @shipping_method = shipping_method
  @label_format = label_format
  @label_download_type = label_download_type
  super(**kwargs.merge(package_options_class: LabelPackageOptions))
end

Instance Attribute Details

#label_download_typeObject

Returns the value of attribute label_download_type.



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

def label_download_type
  @label_download_type
end

#label_formatObject

Returns the value of attribute label_format.



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

def label_format
  @label_format
end

#package_optionsObject (readonly)

Package options for the packages in the shipment



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/friendly_shipping/services/ship_engine/label_options.rb', line 15

class LabelOptions < FriendlyShipping::ShipmentOptions
  attr_reader :shipping_method,
              :label_format,
              :label_download_type

  def initialize(
    shipping_method:,
    label_format: :pdf,
    label_download_type: :url,
    **kwargs
  )
    @shipping_method = shipping_method
    @label_format = label_format
    @label_download_type = label_download_type
    super(**kwargs.merge(package_options_class: LabelPackageOptions))
  end
end

#shipping_methodObject (readonly)

Returns the value of attribute shipping_method.



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

def shipping_method
  @shipping_method
end