Readme.md in fedex-3.6.1 vs Readme.md in fedex-3.8.0
- old
+ new
@@ -68,10 +68,25 @@
:packaging_type => "YOUR_PACKAGING",
:drop_off_type => "REGULAR_PICKUP"
}
```
+If you pass a non-nil `:return_reason` as part of the shipping options, you will create
+a return shipment. The request to fedex will include the following additional XML.
+
+```xml
+<SpecialServicesRequested>
+ <SpecialServiceTypes>RETURN_SHIPMENT</SpecialServiceTypes>
+ <ReturnShipmentDetail>
+ <ReturnType>PRINT_RETURN_LABEL</ReturnType>
+ <Rma>
+ <Reason>YOUR RETURN REASON HERE</Reason>
+ </Rma>
+ </ReturnShipmentDetail>
+</SpecialServicesRequested>
+```
+
By default the shipping charges will be assigned to the sender. If you may
change this by passing an extra hash of payment options.
```ruby
payment_options = {
@@ -129,11 +144,11 @@
ship = fedex.ship(:shipper=>shipper,
:recipient => recipient,
:packages => packages,
:service_type => "FEDEX_GROUND",
:shipping_options => shipping_options)
-puts ship[:completed_shipment_detail][:operational_detail] [:transit_time]
+puts ship[:completed_shipment_detail][:operational_detail][:transit_time]
```
Above code will give you the transit time.
### ** Generate a shipping label (PDF) **
@@ -187,11 +202,102 @@
shipment.save!
```
Documentation for setting up Paperclip with Amazon S3 can be found in the Paperclip [README](https://github.com/thoughtbot/paperclip/#storage).
+### ** Generate shipping labels for multi-package shipments (MPS) **
+Multiple packages for a single pick-up, destination and payer can be combined into a single MPS shipment. The first label will provide a master tracking number which must be used in the subsequent calls for the remaining packages in the shipment.
+
+Parameters for the first label:
+```ruby
+label = fedex.label(
+ :filename => file_name,
+ :shipper => shipper,
+ :recipient => recipient,
+ :packages => packages,
+ :service_type => service_type,
+ :shipping_details => shipping_details,
+ :shipping_charges_payment => shipping_charges_payment,
+ :customs_clearance_detail => customs_clearance_detail,
+ :mps => {:package_count => package_count, :total_weight => total_weight, :sequence_number => '1'}
+ )
+```
+
+Parameters for labels 2 through 'n':
+```ruby
+fedex.label(
+ :filename => file_name,
+ :shipper => shipper,
+ :recipient => recipient,
+ :packages => packages,
+ :service_type => service_type,
+ :shipping_details => shipping_details,
+ :shipping_charges_payment => shipping_charges_payment,
+ :customs_clearance_detail => customs_clearance_detail,
+ :mps => {
+ :master_tracking_id => {:tracking_id_type => 'FEDEX', :tracking_number =>tracking_number},
+ :package_count => package_count,
+ :total_weight => {
+ :value => total_weight,
+ :units => 'KG'
+ }
+ :sequence_number => 'n'
+ }
+ )
+```
+
+### ** Create COD Shipment **
+
+To create a Cash On Delivery label for a shipment:
+
+change "commerical_invoice = {:purpose => 'SOLD'}" in customs_clearance_detail
+
+add shipping_options with {:cod => {:currency => "currency", :amount => "amount", :collection_type => 'PAYMENT COLLECTION TYPE'}
+
+PAYMENT COLLECTION TYPE - CASH, CHEQUE, DEMAND DRAFT
+
+### ** To add multiple commodities in customs_clearance_detail
+
+use this format commodities_1 .... commodities_N
+
+example
+
+```
+
+customs_clearance_detail['commodites_1']
+customs_clearance_detail['commodites_2']
+
+```
+
+### ** Masking shipper details in label **
+
+this allows you hide shipper details on the label
+
+Add customer_specified_detail = {:masked_data_1 => 'SOMETHING', :masked_data_2 => 'SOMETHING'} in :label_specification key
+
+Example
+
+```
+ customer_specified_detail = {
+ :masked_data_1 => "SHIPPER_ACCOUNT_NUMBER",
+ :masked_data_2 => "TRANSPORTATION_CHARGES_PAYOR_ACCOUNT_NUMBER",
+ :masked_data_3 => "DUTIES_AND_TAXES_PAYOR_ACCOUNT_NUMBER"
+ }
+
+```
+
+### ** Delete a shipment **
+
+If you do not intend to use a label you should delete it. This will notify FedEx that you will not be using the label and they won't charge you.
+
+To delete a shipment:
+
+```ruby
+fedex.delete(:tracking_number => "1234567890123")
+```
+
### ** Tracking a shipment **
To track a shipment:
```ruby
@@ -217,11 +323,11 @@
To verify an address is valid and deliverable:
```ruby
address = {
- :address => "5 Elm Street",
+ :street => "5 Elm Street",
:city => "Norwalk",
:state => "CT",
:postal_code => "06850",
:country => "USA"
}
@@ -236,16 +342,62 @@
address_result.postal_code
# => "06850-3901"
```
+### ** Requesting a Pickup **
+
+To request a pickup:
+
+```ruby
+
+pickup = fedex.pickup(:carrier_code => 'FDXE',
+ :packages => {:weight => {:units => "LB", :value => 10}, :count => 2},
+ :ready_timestamp => Date.today.to_datetime + 1.375,
+ :close_time => Date.today.to_time + 60 * 60 * 17)
+puts pickup[:pickup_confirmation_number]
+```
+
+### ** Getting pickup availability details **
+
+To check for pickup availability:
+
+```ruby
+
+dispatch = Date.tomorrow.strftime('%Y-%m-%d')
+
+pickup_availability = fedex.pickup_availability(:country_code => 'IN',
+ :postal_code => '400061',
+ :request_type => 'FUTURE_DAY',
+ :dispatch_date => dispatch_date,
+ :carrier_code => 'FDXE')
+
+puts pickup_availability[:options]
+```
+
+### ** Getting service availability **
+
+To check service availability:
+
+```ruby
+
+origin = {:postal_code => '400012', :country_code => 'IN'}
+destination = { :postal_code => '400020', :country_code => 'IN'}
+fedex_service_hash = {:origin => origin, :destination => destination, :ship_date => '2014-06-28', :carrier_code => 'FDXE'}
+
+service = fedex.service_availability(fedex_service_hash)
+
+puts service[:options]
+```
+
# Services/Options Available
```ruby
Fedex::Shipment::SERVICE_TYPES
Fedex::Shipment::PACKAGING_TYPES
Fedex::Shipment::DROP_OFF_TYPES
+Fedex::Shipment::CARRIER_CODES
````
# Contributors:
- [jazminschroeder] (http://github.com/jazminschroeder) (Jazmin Schroeder)
- [parndt] (https://github.com/parndt) (Philip Arndt)
@@ -257,9 +409,10 @@
- [sborsje] (https://github.com/sborsje) (Stefan Borsje)
- [bradediger] (https://github.com/bradediger) (Brad Ediger)
- [yevgenko] (https://github.com/yevgenko) (Yevgeniy Viktorov)
- [smartacus] (https://github.com/smartacus) (Michael Lippold)
- [jonathandean] (https://github.com/jonathandean) (Jonathan Dean)
+- [chirag7jain] (https://github.com/chirag7jain) (Chirag Jain)
- and more... (https://github.com/jazminschroeder/fedex/graphs/contributors)
# Copyright/License:
Copyright 2011 [Jazmin Schroeder](http://jazminschroeder.com)