usps-ruby-client 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +1 -1
- data/lib/data/api/{address-information-api.htm → address-information-api.html} +0 -0
- data/lib/data/api/{domestic-mail-service-standards-api.htm → domestic-mail-service-standards-api.html} +2482 -2195
- data/lib/data/api/{evs-international-label-api.htm → evs-international-label-api.html} +4546 -2118
- data/lib/data/api/{evs-label-api.htm → evs-label-api.html} +9223 -4626
- data/lib/data/api/expressmail-api-retirement-transition-guide.html +3167 -0
- data/lib/data/api/general-api-developer-guide.html +4668 -0
- data/lib/data/api/{hold-for-pickup-facilities-lookup-api.htm → hold-for-pickup-facilities-lookup-api.html} +0 -0
- data/lib/data/api/{package-pickup-api.htm → package-pickup-api.html} +0 -0
- data/lib/data/api/{rate-calculator-api.htm → rate-calculator-api.html} +5765 -2680
- data/lib/data/api/{scan-api.htm → scan-api.html} +0 -0
- data/lib/data/api/service-delivery-calculator-get-locations-api.html +10522 -0
- data/lib/data/api/sunday-holiday-api.html +5905 -0
- data/lib/data/api/{track-and-confirm-api.htm → track-and-confirm-api.html} +840 -342
- data/lib/data/api/{uspsreturnslabel-api.htm → uspsreturnslabel-api.html} +3686 -4084
- data/lib/tasks/api.rake +4 -3
- data/lib/usps/api/endpoints/carrier_pickup_schedule.rb +1 -1
- data/lib/usps/api/endpoints/city_state_lookup.rb +1 -1
- data/lib/usps/api/endpoints/e_vs_express_mail_intl.rb +12 -5
- data/lib/usps/api/endpoints/e_vs_first_class_mail_intl.rb +12 -10
- data/lib/usps/api/endpoints/e_vs_priority_mail_intl.rb +9 -7
- data/lib/usps/api/endpoints/e_vsgxg_get_label.rb +6 -6
- data/lib/usps/api/endpoints/e_vsi_cancel.rb +8 -7
- data/lib/usps/api/endpoints/hfp_facility_info.rb +1 -1
- data/lib/usps/api/endpoints/intl_rate_v2.rb +13 -11
- data/lib/usps/api/endpoints/pts_email.rb +1 -1
- data/lib/usps/api/endpoints/pts_pod.rb +1 -1
- data/lib/usps/api/endpoints/pts_rre.rb +1 -1
- data/lib/usps/api/endpoints/ptst_pod.rb +1 -1
- data/lib/usps/api/endpoints/rate_v4.rb +13 -9
- data/lib/usps/api/endpoints/scan.rb +1 -1
- data/lib/usps/api/endpoints/sunday_holiday_availability.rb +46 -0
- data/lib/usps/api/endpoints/track_v2.rb +1 -1
- data/lib/usps/api/endpoints/usps_returns_label.rb +55 -15
- data/lib/usps/api/endpoints/verify.rb +1 -1
- data/lib/usps/api/endpoints/zip_code_lookup.rb +1 -1
- data/lib/usps/api/endpoints.rb +3 -0
- data/lib/usps/api/templates/method.erb +1 -1
- data/lib/usps/version.rb +1 -1
- data/usps-ruby-client.gemspec +2 -2
- metadata +16 -14
- data/lib/data/api/service-delivery-calculator-get-locations-api.htm +0 -12548
- data/usps-ruby-client-0.1.0.gem +0 -0
- data/usps-ruby-client-0.1.2.gem +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was auto-generated by lib/tasks/api.rake
|
4
|
+
|
5
|
+
module Usps
|
6
|
+
module Api
|
7
|
+
module Endpoints
|
8
|
+
module SundayHolidayAvailability
|
9
|
+
# The Sunday Holiday API allows customers to request information
|
10
|
+
# on package availability for Sunday’s and/or Holidays for a given zip code pairing.
|
11
|
+
# For information on USPS Holidays, please visit https://about.usps.com/newsroom/events/.
|
12
|
+
# @param [Hash] options
|
13
|
+
# @option options [required, Hash] sunday_holiday_request API = SundayHolidayRequest
|
14
|
+
# * *:sunday_holiday* (required, String) — Select Sunday or Holiday
|
15
|
+
# * *:from_zip_code* (required, String) — 5 digit ship from Zip
|
16
|
+
# * *:to_zip_code* (required, String) — 5 digiit ship to zip
|
17
|
+
def sunday_holiday_availability(options = {})
|
18
|
+
throw ArgumentError.new('Required arguments :sunday_holiday_request missing') if options[:sunday_holiday_request].nil?
|
19
|
+
throw ArgumentError.new('Required arguments :sunday_holiday_request, :sunday_holiday missing') if options[:sunday_holiday_request][:sunday_holiday].nil?
|
20
|
+
throw ArgumentError.new('Required arguments :sunday_holiday_request, :from_zip_code missing') if options[:sunday_holiday_request][:from_zip_code].nil?
|
21
|
+
throw ArgumentError.new('Required arguments :sunday_holiday_request, :to_zip_code missing') if options[:sunday_holiday_request][:to_zip_code].nil?
|
22
|
+
|
23
|
+
request = build_request(:sunday_holiday_availability, options)
|
24
|
+
get('https://secure.shippingapis.com/shippingapi.dll', {
|
25
|
+
API: 'SundayHolidayAvailability',
|
26
|
+
XML: request,
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def tag_unless_blank(xml, tag_name, data)
|
33
|
+
xml.tag!(tag_name, data) unless data.blank? || data.nil?
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_sunday_holiday_availability_request(xml, options = {})
|
37
|
+
xml.tag!('SundayHoliday', options[:sunday_holiday_request][:sunday_holiday])
|
38
|
+
xml.tag!('FromZipCode', options[:sunday_holiday_request][:from_zip_code])
|
39
|
+
xml.tag!('ToZipCode', options[:sunday_holiday_request][:to_zip_code])
|
40
|
+
xml.target!
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -21,7 +21,7 @@ module Usps
|
|
21
21
|
# * *:track_id* (required, String)
|
22
22
|
# * *:destination_zip_code* (String)
|
23
23
|
# * *:mailing_date* (String)
|
24
|
-
def track_v2(options = {})
|
24
|
+
def track_v2(options = {})
|
25
25
|
throw ArgumentError.new('Required arguments :track_field_request missing') if options[:track_field_request].nil?
|
26
26
|
throw ArgumentError.new('Required arguments :track_field_request, :revision missing') if options[:track_field_request][:revision].nil?
|
27
27
|
throw ArgumentError.new('Required arguments :track_field_request, :source_id missing') if options[:track_field_request][:source_id].nil?
|
@@ -20,34 +20,54 @@ module Usps
|
|
20
20
|
# * *:option* (String) — For future use.
|
21
21
|
# * *:revision* (String) — For future use. Used to indicate API version.
|
22
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
|
-
# * *:
|
23
|
+
# * *:image_type* (required, String) — Label Image Type. See Appendix A for Image parameter options. For example: <ImageType>PDF</ImageType>
|
24
|
+
# * *:image_parameter* (String) — Returns alternate label image. See Appendix A for Image parameter options. For example: <ImageParameter>4X6LABEL</ImageParameter>
|
25
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
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
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
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
29
|
# * *:customer_address2* (required, String) — Address of customer returning the package. (Primary Street address). For example: <CustomerAddress2>123 Main St.</CustomerAddress2>
|
30
|
+
# * *:customer_urbanization* (String) — Urbanization of customer returning the package.
|
30
31
|
# * *:customer_city* (required, String) — City of customer returning the package.
|
31
32
|
# * *: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
33
|
# * *:customer_zip5* (required, String) — ZIP Code of customer returning the package.
|
33
34
|
# * *:customer_zip4* (String) — ZIP+4 Code of customer returning the package.
|
34
35
|
# * *: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
36
|
# * *: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.
|
37
|
+
# * *:retailer_attn* (String) — Attention line for Retailer Address. If supplied, this optional value will override the value stored in the Retailers WebTools Profile. Note: <RetailerATTN> 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.
|
38
|
+
# * *:retailer_firm* (String) — Firm Name of Retailer Address for return package. Printed on label and receipt. <RetailerFirm> is required for Efulfillment customers using <ReturnsPostageType> = 5. 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.
|
39
|
+
# * *:retailer_address1* (String) — Secondary address unit designator and number (such as an apartment or suite number). For example: “APT 202” or “STE 100” etc. Note: <RetailerAddress1> may be specified by Efulfillment customers using <ReturnsPostageType> = 5. The value supplied will override the value stored in the Retailers WebTools Profile. Efulfillment customers supplying an empty tag or not supplying this tag will also override the value stored in the Retailers WebTools Profile resulting in no RetailerAddress1 line being displayed.
|
40
|
+
# * *:retailer_address2* (String) — Address of Retailer where the package will be returned. (Primary Street address). For example: <RetailerAddress2>123 Main St.</ RetailerAddress2> Note: <RetailerAddress2> is required for Efulfillment customers using <ReturnsPostageType> = 5. Minimum of 1 character required.
|
41
|
+
# * *:retailer_city* (String) — City of Retailer where the package will be returned. Note: <RetailerCity> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
42
|
+
# * *:retailer_state* (String) — State of Retailer where the package will be returned. Value should be passed as two-letter state abbreviation. For example: <RetailerState >DC</ RetailerState > Note: <RetailerState> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
43
|
+
# * *:retailer_zip5* (String) — ZIP Code of Retailer where the package will be returned. Note: <RetailerZip5> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
44
|
+
# * *:retailer_zip4* (String) — ZIP+4 Code of Retailer where the package will be returned. Note: <RetailerZip4> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
45
|
+
# * *:retailer_email* (String) — Email for Retailer of the return package. Note: Either <RetailerEmail> OR <RetailerPhone> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
46
|
+
# * *:retailer_phone* (String) — Phone number for Retailer of the return package. Note: Either <RetailerEmail> OR <RetailerPhone> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
36
47
|
# * *: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
48
|
# * *: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
|
-
# * *:
|
39
|
-
# * *:
|
40
|
-
# * *:
|
49
|
+
# * *:returns_postage_type* (String) — The Postage Type for the Returns Label. Note: Required for USPSReturns callers registered as Efulfillment users. Non-Efulfillment users may omit this tag or supply it with an empty value.
|
50
|
+
# * *:width* (Decimal) — Value must be numeric. Units are inches. For example: <Width>5.5</ Width> Note: 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
|
51
|
+
# * *: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> Note: 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
|
52
|
+
# * *:height* (Decimal) — Value must be numeric. Units are inches. For example: <Height>7</Height> Note: 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
53
|
# * *: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
54
|
# * *:machinable* (Boolean) — Indicates if packaging is Machinable. Used to calculate postage. For example: <Machinable>true</Machinable>
|
43
|
-
# * *:
|
55
|
+
# * *:vendor_code* (String) —
|
56
|
+
# * *:vendor_product_version_number* (String) —
|
57
|
+
# * *:mail_owner_mid* (String) —
|
58
|
+
# * *:customer_ref_no* (String) — Used to collect RMA number.
|
59
|
+
# * *:print_customer_ref_no* (Boolean) — Indicated if the <CustomerRefNo> data should be displayed on the label. For example: <Machinable>true</Machinable>
|
60
|
+
# * *:customer_ref_no2* (String) — Used to collect merchant ID. Note: <CustomerRefNo2> is required for Efulfillment customers using <ReturnsPostageType> = 5.
|
61
|
+
# * *:print_customer_ref_no2* (Boolean) — Indicated if the <CustomerRefNo2> data should be displayed on the label. For example: <Machinable>true</Machinable>
|
44
62
|
# * *: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
|
-
# * *:
|
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 <
|
47
|
-
# * *:
|
63
|
+
# * *:sender_email* (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.
|
64
|
+
# * *: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.
|
65
|
+
# * *:recipient_email* (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.
|
66
|
+
# * *:tracking_email_pdf* (Boolean) — Used to indicate if a PDF returns label will be attached (true) or not (false) to the USPS Tracking email.
|
48
67
|
# * *:extra_services* (Hash) — Groups extra services elements
|
49
|
-
# * *:extra_service* (Service Name) — [{"Service Name"=>"Signature Confirmation Electronic", "Service ID"=>"156"}]
|
50
|
-
|
68
|
+
# * *:extra_service* (Service Name) — [{"Service Name"=>"Insurance (Non-Priority)", "Service ID"=>"100"}, {"Service Name"=>"Insurance (Priority)", "Service ID"=>"125"}, {"Service Name"=>"Signature Confirmation Electronic", "Service ID"=>"156"}]
|
69
|
+
# * *:insured_amount* (Decimal) — Use this tag for entering an insurance amount, if applicable. For example: <InsuredAmount>100.00</InsuredAmount> Note: The maximum insurance available may vary by the Returns Mail Service type requested.
|
70
|
+
def usps_returns_label(options = {})
|
51
71
|
throw ArgumentError.new('Required arguments :usps_returns_label_request missing') if options[:usps_returns_label_request].nil?
|
52
72
|
throw ArgumentError.new('Required arguments :usps_returns_label_request, :image_parameters missing') if options[:usps_returns_label_request][:image_parameters].nil?
|
53
73
|
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?
|
@@ -75,32 +95,52 @@ def usps_returns_label(options = {})
|
|
75
95
|
tag_unless_blank(xml, 'Revision', options[:usps_returns_label_request][:revision])
|
76
96
|
xml.tag!('ImageParameters') do
|
77
97
|
xml.tag!('ImageType', options[:usps_returns_label_request][:image_parameters][:image_type])
|
78
|
-
tag_unless_blank(xml, '
|
98
|
+
tag_unless_blank(xml, 'ImageParameter', options[:usps_returns_label_request][:image_parameters][:image_parameter])
|
79
99
|
tag_unless_blank(xml, 'CustomerFirstName', options[:usps_returns_label_request][:image_parameters][:customer_first_name])
|
80
100
|
tag_unless_blank(xml, 'CustomerLastName', options[:usps_returns_label_request][:image_parameters][:customer_last_name])
|
81
101
|
tag_unless_blank(xml, 'CustomerFirm', options[:usps_returns_label_request][:image_parameters][:customer_firm])
|
82
102
|
tag_unless_blank(xml, 'CustomerAddress1', options[:usps_returns_label_request][:image_parameters][:customer_address1])
|
83
103
|
xml.tag!('CustomerAddress2', options[:usps_returns_label_request][:image_parameters][:customer_address2])
|
104
|
+
tag_unless_blank(xml, 'CustomerUrbanization', options[:usps_returns_label_request][:image_parameters][:customer_urbanization])
|
84
105
|
xml.tag!('CustomerCity', options[:usps_returns_label_request][:image_parameters][:customer_city])
|
85
106
|
xml.tag!('CustomerState', options[:usps_returns_label_request][:image_parameters][:customer_state])
|
86
107
|
xml.tag!('CustomerZip5', options[:usps_returns_label_request][:image_parameters][:customer_zip5])
|
87
108
|
tag_unless_blank(xml, 'CustomerZip4', options[:usps_returns_label_request][:image_parameters][:customer_zip4])
|
88
109
|
tag_unless_blank(xml, 'POZipCode', options[:usps_returns_label_request][:image_parameters][:po_zip_code])
|
89
110
|
tag_unless_blank(xml, 'AllowNonCleansedOriginAddr', options[:usps_returns_label_request][:image_parameters][:allow_non_cleansed_origin_addr])
|
111
|
+
tag_unless_blank(xml, 'RetailerATTN', options[:usps_returns_label_request][:image_parameters][:retailer_attn])
|
112
|
+
tag_unless_blank(xml, 'RetailerFirm', options[:usps_returns_label_request][:image_parameters][:retailer_firm])
|
113
|
+
tag_unless_blank(xml, 'RetailerAddress1', options[:usps_returns_label_request][:image_parameters][:retailer_address1])
|
114
|
+
tag_unless_blank(xml, 'RetailerAddress2', options[:usps_returns_label_request][:image_parameters][:retailer_address2])
|
115
|
+
tag_unless_blank(xml, 'RetailerCity', options[:usps_returns_label_request][:image_parameters][:retailer_city])
|
116
|
+
tag_unless_blank(xml, 'RetailerState', options[:usps_returns_label_request][:image_parameters][:retailer_state])
|
117
|
+
tag_unless_blank(xml, 'RetailerZip5', options[:usps_returns_label_request][:image_parameters][:retailer_zip5])
|
118
|
+
tag_unless_blank(xml, 'RetailerZip4', options[:usps_returns_label_request][:image_parameters][:retailer_zip4])
|
119
|
+
tag_unless_blank(xml, 'RetailerEmail', options[:usps_returns_label_request][:image_parameters][:retailer_email])
|
120
|
+
tag_unless_blank(xml, 'RetailerPhone', options[:usps_returns_label_request][:image_parameters][:retailer_phone])
|
90
121
|
tag_unless_blank(xml, 'WeightInOunces', options[:usps_returns_label_request][:image_parameters][:weight_in_ounces])
|
91
122
|
xml.tag!('ServiceType', options[:usps_returns_label_request][:image_parameters][:service_type])
|
123
|
+
tag_unless_blank(xml, 'ReturnsPostageType', options[:usps_returns_label_request][:image_parameters][:returns_postage_type])
|
92
124
|
tag_unless_blank(xml, 'Width', options[:usps_returns_label_request][:image_parameters][:width])
|
93
125
|
tag_unless_blank(xml, 'Length', options[:usps_returns_label_request][:image_parameters][:length])
|
94
126
|
tag_unless_blank(xml, 'Height', options[:usps_returns_label_request][:image_parameters][:height])
|
95
127
|
tag_unless_blank(xml, 'Girth', options[:usps_returns_label_request][:image_parameters][:girth])
|
96
128
|
tag_unless_blank(xml, 'Machinable', options[:usps_returns_label_request][:image_parameters][:machinable])
|
97
|
-
tag_unless_blank(xml, '
|
129
|
+
tag_unless_blank(xml, 'VendorCode', options[:usps_returns_label_request][:image_parameters][:vendor_code])
|
130
|
+
tag_unless_blank(xml, 'VendorProductVersionNumber', options[:usps_returns_label_request][:image_parameters][:vendor_product_version_number])
|
131
|
+
tag_unless_blank(xml, 'MailOwnerMID', options[:usps_returns_label_request][:image_parameters][:mail_owner_mid])
|
132
|
+
tag_unless_blank(xml, 'CustomerRefNo', options[:usps_returns_label_request][:image_parameters][:customer_ref_no])
|
133
|
+
tag_unless_blank(xml, 'PrintCustomerRefNo', options[:usps_returns_label_request][:image_parameters][:print_customer_ref_no])
|
134
|
+
tag_unless_blank(xml, 'CustomerRefNo2', options[:usps_returns_label_request][:image_parameters][:customer_ref_no2])
|
135
|
+
tag_unless_blank(xml, 'PrintCustomerRefNo2', options[:usps_returns_label_request][:image_parameters][:print_customer_ref_no2])
|
98
136
|
tag_unless_blank(xml, 'SenderName', options[:usps_returns_label_request][:image_parameters][:sender_name])
|
99
|
-
tag_unless_blank(xml, '
|
137
|
+
tag_unless_blank(xml, 'SenderEmail', options[:usps_returns_label_request][:image_parameters][:sender_email])
|
100
138
|
tag_unless_blank(xml, 'RecipientName', options[:usps_returns_label_request][:image_parameters][:recipient_name])
|
101
|
-
tag_unless_blank(xml, '
|
139
|
+
tag_unless_blank(xml, 'RecipientEmail', options[:usps_returns_label_request][:image_parameters][:recipient_email])
|
140
|
+
tag_unless_blank(xml, 'TrackingEmailPDF', options[:usps_returns_label_request][:image_parameters][:tracking_email_pdf])
|
102
141
|
xml.tag!('ExtraServices') do
|
103
142
|
tag_unless_blank(xml, 'ExtraService', options[:usps_returns_label_request][:image_parameters][:extra_services][:extra_service])
|
143
|
+
tag_unless_blank(xml, 'InsuredAmount', options[:usps_returns_label_request][:image_parameters][:extra_services][:insured_amount])
|
104
144
|
end if options[:usps_returns_label_request][:image_parameters][:extra_services].present?
|
105
145
|
end
|
106
146
|
xml.target!
|
@@ -18,7 +18,7 @@ module Usps
|
|
18
18
|
# * *:urbanization* (String) — Urbanization. For Puerto Rico addresses only.
|
19
19
|
# * *:zip5* (String) — Destination 5-digit ZIP Code. Numeric values (0-9) only. If International, all zeroes.
|
20
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 = {})
|
21
|
+
def verify(options = {})
|
22
22
|
throw ArgumentError.new('Required arguments :address_validate_request missing') if options[:address_validate_request].nil?
|
23
23
|
throw ArgumentError.new('Required arguments :address_validate_request, :revision missing') if options[:address_validate_request][:revision].nil?
|
24
24
|
throw ArgumentError.new('Required arguments :address_validate_request, :address missing') if options[:address_validate_request][:address].nil?
|
@@ -20,7 +20,7 @@ module Usps
|
|
20
20
|
# * *:state* (String) — Two-character state code of the destination address.
|
21
21
|
# * *:zip5* (String) — Destination 5-digit ZIP Code. Must be 5-digits. Numeric values (0-9) only. If International, all zeroes.
|
22
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 = {})
|
23
|
+
def zip_code_lookup(options = {})
|
24
24
|
throw ArgumentError.new('Required arguments :zip_code_lookup_request missing') if options[:zip_code_lookup_request].nil?
|
25
25
|
|
26
26
|
request = build_request(:zip_code_lookup, options)
|
data/lib/usps/api/endpoints.rb
CHANGED
@@ -16,6 +16,7 @@ require_relative 'endpoints/pts_rre'
|
|
16
16
|
require_relative 'endpoints/ptst_pod'
|
17
17
|
require_relative 'endpoints/rate_v4'
|
18
18
|
require_relative 'endpoints/scan'
|
19
|
+
require_relative 'endpoints/sunday_holiday_availability'
|
19
20
|
require_relative 'endpoints/track_v2'
|
20
21
|
require_relative 'endpoints/usps_returns_label'
|
21
22
|
require_relative 'endpoints/verify'
|
@@ -39,6 +40,7 @@ module Usps
|
|
39
40
|
include PTSTPod
|
40
41
|
include RateV4
|
41
42
|
include SCAN
|
43
|
+
include SundayHolidayAvailability
|
42
44
|
include TrackV2
|
43
45
|
include USPSReturnsLabel
|
44
46
|
include Verify
|
@@ -60,6 +62,7 @@ module Usps
|
|
60
62
|
ptst_pod: 'PTSTPod',
|
61
63
|
rate_v4: 'RateV4',
|
62
64
|
scan: 'SCAN',
|
65
|
+
sunday_holiday_availability: 'SundayHolidayAvailability',
|
63
66
|
track_v2: 'TrackV2',
|
64
67
|
usps_returns_label: 'USPSReturnsLabel',
|
65
68
|
verify: 'Verify',
|
@@ -13,7 +13,7 @@ module Usps
|
|
13
13
|
# @option options [required, Hash] <%= data[:request_descriptions].first[1][:name].underscore %> <%= data[:request_descriptions].first[1][:description] %>
|
14
14
|
<% data[:request_descriptions].each do |option_name, option| %>
|
15
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 = {})
|
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 = {})
|
17
17
|
<% data[:request_descriptions].select{|n,o| o[:required]}.each do |option_name, option| %>
|
18
18
|
<%= Erubis::Eruby.new(File.read('lib/usps/api/templates/_throw_argument_error.erb')).result(option: option, parents: [], indentation: 3) %>
|
19
19
|
<% end %>
|
data/lib/usps/version.rb
CHANGED
data/usps-ruby-client.gemspec
CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
18
18
|
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/joeyparis/usps-ruby-client'
|
21
21
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Paris
|
@@ -242,17 +242,20 @@ files:
|
|
242
242
|
- Rakefile
|
243
243
|
- bin/console
|
244
244
|
- bin/setup
|
245
|
-
- lib/data/api/address-information-api.
|
246
|
-
- lib/data/api/domestic-mail-service-standards-api.
|
247
|
-
- lib/data/api/evs-international-label-api.
|
248
|
-
- lib/data/api/evs-label-api.
|
249
|
-
- lib/data/api/
|
250
|
-
- lib/data/api/
|
251
|
-
- lib/data/api/
|
252
|
-
- lib/data/api/
|
253
|
-
- lib/data/api/
|
254
|
-
- lib/data/api/
|
255
|
-
- lib/data/api/
|
245
|
+
- lib/data/api/address-information-api.html
|
246
|
+
- lib/data/api/domestic-mail-service-standards-api.html
|
247
|
+
- lib/data/api/evs-international-label-api.html
|
248
|
+
- lib/data/api/evs-label-api.html
|
249
|
+
- lib/data/api/expressmail-api-retirement-transition-guide.html
|
250
|
+
- lib/data/api/general-api-developer-guide.html
|
251
|
+
- lib/data/api/hold-for-pickup-facilities-lookup-api.html
|
252
|
+
- lib/data/api/package-pickup-api.html
|
253
|
+
- lib/data/api/rate-calculator-api.html
|
254
|
+
- lib/data/api/scan-api.html
|
255
|
+
- lib/data/api/service-delivery-calculator-get-locations-api.html
|
256
|
+
- lib/data/api/sunday-holiday-api.html
|
257
|
+
- lib/data/api/track-and-confirm-api.html
|
258
|
+
- lib/data/api/uspsreturnslabel-api.html
|
256
259
|
- lib/helpers/erubis_helper.rb
|
257
260
|
- lib/tasks/api.rake
|
258
261
|
- lib/usps-ruby-client.rb
|
@@ -272,6 +275,7 @@ files:
|
|
272
275
|
- lib/usps/api/endpoints/ptst_pod.rb
|
273
276
|
- lib/usps/api/endpoints/rate_v4.rb
|
274
277
|
- lib/usps/api/endpoints/scan.rb
|
278
|
+
- lib/usps/api/endpoints/sunday_holiday_availability.rb
|
275
279
|
- lib/usps/api/endpoints/track_v2.rb
|
276
280
|
- lib/usps/api/endpoints/usps_returns_label.rb
|
277
281
|
- lib/usps/api/endpoints/verify.rb
|
@@ -293,8 +297,6 @@ files:
|
|
293
297
|
- lib/usps/faraday/response/raise_error.rb
|
294
298
|
- lib/usps/logger.rb
|
295
299
|
- lib/usps/version.rb
|
296
|
-
- usps-ruby-client-0.1.0.gem
|
297
|
-
- usps-ruby-client-0.1.2.gem
|
298
300
|
- usps-ruby-client.gemspec
|
299
301
|
homepage: https://www.usps.com/business/web-tools-apis/documentation-updates.htm
|
300
302
|
licenses:
|