Class: FriendlyShipping::Services::UpsFreight::RatesOptions

Inherits:
FriendlyShipping::ShipmentOptions show all
Defined in:
lib/friendly_shipping/services/ups_freight/rates_options.rb

Overview

Options for generating UPS Freight rates for a shipment

Direct Known Subclasses

LabelOptions

Constant Summary collapse

BILLING_CODES =
{
  prepaid: '10',
  third_party: '30',
  freight_collect: '40'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FriendlyShipping::ShipmentOptions

#options_for_package

Constructor Details

#initialize(shipper_number:, billing_address:, shipping_method:, billing: :prepaid, customer_context: nil, pickup_request_options: nil, commodity_information_generator: GenerateCommodityInformation, **kwargs) ⇒ RatesOptions

Returns a new instance of RatesOptions.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 37

def initialize(
  shipper_number:,
  billing_address:,
  shipping_method:,
  billing: :prepaid,
  customer_context: nil,
  pickup_request_options: nil,
  commodity_information_generator: GenerateCommodityInformation,
  **kwargs
)
  @shipper_number = shipper_number
  @billing_address = billing_address
  @shipping_method = shipping_method
  @billing_code = BILLING_CODES.fetch(billing)
  @customer_context = customer_context
  @pickup_request_options = pickup_request_options
  @commodity_information_generator = commodity_information_generator
  super(**kwargs.merge(package_options_class: RatesPackageOptions))
end

Instance Attribute Details

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def billing_address
  @billing_address
end

#billing_codeObject (readonly)

Returns the value of attribute billing_code.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def billing_code
  @billing_code
end

#commodity_information_generatorObject (readonly)

Returns the value of attribute commodity_information_generator.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def commodity_information_generator
  @commodity_information_generator
end

#customer_contextObject (readonly)

Returns the value of attribute customer_context.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def customer_context
  @customer_context
end

#customer_context A reference to match this request with an order or shipment(Areferencetomatchthisrequestwithanorder) ⇒ Object (readonly)

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#pickup_comments Additional pickup instructions(Additionalpickupinstructions) ⇒ Object (readonly)

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#pickup_request_optionsObject (readonly)

Returns the value of attribute pickup_request_options.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def pickup_request_options
  @pickup_request_options
end

#shipper_numberObject (readonly)

Returns the value of attribute shipper_number.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def shipper_number
  @shipper_number
end

#shipper_number The shipper number associated with the shipper(Theshippernumberassociatedwiththeshipper) ⇒ Object (readonly)

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#shipping_methodObject (readonly)

Returns the value of attribute shipping_method.



29
30
31
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 29

def shipping_method
  @shipping_method
end

#shipping_method The shipping method to use(Theshippingmethodtouse) ⇒ Object (readonly)

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

Instance Method Details

#billing One of the keys in the `BILLING_CODES` constant. How the shipment=(Oneofthekeys) ⇒ Object

would be billed.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#billing_address The billing address=(Thebillingaddress = (value)) ⇒ Object

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#commodity_information_generator A callable that takes a shipment=(Acallablethattakesashipment = (value)) ⇒ Object

and an options object to create an Array of commodity fields as per the UPS docs.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#package_options Options for each of the packages/pallets in this shipment=(Options) ⇒ Object

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end

#pickup_date Date of the Pickup=(DateofthePickup = (value)) ⇒ Object

Options for generating UPS Freight rates for a shipment



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/friendly_shipping/services/ups_freight/rates_options.rb', line 22

class RatesOptions < FriendlyShipping::ShipmentOptions
  BILLING_CODES = {
    prepaid: '10',
    third_party: '30',
    freight_collect: '40'
  }.freeze

  attr_reader :shipper_number,
              :billing_address,
              :billing_code,
              :customer_context,
              :shipping_method,
              :pickup_request_options,
              :commodity_information_generator

  def initialize(
    shipper_number:,
    billing_address:,
    shipping_method:,
    billing: :prepaid,
    customer_context: nil,
    pickup_request_options: nil,
    commodity_information_generator: GenerateCommodityInformation,
    **kwargs
  )
    @shipper_number = shipper_number
    @billing_address = billing_address
    @shipping_method = shipping_method
    @billing_code = BILLING_CODES.fetch(billing)
    @customer_context = customer_context
    @pickup_request_options = pickup_request_options
    @commodity_information_generator = commodity_information_generator
    super(**kwargs.merge(package_options_class: RatesPackageOptions))
  end
end