friendly_shipping 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c75e81bbcef45d76dadd8e02683a43797c06f88712adb09fd5f185219364c83
4
- data.tar.gz: 6c0aa8348d4468c564a35026afed777041f42ffc905f21a6559df363d5784ea5
3
+ metadata.gz: ad0bd0ca10d1e4d781445eae63c71f67361da4f1dc7d8f1fe86c5372371ede0a
4
+ data.tar.gz: 3a327d0fc73633dc59c7e669db85d649d3d8daa8ae2a08d15ebde792d1a19679
5
5
  SHA512:
6
- metadata.gz: a46dae2ab3fb93a90e0d2d8d97a70a0fa0147b700662de40d3e31ce84856634e744d8531b3d75ff4559b8a5eb759a419af41165172440b4eb8238a7935a075c1
7
- data.tar.gz: b2316af744ca94fae7db521cf7dc52899acb726e3b4803440928b9ba516fc53e3284043d9e7114893d09ff58fa24b786ab99896ab7b67a169fc14212e6dc0d41
6
+ metadata.gz: 6db80ebea75835a2d100b46250e18e43231051e895c57ca6dc71bf63a16e6d3ca06396dba9b865b62cb6580e1bad54ed64b9e2785c23df5edbb18c5e37f5d2d4
7
+ data.tar.gz: d3d1d930b11db4dc22e052ed7ce49b5a9be371a0d384cfdb38830383660de60532db044e252a9e2219203cab4fb1759f62391d6296de7fbc8a03d184ecd9d31b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ 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.11] - 2020-01-14
8
+
9
+ ### Changed
10
+ - USPS Service: Identify packages within a shipment by index rather than by ID (#72)
11
+ - USPS Service: Do not raise if multiple rates for a package and shipping method are present (#72)
12
+
7
13
  ## [0.4.10] - 2020-01-10
8
14
 
9
15
  ### Changed
@@ -31,13 +31,8 @@ module FriendlyShipping
31
31
  r.data[:hold_for_pickup] == !!package.properties[:hold_for_pickup]
32
32
  end
33
33
 
34
- # At this point we should be left with a single rate. If we are not, raise an error,
35
- # as that means we're missing some code.
36
- if rates_with_this_hold_for_pickup_option.length > 1
37
- raise CannotDetermineRate
38
- end
39
-
40
- # As we only have one rate left, return that without the array.
34
+ # At this point, we have one or two rates left, and they're similar enough.
35
+ # Once this poses an actual problem, we'll fix it.
41
36
  rates_with_this_hold_for_pickup_option.first
42
37
  end
43
38
  end
@@ -65,7 +65,7 @@ module FriendlyShipping
65
65
  def rates_from_response_node(xml, shipment)
66
66
  xml.xpath(PACKAGE_NODE_XPATH).each_with_object({}) do |package_node, result|
67
67
  package_id = package_node['ID']
68
- corresponding_package = shipment.packages.detect { |p| p.id == package_id }
68
+ corresponding_package = shipment.packages[package_id.to_i]
69
69
 
70
70
  # There should always be a package in the original shipment that corresponds to the package ID
71
71
  # in the USPS response.
@@ -19,8 +19,8 @@ module FriendlyShipping
19
19
  def call(shipment:, login:, shipping_method: nil)
20
20
  xml_builder = Nokogiri::XML::Builder.new do |xml|
21
21
  xml.RateV4Request('USERID' => login) do
22
- shipment.packages.each do |package|
23
- xml.Package('ID' => package.id) do
22
+ shipment.packages.each_with_index do |package, index|
23
+ xml.Package('ID' => index) do
24
24
  xml.Service(service_code_by(shipping_method, package))
25
25
  if package.properties[:first_class_mail_type]
26
26
  xml.FirstClassMailType(FIRST_CLASS_MAIL_TYPES[package.properties[:first_class_mail_type]])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyShipping
4
- VERSION = "0.4.10"
4
+ VERSION = "0.4.11"
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.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: data_uri