friendly_shipping 0.10.1 → 0.10.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 +4 -4
- data/.env.test.local.template +2 -2
- data/CHANGELOG.md +31 -0
- data/Gemfile +1 -0
- data/README.md +16 -16
- data/lib/friendly_shipping/services/rl/parse_rate_quote_response.rb +3 -3
- data/lib/friendly_shipping/services/ups_json/parse_money_hash.rb +1 -0
- data/lib/friendly_shipping/services/usps_international/parse_rate_response.rb +3 -3
- data/lib/friendly_shipping/services/{usps → usps_international}/parse_xml_response.rb +1 -1
- data/lib/friendly_shipping/services/usps_international/serialize_rate_request.rb +1 -1
- data/lib/friendly_shipping/services/usps_ship/machinable_package.rb +3 -3
- data/lib/friendly_shipping/services/usps_ship/parse_city_state_response.rb +78 -0
- data/lib/friendly_shipping/services/usps_ship/parse_rate_estimates_response.rb +1 -1
- data/lib/friendly_shipping/services/usps_ship.rb +27 -1
- data/lib/friendly_shipping/version.rb +1 -1
- metadata +5 -55
- data/lib/friendly_shipping/services/ups/label.rb +0 -20
- data/lib/friendly_shipping/services/ups/label_billing_options.rb +0 -41
- data/lib/friendly_shipping/services/ups/label_item_options.rb +0 -75
- data/lib/friendly_shipping/services/ups/label_options.rb +0 -174
- data/lib/friendly_shipping/services/ups/label_package_options.rb +0 -49
- data/lib/friendly_shipping/services/ups/parse_address_classification_response.rb +0 -29
- data/lib/friendly_shipping/services/ups/parse_address_validation_response.rb +0 -53
- data/lib/friendly_shipping/services/ups/parse_city_state_lookup_response.rb +0 -33
- data/lib/friendly_shipping/services/ups/parse_modifier_element.rb +0 -29
- data/lib/friendly_shipping/services/ups/parse_money_element.rb +0 -128
- data/lib/friendly_shipping/services/ups/parse_rate_response.rb +0 -101
- data/lib/friendly_shipping/services/ups/parse_shipment_accept_response.rb +0 -77
- data/lib/friendly_shipping/services/ups/parse_shipment_confirm_response.rb +0 -24
- data/lib/friendly_shipping/services/ups/parse_time_in_transit_response.rb +0 -56
- data/lib/friendly_shipping/services/ups/parse_void_shipment_response.rb +0 -24
- data/lib/friendly_shipping/services/ups/parse_xml_response.rb +0 -50
- data/lib/friendly_shipping/services/ups/rate_estimate_options.rb +0 -111
- data/lib/friendly_shipping/services/ups/rate_estimate_package_options.rb +0 -22
- data/lib/friendly_shipping/services/ups/serialize_access_request.rb +0 -20
- data/lib/friendly_shipping/services/ups/serialize_address_snippet.rb +0 -60
- data/lib/friendly_shipping/services/ups/serialize_address_validation_request.rb +0 -40
- data/lib/friendly_shipping/services/ups/serialize_city_state_lookup_request.rb +0 -26
- data/lib/friendly_shipping/services/ups/serialize_package_node.rb +0 -75
- data/lib/friendly_shipping/services/ups/serialize_rating_service_selection_request.rb +0 -98
- data/lib/friendly_shipping/services/ups/serialize_shipment_accept_request.rb +0 -27
- data/lib/friendly_shipping/services/ups/serialize_shipment_address_snippet.rb +0 -21
- data/lib/friendly_shipping/services/ups/serialize_shipment_confirm_request.rb +0 -285
- data/lib/friendly_shipping/services/ups/serialize_time_in_transit_request.rb +0 -56
- data/lib/friendly_shipping/services/ups/serialize_void_shipment_request.rb +0 -21
- data/lib/friendly_shipping/services/ups/shipping_methods.rb +0 -111
- data/lib/friendly_shipping/services/ups/timing_options.rb +0 -33
- data/lib/friendly_shipping/services/ups.rb +0 -218
- data/lib/friendly_shipping/services/usps/choose_package_rate.rb +0 -40
- data/lib/friendly_shipping/services/usps/machinable_package.rb +0 -50
- data/lib/friendly_shipping/services/usps/parse_address_validation_response.rb +0 -43
- data/lib/friendly_shipping/services/usps/parse_city_state_lookup_response.rb +0 -41
- data/lib/friendly_shipping/services/usps/parse_package_rate.rb +0 -159
- data/lib/friendly_shipping/services/usps/parse_rate_response.rb +0 -86
- data/lib/friendly_shipping/services/usps/parse_time_in_transit_response.rb +0 -240
- data/lib/friendly_shipping/services/usps/rate_estimate_options.rb +0 -26
- data/lib/friendly_shipping/services/usps/rate_estimate_package_options.rb +0 -66
- data/lib/friendly_shipping/services/usps/serialize_address_validation_request.rb +0 -25
- data/lib/friendly_shipping/services/usps/serialize_city_state_lookup_request.rb +0 -20
- data/lib/friendly_shipping/services/usps/serialize_rate_request.rb +0 -83
- data/lib/friendly_shipping/services/usps/serialize_time_in_transit_request.rb +0 -22
- data/lib/friendly_shipping/services/usps/shipping_methods.rb +0 -66
- data/lib/friendly_shipping/services/usps/timing_options.rb +0 -19
- data/lib/friendly_shipping/services/usps.rb +0 -115
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea046468f58d0fcb1b73a5a412d1196ba22b5196772bdc09167f085bdad718e
|
4
|
+
data.tar.gz: cdb2ae78f0a244358795e3a695cbb837c5199b16e1b1ea62d35fc3c2db7593ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab58d07654f00ad218e80582bf9ebdc242074e9e10d062d6d89dea04125b71785c05e496800da635805be221b61b544dad233258e78cfe2b633590788b401930
|
7
|
+
data.tar.gz: ccfae1ca937d3f1c93223a40d8a0193943720be569403565795a70cf7457cd010950d4dfef271bfa5e52145c05cffd004f307566485874baa30c864189fc7e4e
|
data/.env.test.local.template
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# .env.test.local.template
|
2
2
|
|
3
|
-
# When recording VCR cassettes for TForce and
|
4
|
-
# should be set to a valid token for
|
3
|
+
# When recording VCR cassettes for TForce, UPS, and USPS Ship service classes, this env var
|
4
|
+
# should be set to a valid token for the service being tested.
|
5
5
|
|
6
6
|
ACCESS_TOKEN=secret_token
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,37 @@ 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.10.3] - 2025
|
8
|
+
- Add USPS Ship city/state lookup request (#279)
|
9
|
+
|
10
|
+
## [0.10.2] - 2025
|
11
|
+
- Remove legacy UPS integration (#275)
|
12
|
+
- Add observer gem to Gemfile (#276)
|
13
|
+
- Remove legacy USPS integration (#277)
|
14
|
+
- Add UPS surcharge code 495 to money hash parser (#278)
|
15
|
+
|
16
|
+
## [0.10.1] - 2025-01-03
|
17
|
+
- Remove Inflections file (#274)
|
18
|
+
|
19
|
+
## [0.10.0] - 2025-01-03
|
20
|
+
- Bump version to 0.9.0 and log changes (#257)
|
21
|
+
- USPS Ship: Fix machinable criteria (#258)
|
22
|
+
- Add debug param to ShipEngine labels method (#259)
|
23
|
+
- Truncate R+L BOL address lines to 30 chars (#260)
|
24
|
+
- Fix UPS json rate details, add specs (#261)
|
25
|
+
- Fix ups label cost breakdown (#262)
|
26
|
+
- Remove TForce company name sanitization (#263)
|
27
|
+
- Update payload location of NegotiatedRatesIndicator within UPS JSON (#264)
|
28
|
+
- Attach cost breakdown to R+L rates data (#265)
|
29
|
+
- Expand TForce cost breakdown detail (#266)
|
30
|
+
- Never send empty UPS ShipmentRatingOptions (#267)
|
31
|
+
- Bump required Ruby version to 3.1 or greater (#269)
|
32
|
+
- Add city/state lookup endpoint for UPS JSON API (#268)
|
33
|
+
- Extract AccessToken parent class (#270)
|
34
|
+
- Return errors in ApiFailures for USPS timings, UPS json parsing (#271)
|
35
|
+
- Deprecate ApiFailure class (#272)
|
36
|
+
- Use Zeitwerk to load FriendlyShipping (#273)
|
37
|
+
|
7
38
|
## [0.9.0] - 2024-05-02
|
8
39
|
- Implement R&L service with rates and timings (#177)
|
9
40
|
- Add R&L Freight API call to create BOL and schedule pickup (#178)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,8 +22,8 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
The entry point for using FriendlyShipping are the `service` objects that each represent an API provider. Currently, there are three services:
|
24
24
|
|
25
|
-
1. `FriendlyShipping::Services::
|
26
|
-
2. `FriendlyShipping::Services::
|
25
|
+
1. `FriendlyShipping::Services::UpsJson`
|
26
|
+
2. `FriendlyShipping::Services::USPSShip`
|
27
27
|
3. `FriendlyShipping::Services::ShipEngine`
|
28
28
|
4. `FriendlyShipping::Services::UpsFreight`
|
29
29
|
|
@@ -54,13 +54,11 @@ The following methods are supported:
|
|
54
54
|
|
55
55
|
#### UPS (United Parcel Service)
|
56
56
|
|
57
|
-
The service class for UPS is `FriendlyShipping::Services::
|
57
|
+
The service class for UPS is `FriendlyShipping::Services::UpsJson`. Initialize like so:
|
58
58
|
|
59
59
|
```rb
|
60
|
-
service = FriendlyShipping::Services::
|
61
|
-
|
62
|
-
login: ENV['UPS_API_LOGIN'],
|
63
|
-
password: ENV['UPS_API_PASSWORD'],
|
60
|
+
service = FriendlyShipping::Services::UpsJson.new(
|
61
|
+
access_token: ENV['UPS_ACCESS_TOKEN'],
|
64
62
|
test: true
|
65
63
|
)
|
66
64
|
```
|
@@ -68,19 +66,21 @@ service = FriendlyShipping::Services::Ups.new(
|
|
68
66
|
The following methods are supported:
|
69
67
|
|
70
68
|
- `#carriers` - List all configured carriers (always returns UPS)
|
71
|
-
- `#
|
72
|
-
- `#
|
69
|
+
- `#create_access_token(client_id:, client_secret:, merchant_id:)` - Create a new API access token
|
70
|
+
- `#rates(physical_shipment, options:)` - Get rate estimates for a shipment
|
71
|
+
- `#timings(physical_shipment, options:)` - Get transit timings for a shipment
|
72
|
+
- `#labels(physical_shipment, options:)` - Get labels for a shipment
|
73
73
|
- `#address_classification(physical_location)` - Determine whether an address is commercial or residential.
|
74
|
-
- `#address_validation(physical_location)` - Perform a detailed address validation and determine whether an address is commercial or residential.
|
75
74
|
- `#city_state_lookup(physical_location)` - Lookup City and State for a given ZIP code.
|
75
|
+
- `#void(label)` - Void a previously created label.
|
76
76
|
|
77
77
|
#### USPS (United States Postal Service)
|
78
78
|
|
79
|
-
The service class for USPS is `FriendlyShipping::Services::
|
79
|
+
The service class for USPS is `FriendlyShipping::Services::USPSShip`. Initialize like so:
|
80
80
|
|
81
81
|
```rb
|
82
|
-
service = FriendlyShipping::Services::
|
83
|
-
|
82
|
+
service = FriendlyShipping::Services::USPSShip.new(
|
83
|
+
access_token: ENV['USPS_ACCESS_TOKEN'],
|
84
84
|
test: true
|
85
85
|
)
|
86
86
|
```
|
@@ -88,9 +88,9 @@ service = FriendlyShipping::Services::Usps.new(
|
|
88
88
|
The following methods are supported:
|
89
89
|
|
90
90
|
- `#carriers` - List all configured carriers (always returns USPS)
|
91
|
-
- `#
|
92
|
-
- `#
|
93
|
-
- `#
|
91
|
+
- `#create_access_token(client_id:, client_secret:)` - Create a new API access token
|
92
|
+
- `#rate_estimates(physical_shipment, options:)` - Get rate estimates for a shipment
|
93
|
+
- `#timings(physical_location, options:)` - Get transit timings for a shipment
|
94
94
|
|
95
95
|
#### UPS Freight
|
96
96
|
|
@@ -34,10 +34,10 @@ module FriendlyShipping
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
private
|
38
|
-
|
39
37
|
# The currency to use when parsing the rate quotes.
|
40
|
-
CURRENCY = Money::Currency.new('USD')
|
38
|
+
CURRENCY = Money::Currency.new('USD')
|
39
|
+
|
40
|
+
private
|
41
41
|
|
42
42
|
# Builds {Rate} instances from the parsed JSON.
|
43
43
|
#
|
@@ -105,6 +105,7 @@ module FriendlyShipping
|
|
105
105
|
"470" => "COMMITTED DELIVERY WINDOW",
|
106
106
|
"480" => "SECURITY SURCHARGE",
|
107
107
|
"492" => "CUSTOMER TRANSACTION FEE",
|
108
|
+
"495" => "EXTENDED AREA SURCHARGE",
|
108
109
|
"500" => "SHIPMENT COD",
|
109
110
|
"510" => "LIFT GATE FOR PICKUP",
|
110
111
|
"511" => "LIFT GATE FOR DELIVERY",
|
@@ -16,7 +16,7 @@ module FriendlyShipping
|
|
16
16
|
# @return [Result<ApiResult<Array<FriendlyShipping::Rate>>>] When successfully parsing, an array of rates in a Success Monad.
|
17
17
|
def call(request:, response:, shipment:, options:)
|
18
18
|
# Filter out error responses and directly return a failure
|
19
|
-
parsing_result =
|
19
|
+
parsing_result = ParseXMLResponse.call(
|
20
20
|
request: request,
|
21
21
|
response: response,
|
22
22
|
expected_root_tag: 'IntlRateV2Response'
|
@@ -51,11 +51,11 @@ module FriendlyShipping
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
private
|
55
|
-
|
56
54
|
PACKAGE_NODE_XPATH = '//Package'
|
57
55
|
SERVICE_NODE_NAME = 'Service'
|
58
56
|
|
57
|
+
private
|
58
|
+
|
59
59
|
# Iterate over all packages and parse the rates for each package
|
60
60
|
#
|
61
61
|
# @param [Nokogiri::XML::Node] xml The XML document containing packages and rates
|
@@ -50,7 +50,7 @@ module FriendlyShipping
|
|
50
50
|
private
|
51
51
|
|
52
52
|
def machinable(package)
|
53
|
-
FriendlyShipping::Services::
|
53
|
+
FriendlyShipping::Services::USPSShip::MachinablePackage.new(package).machinable? ? 'true' : 'false'
|
54
54
|
end
|
55
55
|
|
56
56
|
def ounces_for(package)
|
@@ -29,13 +29,13 @@ module FriendlyShipping
|
|
29
29
|
|
30
30
|
# @return [Boolean]
|
31
31
|
def machinable?
|
32
|
-
at_least_minimum && at_most_maximum
|
32
|
+
at_least_minimum? && at_most_maximum?
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
37
|
# @return [Boolean]
|
38
|
-
def at_least_minimum
|
38
|
+
def at_least_minimum?
|
39
39
|
package.length >= MIN_LENGTH &&
|
40
40
|
package.width >= MIN_WIDTH &&
|
41
41
|
package.height >= MIN_HEIGHT &&
|
@@ -43,7 +43,7 @@ module FriendlyShipping
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# @return [Boolean]
|
46
|
-
def at_most_maximum
|
46
|
+
def at_most_maximum?
|
47
47
|
package.length <= MAX_LENGTH &&
|
48
48
|
package.width <= MAX_WIDTH &&
|
49
49
|
package.height <= MAX_HEIGHT &&
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FriendlyShipping
|
4
|
+
module Services
|
5
|
+
class USPSShip
|
6
|
+
class ParseCityStateResponse
|
7
|
+
extend Dry::Monads::Result::Mixin
|
8
|
+
USA = Carmen::Country.coded("USA")
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# Parse a city/state response.
|
12
|
+
#
|
13
|
+
# @param request [Request] the request that was used to obtain this response
|
14
|
+
# @param response [Response] the response that USPS returned
|
15
|
+
# @return [Success<ApiResult<Physical::Location>>, Failure<ApiResult<String>>]
|
16
|
+
def call(request:, response:)
|
17
|
+
city_state = JSON.parse(response.body)
|
18
|
+
|
19
|
+
if city_state['error']
|
20
|
+
failure(
|
21
|
+
api_error("Error: #{city_state.dig('error', 'message')}"),
|
22
|
+
request,
|
23
|
+
response
|
24
|
+
)
|
25
|
+
else
|
26
|
+
success(
|
27
|
+
Physical::Location.new(
|
28
|
+
city: city_state['city'],
|
29
|
+
region: city_state['state'],
|
30
|
+
zip: city_state['ZIPCode'],
|
31
|
+
country: USA
|
32
|
+
),
|
33
|
+
request,
|
34
|
+
response
|
35
|
+
)
|
36
|
+
end
|
37
|
+
rescue JSON::ParserError => e
|
38
|
+
failure(e, request, response)
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param location [Physical::Location]
|
42
|
+
# @param request [Request]
|
43
|
+
# @param response [Response]
|
44
|
+
# @return [Success<ApiResult<Physical::Location>>]
|
45
|
+
def success(location, request, response)
|
46
|
+
Success(
|
47
|
+
ApiResult.new(
|
48
|
+
location,
|
49
|
+
original_request: request,
|
50
|
+
original_response: response
|
51
|
+
)
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param error [JSON::ParserError, FriendlyShipping::ApiError]
|
56
|
+
# @param request [Request]
|
57
|
+
# @param response [Response]
|
58
|
+
# @return [Failure<ApiResult>]
|
59
|
+
def failure(error, request, response)
|
60
|
+
Failure(
|
61
|
+
ApiResult.new(
|
62
|
+
error,
|
63
|
+
original_request: request,
|
64
|
+
original_response: response
|
65
|
+
)
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def api_error(message)
|
72
|
+
FriendlyShipping::ApiError.new(nil, message)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -32,7 +32,8 @@ module FriendlyShipping
|
|
32
32
|
RESOURCES = {
|
33
33
|
token: 'oauth2/v3/token',
|
34
34
|
rates: 'prices/v3/base-rates/search',
|
35
|
-
timings: 'service-standards/v3/estimates'
|
35
|
+
timings: 'service-standards/v3/estimates',
|
36
|
+
city_state: 'addresses/v3/city-state'
|
36
37
|
}.freeze
|
37
38
|
|
38
39
|
# @param access_token [AccessToken] the access token
|
@@ -161,6 +162,31 @@ module FriendlyShipping
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
165
|
+
# Get city and state for given ZIP code.
|
166
|
+
# @see https://developer.usps.com/addressesv3#tag/Resources/operation/get-city-state API documentation
|
167
|
+
#
|
168
|
+
# @param location [Physical::Location] the location with ZIP code we want to complete
|
169
|
+
# @return [Result<ApiResult<Array<Timing>>>] the {Timing}s wrapped in an {ApiResult} object
|
170
|
+
# @return [Result<ApiResult<Physical::Location>>] The response data from USPS encoded in a
|
171
|
+
# `Physical::Location` object. Country, City and ZIP code will be set, everything else nil.
|
172
|
+
def city_state(location, debug: false)
|
173
|
+
request = FriendlyShipping::Request.new(
|
174
|
+
url: "#{BASE_URL}/#{RESOURCES[:city_state]}?ZIPCode=#{location.zip}",
|
175
|
+
http_method: "GET",
|
176
|
+
debug: debug,
|
177
|
+
headers: {
|
178
|
+
Accept: "application/json",
|
179
|
+
Authorization: "Bearer #{access_token.raw_token}"
|
180
|
+
}
|
181
|
+
)
|
182
|
+
|
183
|
+
client.get(request).bind do |response|
|
184
|
+
ParseCityStateResponse.call(response: response, request: request)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
alias_method :city_state_lookup, :city_state
|
189
|
+
|
164
190
|
private
|
165
191
|
|
166
192
|
# @param api [Symbol]
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_shipping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Meyerhoff
|
8
8
|
- Matthew Bass
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: dry-monads
|
@@ -230,38 +229,6 @@ files:
|
|
230
229
|
- lib/friendly_shipping/services/tforce_freight/shipment_options.rb
|
231
230
|
- lib/friendly_shipping/services/tforce_freight/shipping_methods.rb
|
232
231
|
- lib/friendly_shipping/services/tforce_freight/structure_options.rb
|
233
|
-
- lib/friendly_shipping/services/ups.rb
|
234
|
-
- lib/friendly_shipping/services/ups/label.rb
|
235
|
-
- lib/friendly_shipping/services/ups/label_billing_options.rb
|
236
|
-
- lib/friendly_shipping/services/ups/label_item_options.rb
|
237
|
-
- lib/friendly_shipping/services/ups/label_options.rb
|
238
|
-
- lib/friendly_shipping/services/ups/label_package_options.rb
|
239
|
-
- lib/friendly_shipping/services/ups/parse_address_classification_response.rb
|
240
|
-
- lib/friendly_shipping/services/ups/parse_address_validation_response.rb
|
241
|
-
- lib/friendly_shipping/services/ups/parse_city_state_lookup_response.rb
|
242
|
-
- lib/friendly_shipping/services/ups/parse_modifier_element.rb
|
243
|
-
- lib/friendly_shipping/services/ups/parse_money_element.rb
|
244
|
-
- lib/friendly_shipping/services/ups/parse_rate_response.rb
|
245
|
-
- lib/friendly_shipping/services/ups/parse_shipment_accept_response.rb
|
246
|
-
- lib/friendly_shipping/services/ups/parse_shipment_confirm_response.rb
|
247
|
-
- lib/friendly_shipping/services/ups/parse_time_in_transit_response.rb
|
248
|
-
- lib/friendly_shipping/services/ups/parse_void_shipment_response.rb
|
249
|
-
- lib/friendly_shipping/services/ups/parse_xml_response.rb
|
250
|
-
- lib/friendly_shipping/services/ups/rate_estimate_options.rb
|
251
|
-
- lib/friendly_shipping/services/ups/rate_estimate_package_options.rb
|
252
|
-
- lib/friendly_shipping/services/ups/serialize_access_request.rb
|
253
|
-
- lib/friendly_shipping/services/ups/serialize_address_snippet.rb
|
254
|
-
- lib/friendly_shipping/services/ups/serialize_address_validation_request.rb
|
255
|
-
- lib/friendly_shipping/services/ups/serialize_city_state_lookup_request.rb
|
256
|
-
- lib/friendly_shipping/services/ups/serialize_package_node.rb
|
257
|
-
- lib/friendly_shipping/services/ups/serialize_rating_service_selection_request.rb
|
258
|
-
- lib/friendly_shipping/services/ups/serialize_shipment_accept_request.rb
|
259
|
-
- lib/friendly_shipping/services/ups/serialize_shipment_address_snippet.rb
|
260
|
-
- lib/friendly_shipping/services/ups/serialize_shipment_confirm_request.rb
|
261
|
-
- lib/friendly_shipping/services/ups/serialize_time_in_transit_request.rb
|
262
|
-
- lib/friendly_shipping/services/ups/serialize_void_shipment_request.rb
|
263
|
-
- lib/friendly_shipping/services/ups/shipping_methods.rb
|
264
|
-
- lib/friendly_shipping/services/ups/timing_options.rb
|
265
232
|
- lib/friendly_shipping/services/ups_freight.rb
|
266
233
|
- lib/friendly_shipping/services/ups_freight/api_error.rb
|
267
234
|
- lib/friendly_shipping/services/ups_freight/generate_commodity_information.rb
|
@@ -324,26 +291,10 @@ files:
|
|
324
291
|
- lib/friendly_shipping/services/ups_json/rates_package_options.rb
|
325
292
|
- lib/friendly_shipping/services/ups_json/shipping_methods.rb
|
326
293
|
- lib/friendly_shipping/services/ups_json/timings_options.rb
|
327
|
-
- lib/friendly_shipping/services/usps.rb
|
328
|
-
- lib/friendly_shipping/services/usps/choose_package_rate.rb
|
329
|
-
- lib/friendly_shipping/services/usps/machinable_package.rb
|
330
|
-
- lib/friendly_shipping/services/usps/parse_address_validation_response.rb
|
331
|
-
- lib/friendly_shipping/services/usps/parse_city_state_lookup_response.rb
|
332
|
-
- lib/friendly_shipping/services/usps/parse_package_rate.rb
|
333
|
-
- lib/friendly_shipping/services/usps/parse_rate_response.rb
|
334
|
-
- lib/friendly_shipping/services/usps/parse_time_in_transit_response.rb
|
335
|
-
- lib/friendly_shipping/services/usps/parse_xml_response.rb
|
336
|
-
- lib/friendly_shipping/services/usps/rate_estimate_options.rb
|
337
|
-
- lib/friendly_shipping/services/usps/rate_estimate_package_options.rb
|
338
|
-
- lib/friendly_shipping/services/usps/serialize_address_validation_request.rb
|
339
|
-
- lib/friendly_shipping/services/usps/serialize_city_state_lookup_request.rb
|
340
|
-
- lib/friendly_shipping/services/usps/serialize_rate_request.rb
|
341
|
-
- lib/friendly_shipping/services/usps/serialize_time_in_transit_request.rb
|
342
|
-
- lib/friendly_shipping/services/usps/shipping_methods.rb
|
343
|
-
- lib/friendly_shipping/services/usps/timing_options.rb
|
344
294
|
- lib/friendly_shipping/services/usps_international.rb
|
345
295
|
- lib/friendly_shipping/services/usps_international/parse_package_rate.rb
|
346
296
|
- lib/friendly_shipping/services/usps_international/parse_rate_response.rb
|
297
|
+
- lib/friendly_shipping/services/usps_international/parse_xml_response.rb
|
347
298
|
- lib/friendly_shipping/services/usps_international/rate_estimate_options.rb
|
348
299
|
- lib/friendly_shipping/services/usps_international/rate_estimate_package_options.rb
|
349
300
|
- lib/friendly_shipping/services/usps_international/serialize_rate_request.rb
|
@@ -352,6 +303,7 @@ files:
|
|
352
303
|
- lib/friendly_shipping/services/usps_ship/access_token.rb
|
353
304
|
- lib/friendly_shipping/services/usps_ship/api_error.rb
|
354
305
|
- lib/friendly_shipping/services/usps_ship/machinable_package.rb
|
306
|
+
- lib/friendly_shipping/services/usps_ship/parse_city_state_response.rb
|
355
307
|
- lib/friendly_shipping/services/usps_ship/parse_rate_estimates_response.rb
|
356
308
|
- lib/friendly_shipping/services/usps_ship/parse_timings_response.rb
|
357
309
|
- lib/friendly_shipping/services/usps_ship/rate_estimate_options.rb
|
@@ -370,7 +322,6 @@ licenses:
|
|
370
322
|
- MIT
|
371
323
|
metadata:
|
372
324
|
rubygems_mfa_required: 'true'
|
373
|
-
post_install_message:
|
374
325
|
rdoc_options: []
|
375
326
|
require_paths:
|
376
327
|
- lib
|
@@ -385,8 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
385
336
|
- !ruby/object:Gem::Version
|
386
337
|
version: '0'
|
387
338
|
requirements: []
|
388
|
-
rubygems_version: 3.
|
389
|
-
signing_key:
|
339
|
+
rubygems_version: 3.6.9
|
390
340
|
specification_version: 4
|
391
341
|
summary: An integration layer for shipping services
|
392
342
|
test_files: []
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module FriendlyShipping
|
4
|
-
module Services
|
5
|
-
class Ups
|
6
|
-
class Label < FriendlyShipping::Label
|
7
|
-
attr_reader :usps_tracking_number
|
8
|
-
|
9
|
-
# @param [String] usps_tracking_number The label's usps tracking number. Limited to SUREPOST
|
10
|
-
def initialize(
|
11
|
-
usps_tracking_number: nil,
|
12
|
-
**params
|
13
|
-
)
|
14
|
-
@usps_tracking_number = usps_tracking_number
|
15
|
-
super(**params)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module FriendlyShipping
|
4
|
-
module Services
|
5
|
-
class Ups
|
6
|
-
# Represents billing-related options for obtaining shipment labels.
|
7
|
-
# @option bill_third_party [Boolean] When truthy, bill an account other than the shipper's.
|
8
|
-
# Specified by billing_(account, zip and country)
|
9
|
-
# @option bill_to_consignee [Boolean] If billing a third party, bill the consignee instead of the 3rd party shipper
|
10
|
-
# @option prepay [Boolean] If truthy the shipper will be bill immediately. Otherwise the shipper is billed
|
11
|
-
# when the label is used. Default: false
|
12
|
-
class LabelBillingOptions
|
13
|
-
attr_reader :bill_third_party,
|
14
|
-
:bill_to_consignee,
|
15
|
-
:prepay,
|
16
|
-
:billing_account,
|
17
|
-
:billing_zip,
|
18
|
-
:billing_country,
|
19
|
-
:currency
|
20
|
-
|
21
|
-
def initialize(
|
22
|
-
bill_third_party: false,
|
23
|
-
bill_to_consignee: false,
|
24
|
-
prepay: false,
|
25
|
-
billing_account: nil,
|
26
|
-
billing_zip: nil,
|
27
|
-
billing_country: nil,
|
28
|
-
currency: nil
|
29
|
-
)
|
30
|
-
@bill_third_party = bill_third_party
|
31
|
-
@bill_to_consignee = bill_to_consignee
|
32
|
-
@prepay = prepay
|
33
|
-
@billing_account = billing_account
|
34
|
-
@billing_zip = billing_zip
|
35
|
-
@billing_country = billing_country
|
36
|
-
@currency = currency
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module FriendlyShipping
|
4
|
-
module Services
|
5
|
-
class Ups
|
6
|
-
class LabelItemOptions < FriendlyShipping::ItemOptions
|
7
|
-
PRODUCT_UNIT_OF_MEASURE_CODES = {
|
8
|
-
barrel: 'BA',
|
9
|
-
bundle: 'BE',
|
10
|
-
bag: 'BG',
|
11
|
-
bunch: 'BH',
|
12
|
-
box: 'BOX',
|
13
|
-
bolt: 'BT',
|
14
|
-
butt: 'BU',
|
15
|
-
canister: 'CI',
|
16
|
-
centimeter: 'CM',
|
17
|
-
container: 'CON',
|
18
|
-
crate: 'CR',
|
19
|
-
case: 'CS',
|
20
|
-
carton: 'CT',
|
21
|
-
cylinder: 'CY',
|
22
|
-
dozen: 'DOZ',
|
23
|
-
each: 'EA',
|
24
|
-
envelope: 'EN',
|
25
|
-
feet: 'FT',
|
26
|
-
kilogram: 'KG',
|
27
|
-
kilograms: 'KGS',
|
28
|
-
pound: 'LB',
|
29
|
-
pounds: 'LBS',
|
30
|
-
liter: 'L',
|
31
|
-
meter: 'M',
|
32
|
-
number: 'NMB',
|
33
|
-
packet: 'PA',
|
34
|
-
pallet: 'PAL',
|
35
|
-
piece: 'PC',
|
36
|
-
pieces: 'PCS',
|
37
|
-
proof_liters: 'PF',
|
38
|
-
package: 'PKG',
|
39
|
-
pair: 'PR',
|
40
|
-
pairs: 'PRS',
|
41
|
-
roll: 'RL',
|
42
|
-
set: 'SET',
|
43
|
-
square_meters: 'SME',
|
44
|
-
square_yards: 'SYD',
|
45
|
-
tube: 'TU',
|
46
|
-
yard: 'YD',
|
47
|
-
other: 'OTH'
|
48
|
-
}.freeze
|
49
|
-
|
50
|
-
attr_reader :commodity_code,
|
51
|
-
:country_of_origin
|
52
|
-
|
53
|
-
def initialize(
|
54
|
-
commodity_code: nil,
|
55
|
-
country_of_origin: nil,
|
56
|
-
product_unit_of_measure: :number,
|
57
|
-
**kwargs
|
58
|
-
)
|
59
|
-
@commodity_code = commodity_code
|
60
|
-
@country_of_origin = country_of_origin
|
61
|
-
@product_unit_of_measure = product_unit_of_measure
|
62
|
-
super(**kwargs)
|
63
|
-
end
|
64
|
-
|
65
|
-
def product_unit_of_measure_code
|
66
|
-
PRODUCT_UNIT_OF_MEASURE_CODES[product_unit_of_measure]
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
attr_reader :product_unit_of_measure
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|