friendly_shipping 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/CHANGELOG.md +7 -0
- data/lib/friendly_shipping/services/ups/parse_rate_response.rb +12 -4
- data/lib/friendly_shipping/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 107fa27ec95b49342549dbf24c53cc483cd05bdfbb64871940036aaac6567eb6
|
4
|
+
data.tar.gz: 7dd9c281178e513482ae0cb93787eb551b09e5f697f10d4db50dc2aef21dd4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c37297f77dc6be490cf9719211780b81b0d91cdc49311b349fc3844a6cbcb5755265e663b80e24a67cda9847e19d328808cec786cf7172d6986ccb75bbf6eb
|
7
|
+
data.tar.gz: 022c69680c07d9fed0b2b9afa8093e40b20bb7b441b332acd743078f74db70f3de03227953952de8b08048aa40eb902895529c781b6332036cf4e38ba653804e
|
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.6.4] - 2021-01-27
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- UPS Service: Include negotiated charges for UPS (#119)
|
12
|
+
- UPS Service: Include shipment-level itemized charges (#117)
|
13
|
+
|
7
14
|
## [0.6.3] - 2020-10-30
|
8
15
|
|
9
16
|
### Added
|
@@ -36,6 +36,8 @@ module FriendlyShipping
|
|
36
36
|
negotiated_rate = ParseMoneyElement.call(
|
37
37
|
rated_shipment.at('NegotiatedRates/NetSummaryCharges/GrandTotal')
|
38
38
|
)&.last
|
39
|
+
negotiated_charges = extract_charges(rated_shipment.xpath('NegotiatedRates/ItemizedCharges'))
|
40
|
+
itemized_charges = extract_charges(rated_shipment.xpath('ItemizedCharges'))
|
39
41
|
|
40
42
|
rated_shipment_warnings = rated_shipment.css('RatedShipmentWarning').map { |e| e.text.strip }
|
41
43
|
if rated_shipment_warnings.any? { |e| e.match?(/to Residential/) }
|
@@ -52,8 +54,10 @@ module FriendlyShipping
|
|
52
54
|
data: {
|
53
55
|
insurance_price: insurance_price,
|
54
56
|
negotiated_rate: negotiated_rate,
|
57
|
+
negotiated_charges: negotiated_charges,
|
55
58
|
days_to_delivery: days_to_delivery,
|
56
59
|
new_address_type: new_address_type,
|
60
|
+
itemized_charges: itemized_charges,
|
57
61
|
packages: build_packages(rated_shipment)
|
58
62
|
}.compact
|
59
63
|
)
|
@@ -64,20 +68,24 @@ module FriendlyShipping
|
|
64
68
|
|
65
69
|
def build_packages(rated_shipment)
|
66
70
|
rated_shipment.css('RatedPackage').map do |rated_package|
|
67
|
-
itemized_charges = rated_package.xpath('ItemizedCharges').map do |element|
|
68
|
-
ParseMoneyElement.call(element)
|
69
|
-
end.compact.to_h
|
70
71
|
{
|
71
72
|
transportation_charges: ParseMoneyElement.call(rated_package.at('TransportationCharges')).last,
|
72
73
|
base_service_charge: ParseMoneyElement.call(rated_package.at('BaseServiceCharge')).last,
|
73
74
|
service_options_charges: ParseMoneyElement.call(rated_package.at('ServiceOptionsCharges'))&.last,
|
74
|
-
itemized_charges:
|
75
|
+
itemized_charges: extract_charges(rated_package.xpath('ItemizedCharges')),
|
75
76
|
total_charges: ParseMoneyElement.call(rated_package.at('TotalCharges')).last,
|
77
|
+
negotiated_charges: extract_charges(rated_package.xpath('NegotiatedCharges/ItemizedCharges')),
|
76
78
|
weight: BigDecimal(rated_package.at('Weight').text),
|
77
79
|
billing_weight: BigDecimal(rated_package.at('BillingWeight/Weight').text)
|
78
80
|
}.compact
|
79
81
|
end
|
80
82
|
end
|
83
|
+
|
84
|
+
def extract_charges(node)
|
85
|
+
node.map do |element|
|
86
|
+
ParseMoneyElement.call(element)
|
87
|
+
end.compact.to_h
|
88
|
+
end
|
81
89
|
end
|
82
90
|
end
|
83
91
|
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.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Meyerhoff
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: data_uri
|
@@ -275,6 +275,7 @@ extra_rdoc_files: []
|
|
275
275
|
files:
|
276
276
|
- ".circleci/config.yml"
|
277
277
|
- ".env.template"
|
278
|
+
- ".github/dependabot.yml"
|
278
279
|
- ".gitignore"
|
279
280
|
- ".rspec"
|
280
281
|
- ".rubocop-relaxed.yml"
|
@@ -396,7 +397,7 @@ homepage: https://github.com/friendlycart/friendly_shipping
|
|
396
397
|
licenses:
|
397
398
|
- MIT
|
398
399
|
metadata: {}
|
399
|
-
post_install_message:
|
400
|
+
post_install_message:
|
400
401
|
rdoc_options: []
|
401
402
|
require_paths:
|
402
403
|
- lib
|
@@ -412,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
413
|
version: '0'
|
413
414
|
requirements: []
|
414
415
|
rubygems_version: 3.0.3
|
415
|
-
signing_key:
|
416
|
+
signing_key:
|
416
417
|
specification_version: 4
|
417
418
|
summary: An integration layer for shipping services
|
418
419
|
test_files: []
|