Class: FriendlyShipping::Services::RL::PackageOptions

Inherits:
PackageOptions
  • Object
show all
Defined in:
lib/friendly_shipping/services/rl/package_options.rb

Overview

Serializes packages for R+L API requests.

Instance Attribute Summary collapse

Attributes inherited from PackageOptions

#package_id

Instance Method Summary collapse

Methods inherited from PackageOptions

#options_for_item

Constructor Details

#initialize(freight_class: nil, nmfc_primary_code: nil, nmfc_sub_code: nil, **kwargs) ⇒ PackageOptions

Returns a new instance of PackageOptions.

Parameters:

  • freight_class (String) (defaults to: nil)

    the freight class

  • nmfc_primary_code (String) (defaults to: nil)

    the NMFC primary code

  • nmfc_sub_code (String) (defaults to: nil)

    the NMFC sub code

  • kwargs (Hash)

Options Hash (**kwargs):

  • :package_id (String)

    the ID for the package that belongs to these options

  • :item_options (Array<ItemOptions>)

    the options for items in this package

  • :item_options_class (Class)

    the class to use for item options when none are provided



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/friendly_shipping/services/rl/package_options.rb', line 24

def initialize(
  freight_class: nil,
  nmfc_primary_code: nil,
  nmfc_sub_code: nil,
  **kwargs
)
  @freight_class = freight_class
  @nmfc_primary_code = nmfc_primary_code
  @nmfc_sub_code = nmfc_sub_code
  super(**kwargs.reverse_merge(item_options_class: ItemOptions))
end

Instance Attribute Details

#freight_classString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/friendly_shipping/services/rl/package_options.rb', line 9

def freight_class
  @freight_class
end

#nmfc_primary_codeString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/friendly_shipping/services/rl/package_options.rb', line 12

def nmfc_primary_code
  @nmfc_primary_code
end

#nmfc_sub_codeString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/friendly_shipping/services/rl/package_options.rb', line 15

def nmfc_sub_code
  @nmfc_sub_code
end