usps-ruby-client 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +113 -0
- data/README.md +11 -6
- 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 +2 -1
- data/usps-ruby-client-0.1.0.gem +0 -0
- data/usps-ruby-client-0.1.2.gem +0 -0
- data/usps-ruby-client.gemspec +2 -1
- metadata +25 -8
@@ -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?
|
@@ -6,9 +6,6 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module USPSReturnsLabel
|
9
|
-
#
|
10
|
-
# USPS Returns Label API
|
11
|
-
#
|
12
9
|
# The Web Tools USPS Returns Label API enables
|
13
10
|
# customers to receive USPS Returns service labels which are processed using the
|
14
11
|
# new automated returns process via Package Platform. USPS Returns service account holders will pay
|
@@ -18,73 +15,39 @@ module Usps
|
|
18
15
|
# to request USPS Returns service labels for
|
19
16
|
# items that can be mailed using First-Class Package Return Service, Priority Mail Return Service, and Ground Return Service. For
|
20
17
|
# additional USPS Returns service details, reference: https://www.federalregister.gov/documents/2020/02/25/2020-03170/usps-returns-service.
|
21
|
-
#
|
22
|
-
# @option
|
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
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
|
54
|
-
# @option option [Boolean] :AllowNonCleansedOriginAddr (Optional)
|
55
|
-
# - Allows Non-Validated Origin Street Address. Enter “true” to bypass street address validation failures/errors or “false” if only validated addresses should be allowed. Note: Integrators are recommended to always use “false” to ensure no delivery issues. In the event USPS cannot validate the street address, this tag will “bypass” address validation error when “true” is indicated to allow label creation which could impact delivery. The <AllowNonCleansedOriginAddr> excludes City, State, and ZIP Code which must be valid for a successful response. Reference https://pe.usps.com/text/pub28/28c2_001.htm.
|
56
|
-
# @option option [Integer] :WeightInOunces (Optional)
|
57
|
-
# - Package weight used to calculate postage. Items must weigh 70 pounds (1120 ounces) or less. For example: <WeightInOunces>80</ WeightInOunces> Note: If weight not supplied, 4oz used.
|
58
|
-
# @option option [String] :ServiceType (Required)
|
59
|
-
# - Enter one of the valid Mail Service entries: “PRIORITY” for Priority Mail Return Service. “FIRST CLASS” for First-Class Package Return Service. “GROUND” for Ground Return Service.
|
60
|
-
# @option option [Decimal] :Width (Optional)
|
61
|
-
# - Value must be numeric. Units are inches. For example: <Width>5.5</ Width> 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 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
|
62
|
-
# @option option [Decimal] :Length (Optional)
|
63
|
-
# - Value must be numeric. Units are inches. Length should be longest dimension when compared to Width and Height values supplied. For example: <Length>11</Length> 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 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
|
64
|
-
# @option option [Decimal] :Height (Optional)
|
65
|
-
# - Value must be numeric. Units are inches. For example: <Height>7</Height> 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 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
|
66
|
-
# @option option [Decimal] :Girth (Optional)
|
67
|
-
# - Note: Girth is required only for a non-rectangular package. For rectangular packages, girth must be left blank. Value must be numeric. Units are inches. Girth is distance around the thickest part of package (perpendicular to the length). For 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. For example: <Girth>25</Girth> Note: If partial dimensions are provided, an error response will return. (i.e. Length, Width, and Height must all be supplied with Girth).
|
68
|
-
# @option option [Boolean] :Machinable (Optional)
|
69
|
-
# - Indicates if packaging is Machinable. Used to calculate postage. For example: <Machinable>true</Machinable>
|
70
|
-
# @option option [String] :ShipDate (Optional)
|
71
|
-
# - Date Package Will Be Mailed. Ship date may be today plus 0 to 3 days in advance. Enter the date in either format: dd-mmm-yyyy, such as 14-Feb-2020, or mm/dd/ yyyy, such as 02/14/2020. If not provided, current day will be used as a basis for delivery date calculations. For example: <ShipDate>02/14/2011</ShipDate>
|
72
|
-
# @option option [String] :SenderName (Optional)
|
73
|
-
# - Used for the USPS Tracking email. Indicates the name of the person or company sending the USPS tracking email notification. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
74
|
-
# @option option [String] :SenderEMail (Optional)
|
75
|
-
# - Used for the USPS Tracking email. Indicates the email address of sender used for USPS tracking email notification. Valid email addresses must be used. Note: <RecipientEMail> must be populated to generate USPS tracking email notification. If <SenderEMail> provided without <RecipientEMail>, USPS tracking email notification will not be generated. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
76
|
-
# @option option [String] :RecipientName (Optional)
|
77
|
-
# - Used for the USPS Tracking email. Indicates the name of the person or company receiving the USPS tracking email notification. If recipient name not provided, email will be addressed to <RecipientEMail> value provided. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
78
|
-
# @option option [String] :RecipientEMail (Optional)
|
79
|
-
# - Required to generate the USPS Tracking email. Indicates email address of recipient receiving the USPS tracking email notification. Valid email addresses must be used. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
80
|
-
# @option option [(Group)] :ExtraServices (Optional)
|
81
|
-
# - Groups extra services elements
|
82
|
-
# @option option [Service Name] :ExtraService (Optional)
|
83
|
-
# - [{"Service Name"=>"Signature Confirmation Electronic", "Service ID"=>"156"}]
|
84
|
-
|
85
|
-
#
|
86
|
-
# @see
|
87
|
-
def usps_returns_label(options = {})
|
18
|
+
# @param [Hash] options
|
19
|
+
# @option options [required, Hash] usps_returns_label_request Used with API=USPSReturnsLabel
|
20
|
+
# * *:option* (String) — For future use.
|
21
|
+
# * *:revision* (String) — For future use. Used to indicate API version.
|
22
|
+
# * *:image_parameters* (required, Hash) — Group containing all request parameters pertaining to the Label Image generation.
|
23
|
+
# * *:image_type* (required, String) — Label Image Type. For example: <ImageType>PDF</ImageType>
|
24
|
+
# * *:separate_receipt_page* (Boolean) — Flag to request a Separate Receipt Image. Enter “true” if you want receipt returned on a separate page – this will return label in <LabelImage> tag and receipt in <ReceiptImage> tag. For example: <SeparateReceiptPage>true</SeparateReceiptPage> Note: If not specified, receipt will return on same page as returns label. Response will contain a single <LabelImage> tag containing label and receipt on the same page.
|
25
|
+
# * *:customer_first_name* (String) — First Name of customer returning package. Printed on label and receipt. Either <CustomerFirstName> and <CustomerLastName> OR <CustomerFirm> required. Minimum of 1 character required. Note: <CustomerFirstName> and <CustomerLastName> values have a combined 32-character limit when printed on label. Combined values exceeding 32 characters will be truncated due to space limitations on the label. API request eligible to accept up to 50 characters.
|
26
|
+
# * *:customer_last_name* (String) — Last Name of customer returning package. Printed on label and receipt. Either <CustomerFirstName> and <CustomerLastName> OR <CustomerFirm> required. Minimum of 1 character required. Note: <CustomerFirstName> and <CustomerLastName> values have a combined 32-character limit when printed on label. Combined values exceeding 32 characters will be truncated due to space limitations on the label. API request eligible to accept up to 50 characters.
|
27
|
+
# * *:customer_firm* (String) — Firm Name of customer returning package. Printed on label and receipt. Either <CustomerFirstName> and <CustomerLastName> OR <CustomerFirm> required. Minimum of 1 character required. Note: <CustomerFirm> has a 32-character limit when printed on label. Values exceeding 32 characters will be truncated due to space limitations on the label. API request eligible to accept up to 50 characters.
|
28
|
+
# * *:customer_address1* (String) — Secondary address unit designator and number (such as an apartment or suite number). For example: “APT 202” or “STE 100” etc. Note: This tag must be included in the request, even if the value is null, to return a successful response. For addresses that do not require secondary information, integrators should include “<CustomerAddress1/>” in the request.
|
29
|
+
# * *:customer_address2* (required, String) — Address of customer returning the package. (Primary Street address). For example: <CustomerAddress2>123 Main St.</CustomerAddress2>
|
30
|
+
# * *:customer_city* (required, String) — City of customer returning the package.
|
31
|
+
# * *:customer_state* (required, String) — State of customer returning the package. Value should be passed as two-letter state abbreviation. For example: <CustomerState>DC</CustomerState>
|
32
|
+
# * *:customer_zip5* (required, String) — ZIP Code of customer returning the package.
|
33
|
+
# * *:customer_zip4* (String) — ZIP+4 Code of customer returning the package.
|
34
|
+
# * *:po_zip_code* (String) — ZIP Code of Post Office or collection box where item is mailed. May be different than CustomerZip5. This tag will take precedence over CustomerZip5 when provided. For example: <POZipCode>20770</ POZipCode>
|
35
|
+
# * *:allow_non_cleansed_origin_addr* (Boolean) — Allows Non-Validated Origin Street Address. Enter “true” to bypass street address validation failures/errors or “false” if only validated addresses should be allowed. Note: Integrators are recommended to always use “false” to ensure no delivery issues. In the event USPS cannot validate the street address, this tag will “bypass” address validation error when “true” is indicated to allow label creation which could impact delivery. The <AllowNonCleansedOriginAddr> excludes City, State, and ZIP Code which must be valid for a successful response. Reference https://pe.usps.com/text/pub28/28c2_001.htm.
|
36
|
+
# * *:weight_in_ounces* (Integer) — Package weight used to calculate postage. Items must weigh 70 pounds (1120 ounces) or less. For example: <WeightInOunces>80</ WeightInOunces> Note: If weight not supplied, 4oz used.
|
37
|
+
# * *:service_type* (required, String) — Enter one of the valid Mail Service entries: “PRIORITY” for Priority Mail Return Service. “FIRST CLASS” for First-Class Package Return Service. “GROUND” for Ground Return Service.
|
38
|
+
# * *:width* (Decimal) — Value must be numeric. Units are inches. For example: <Width>5.5</ Width> 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 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
|
39
|
+
# * *:length* (Decimal) — Value must be numeric. Units are inches. Length should be longest dimension when compared to Width and Height values supplied. For example: <Length>11</Length> 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 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
|
40
|
+
# * *:height* (Decimal) — Value must be numeric. Units are inches. For example: <Height>7</Height> 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 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
|
41
|
+
# * *:girth* (Decimal) — Note: Girth is required only for a non-rectangular package. For rectangular packages, girth must be left blank. Value must be numeric. Units are inches. Girth is distance around the thickest part of package (perpendicular to the length). For 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. For example: <Girth>25</Girth> Note: If partial dimensions are provided, an error response will return. (i.e. Length, Width, and Height must all be supplied with Girth).
|
42
|
+
# * *:machinable* (Boolean) — Indicates if packaging is Machinable. Used to calculate postage. For example: <Machinable>true</Machinable>
|
43
|
+
# * *:ship_date* (String) — Date Package Will Be Mailed. Ship date may be today plus 0 to 3 days in advance. Enter the date in either format: dd-mmm-yyyy, such as 14-Feb-2020, or mm/dd/ yyyy, such as 02/14/2020. If not provided, current day will be used as a basis for delivery date calculations. For example: <ShipDate>02/14/2011</ShipDate>
|
44
|
+
# * *:sender_name* (String) — Used for the USPS Tracking email. Indicates the name of the person or company sending the USPS tracking email notification. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
45
|
+
# * *:sender_e_mail* (String) — Used for the USPS Tracking email. Indicates the email address of sender used for USPS tracking email notification. Valid email addresses must be used. Note: <RecipientEMail> must be populated to generate USPS tracking email notification. If <SenderEMail> provided without <RecipientEMail>, USPS tracking email notification will not be generated. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
46
|
+
# * *:recipient_name* (String) — Used for the USPS Tracking email. Indicates the name of the person or company receiving the USPS tracking email notification. If recipient name not provided, email will be addressed to <RecipientEMail> value provided. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
47
|
+
# * *:recipient_e_mail* (String) — Required to generate the USPS Tracking email. Indicates email address of recipient receiving the USPS tracking email notification. Valid email addresses must be used. Note: No email is returned when generating a Sample (i.e. API=USPSReturnsLabelCertify) request.
|
48
|
+
# * *:extra_services* (Hash) — Groups extra services elements
|
49
|
+
# * *:extra_service* (Service Name) — [{"Service Name"=>"Signature Confirmation Electronic", "Service ID"=>"156"}]
|
50
|
+
def usps_returns_label(options = {})
|
88
51
|
throw ArgumentError.new('Required arguments :usps_returns_label_request missing') if options[:usps_returns_label_request].nil?
|
89
52
|
throw ArgumentError.new('Required arguments :usps_returns_label_request, :image_parameters missing') if options[:usps_returns_label_request][:image_parameters].nil?
|
90
53
|
throw ArgumentError.new('Required arguments :usps_returns_label_request, :image_parameters, :image_type missing') if options[:usps_returns_label_request][:image_parameters][:image_type].nil?
|
@@ -6,36 +6,19 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module Verify
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
22
|
-
# - Delivery Address in the destination address. May contain secondary unit designator, such as APT or SUITE, for Accountable mail.)
|
23
|
-
# @option option [String] :Address2 (Required)
|
24
|
-
# - Delivery Address in the destination address. Required for all mail and packages, however 11-digit Destination Delivery Point ZIP+4 Code can be provided as an alternative in the Detail 1 Record.
|
25
|
-
# @option option [String] :City (Optional)
|
26
|
-
# - City name of the destination address.
|
27
|
-
# @option option [String] :State (Optional)
|
28
|
-
# - Two-character state code of the destination address.
|
29
|
-
# @option option [String] :Urbanization (Optional)
|
30
|
-
# - Urbanization. For Puerto Rico addresses only.
|
31
|
-
# @option option [String] :Zip5 (Optional)
|
32
|
-
# - Destination 5-digit ZIP Code. Numeric values (0-9) only. If International, all zeroes.
|
33
|
-
# @option option [String] :Zip4 (Optional)
|
34
|
-
# - Destination ZIP+4 Numeric values (0-9) only. If International, all zeroes. Default to spaces if not available.
|
35
|
-
|
36
|
-
#
|
37
|
-
# @see
|
38
|
-
def verify(options = {})
|
9
|
+
# @param [Hash] options
|
10
|
+
# @option options [required, Hash] address_validate_request API = AddressValidateRequest
|
11
|
+
# * *:revision* (required, String) — Integer value used to return of all available response fields. Set this value to 1 to return all currently documented response fields. Example: Revision>1</Revision>
|
12
|
+
# * *:address* (required, Hash) — Up to 5 address verifications can be included per transaction.
|
13
|
+
# * *:firm_name* (String) — Firm Name Example:<FirmName>XYZ Corp.</FirmName>
|
14
|
+
# * *:address1* (String) — Delivery Address in the destination address. May contain secondary unit designator, such as APT or SUITE, for Accountable mail.)
|
15
|
+
# * *:address2* (required, String) — Delivery Address in the destination address. Required for all mail and packages, however 11-digit Destination Delivery Point ZIP+4 Code can be provided as an alternative in the Detail 1 Record.
|
16
|
+
# * *:city* (String) — City name of the destination address.
|
17
|
+
# * *:state* (String) — Two-character state code of the destination address.
|
18
|
+
# * *:urbanization* (String) — Urbanization. For Puerto Rico addresses only.
|
19
|
+
# * *:zip5* (String) — Destination 5-digit ZIP Code. Numeric values (0-9) only. If International, all zeroes.
|
20
|
+
# * *:zip4* (String) — Destination ZIP+4 Numeric values (0-9) only. If International, all zeroes. Default to spaces if not available.
|
21
|
+
def verify(options = {})
|
39
22
|
throw ArgumentError.new('Required arguments :address_validate_request missing') if options[:address_validate_request].nil?
|
40
23
|
throw ArgumentError.new('Required arguments :address_validate_request, :revision missing') if options[:address_validate_request][:revision].nil?
|
41
24
|
throw ArgumentError.new('Required arguments :address_validate_request, :address missing') if options[:address_validate_request][:address].nil?
|
@@ -6,35 +6,21 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module ZipCodeLookup
|
9
|
-
#
|
10
|
-
# ZIP Code Lookup API
|
11
|
-
#
|
12
9
|
# The ZipCodeLookup API, which returns the ZIP Code and ZIP
|
13
10
|
# Code + 4 corresponding to the given address, city, and state (use USPS state
|
14
11
|
# abbreviations). The ZipCodeLookup API processes up to
|
15
12
|
# five lookups per request.
|
16
|
-
#
|
17
|
-
# @option
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
|
27
|
-
# - City name of the destination address. Field is required, unless a verified 11-digit DPV is provided for the mail piece.
|
28
|
-
# @option option [String] :State (Optional)
|
29
|
-
# - Two-character state code of the destination address.
|
30
|
-
# @option option [String] :Zip5 (Optional)
|
31
|
-
# - Destination 5-digit ZIP Code. Must be 5-digits. Numeric values (0-9) only. If International, all zeroes.
|
32
|
-
# @option option [String] :Zip4 (Optional)
|
33
|
-
# - Destination ZIP+4. Numeric values (0-9) only. If International, all zeroes. Default to spaces if not available.
|
34
|
-
|
35
|
-
#
|
36
|
-
# @see
|
37
|
-
def zip_code_lookup(options = {})
|
13
|
+
# @param [Hash] options
|
14
|
+
# @option options [required, Hash] zip_code_lookup_request API = ZipCodeLookupRequest
|
15
|
+
# * *:address* (Hash) —
|
16
|
+
# * *:firm_name* (String) — Up to 5 address verifications can be included per transaction.
|
17
|
+
# * *:address1* (String) — Delivery Address in the destination address. May contain secondary unit designator, such as APT or SUITE, for Accountable mail.)
|
18
|
+
# * *:address2* (required, String) — Delivery Address in the destination address. Required for all mail and packages, however 11-digit Destination Delivery Point ZIP+4 Code can be provided as an alternative in the Detail 1 Record.
|
19
|
+
# * *:city* (String) — City name of the destination address. Field is required, unless a verified 11-digit DPV is provided for the mail piece.
|
20
|
+
# * *:state* (String) — Two-character state code of the destination address.
|
21
|
+
# * *:zip5* (String) — Destination 5-digit ZIP Code. Must be 5-digits. Numeric values (0-9) only. If International, all zeroes.
|
22
|
+
# * *:zip4* (String) — Destination ZIP+4. Numeric values (0-9) only. If International, all zeroes. Default to spaces if not available.
|
23
|
+
def zip_code_lookup(options = {})
|
38
24
|
throw ArgumentError.new('Required arguments :zip_code_lookup_request missing') if options[:zip_code_lookup_request].nil?
|
39
25
|
|
40
26
|
request = build_request(:zip_code_lookup, options)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
<%= ErubisHelper.tabs(static_indentation) %>#<%= ErubisHelper.spaces(indentation*2)
|
2
|
-
<% if option[:description].present? %>
|
3
|
-
<%= ErubisHelper.tabs(static_indentation) %>#<%= ErubisHelper.spaces(indentation*2) %>- <%= option[:description] %>
|
4
|
-
<% end %>
|
1
|
+
<%= ErubisHelper.tabs(static_indentation) %>#<%= ErubisHelper.spaces(indentation*2) %> * *:<%= option[:name].underscore %>* (<%= option[:required] ? 'required, ' : '' %><%= ['(alias)', '(group)'].any?(option[:type].downcase) ? 'Hash' : option[:type] %>)<% if option[:description] %> — <%= option[:description] %><% end %>
|
5
2
|
<% option[:children].each do |child_option_name, child_option| %>
|
6
3
|
<%= Erubis::Eruby.new(File.read('lib/usps/api/templates/_options.erb')).result(option: child_option, parents: [], indentation: indentation + 1, static_indentation: static_indentation) %><% end %>
|
@@ -6,18 +6,14 @@ module Usps
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module <%= data[:group].camelize %>
|
9
|
-
#
|
10
|
-
# <%= data[:title] %>
|
11
|
-
#
|
12
9
|
<% data[:description].to_s.split("\r").each do |line| %>
|
13
10
|
# <%= line.strip %>
|
14
11
|
<% end %>
|
15
|
-
#
|
12
|
+
# @param [Hash] options
|
13
|
+
# @option options [required, Hash] <%= data[:request_descriptions].first[1][:name].underscore %> <%= data[:request_descriptions].first[1][:description] %>
|
16
14
|
<% data[:request_descriptions].each do |option_name, option| %>
|
17
|
-
|
18
|
-
|
19
|
-
# @see <%= data[:link] %>
|
20
|
-
def <%= data[:group].underscore %>(options = {})
|
15
|
+
<% option[:children].each do |child_option_name, child_option| %>
|
16
|
+
<%= Erubis::Eruby.new(File.read('lib/usps/api/templates/_options.erb')).result(option: child_option, parents: [], indentation: 0, static_indentation: 3) %><% end %><% end %>def <%= data[:group].underscore %>(options = {})
|
21
17
|
<% data[:request_descriptions].select{|n,o| o[:required]}.each do |option_name, option| %>
|
22
18
|
<%= Erubis::Eruby.new(File.read('lib/usps/api/templates/_throw_argument_error.erb')).result(option: option, parents: [], indentation: 3) %>
|
23
19
|
<% end %>
|
data/lib/usps/version.rb
CHANGED
Binary file
|
Binary file
|
data/usps-ruby-client.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_dependency 'activesupport', '~>
|
32
|
+
spec.add_dependency 'activesupport', '~> 7.0'
|
33
33
|
spec.add_dependency 'builder', '~> 3.2'
|
34
34
|
spec.add_dependency 'faraday', '~> 0.17'
|
35
35
|
spec.add_dependency 'faraday_middleware', '~> 0.14'
|
@@ -43,4 +43,5 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency 'rubocop-performance', '~> 1.9'
|
44
44
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
|
45
45
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
46
|
+
spec.add_development_dependency 'yard', '~> 0.9'
|
46
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Paris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,6 +206,20 @@ dependencies:
|
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0.21'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: yard
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0.9'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0.9'
|
209
223
|
description: An automatically generated USPS API Client based on the official USPS
|
210
224
|
User Guides
|
211
225
|
email:
|
@@ -222,6 +236,7 @@ files:
|
|
222
236
|
- ".travis.yml"
|
223
237
|
- CODE_OF_CONDUCT.md
|
224
238
|
- Gemfile
|
239
|
+
- Gemfile.lock
|
225
240
|
- LICENSE.txt
|
226
241
|
- README.md
|
227
242
|
- Rakefile
|
@@ -278,6 +293,8 @@ files:
|
|
278
293
|
- lib/usps/faraday/response/raise_error.rb
|
279
294
|
- lib/usps/logger.rb
|
280
295
|
- lib/usps/version.rb
|
296
|
+
- usps-ruby-client-0.1.0.gem
|
297
|
+
- usps-ruby-client-0.1.2.gem
|
281
298
|
- usps-ruby-client.gemspec
|
282
299
|
homepage: https://www.usps.com/business/web-tools-apis/documentation-updates.htm
|
283
300
|
licenses:
|
@@ -285,7 +302,7 @@ licenses:
|
|
285
302
|
metadata:
|
286
303
|
homepage_uri: https://www.usps.com/business/web-tools-apis/documentation-updates.htm
|
287
304
|
source_code_uri: https://github.com/joeyparis/usps-ruby-client
|
288
|
-
post_install_message:
|
305
|
+
post_install_message:
|
289
306
|
rdoc_options: []
|
290
307
|
require_paths:
|
291
308
|
- lib
|
@@ -300,8 +317,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
317
|
- !ruby/object:Gem::Version
|
301
318
|
version: '0'
|
302
319
|
requirements: []
|
303
|
-
rubygems_version: 3.
|
304
|
-
signing_key:
|
320
|
+
rubygems_version: 3.2.32
|
321
|
+
signing_key:
|
305
322
|
specification_version: 4
|
306
323
|
summary: An automatically generated USPS API Client
|
307
324
|
test_files: []
|