friendly_shipping 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea451610e13a57cf5515da031454c29350f88fe5
4
- data.tar.gz: 448c153d99953e67528b94ad8bc7807c5a3b26f7
3
+ metadata.gz: 4d761859165aa830263e2c0a32ffb65f48b8a139
4
+ data.tar.gz: '010484c2f0bce6443d15eecdf86b82d9ffb68ca5'
5
5
  SHA512:
6
- metadata.gz: 509d6772349fdaac8ba0c35251466bd7d2e08f029ae92ac19acf47987518138ed0f97637d9c45f2caf99fea6ff8e9615798e35c063350673ada20f436a0ec784
7
- data.tar.gz: f020a36ab7693c073b5f4949bd02bff7ab9ab450347a8eda729cac3d8e974e05f6520936d705ef71a282fcf0783715b8c61df37e255e31971a8dded64a29a4c6
6
+ metadata.gz: acc250eb47504239555f0507a6e7aa063c9b6ad1b1cd32eb6b1f0da4b0997f0aa4b1519a6ffc058f8fdeec8e4eefbeb5753ef6779c7aad4032bfa7f003597c26
7
+ data.tar.gz: 839c5d701cb9f12bca12036a8ca0834a96f2ce91f523f8269c17c5b2e0f16172dc7cb322d7a7a28de3e4ad0127859887e27ea86ff08954ac6cec971193687ec2
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.4.3] - 2019-11-27
8
+
9
+ ### Changed
10
+ - UPS Freight: Allow passing PickupRequest element with Pickup date
11
+
7
12
  ## [0.4.2] - 2019-11-19
8
13
 
9
14
  ### Changed
@@ -19,13 +19,23 @@ module FriendlyShipping
19
19
  Code: options.shipping_method.service_code
20
20
  },
21
21
  Commodity: options.commodity_information_generator.call(shipment: shipment, options: options),
22
- TimeInTransitIndicator: 'true'
22
+ TimeInTransitIndicator: 'true',
23
+ PickupRequest: pickup_request(options)
23
24
  }.compact.merge(handling_units(shipment, options).reduce(&:merge).to_h)
24
25
  }
25
26
  end
26
27
 
27
28
  private
28
29
 
30
+ def pickup_request(options)
31
+ return unless options.pickup_date
32
+
33
+ {
34
+ PickupDate: options.pickup_date.strftime('%Y%m%d'),
35
+ AdditionalComments: options.pickup_comments
36
+ }
37
+ end
38
+
29
39
  def handling_units(shipment, options)
30
40
  all_package_options = shipment.packages.map { |package| options.options_for_package(package) }
31
41
  all_package_options.group_by(&:handling_unit_code).map do |_handling_unit_code, options_group|
@@ -16,6 +16,8 @@ module FriendlyShipping
16
16
  # and an options object to create an Array of commodity fields as per the UPS docs.
17
17
  # @attribute [Symbol] billing One of the keys in the `BILLING_CODES` constant. How the shipment
18
18
  # would be billed.
19
+ # @attribute [Date] pickup_date Date of the Pickup
20
+ # @attribute [String] pickup_comments Additional pickup instructions
19
21
  # @attribute [RatesPackageOptions] package_options Options for each of the packages/pallets in this shipment
20
22
  class RatesOptions < FriendlyShipping::ShipmentOptions
21
23
  BILLING_CODES = {
@@ -29,6 +31,8 @@ module FriendlyShipping
29
31
  :billing_code,
30
32
  :customer_context,
31
33
  :shipping_method,
34
+ :pickup_date,
35
+ :pickup_comments,
32
36
  :commodity_information_generator
33
37
 
34
38
  def initialize(
@@ -37,6 +41,8 @@ module FriendlyShipping
37
41
  shipping_method:,
38
42
  billing: :prepaid,
39
43
  customer_context: nil,
44
+ pickup_date: nil,
45
+ pickup_comments: nil,
40
46
  commodity_information_generator: GenerateCommodityInformation,
41
47
  **kwargs
42
48
  )
@@ -45,6 +51,8 @@ module FriendlyShipping
45
51
  @shipping_method = shipping_method
46
52
  @billing_code = BILLING_CODES.fetch(billing)
47
53
  @customer_context = customer_context
54
+ @pickup_date = pickup_date
55
+ @pickup_comments = pickup_comments
48
56
  @commodity_information_generator = commodity_information_generator
49
57
  super kwargs.merge(package_options_class: RatesPackageOptions)
50
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyShipping
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: data_uri