usps-ruby-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tasks/api.rake +1 -1
- data/lib/usps/api/endpoints/carrier_pickup_schedule.rb +22 -47
- data/lib/usps/api/endpoints/city_state_lookup.rb +5 -12
- data/lib/usps/api/endpoints/e_vs_express_mail_intl.rb +108 -217
- data/lib/usps/api/endpoints/e_vs_first_class_mail_intl.rb +95 -191
- data/lib/usps/api/endpoints/e_vs_priority_mail_intl.rb +109 -221
- data/lib/usps/api/endpoints/e_vsgxg_get_label.rb +103 -208
- data/lib/usps/api/endpoints/e_vsi_cancel.rb +5 -12
- data/lib/usps/api/endpoints/hfp_facility_info.rb +8 -20
- data/lib/usps/api/endpoints/intl_rate_v2.rb +31 -66
- data/lib/usps/api/endpoints/pts_email.rb +14 -20
- data/lib/usps/api/endpoints/pts_pod.rb +23 -29
- data/lib/usps/api/endpoints/pts_rre.rb +15 -21
- data/lib/usps/api/endpoints/ptst_pod.rb +16 -22
- data/lib/usps/api/endpoints/rate_v4.rb +34 -72
- data/lib/usps/api/endpoints/scan.rb +27 -58
- data/lib/usps/api/endpoints/track_v2.rb +9 -15
- data/lib/usps/api/endpoints/usps_returns_label.rb +33 -70
- data/lib/usps/api/endpoints/verify.rb +13 -30
- data/lib/usps/api/endpoints/zip_code_lookup.rb +11 -25
- data/lib/usps/api/templates/_options.erb +1 -4
- data/lib/usps/api/templates/method.erb +4 -8
- data/lib/usps/version.rb +1 -1
- data/usps-ruby-client-0.1.0.gem +0 -0
- data/usps-ruby-client.gemspec +1 -0
- metadata +16 -1
@@ -6,9 +6,6 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module PTSEmail
|
9
|
-
#
|
10
|
-
# Track and Confirm by Email API
|
11
|
-
#
|
12
9
|
# The Track and Confirm by
|
13
10
|
# Email API allows the customer to submit their email address to be notified of
|
14
11
|
# current or future tracking activity. When you request access for this API,
|
@@ -16,23 +13,20 @@ module Usps
|
|
16
13
|
# utilizing this API. A mailer identification number (MID) is a 6 or 9-digit
|
17
14
|
# number assigned to a customer through the USPS Business Customer Gateway (BCG).
|
18
15
|
# Please refer to the following links for help:
|
19
|
-
#
|
20
|
-
# @option
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
#
|
34
|
-
# @see
|
35
|
-
def pts_email(options = {})
|
16
|
+
# @param [Hash] options
|
17
|
+
# @option options [required, Hash] pts_email_request
|
18
|
+
# * *:track_id* (required, String)
|
19
|
+
# * *:client_ip* (String)
|
20
|
+
# * *:source_id* (String)
|
21
|
+
# * *:mp_suffix* (required, Integer)
|
22
|
+
# * *:mp_date* (required, String)
|
23
|
+
# * *:request_type* (Request Type)
|
24
|
+
# * *:first_name* (String)
|
25
|
+
# * *:last_name* (String)
|
26
|
+
# * *:email1* (required, String)
|
27
|
+
# * *:email2* (String)
|
28
|
+
# * *:email3* (String)
|
29
|
+
def pts_email(options = {})
|
36
30
|
throw ArgumentError.new('Required arguments :pts_email_request missing') if options[:pts_email_request].nil?
|
37
31
|
throw ArgumentError.new('Required arguments :pts_email_request, :track_id missing') if options[:pts_email_request][:track_id].nil?
|
38
32
|
throw ArgumentError.new('Required arguments :pts_email_request, :mp_suffix missing') if options[:pts_email_request][:mp_suffix].nil?
|
@@ -6,9 +6,6 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module PTSPod
|
9
|
-
#
|
10
|
-
# Proof of Delivery API
|
11
|
-
#
|
12
9
|
# Proof of
|
13
10
|
# Delivery is a letter that includes the recipient's name and a copy of their
|
14
11
|
# signature. The Proof of Delivery API
|
@@ -17,32 +14,29 @@ module Usps
|
|
17
14
|
# mailer ID and how you will be utilizing this API. A mailer identification
|
18
15
|
# number (MID) is a 6 or 9-digit number assigned to a customer through the USPS
|
19
16
|
# Business Customer Gateway (BCG). Please refer to the following links for help:
|
20
|
-
#
|
21
|
-
# @option
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
43
|
-
#
|
44
|
-
# @see
|
45
|
-
def pts_pod(options = {})
|
17
|
+
# @param [Hash] options
|
18
|
+
# @option options [required, Hash] pts_pod_request
|
19
|
+
# * *:track_id* (required, String)
|
20
|
+
# * *:client_ip* (String)
|
21
|
+
# * *:source_id* (String)
|
22
|
+
# * *:mp_suffix* (required, integer)
|
23
|
+
# * *:mp_date* (required, String)
|
24
|
+
# * *:request_type* (required, String)
|
25
|
+
# * *:first_name* (required, String)
|
26
|
+
# * *:last_name* (required, String)
|
27
|
+
# * *:email1* (String)
|
28
|
+
# * *:email2* (String)
|
29
|
+
# * *:email3* (String)
|
30
|
+
# * *:fax_number* (String)
|
31
|
+
# * *:address_line1* (String)
|
32
|
+
# * *:address_line2* (String)
|
33
|
+
# * *:city* (String)
|
34
|
+
# * *:state* (String)
|
35
|
+
# * *:zip* (String)
|
36
|
+
# * *:verify_address* (Boolean)
|
37
|
+
# * *:table_code* (required, String)
|
38
|
+
# * *:cust_reg_id* (String)
|
39
|
+
def pts_pod(options = {})
|
46
40
|
request = build_request(:pts_pod, options)
|
47
41
|
get('https://secure.shippingapis.com/ShippingAPI.dll', {
|
48
42
|
API: 'PTSPod',
|
@@ -6,28 +6,22 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module PTSRre
|
9
|
-
#
|
10
|
-
# Return Receipt Electronic API
|
11
|
-
#
|
12
9
|
# Overview
|
13
|
-
#
|
14
|
-
# @option
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
#
|
29
|
-
# @see
|
30
|
-
def pts_rre(options = {})
|
10
|
+
# @param [Hash] options
|
11
|
+
# @option options [required, Hash] pts_rre_request
|
12
|
+
# * *:track_id* (required, String)
|
13
|
+
# * *:client_ip* (String)
|
14
|
+
# * *:source_id* (String)
|
15
|
+
# * *:mp_suffix* (required, integer)
|
16
|
+
# * *:mp_date* (required, String)
|
17
|
+
# * *:first_name* (required, String)
|
18
|
+
# * *:last_name* (required, String)
|
19
|
+
# * *:email1* (required, String)
|
20
|
+
# * *:email2* (String)
|
21
|
+
# * *:email3* (String)
|
22
|
+
# * *:table_code* (required, String)
|
23
|
+
# * *:cust_reg_id* (String)
|
24
|
+
def pts_rre(options = {})
|
31
25
|
throw ArgumentError.new('Required arguments :pts_rre_request missing') if options[:pts_rre_request].nil?
|
32
26
|
throw ArgumentError.new('Required arguments :pts_rre_request, :track_id missing') if options[:pts_rre_request][:track_id].nil?
|
33
27
|
throw ArgumentError.new('Required arguments :pts_rre_request, :mp_suffix missing') if options[:pts_rre_request][:mp_suffix].nil?
|
@@ -6,29 +6,23 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module PTSTPod
|
9
|
-
#
|
10
|
-
# Track Proof of Delivery API
|
11
|
-
#
|
12
9
|
# Overview
|
13
|
-
#
|
14
|
-
# @option
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
29
|
-
#
|
30
|
-
# @see
|
31
|
-
def ptst_pod(options = {})
|
10
|
+
# @param [Hash] options
|
11
|
+
# @option options [required, Hash] ptst_pod_request
|
12
|
+
# * *:track_id* (required, String)
|
13
|
+
# * *:mp_suffix* (required, integer)
|
14
|
+
# * *:mp_date* (required, String)
|
15
|
+
# * *:request_type* (required, String)
|
16
|
+
# * *:first_name* (required, String)
|
17
|
+
# * *:last_name* (required, String)
|
18
|
+
# * *:email1* (String)
|
19
|
+
# * *:email2* (String)
|
20
|
+
# * *:email3* (String)
|
21
|
+
# * *:cust_reg_id* (required, String)
|
22
|
+
# * *:table_code* (required, String)
|
23
|
+
# * *:client_ip* (String)
|
24
|
+
# * *:source_id* (String)
|
25
|
+
def ptst_pod(options = {})
|
32
26
|
throw ArgumentError.new('Required arguments :ptst_pod_request missing') if options[:ptst_pod_request].nil?
|
33
27
|
throw ArgumentError.new('Required arguments :ptst_pod_request, :track_id missing') if options[:ptst_pod_request][:track_id].nil?
|
34
28
|
throw ArgumentError.new('Required arguments :ptst_pod_request, :mp_suffix missing') if options[:ptst_pod_request][:mp_suffix].nil?
|
@@ -6,82 +6,44 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module RateV4
|
9
|
-
#
|
10
|
-
# Domestic Rates API
|
11
|
-
#
|
12
9
|
# The RateV4 API lets customers calculate the
|
13
10
|
# rate for domestic packages and envelopes given the weight and dimensions of the
|
14
11
|
# item. The RateV4 API limits the data requested to twenty-five (25) packages per
|
15
12
|
# transaction.
|
16
|
-
#
|
17
|
-
# @option
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
|
50
|
-
# - Available when RateV4Request [Revision='2']. Collect on delivery amount. Used to determine availability and cost of extra services. For example: <AmountToCollect>150.00</AmountToCollect>
|
51
|
-
# @option option [(Group)] :SpecialServices (Optional)
|
52
|
-
# - Available when RateV4Request [Revision='2']. Groups the SpecialServices elements. Special Services prices and availability will not be returned when Service = “ALL”, “ONLINE”, or “PLUS”
|
53
|
-
# @option option [Special Service Name] :SpecialService (Optional)
|
54
|
-
# - [{"Special Service Name"=>"Insurance", "ServiceID"=>"100"}, {"Special Service Name"=>"Insurance – Priority Mail Express", "ServiceID"=>"101"}, {"Special Service Name"=>"Return Receipt", "ServiceID"=>"102"}, {"Special Service Name"=>"Collect on Delivery", "ServiceID"=>"103"}, {"Special Service Name"=>"Certificate of Mailing (Form 3665)", "ServiceID"=>"104"}, {"Special Service Name"=>"Certified Mail", "ServiceID"=>"105"}, {"Special Service Name"=>"USPS Tracking", "ServiceID"=>"106"}, {"Special Service Name"=>"Signature Confirmation", "ServiceID"=>"108"}, {"Special Service Name"=>"Registered Mail", "ServiceID"=>"109"}, {"Special Service Name"=>"Return Receipt Electronic", "ServiceID"=>"110"}, {"Special Service Name"=>"Registered mail COD collection Charge", "ServiceID"=>"112"}, {"Special Service Name"=>"Return Receipt – Priority Mail Express", "ServiceID"=>"118"}, {"Special Service Name"=>"Adult Signature Required", "ServiceID"=>"119"}, {"Special Service Name"=>"Adult Signature Restricted Delivery", "ServiceID"=>"120"}, {"Special Service Name"=>"Insurance – Priority Mail", "ServiceID"=>"125"}, {"Special Service Name"=>"USPS Tracking Electronic", "ServiceID"=>"155"}, {"Special Service Name"=>"Signature Confirmation Electronic", "ServiceID"=>"156"}, {"Special Service Name"=>"Certificate of Mailing (Form 3817)", "ServiceID"=>"160"}, {"Special Service Name"=>"Priority Mail Express 1030 AM Delivery", "ServiceID"=>"161"}, {"Special Service Name"=>"Certified Mail Restricted Delivery", "ServiceID"=>"170"}, {"Special Service Name"=>"Certified Mail Adult Signature Required", "ServiceID"=>"171"}, {"Special Service Name"=>"Certified Mail Adult Signature Restricted Delivery", "ServiceID"=>"172"}, {"Special Service Name"=>"Signature Confirm. Restrict. Delivery", "ServiceID"=>"173"}, {"Special Service Name"=>"Signature Confirmation Electronic Restricted Delivery", "ServiceID"=>"174"}, {"Special Service Name"=>"Collect on Delivery Restricted Delivery", "ServiceID"=>"175"}, {"Special Service Name"=>"Registered Mail Restricted Delivery", "ServiceID"=>"176"}, {"Special Service Name"=>"Insurance Restricted Delivery", "ServiceID"=>"177"}, {"Special Service Name"=>"Insurance Restrict. Delivery – Priority Mail", "ServiceID"=>"179"}, {"Special Service Name"=>"Insurance Restrict. Delivery – Priority Mail Express", "ServiceID"=>"178"}, {"Special Service Name"=>"Insurance Restrict. Delivery (Bulk Only)", "ServiceID"=>"180"}, {"Special Service Name"=>"Scan Retention", "ServiceID"=>"181"}, {"Special Service Name"=>"Scan + Signature Retention", "ServiceID"=>"182"}, {"Special Service Name"=>"Special Handling - Fragile", "ServiceID"=>"190"}]
|
55
|
-
# @option option [Group] :Content (Optional)
|
56
|
-
# - Available when RateV4Request[Revision='2']. Groups the ContentType and ContentDescription elements.
|
57
|
-
# @option option [String] :ContentType (Optional)
|
58
|
-
# - Available when RateV4Request [Revision=’2’]. Defines the type of content of the package.
|
59
|
-
# @option option [String] :ContentDescription (Optional)
|
60
|
-
# - Available when RateV4Request[Revision=’2’]. Describes the content of the package. Optional but required for ContentType ‘LIVES’.
|
61
|
-
# @option option [Boolean] :GroundOnly (Optional)
|
62
|
-
# - Available when RateV4Request [Revision=’2’]. RateV4Request [Service=’ Retail Ground’] Use “true” when shipment contains mailable hazardous materials, live animals and other “surface-only” items.
|
63
|
-
# @option option [String] :SortBy (Optional)
|
64
|
-
# - Available when RateV4Request [Revision='2']. Returns all mailing services available based on item shape. When specified, value in <Container> is ignored. Available when: RateV4Request[Service='ALL'] RateV4Request[Service='ONLINE'] For example: <SortBy>PACKAGE</SortBy>
|
65
|
-
# @option option [Boolean] :Machinable (Optional)
|
66
|
-
# - RateV4Request/Machinable is required when: RateV4Request[Service='FIRST CLASS' and (FirstClassMailType='LETTER' or FirstClassMailType='FLAT')] RateV4Request[Service='Retail Ground’] RateV4Request[Service='ALL'] RateV4Request[Service='ONLINE'] If false, First Class Mail Letters and Flats will not be returned. For example: <Machinable>true</Machinable>
|
67
|
-
# @option option [Boolean] :ReturnLocations (Optional)
|
68
|
-
# - Include Dropoff Locations in Response if available. Requires "ShipDate" tag.
|
69
|
-
# @option option [Boolean] :ReturnServiceInfo (Optional)
|
70
|
-
# - If a value of “True” is indicated in the request then the response will include the <ServiceInformation> tag containing mail service specific information
|
71
|
-
# @option option [String] :DropOffTime (Optional)
|
72
|
-
# - Time Package Will Be Mailed. Enter drop off time in format: HH:mm, such as 13:45. Inclusion of Drop Off Time will result increased accuracy of <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants. For example: <DropOffTime>13:45</DropOffTime>
|
73
|
-
# @option option [String] :ShipDate (Optional)
|
74
|
-
# - Date Package Will Be Mailed. Ship date may be today plus 0 to 3 days in advance. Enter the date in format: yyyy-mm-dd, such as 2013-07-28. Inclusion of Ship Date will result in <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants For example: <ShipDate Option="HFP">2013-07-28</ShipDate>
|
75
|
-
# @option option [String] :Option (Optional)
|
76
|
-
# - The value of this attribute specifies how the RateV4Response will structure the Priority Express Mail Commitment data elements.
|
77
|
-
# @option option [Boolean] :ReturnDimensionalWeight (Optional)
|
78
|
-
# - This tag must be explicitly set to “true” for dimensional weight to be returned in the xml response.
|
79
|
-
# @option option [String] :TrackingRetentionPeriod (Optional)
|
80
|
-
# - Used to determine period of Retention for tracking data
|
81
|
-
|
82
|
-
#
|
83
|
-
# @see
|
84
|
-
def rate_v4(options = {})
|
13
|
+
# @param [Hash] options
|
14
|
+
# @option options [required, Hash] rate_v4_request API=RateV4 This API returns the current USPS postage corresponding to the parameters given.
|
15
|
+
# * *:revision* (String) — Set this value to “2” to return all currently documented response fields. For example: <Revision>2</Revsion>
|
16
|
+
# * *:package* (Hash) — See the RateV4 Service Request chart for valid combinations of the following tags.
|
17
|
+
# * *:service* (required, String) — Web Tools validates the entry to one of the service types. For example: <Service>PRIORITY MAIL EXPRESS</Service> Please see Appendix A for detailed business rules regarding combinations of Service, Container, dimensions and other request values. Note: Mailable matter not required to be mailed as First-Class Mail is permitted with Retail Ground to Zones 5-9. Zones 1-4 items are limited to mailable hazardous materials, live animals, and other “surface-only” items. Retail Ground can only be used for Zones 5-9 unless the shipment is oversized or contains classes of materials. (e.g. certain HAZMAT) For more details, see: http://pe.usps.com/businessmail101/classes/packageServices.htm. Note: The use of <Service> = “BPM” is restricted. If access to this service is needed, please reach out to the following email address: webtools@usps.gov.
|
18
|
+
# * *:first_class_mail_type* (String) — Required when: RateV4Request[Service='FIRST CLASS'] or RateV4Request[Service='FIRST CLASS COMMERCIAL’], or RateV4Request[Service='FIRST CLASS HFP COMMERCIAL’] Example: <FirstClassMailType>LETTER</FirstClassMailType> Note: The <FirstClassMailType> tag is returned only if the <ServiceType> submitted is “First Class”. If any other <ServiceType> is returned (Including “First Class Commercial”) the <Container> tag is used. Note: Flats are also known as Large Envelopes
|
19
|
+
# * *:zip_origination* (required, String) — ZIP code must be valid. For example: <ZipOrigination>20770</ZipOrigination>
|
20
|
+
# * *:zip_destination* (required, String) — ZIP code must be valid. For example: <ZipDestination>54324</ZipDestination>
|
21
|
+
# * *:pounds* (required, String) — Value must be numeric. Package weight cannot exceed 70 pounds. For example: <Pounds>2</Pounds> <Pounds>2.12345678</Pounds>
|
22
|
+
# * *:ounces* (required, String) — Value must be numeric. Package weight cannot exceed 70 pounds (1120 ounces). For example: <Ounces>0</Ounces> <Ounces>0.12345678</Ounces>
|
23
|
+
# * *:container* (required, String) — Use to specify container attributes that may affect postage; otherwise, leave blank. Note: The <FirstClassMailType> tag is used instead of the <Container> tag only if the <ServiceType> submitted is “First Class”. Note: “Cubic Soft Pack” and “Cubic Parcels” are only valid containers for service “Priority Mail Cubic”. Dimensions Length and Height are required when requesting Cubic Soft Pack. Dimensions Length, Height, and Width are required when requesting Cubic Parcels. Note: “VARIABLE” is used to denote that a customer is using packaging other than a USPS-produced Flat Rate Box/Envelope or Regional Rate Box”.
|
24
|
+
# * *:size* (String) — Note: This tag has been deprecated. <Size> tag and any values within the <Size> tag will not result in an error response and will not impact rates that are returned.
|
25
|
+
# * *:width* (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing, please reference the Domestic Mail Manual Section 123.1.4 for Retail Mail and Section 223.1.6 for Commercial Mail. https://pe.usps.com/text/dmm300/index.htm
|
26
|
+
# * *:length* (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing, please reference the Domestic Mail Manual Section 123.1.4 for Retail Mail and Section 223.1.6 for Commercial Mail. https://pe.usps.com/text/dmm300/index.htm
|
27
|
+
# * *:height* (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing, please reference the Domestic Mail Manual Section 123.1.4 for Retail Mail and Section 223.1.6 for Commercial Mail. https://pe.usps.com/text/dmm300/index.htm
|
28
|
+
# * *:girth* (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing, please reference the Domestic Mail Manual Section 123.1.4 for Retail Mail and Section 223.1.6 for Commercial Mail. https://pe.usps.com/text/dmm300/index.htm
|
29
|
+
# * *:value* (String) — Available when RateV4Request [Revision='2']. Package value. Used to determine availability and cost of extra services. For example: <Value>150.00</Value>
|
30
|
+
# * *:amount_to_collect* (String) — Available when RateV4Request [Revision='2']. Collect on delivery amount. Used to determine availability and cost of extra services. For example: <AmountToCollect>150.00</AmountToCollect>
|
31
|
+
# * *:special_services* (Hash) — Available when RateV4Request [Revision='2']. Groups the SpecialServices elements. Special Services prices and availability will not be returned when Service = “ALL”, “ONLINE”, or “PLUS”
|
32
|
+
# * *:special_service* (Special Service Name) — [{"Special Service Name"=>"Insurance", "ServiceID"=>"100"}, {"Special Service Name"=>"Insurance – Priority Mail Express", "ServiceID"=>"101"}, {"Special Service Name"=>"Return Receipt", "ServiceID"=>"102"}, {"Special Service Name"=>"Collect on Delivery", "ServiceID"=>"103"}, {"Special Service Name"=>"Certificate of Mailing (Form 3665)", "ServiceID"=>"104"}, {"Special Service Name"=>"Certified Mail", "ServiceID"=>"105"}, {"Special Service Name"=>"USPS Tracking", "ServiceID"=>"106"}, {"Special Service Name"=>"Signature Confirmation", "ServiceID"=>"108"}, {"Special Service Name"=>"Registered Mail", "ServiceID"=>"109"}, {"Special Service Name"=>"Return Receipt Electronic", "ServiceID"=>"110"}, {"Special Service Name"=>"Registered mail COD collection Charge", "ServiceID"=>"112"}, {"Special Service Name"=>"Return Receipt – Priority Mail Express", "ServiceID"=>"118"}, {"Special Service Name"=>"Adult Signature Required", "ServiceID"=>"119"}, {"Special Service Name"=>"Adult Signature Restricted Delivery", "ServiceID"=>"120"}, {"Special Service Name"=>"Insurance – Priority Mail", "ServiceID"=>"125"}, {"Special Service Name"=>"USPS Tracking Electronic", "ServiceID"=>"155"}, {"Special Service Name"=>"Signature Confirmation Electronic", "ServiceID"=>"156"}, {"Special Service Name"=>"Certificate of Mailing (Form 3817)", "ServiceID"=>"160"}, {"Special Service Name"=>"Priority Mail Express 1030 AM Delivery", "ServiceID"=>"161"}, {"Special Service Name"=>"Certified Mail Restricted Delivery", "ServiceID"=>"170"}, {"Special Service Name"=>"Certified Mail Adult Signature Required", "ServiceID"=>"171"}, {"Special Service Name"=>"Certified Mail Adult Signature Restricted Delivery", "ServiceID"=>"172"}, {"Special Service Name"=>"Signature Confirm. Restrict. Delivery", "ServiceID"=>"173"}, {"Special Service Name"=>"Signature Confirmation Electronic Restricted Delivery", "ServiceID"=>"174"}, {"Special Service Name"=>"Collect on Delivery Restricted Delivery", "ServiceID"=>"175"}, {"Special Service Name"=>"Registered Mail Restricted Delivery", "ServiceID"=>"176"}, {"Special Service Name"=>"Insurance Restricted Delivery", "ServiceID"=>"177"}, {"Special Service Name"=>"Insurance Restrict. Delivery – Priority Mail", "ServiceID"=>"179"}, {"Special Service Name"=>"Insurance Restrict. Delivery – Priority Mail Express", "ServiceID"=>"178"}, {"Special Service Name"=>"Insurance Restrict. Delivery (Bulk Only)", "ServiceID"=>"180"}, {"Special Service Name"=>"Scan Retention", "ServiceID"=>"181"}, {"Special Service Name"=>"Scan + Signature Retention", "ServiceID"=>"182"}, {"Special Service Name"=>"Special Handling - Fragile", "ServiceID"=>"190"}]
|
33
|
+
# * *:content* (Group) — Available when RateV4Request[Revision='2']. Groups the ContentType and ContentDescription elements.
|
34
|
+
# * *:content_type* (String) — Available when RateV4Request [Revision=’2’]. Defines the type of content of the package.
|
35
|
+
# * *:content_description* (String) — Available when RateV4Request[Revision=’2’]. Describes the content of the package. Optional but required for ContentType ‘LIVES’.
|
36
|
+
# * *:ground_only* (Boolean) — Available when RateV4Request [Revision=’2’]. RateV4Request [Service=’ Retail Ground’] Use “true” when shipment contains mailable hazardous materials, live animals and other “surface-only” items.
|
37
|
+
# * *:sort_by* (String) — Available when RateV4Request [Revision='2']. Returns all mailing services available based on item shape. When specified, value in <Container> is ignored. Available when: RateV4Request[Service='ALL'] RateV4Request[Service='ONLINE'] For example: <SortBy>PACKAGE</SortBy>
|
38
|
+
# * *:machinable* (Boolean) — RateV4Request/Machinable is required when: RateV4Request[Service='FIRST CLASS' and (FirstClassMailType='LETTER' or FirstClassMailType='FLAT')] RateV4Request[Service='Retail Ground’] RateV4Request[Service='ALL'] RateV4Request[Service='ONLINE'] If false, First Class Mail Letters and Flats will not be returned. For example: <Machinable>true</Machinable>
|
39
|
+
# * *:return_locations* (Boolean) — Include Dropoff Locations in Response if available. Requires "ShipDate" tag.
|
40
|
+
# * *:return_service_info* (Boolean) — If a value of “True” is indicated in the request then the response will include the <ServiceInformation> tag containing mail service specific information
|
41
|
+
# * *:drop_off_time* (String) — Time Package Will Be Mailed. Enter drop off time in format: HH:mm, such as 13:45. Inclusion of Drop Off Time will result increased accuracy of <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants. For example: <DropOffTime>13:45</DropOffTime>
|
42
|
+
# * *:ship_date* (String) — Date Package Will Be Mailed. Ship date may be today plus 0 to 3 days in advance. Enter the date in format: yyyy-mm-dd, such as 2013-07-28. Inclusion of Ship Date will result in <CommitmentName> and <CommitmentDate> in the response for Priority Mail and Priority Mail Express variants For example: <ShipDate Option="HFP">2013-07-28</ShipDate>
|
43
|
+
# * *:option* (String) — The value of this attribute specifies how the RateV4Response will structure the Priority Express Mail Commitment data elements.
|
44
|
+
# * *:return_dimensional_weight* (Boolean) — This tag must be explicitly set to “true” for dimensional weight to be returned in the xml response.
|
45
|
+
# * *:tracking_retention_period* (String) — Used to determine period of Retention for tracking data
|
46
|
+
def rate_v4(options = {})
|
85
47
|
throw ArgumentError.new('Required arguments :rate_v4_request missing') if options[:rate_v4_request].nil?
|
86
48
|
|
87
49
|
request = build_request(:rate_v4, options)
|
@@ -6,68 +6,37 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module SCAN
|
9
|
-
#
|
10
|
-
# SCAN API
|
11
|
-
#
|
12
9
|
# The SCAN API allows integrators to consolidate
|
13
10
|
# multiple domestic and international labels and custom forms through one
|
14
11
|
# Electronic File Number (EFN) and physical SCAN Form (PS Form 5630 or 3152). The
|
15
12
|
# API operates as follows:
|
16
|
-
#
|
17
|
-
# @option
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
43
|
-
# @option option [String] :PkgBarcode (Required)
|
44
|
-
# - Individual package barcodes. Example: <PkgBarcode>42020260910180521390702413570 </PkgBarcode> Note: The SCAN API can contain no more than 1,000 package barcodes in a single request. If exceeded, 'Total PackageDetail items exceeded 1000.’ error will return”
|
45
|
-
# @option option [(Group)] :SpecialService (Optional)
|
46
|
-
# - FOR FUTURE USE. Groups extra service information.
|
47
|
-
# @option option [String] :SpcServCode (Required)
|
48
|
-
# - FOR FUTURE USE. If present, must be <SpcServFee>. From Extra Service Code table. Example: <SpcServCode>01</SpcServCode>
|
49
|
-
# @option option [String] :SpcServFee (Required)
|
50
|
-
# - FOR FUTURE USE. Fee for Extra Service. Example: <SpcServFee>00275</SpcServFee>
|
51
|
-
# @option option [String] :EMail (Optional)
|
52
|
-
# - FOR FUTURE USE. Email address of acceptance scan event recipient. Example: <EMail>john.smith@abc.com</EMail>
|
53
|
-
# @option option [Boolean] :CloseManifest (Optional)
|
54
|
-
# - Used to include all labels for the submitted UserID. There are two values: “ALL” will close all labels for the submitted USERID. “SHIPDATE” will close all the labels for the submitted USERID that have the <Shipdate> tag matching the value in the <MailDate> tag. Note: When <CloseManifest> is indicated in the request, the following two response fields are eligible to return if conditions are met: · <MaxPackagesExceeded> · <MaxLabelsExceeded>
|
55
|
-
# @option option [String] :MailDate (Required)
|
56
|
-
# - Date of mailing/Carrier Pickup. This denotes date mail to be tendered to Postal Service. YYYYMMDD format. Example: <MailDate>20060103</MailDate>
|
57
|
-
# @option option [String] :MailTime (Required)
|
58
|
-
# - Time of mailing/Carrier Pickup. This is an approximation. This denotes time of mail to be tendered to Postal Service. HHMMSS (24 hour) format. Example: <MailTime>143000</MailTime>
|
59
|
-
# @option option [String] :EntryFacility (Required)
|
60
|
-
# - ZIP Code of Postal Service facility. Populate/required only if different from <FromZip5>. Example: <EntryFacility>07067</EntryFacility>
|
61
|
-
# @option option [String] :ImageType (Required)
|
62
|
-
# - The form image format desired. Enter one of the valid entries: Example: <ImageType>TIF</ImageType>
|
63
|
-
# @option option [String] :CustomerRefNo (Optional)
|
64
|
-
# - Arbitrary number for customers own tracking or inventory systems, does not print to form or manifest with Product Tracking. May be any combination of alpha and numeric characters, up to a maximum of 30. Example: <CustomerRefNo>123456</CustomerRefNo>
|
65
|
-
# @option option [Boolean] :CarrierPickup (Optional)
|
66
|
-
# - FOR FUTURE USE.
|
67
|
-
|
68
|
-
#
|
69
|
-
# @see
|
70
|
-
def scan(options = {})
|
13
|
+
# @param [Hash] options
|
14
|
+
# @option options [required, Hash] scan_request API=SCAN
|
15
|
+
# * *:option* (Hash) — Groups form information
|
16
|
+
# * *:form* (String) — Designates desired label option selected by customer. Enter one of the valid entries: ‘3152’ generates PS Form 3152. ‘5630’ generates PS Form 5630. For example: <Form>3152</Form>
|
17
|
+
# * *:from_name* (required, String) — Name of sender. Example: <FromName>Joe Smith</FromName>
|
18
|
+
# * *:from_firm* (String) — Company name. Example: <FromFirm>ABC Corp.</FromFirm>
|
19
|
+
# * *:from_address1* (String) — From address line 1. Denote apartment or suite number. Example: <FromAddress1>Apt. 3C</FromAddress1>
|
20
|
+
# * *:from_address2* (required, String) — From address line 2. Denote street/structure number. Example: <FromAddress2>475 L’Enfant Plaza SW</FromAddress2>
|
21
|
+
# * *:from_city* (required, String) — From city. Example: <FromCity>Greenbelt</FromCity>
|
22
|
+
# * *:from_state* (required, String) — From state. Example: <FromState>MD</FromState>
|
23
|
+
# * *:from_zip5* (required, String) — From ZIP Code. Must be a valid ZIP5 Code. Example: <FromZip5>20770</FromZip5>
|
24
|
+
# * *:from_zip4* (String) — From ZIP Code+4. Example: <FromZip4>1234</FromZip4>
|
25
|
+
# * *:shipment* (Hash) — Groups shipment information
|
26
|
+
# * *:package_detail* (Hash) — Groups package detail information
|
27
|
+
# * *:pkg_barcode* (required, String) — Individual package barcodes. Example: <PkgBarcode>42020260910180521390702413570 </PkgBarcode> Note: The SCAN API can contain no more than 1,000 package barcodes in a single request. If exceeded, 'Total PackageDetail items exceeded 1000.’ error will return”
|
28
|
+
# * *:special_service* (Hash) — FOR FUTURE USE. Groups extra service information.
|
29
|
+
# * *:spc_serv_code* (required, String) — FOR FUTURE USE. If present, must be <SpcServFee>. From Extra Service Code table. Example: <SpcServCode>01</SpcServCode>
|
30
|
+
# * *:spc_serv_fee* (required, String) — FOR FUTURE USE. Fee for Extra Service. Example: <SpcServFee>00275</SpcServFee>
|
31
|
+
# * *:e_mail* (String) — FOR FUTURE USE. Email address of acceptance scan event recipient. Example: <EMail>john.smith@abc.com</EMail>
|
32
|
+
# * *:close_manifest* (Boolean) — Used to include all labels for the submitted UserID. There are two values: “ALL” will close all labels for the submitted USERID. “SHIPDATE” will close all the labels for the submitted USERID that have the <Shipdate> tag matching the value in the <MailDate> tag. Note: When <CloseManifest> is indicated in the request, the following two response fields are eligible to return if conditions are met: · <MaxPackagesExceeded> · <MaxLabelsExceeded>
|
33
|
+
# * *:mail_date* (required, String) — Date of mailing/Carrier Pickup. This denotes date mail to be tendered to Postal Service. YYYYMMDD format. Example: <MailDate>20060103</MailDate>
|
34
|
+
# * *:mail_time* (required, String) — Time of mailing/Carrier Pickup. This is an approximation. This denotes time of mail to be tendered to Postal Service. HHMMSS (24 hour) format. Example: <MailTime>143000</MailTime>
|
35
|
+
# * *:entry_facility* (required, String) — ZIP Code of Postal Service facility. Populate/required only if different from <FromZip5>. Example: <EntryFacility>07067</EntryFacility>
|
36
|
+
# * *:image_type* (required, String) — The form image format desired. Enter one of the valid entries: Example: <ImageType>TIF</ImageType>
|
37
|
+
# * *:customer_ref_no* (String) — Arbitrary number for customers own tracking or inventory systems, does not print to form or manifest with Product Tracking. May be any combination of alpha and numeric characters, up to a maximum of 30. Example: <CustomerRefNo>123456</CustomerRefNo>
|
38
|
+
# * *:carrier_pickup* (Boolean) — FOR FUTURE USE.
|
39
|
+
def scan(options = {})
|
71
40
|
throw ArgumentError.new('Required arguments :scan_request missing') if options[:scan_request].nil?
|
72
41
|
|
73
42
|
request = build_request(:scan, options)
|
@@ -6,9 +6,6 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module TrackV2
|
9
|
-
#
|
10
|
-
# Package Tracking
|
11
|
-
#
|
12
9
|
# The Package Tracking “Fields” API is similar
|
13
10
|
# to the Package Track API
|
14
11
|
# except for the request fields, API name, and the return information. Data
|
@@ -16,18 +13,15 @@ module Usps
|
|
16
13
|
# information is broken down into fields instead of having only one line of text.
|
17
14
|
# Up to 10 tracking IDs may be contained in each API request to the Web Tools
|
18
15
|
# server.
|
19
|
-
#
|
20
|
-
# @option
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
#
|
29
|
-
# @see
|
30
|
-
def track_v2(options = {})
|
16
|
+
# @param [Hash] options
|
17
|
+
# @option options [required, Hash] track_field_request
|
18
|
+
# * *:revision* (required, Integer)
|
19
|
+
# * *:client_ip* (String)
|
20
|
+
# * *:source_id* (required, String)
|
21
|
+
# * *:track_id* (required, String)
|
22
|
+
# * *:destination_zip_code* (String)
|
23
|
+
# * *:mailing_date* (String)
|
24
|
+
def track_v2(options = {})
|
31
25
|
throw ArgumentError.new('Required arguments :track_field_request missing') if options[:track_field_request].nil?
|
32
26
|
throw ArgumentError.new('Required arguments :track_field_request, :revision missing') if options[:track_field_request][:revision].nil?
|
33
27
|
throw ArgumentError.new('Required arguments :track_field_request, :source_id missing') if options[:track_field_request][:source_id].nil?
|