Module: Usps::Api::Endpoints::EVSGXGGetLabel

Included in:
Usps::Api::Endpoints
Defined in:
lib/usps/api/endpoints/e_vsgxg_get_label.rb

Instance Method Summary collapse

Instance Method Details

#e_vsgxg_get_label(options = {}) ⇒ Object

Global Express Guaranteed is our fastest international shipping service, with transportation and delivery by FedEx Express. It features date-certain delivery in 1-3 business days* to more than 190 countries with a money-back guarantee** to all destinations. This document contains a Reference Guide to the eVS GXG Get Label Request.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • e_vsgxg_get_label_request (required, Hash)
    • :option (required, Empty) — For future use.

    • :revision (String) — This is for versioning of the APIs and for triggering response tags for future versions. In this API use a value of 2 to trigger new functionality. For example: <Revision>1</Revision>

    • :image_parameters (required, Empty) — For future use.

    • :from_first_name (required, String) — First and Last Name must be sent. Maximum Length: 32 characters total for First, Middle, and Last Names with space after first and middle name. For example: <FromFirstName>John</FromFirstName>

    • :from_middle_initial (String) — First and Last Name must be sent. Maximum Length: 32 characters total for First, Middle, and Last Names with space after first and middle name. For example: <FromMiddleInitial>L</FromMiddleInitial>

    • :from_last_name (required, String) — First and Last Name must be sent. Maximum Length: 32 characters total for First, Middle, and Last Names with space after first and middle name. For example: <FromLastName>Doe</FromLastName>

    • :from_firm (required, String) — Firm Name. For example: <FromFirm>USPS</FromFirm>

    • :from_address1 (String) — Secondary address unit designator and number (such as an apartment or suite number (APT 202, STE 100). For example: <FromAddress1>APT 202</FromAddress1>

    • :from_address2 (required, String) — Street number and name (including predirectional, suffix, and postdirectional as shown in USPS ZIP+4 Product for the delivery address or rural route and box number (RR 5 BOX 10), highway contract route and box number (HC 4 BOX 45), or post office box number (PO BOX 458). For example: <FromAddress2>10 Elm Street </FromAddress2>

    • :from_urbanization (String) — Urbanization name (Puerto Rico only, ZIP Code prefixes 006 to 009, if area is so designated). For example: <FromUrbanization>URB Caparra Ter</FromUrbanization>

    • :from_city (required, String) — City name. For example: <FromCity>Anytown</FromCity>

    • :from_state (required, String) — Use 2-letter USPS state abbreviation. For example: <FromState>PA</FromState>

    • :from_zip5 (required, String) — Five-digit ZIP code. For example: <FromZip5>01234</FromZip5>

    • :from_zip4 (String) — Four-digit extension of ZIP+4 code. For example: <FromZip4>5678</FromZip4>

    • :from_phone (required, String) — 10 digits Required (including area code), with no punctuation. Use format: 2125551234 For example: <FromPhone>5555555555</FromPhone>

    • :ship_from_zip (String) — Origin ZIP Code shall be accepted as component in request via “ShipFromZip” tag. For example: <ShipFromZIP>18701</ShipFromZIP>

    • :sender_e_mail (String) — E-mail address of sender. Valid e-mail addresses must be used. Note: No e-mail is returned when generating a Sample label request. For example: <SenderEMail>[email protected]</SenderEMail>

    • :to_first_name (required, String) — First and Last Name must be sent. Maximum Length: 36 characters total for First, and Last Names with space after first name. For example: <ToFirstName>John</ToFirstName>

    • :to_last_name (required, String) — First and Last Name must be sent. Maximum Length: 36 characters total for First, and Last Names with space after first name. For example: <ToLastName>John</ToLastName>

    • :to_firm (required, String) — Firm Name. For example: <ToFirm>USPS</ToFirm>

    • :to_address1 (String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address.

    • :to_address2 (required, String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address.

    • :to_address3 (String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address.

    • :to_postal_code (String) — Destination Postal Code. For example: <ToPostalCode> T2G 2W1</ToPostalCode>

    • :to_phone (String) — Up to 25 digits allowed with no punctuation. For example: <ToPhone>1234567890</ToPhone>

    • :recipient_e_mail (String) — E-mail address of recipient. Valid e-mail addresses must be used. Note: No e-mail is returned when generating a Sample label request. For example: <RecipientEMail>[email protected]</RecipientEMail>

    • :to_dpid (required, String) — The Delivery Point ID as determined via the GXGGetDeliveryPoint API response. Please contact [email protected] for more information. For example: <ToDPID>142</ToDPID>

    • :to_province (String) — Enter the province for the recipient. For example: <ToProvince>JALISCO</ToProvince>

    • :to_tax_id (String) — Tax ID For example: <ToTaxID/>

    • :container (required, String) — Container type. USPS refers to USPS-supplied large flat envelopes which incur weight-based postage. For example: <Container>LETTER</Container>

    • :content_type (required, String) — Content type. For example: <ContentType>DOCUMENTS</ContentType>

    • :shipping_contents (required, Hash) — Contents of package.

      • :item_detail (Hash) — One item detail per item type enclosed.

        • :description (required, String) — Description of the item. For example: <Description>Policy guidelines document</Description>

        • :commodity (required, String) — Commodity shall be a text String matching Commodity Name from GXGGetCommodityInfo. For example: <Commodity>Documents</Commodity>

        • :restriction (Hash) — Allows integrators to pass restrictions information (responses to footnote questions) for each “Commodity/CommodityName.”

          • :footnote_number (required, String) — Number associated with the commodity restriction question returned from the Get Commodity Restrictions service. Using a number which does not pertain to the passed commodity and derived country will result in an error return. For example: <FootnoteNumber>196</FootnoteNumber>

          • :response (required, String) — May affect the need to use a Commercial invoice, and/or the ability to continue the transaction at all. For example: <Response>Y</Response>

          • :quantity (required, String) — Quantity of the item. For example: <Quantity>4</Quantity>

          • :unit_value (required, Decimal) — The data entered with this tag provides the value of the one of items in this Item Detail. For example: <UnitValue>125.00</UnitValue>

          • :net_pounds (Integer) — Rules: 1. If any <ItemDetail> contains either a <NetPounds> or <NetOunces> sub-tag, then all <ItemDetail> nodes must specify at least a <NetPounds> or <NetOunces> tag. 2. If the <NetPounds> and/or <NetOunces> are specified successfully, then those values will be used in the manifesting of the Customs Declarations. 3. If <NetPounds> and <NetOunces> are note specified, then the value for <NetPounds> and <NetOunces> for each customs declaration will be the <GrossPounds> and <GrossOunces> divided by the number of <ItemDetails> present.

          • :net_ounces (Decimal) — Rules: 1. If any <ItemDetail> contains either a <NetPounds> or <NetOunces> sub-tag, then all <ItemDetail> nodes must specify at least a <NetPounds> or <NetOunces> tag. 2. If the <NetPounds> and/or <NetOunces> are specified successfully, then those values will be used in the manifesting of the Customs Declarations. 3. If <NetPounds> and <NetOunces> are note specified, then the value for <NetPounds> and <NetOunces> for each customs declaration will be the <GrossPounds> and <GrossOunces> divided by the number of <ItemDetails> present.

          • :unit_of_measure (String) — Unit of Measure for item quantity. For example: <UnitOfMeasure>Dozen</UnitOfMeasure>

          • :hs_tariff_number (String) — For commercial items only. If known, the HS tariff number must be based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. For example: <HSTariffNumber>123456</HSTariffNumber>

          • :countryof_manufacture (String) — The country name entered must match an entry from the USPS-approved International Index of Countries and Localities or be “United States”. Click on the link for “International Country Listings.” Using a country name not on the list will result in a request failure. Required when CIRequired=”true”. For example: <CountryOfManufacture>United States</CountryOfManufacture>

          • :purpose_of_shipment (required, String) — Statement of shipment purpose. For example: <PurposeOfShipment>Gift</PurposeOfShipment>

          • :parties_to_transaction (String) — Defines relationship of parties to transaction. For example: <PartiesToTransaction>Related</PartiesToTransaction>

          • :agreement (required, String) — Agreement to GXG service terms and conditions. For example: <Agreement>Y</Agreement>

          • :postage (Decimal) — Use this tag for entering the postage amount, if known, excluding extra services. If the value is blank, the postage will be automatically calculated using retail rates. For example: <Postage>137.95</Postage>

          • :insured_value (Decimal) — If specified, InsuredValue is used to calculate the Insurance Fee. For example: <InsuredValue>180.00</InsuredValue>

          • :gross_pounds (Decimal) — GrossPounds + (GrossOunces/16) must be less than 70. For example: <GrossPounds>40</GrossPounds>

          • :gross_ounces (Decimal) — GrossPounds + (GrossOunces/16) must be less than 70. For example: <GrossOunces>5</GrossOunces>

          • :length (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing or dimension validation reference IMM pe.usps.com/text/imm/welcome.htm

          • :width (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing or dimension validation reference IMM pe.usps.com/text/imm/welcome.htm

          • :height (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing or dimension validation reference IMM pe.usps.com/text/imm/welcome.htm

          • :girth (Decimal) — Value must be numeric. Units are inches. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non-rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages. For more details on dimensional weight pricing or dimension validation reference IMM pe.usps.com/text/imm/welcome.htm

          • :shape (String) — Shape, plus the package’s physical dimensions, help determine whether the scale weight or the dimensional weight is used to calculate the shipping cost. For example: <Shape>RECTANGULAR</Shape>

          • :ci_required (boolean) — Indicates if Commercial Invoice is Required. When CIRequired=” true”, commercial invoice image will be generated. For example: <CIRequired>true</CIRequired>

          • :invoice_date () — Invoice date. Required when CommercialShipment=” true”. For example: <InvoiceDate>01/01/2012</InvoiceDate>

          • :invoice_number (String) — Invoice number. Required when CommercialShipment=” true”. For example: <InvoiceNumber>20120101</InvoiceNumber>

          • :customer_order_number (String) — Customer order number. User assigned number for internal use. For example: <CustomerOrderNumber>20120101</CustomerOrderNumber>

          • :cust_order_number (String) — Customer order number. User assigned number for internal use. Either use CustomerOrderNumber or CustOrderNumber. For example: <CustOrderNumber>20120101</CustOrderNumber>

          • :terms_delivery (String) — Indicates terms of delivery. Required when CommercialShipment=” true”. For example: <TermsDelivery>CPT</TermsDelivery>

          • :terms_delivery_other (String) — Terms description. Required when TermsDelivery=” OTHER”. For example: <TermsDeliveryOther>DES</TermsDeliveryOther>

          • :packing_cost (Decimal) — Packing cost. For example: <PackingCost>15.00</PackingCost>

          • :country_ult_dest (required, String) — Ultimate destination country. For example: <CountryUltDest>Austria</CountryUltDest>

          • :ci_agreement (boolean) — Agreement to Commercial Invoice terms and conditions. Required when CIRequired=” true”. For example: <CIAgreement>true</CIAgreement>

          • :image_type (required, String) — Controls the file format of the commercial invoice image returned. For example: <ImageType>NONE</ImageType>

          • :image_layout (Empty) — For future use.

          • :customer_ref_no (String) — Written to Postal Manifest Detail record. For example: <CustomerRefNo>Ref 369246</CustomerRefNo>

          • :customer_ref_no2 (String) — Written to Postal Manifest Detail record. For example: <CustomerRefNo2>ACT 369246</ CustomerRefNo2>

          • :ship_date (required, String) — Format: mm/dd/yyyy. No more than 4 days in the future. Should “ShipDate” value not be provided, the service shall use the current date as a basis for delivery date calculations. For example: <ShipDate>01/01/2012</ShipDate>

          • :hold_for_manifest (String) — Restricted use. For authorized users, holds manifest record for possible inclusion in SCAN request when Y. All other users should omit or specify N. For example: <HoldForManifest>Y</HoldForManifest>

          • :price_options (String) — Returns commercial pricing.

          • :commercial_shipment (boolean) — If True, then Invoice/Buyer info Required. If False, then Optional. For example: <CommercialShipment>true</CommercialShipment>

          • :buyer_first_name (String) — Buyer first name. Required when CommercialShipment=” true”. For example: <BuyerFirstName>John</BuyerFirstName>

          • :buyer_last_name (String) — Buyer last name. Required when CommercialShipment=” true”. For example: <BuyerLastName>Smith</BuyerLastName>

          • :buyer_address1 (String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address. Required when CommercialShipment=”true”. For example: <BuyerAddress1>Lazarette Str. 7</BuyerAddress1>

          • :buyer_address2 (String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address. For example: <BuyerAddress2/>

          • :buyer_address3 (String) — Three address lines are provided, but only 1 is Required. Use as many as needed for complete address. For example: <BuyerAddress3/>

          • :buyer_city (String) — Buyer city. Required when CommercialShipment=” true”. For example: <BuyerCity>Berlin</BuyerCity>

          • :buyer_state (String) — Buyer state. Required when CommercialShipment=” true”. For example: <BuyerState/>

          • :buyer_postal_code (String) — Buyer postal code. Required when CommercialShipment=” true”. For example: <BuyerPostalCode>10117</BuyerPostalCode>

          • :buyer_country (String) — Buyer country. Required when CommercialShipment=” true”. For example: <BuyerCountry>Germany</BuyerCountry>

          • :buyer_tax_id (String) — Buyer TaxID. For example: <BuyerTaxID>11123456789</BuyerTaxID>

          • :buyer_recipient (Boolean) — Indicates that Buyer and Recipient are the same. When CommercialShipment=”true” and BuyerRecipient =”true”, buyer information is not Required. For example: <BuyerRecipient>true</BuyerRecipient>

          • :terms_payment (String) — TermsPayment is Required when CommercialShipment =” true”. For example: <TermsPayment>Net 50</TermsPayment>

          • :action_code (String) — Passed to SPE file via the shipment manifest.

          • :opt_out_of_spe (boolean) — Allows a customer to opt out of SPE file creation. “false” WILL create a SPE file. Note: This request tag is case sensitive.

          • :permit_number (String) — Number associated with a mailing permit. The permit is permission to use a certain postage payment method for bulk and commercial mailings

          • :account_zip_code (String) — ZIP of Account Post Office where mailed if different from <FromZip5/>. Written to Postal Manifest Detail record. Must be valid ZIP Code. For example: <AccountZipCode>00962</AccountZipCode>

          • :machinable (Boolean) — Indicates whether or not the item is machinable. A surcharge is applied to a First-Class Mail International item if it has one or more non-machinable characteristics. See International Mail Manual (IMM) Section 241 for more information. For example: <Machinable>false</Machinable>

          • :destination_rate_indicator (required, String) — Required for destination entry packagesenter either “I” or “N”. · I = International Service Center (ISC) · N = None

          • :mid (String) — Mailer ID (MID), Represents Mail Owner MID. Located in position #13 in the Detail 1 record of the Shipping Services File v2.0. For example: <MID>847654321</ MID>

          • :logistics_manager_mid (String) — The MID of the company that manages the mailing. Located in position #12 in the Detail 1 record of the Shipping Services File v2.0. Note: If LogisticsManagerMID is populated, either CRID or MID must also be populated. For example: <LogisticsManagerMID>489001< / LogisticsManagerMID>

          • :crid (String) — Customer Registration ID, Represents Mail Owner CRID. Located in position #20 in the Detail 1 record of the Shipping Services File v2.0. For example: <CRID>544762</ CRID>

          • :vendor_code (String) — Code from vendor software to identify the developer of the shipping system. Located in position #15 in the Detail 1 record of the Shipping Services File v2.0. For example: <VendorCode>1234<VendorCode>

          • :vendor_product_version_number (String) — Shipping software’s product version number. Located in position #16 in the Detail 1 record of the Shipping Services File v2.0. For example: <VendorProductVersionNumber>5.02.1B</ VendorProductVersionNumber>

          • :override_mid (String) —

          • :chargeback_code (String) — Used in Shipping Services File v2.0 for G-10 labels. Contact your Technical Integration Specialist for details.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/usps/api/endpoints/e_vsgxg_get_label.rb', line 117

def e_vsgxg_get_label(options = {})
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request missing') if options[:e_vsgxg_get_label_request].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :option missing') if options[:e_vsgxg_get_label_request][:option].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :image_parameters missing') if options[:e_vsgxg_get_label_request][:image_parameters].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_first_name missing') if options[:e_vsgxg_get_label_request][:from_first_name].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_last_name missing') if options[:e_vsgxg_get_label_request][:from_last_name].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_firm missing') if options[:e_vsgxg_get_label_request][:from_firm].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_address2 missing') if options[:e_vsgxg_get_label_request][:from_address2].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_city missing') if options[:e_vsgxg_get_label_request][:from_city].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_state missing') if options[:e_vsgxg_get_label_request][:from_state].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_zip5 missing') if options[:e_vsgxg_get_label_request][:from_zip5].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :from_phone missing') if options[:e_vsgxg_get_label_request][:from_phone].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :to_first_name missing') if options[:e_vsgxg_get_label_request][:to_first_name].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :to_last_name missing') if options[:e_vsgxg_get_label_request][:to_last_name].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :to_firm missing') if options[:e_vsgxg_get_label_request][:to_firm].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :to_address2 missing') if options[:e_vsgxg_get_label_request][:to_address2].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :to_dpid missing') if options[:e_vsgxg_get_label_request][:to_dpid].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :container missing') if options[:e_vsgxg_get_label_request][:container].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :content_type missing') if options[:e_vsgxg_get_label_request][:content_type].nil?
	throw ArgumentError.new('Required arguments :e_vsgxg_get_label_request, :shipping_contents missing') if options[:e_vsgxg_get_label_request][:shipping_contents].nil?

	request = build_request(:e_vsgxg_get_label, options)
	get('https://secure.shippingapis.com/ShippingAPI.dll', {
		API: 'eVSGXGGetLabel',
		XML: request,
	})
end