Class: FriendlyShipping::Services::ShipEngine::LabelPackageOptions

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

Overview

Options relating to packages in the ShipEngine labels call

Instance Attribute Summary collapse

Attributes inherited from PackageOptions

#package_id

Instance Method Summary collapse

Methods inherited from PackageOptions

#options_for_item

Constructor Details

#initialize(package_code: nil, messages: [], **kwargs) ⇒ LabelPackageOptions

Returns a new instance of LabelPackageOptions.



20
21
22
23
24
# File 'lib/friendly_shipping/services/ship_engine/label_package_options.rb', line 20

def initialize(package_code: nil, messages: [], **kwargs)
  @package_code = package_code
  @messages = messages
  super(**kwargs)
end

Instance Attribute Details

#messagesObject (readonly)

A list of messages to add to the label. No carrier accepts more than three messages, and some have restrictions on how many characters are possible. We’re not validating here though.



17
18
19
20
21
22
23
24
25
# File 'lib/friendly_shipping/services/ship_engine/label_package_options.rb', line 17

class LabelPackageOptions < FriendlyShipping::PackageOptions
  attr_reader :package_code, :messages

  def initialize(package_code: nil, messages: [], **kwargs)
    @package_code = package_code
    @messages = messages
    super(**kwargs)
  end
end

#package_codeObject (readonly)

Returns the value of attribute package_code.



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

def package_code
  @package_code
end

Instance Method Details

#:package_code=(: package_code=(value)) ⇒ Object

The type of package. Possible types can be gotten via the ShipEngine API: www.shipengine.com/docs/reference/list-carrier-packages/ If a package type is given, no dimensions will be added to the call (as we can assume the carrier knows the dimensions of their packaging types).



17
18
19
20
21
22
23
24
25
# File 'lib/friendly_shipping/services/ship_engine/label_package_options.rb', line 17

class LabelPackageOptions < FriendlyShipping::PackageOptions
  attr_reader :package_code, :messages

  def initialize(package_code: nil, messages: [], **kwargs)
    @package_code = package_code
    @messages = messages
    super(**kwargs)
  end
end