friendly_shipping 0.4.7 → 0.4.8

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
- SHA1:
3
- metadata.gz: a74d755729d634f9a26b89c9cf7fe9de4f0f9c6f
4
- data.tar.gz: d55595a012e01a25af70df3f0c7d6d20e1107b6c
2
+ SHA256:
3
+ metadata.gz: 040c918f1349ab0ca0eac9a810082c9b5e751f78ce3f8ccc60af7f5dcc7f81b2
4
+ data.tar.gz: '07479b91f4e7ad7bf983eec39da3b286d4959117f95f7e9caa062d95d2883785'
5
5
  SHA512:
6
- metadata.gz: 43ad0e0432113fcd26fb0f3472bc2ebf8c64a0d9a4b9b25b0618831a6ecb2a66a97d55f9764d11387c0ce68f6923a3c190d087ea2f40ee39004df4c0c336890a
7
- data.tar.gz: 6c86ce696207eeb0bc1274485769f53070806a11314df7981d684bd2d0cb9eddb1699c22592f2ff90c4484c3b9a9caf398eb7deb597d4c15136e0148ed231375
6
+ metadata.gz: 15b651d1056fee2933438df10c36fcae9c85deacaf0807e9745b8ccdcc04aa07be53f05e5d6f0737402d0c94591b267546b3878d2bbd8c27ccd499737745cd25
7
+ data.tar.gz: 0e683464058b2bf4881d4f9b10b3c887bf39d45b13f19fca170b40d3074573130b7e238422aefe27710c74fc7802633f30361f2ebbac73899b8424e6f64caad6
data/.rubocop-relaxed.yml CHANGED
@@ -156,7 +156,7 @@ Metrics/ModuleLength:
156
156
  Metrics/CyclomaticComplexity:
157
157
  Enabled: false
158
158
 
159
- Metrics/LineLength:
159
+ Layout/LineLength:
160
160
  Enabled: false
161
161
 
162
162
  Metrics/MethodLength:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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.8] - 2020-01-06
8
+
9
+ ### Changed
10
+ - USPS Service: Only transmit weights up to 150 pounds to timing API (#64)
11
+ - UPS Service: Transmit City and State when asking for timing information (#62)
12
+ - USPS Service: Gracefully handle missing expedited timing nodes (#60)
13
+
7
14
  ## [0.4.7] - 2019-11-28
8
15
 
9
16
  ### Changed
@@ -4,6 +4,8 @@ module FriendlyShipping
4
4
  module Services
5
5
  class Ups
6
6
  class SerializeTimeInTransitRequest
7
+ MAX_SHIPMENT_WEIGHT = Measured::Weight.new(150, :pounds)
8
+
7
9
  def self.call(shipment:, options:)
8
10
  xml_builder = Nokogiri::XML::Builder.new do |xml|
9
11
  xml.TimeInTransitRequest do
@@ -25,8 +27,8 @@ module FriendlyShipping
25
27
  end
26
28
  xml.TransitTo do
27
29
  xml.AddressArtifactFormat do
28
- # We no longer include the destination city since it doesn't seem to change the timing
29
- # result and can prevent the time in transit request from succeeding when invalid.
30
+ xml.PoliticalDivision2(shipment.destination.city)
31
+ xml.PoliticalDivision1(shipment.destination.region.code)
30
32
  xml.CountryCode(shipment.destination.country.code)
31
33
  xml.PostcodePrimaryLow(shipment.destination.zip)
32
34
  end
@@ -36,7 +38,8 @@ module FriendlyShipping
36
38
  xml.Code('LBS')
37
39
  end
38
40
  shipment_weight = shipment.packages.map(&:weight).inject(Measured::Weight(0, :pounds), :+)
39
- xml.Weight(shipment_weight.convert_to(:pounds).value.to_f.round(3))
41
+ weight_for_ups = [shipment_weight, MAX_SHIPMENT_WEIGHT].min
42
+ xml.Weight(weight_for_ups.convert_to(:pounds).value.to_f.round(3))
40
43
  end
41
44
  xml.InvoiceLineTotal do
42
45
  xml.CurrencyCode(options.invoice_total.currency.iso_code)
@@ -34,6 +34,8 @@ module FriendlyShipping
34
34
  private
35
35
 
36
36
  def parse_expedited_commitment_nodes(expedited_commitment_nodes)
37
+ return [] if expedited_commitment_nodes.empty?
38
+
37
39
  # All Expedited Commitments have the same acceptance date
38
40
  effective_acceptance_date = Time.parse(expedited_commitment_nodes.at('EAD').text)
39
41
  expedited_commitment_nodes.xpath('Commitment').map do |commitment_node|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyShipping
4
- VERSION = "0.4.7"
4
+ VERSION = "0.4.8"
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.7
4
+ version: 0.4.8
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-12-09 00:00:00.000000000 Z
11
+ date: 2020-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: data_uri
@@ -260,8 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubyforge_project:
264
- rubygems_version: 2.6.14.1
263
+ rubygems_version: 3.0.3
265
264
  signing_key:
266
265
  specification_version: 4
267
266
  summary: An integration layer for shipping services