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 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
|
data/usps-ruby-client.gemspec
CHANGED
@@ -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,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Paris
|
@@ -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:
|
@@ -278,6 +292,7 @@ files:
|
|
278
292
|
- lib/usps/faraday/response/raise_error.rb
|
279
293
|
- lib/usps/logger.rb
|
280
294
|
- lib/usps/version.rb
|
295
|
+
- usps-ruby-client-0.1.0.gem
|
281
296
|
- usps-ruby-client.gemspec
|
282
297
|
homepage: https://www.usps.com/business/web-tools-apis/documentation-updates.htm
|
283
298
|
licenses:
|