fedex_ship 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.idea/.rakeTasks +7 -0
  4. data/.idea/fedex_ship-0.1.0.iml +22 -0
  5. data/.idea/misc.xml +7 -0
  6. data/.idea/modules.xml +8 -0
  7. data/.idea/vcs.xml +6 -0
  8. data/.idea/workspace.xml +56 -0
  9. data/.rspec +2 -0
  10. data/Gemfile +5 -0
  11. data/Rakefile +7 -0
  12. data/Readme.md +496 -0
  13. data/fedex_ship.gemspec +28 -0
  14. data/lib/fedex_ship.rb +55 -0
  15. data/lib/fedex_ship/address.rb +31 -0
  16. data/lib/fedex_ship/credentials.rb +26 -0
  17. data/lib/fedex_ship/document.rb +51 -0
  18. data/lib/fedex_ship/ground_manifest.rb +25 -0
  19. data/lib/fedex_ship/helpers.rb +20 -0
  20. data/lib/fedex_ship/label.rb +71 -0
  21. data/lib/fedex_ship/rate.rb +38 -0
  22. data/lib/fedex_ship/request/address.rb +97 -0
  23. data/lib/fedex_ship/request/base.rb +443 -0
  24. data/lib/fedex_ship/request/delete.rb +76 -0
  25. data/lib/fedex_ship/request/document.rb +45 -0
  26. data/lib/fedex_ship/request/ground_close.rb +73 -0
  27. data/lib/fedex_ship/request/label.rb +29 -0
  28. data/lib/fedex_ship/request/logs_fedex.rb +74 -0
  29. data/lib/fedex_ship/request/pickup.rb +135 -0
  30. data/lib/fedex_ship/request/pickup_availability.rb +102 -0
  31. data/lib/fedex_ship/request/rate.rb +94 -0
  32. data/lib/fedex_ship/request/service_availability.rb +86 -0
  33. data/lib/fedex_ship/request/shipment.rb +249 -0
  34. data/lib/fedex_ship/request/tracking_information.rb +119 -0
  35. data/lib/fedex_ship/shipment.rb +115 -0
  36. data/lib/fedex_ship/tracking_information.rb +54 -0
  37. data/lib/fedex_ship/tracking_information/event.rb +24 -0
  38. data/lib/fedex_ship/version.rb +6 -0
  39. data/spec/config/fedex_credentials.example.yml +13 -0
  40. data/spec/lib/fedex_ship/address_spec.rb +59 -0
  41. data/spec/lib/fedex_ship/delete_spec.rb +26 -0
  42. data/spec/lib/fedex_ship/document_spec.rb +177 -0
  43. data/spec/lib/fedex_ship/ground_close_spec.rb +42 -0
  44. data/spec/lib/fedex_ship/label_spec.rb +73 -0
  45. data/spec/lib/fedex_ship/pickup_availability_spec.rb +19 -0
  46. data/spec/lib/fedex_ship/pickup_spec.rb +32 -0
  47. data/spec/lib/fedex_ship/rate_spec.rb +216 -0
  48. data/spec/lib/fedex_ship/service_availability_spec.rb +20 -0
  49. data/spec/lib/fedex_ship/shipment_spec.rb +86 -0
  50. data/spec/lib/fedex_ship/track_spec.rb +67 -0
  51. data/spec/spec_helper.rb +12 -0
  52. data/spec/support/credentials.rb +15 -0
  53. data/spec/support/vcr.rb +14 -0
  54. metadata +193 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6bdda2541489eec10d0e9d17166967378a8e0a737a10f30c4fc43dd478e46e3d
4
+ data.tar.gz: 074b9ddde307222086cfcf7e4323b9a09d7f1625168341256efc7364e93765dc
5
+ SHA512:
6
+ metadata.gz: c97cae30fd8c92dc14d5bfd57f1b122844950ca12373fe9df9b900455a7928f1599b0ee40dcf6b273af915ab2d0d6840aab0dc03496b0b45a43b0ebb132c7b43
7
+ data.tar.gz: d45e1734761537ad09b7fac31f894dc9dd9a41a5bf0bb10eb22fb60a29d6d8016e1283883d1b69aa44ad2d1940872d9ef50c700740c0f893befcf037f3b1faf1
@@ -0,0 +1,15 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .rvmrc
6
+ doc/*
7
+ .yardoc/*
8
+ pkg/*
9
+ .yardopts
10
+ fedex_credentials.yml
11
+ spec/vcr
12
+ *.bbprojectd
13
+ .DS_Store
14
+ hacks
15
+ .ruby-version
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.8, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="pry (v0.12.2, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.6.0 [global]) [gem]" level="application" />
21
+ </component>
22
+ </module>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.0 [global]" project-jdk-type="RUBY_SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/fedex_ship-0.1.0.iml" filepath="$PROJECT_DIR$/.idea/fedex_ship-0.1.0.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,56 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="9f818173-e813-4628-8515-c464b67986bf" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/Rakefile" beforeDir="false" afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
7
+ </list>
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="Git.Settings">
14
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
+ </component>
16
+ <component name="ProjectId" id="1Xq4QITZYvetd2lOaU9h2KOB0ox" />
17
+ <component name="ProjectViewState">
18
+ <option name="hideEmptyMiddlePackages" value="true" />
19
+ <option name="showExcludedFiles" value="true" />
20
+ <option name="showLibraryContents" value="true" />
21
+ <option name="showMembers" value="true" />
22
+ </component>
23
+ <component name="PropertiesComponent">
24
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
25
+ <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
26
+ <property name="WebServerToolWindowFactoryState" value="false" />
27
+ <property name="last_opened_file_path" value="$PROJECT_DIR$/../../../Bloque Labs/SchoolChain" />
28
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
29
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
30
+ <property name="settings.editor.selected.configurable" value="editor.preferences.gutterIcons" />
31
+ </component>
32
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
33
+ <component name="SvnConfiguration">
34
+ <configuration />
35
+ </component>
36
+ <component name="TaskManager">
37
+ <task active="true" id="Default" summary="Default task">
38
+ <changelist id="9f818173-e813-4628-8515-c464b67986bf" name="Default Changelist" comment="" />
39
+ <created>1581760272614</created>
40
+ <option name="number" value="Default" />
41
+ <option name="presentableId" value="Default" />
42
+ <updated>1581760272614</updated>
43
+ <workItem from="1581760274279" duration="935000" />
44
+ </task>
45
+ <servers />
46
+ </component>
47
+ <component name="TypeScriptGeneratedFilesManager">
48
+ <option name="version" value="1" />
49
+ </component>
50
+ <component name="WindowStateProjectService">
51
+ <state x="405" y="110" width="546" height="581" key="RollbackChangesDialog" timestamp="1581761057353">
52
+ <screen x="0" y="27" width="1366" height="741" />
53
+ </state>
54
+ <state x="405" y="110" width="546" height="581" key="RollbackChangesDialog/0.27.1366.741@0.27.1366.741" timestamp="1581761057353" />
55
+ </component>
56
+ </project>
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in fedex.gemspec
4
+ gemspec
5
+ gem 'httparty', '~> 0.13.7'
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ # require 'rspec/core/rake_task'
3
+
4
+ # RSpec::Core::RakeTask.new('spec')
5
+
6
+ # If you want to make this the default task
7
+ # task :default => :spec
@@ -0,0 +1,496 @@
1
+ # IMPORTANT!!
2
+
3
+ This is an updated version of fedex gem. I just updated fedex gem for my personal use but later on, I realized that I should give this gem to others to leverage it.
4
+
5
+ I plan a major refactor to this gem. Sorry but at this moment I am not merging PR's. I appreciate your effort but need some time to catch up. Thanks!!
6
+
7
+ # Fedex Rate Web Service
8
+ ## Fedex API Shipment Version: 21
9
+
10
+ For more information visit [Fedex Web Services for Shipping](https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/index.html).
11
+
12
+ This version uses the Non-SOAP Web Services so there is no need to download the
13
+ Fedex WSDL files, note however that you will need to apply for development/production credentials.
14
+
15
+ Note: Please make sure to test your results.
16
+
17
+
18
+ # Installation:
19
+
20
+ ```ruby
21
+ gem install fedex_ship
22
+ ```
23
+
24
+ # Usage example:
25
+
26
+ Define the shipper:
27
+
28
+ ```ruby
29
+
30
+ shipper = { :name => "Sender",
31
+ :company => "Company",
32
+ :phone_number => "555-555-5555",
33
+ :address => "Main Street",
34
+ :city => "Harrison",
35
+ :state => "AR",
36
+ :postal_code => "72601",
37
+ :country_code => "US",
38
+ :tin_type => "BUSINESS_NATIONAL",
39
+ :tin_number => 'Shipper Tin Number'
40
+ }
41
+ ```
42
+
43
+ Define the recipient:
44
+
45
+ ```ruby
46
+ recipient = { :name => "Recipient",
47
+ :company => "Company",
48
+ :phone_number => "555-555-5555",
49
+ :address => "Main Street",
50
+ :city => "Franklin Park",
51
+ :state => "IL",
52
+ :postal_code => "60131",
53
+ :country_code => "US",
54
+ :residential => "false",
55
+ :tin_type => "BUSINESS_NATIONAL",
56
+ :tin_number => 'Shipper Tin Number'
57
+ }
58
+ ```
59
+
60
+ Define the packages; multiple packages in a single shipment are allowed:
61
+ Note that all the dimensions must be integers.
62
+
63
+ ```ruby
64
+ packages = []
65
+ packages << {
66
+ :weight => {:units => "LB", :value => 2},
67
+ :dimensions => {:length => 10, :width => 5, :height => 4, :units => "IN" }
68
+ }
69
+ packages << {
70
+ :weight => {:units => "LB", :value => 6},
71
+ :dimensions => {:length => 5, :width => 5, :height => 4, :units => "IN" }
72
+ }
73
+ ```
74
+
75
+ By default packaging type is "YOUR PACKAGING" and the drop off type is "REGULAR PICKUP".
76
+ If you need something different you can pass an extra hash for shipping options.
77
+
78
+ ```ruby
79
+ shipping_options = {
80
+ :packaging_type => "YOUR_PACKAGING",
81
+ :drop_off_type => "REGULAR_PICKUP",
82
+ :special_services => []
83
+ }
84
+ ```
85
+
86
+ If you pass a non-nil `:return_reason` as part of the shipping options, you will create
87
+ a return shipment. The request to fedex will include the following additional XML.
88
+
89
+ ```xml
90
+ <SpecialServicesRequested>
91
+ <SpecialServiceTypes>RETURN_SHIPMENT</SpecialServiceTypes>
92
+ <ReturnShipmentDetail>
93
+ <ReturnType>PRINT_RETURN_LABEL</ReturnType>
94
+ <Rma>
95
+ <Reason>YOUR RETURN REASON HERE</Reason>
96
+ </Rma>
97
+ </ReturnShipmentDetail>
98
+ </SpecialServicesRequested>
99
+ ```
100
+
101
+ By default the shipping charges will be assigned to the sender. If you may
102
+ change this by passing an extra hash of payment options.
103
+
104
+ ```ruby
105
+ payment_options = {
106
+ :type => "THIRD_PARTY",
107
+ :account_number => "123456789",
108
+ :name => "Third Party Payor",
109
+ :company => "Company",
110
+ :phone_number => "555-555-5555",
111
+ :country_code => "US"
112
+ }
113
+ ```
114
+
115
+ Create a `FedexShip::Shipment` object using your FedEx credentials; mode should be
116
+ either production or development depending on what Fedex environment you want to use.
117
+
118
+ ```ruby
119
+ require 'fedex_ship'
120
+ fedex = FedexShip::Shipment.new(:key => 'xxx',
121
+ :password => 'xxxx',
122
+ :account_number => 'xxxx',
123
+ :meter => 'xxx',
124
+ :mode => 'production')
125
+ ```
126
+
127
+ ### ** Getting Shipping Rates **
128
+
129
+ To find a shipping rate:
130
+
131
+ ```ruby
132
+ rate = fedex.rate(:shipper=>shipper,
133
+ :recipient => recipient,
134
+ :packages => packages,
135
+ :service_type => "FEDEX_GROUND",
136
+ :customs_clearance_detail => {:customs_value => {:currency => "INR", :amount => invoice_amount}, :commercial_invoice => {:purpose => purpose}},
137
+ :shipping_options => shipping_options,
138
+ :carrier_code => 'FDXE',
139
+ :preferred_currency => "INR")
140
+ ```
141
+
142
+ Fedex provides multiple total values; `total_net_charge` is the final amount you are looking for.
143
+
144
+ ```ruby
145
+ $ rate.total_net_charge => "34.03"
146
+ # Complete response
147
+ $ <FedexShip::Rate:0x1019ba5f8
148
+ @total_net_charge="34.03",
149
+ @total_surcharges="1.93",
150
+ @total_billing_weight="8.0 LB",
151
+ @total_taxes="0.0",
152
+ @rate_type="PAYOR_ACCOUNT_PACKAGE",
153
+ @total_base_charge="32.1",
154
+ @total_freight_discounts=nil,
155
+ @total_net_freight="32.1",
156
+ @rate_zone="51">
157
+ ```
158
+ ### ** Create a shipment and Get a Transit time(please note this will generate a shipment in your Fedex account if you are using production mode) **
159
+ ```ruby
160
+ ship = fedex.ship(:shipper=>shipper,
161
+ :recipient => recipient,
162
+ :packages => packages,
163
+ :service_type => "FEDEX_GROUND",
164
+ :customs_clearance_detail => @customs_clearance_detail,
165
+ :mps => {:package_count => packages.length.to_s, :total_weight => total_weight.to_s, :sequence_number => '1'},
166
+ :total_insured_value => {:amount => "0", :currency => "INR"},
167
+ :commercial_invoice_options => {
168
+ :shipping_document_types => "COMMERCIAL_INVOICE",
169
+ :commercial_invoice_detail => {
170
+ :format => {
171
+ :image_type => "PDF",
172
+ :stock_type => "PAPER_LETTER",
173
+ :provide_instructions => "1"
174
+ }
175
+ }
176
+ },
177
+ :shipping_options => shipping_options,
178
+ :carrier_code => 'FDXE',
179
+ :preferred_currency => "INR")
180
+ puts ship[:completed_shipment_detail][:operational_detail][:transit_time]
181
+ ```
182
+ Above code will give you the transit time.
183
+
184
+ ### ** Generate a shipping label (PDF) **
185
+
186
+ To create a label for a shipment:
187
+
188
+ ```ruby
189
+ label = fedex.label(:filename => "my_dir/example.pdf",
190
+ :shipper=>shipper,
191
+ :recipient => recipient,
192
+ :packages => packages,
193
+ :service_type => "FEDEX_GROUND",
194
+ :shipping_options => shipping_options)
195
+ ```
196
+
197
+ ### ** Generate a shipping label in any available format **
198
+
199
+ Change the filename extension and pass a label_specification hash. For example:
200
+
201
+ ```ruby
202
+ example_spec = {
203
+ :image_type => "EPL2",
204
+ :label_stock_type => "STOCK_4X6"
205
+ }
206
+
207
+ label = fedex.label(:filename => "my_dir/example_epl2.pcx",
208
+ :shipper=>shipper,
209
+ :recipient => recipient,
210
+ :packages => packages,
211
+ :service_type => "FEDEX_GROUND",
212
+ :shipping_options => shipping_options,
213
+ :label_specification => example_spec)
214
+ ```
215
+ ### ** Storing a label on Amazon S3 with Paperclip **
216
+
217
+ This is useful when you need to store the labels for later use, and are hosting your application on [Heroku](http://www.heroku.com/) as they do not allow writing to the filesystem, save the `tmp` directory. With [Paperclip](https://github.com/thoughtbot/paperclip/) setup up on a shipment model:
218
+
219
+ ```ruby
220
+ label = fedex.label(:filename => "tmp/example_label.pdf",
221
+ :shipper=>shipper,
222
+ :recipient => recipient,
223
+ :packages => packages,
224
+ :service_type => "FEDEX_GROUND",
225
+ :shipping_options => shipping_options,
226
+ :label_specification => example_spec)
227
+ ```
228
+
229
+ Then attach the label to your Paperclip model:
230
+
231
+ ```ruby
232
+ shipment.fedex_label = label.file_name
233
+ shipment.save!
234
+ ```
235
+
236
+ Documentation for setting up Paperclip with Amazon S3 can be found in the Paperclip [README](https://github.com/thoughtbot/paperclip/#storage).
237
+
238
+ ### ** Generate shipping labels for multi-package shipments (MPS) **
239
+
240
+ 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.
241
+
242
+ Parameters for the first label:
243
+ ```ruby
244
+ label = fedex.label(
245
+ :filename => file_name,
246
+ :shipper => shipper,
247
+ :recipient => recipient,
248
+ :packages => packages,
249
+ :service_type => service_type,
250
+ :shipping_details => shipping_details,
251
+ :shipping_charges_payment => shipping_charges_payment,
252
+ :customs_clearance_detail => customs_clearance_detail,
253
+ :mps => {:package_count => package_count, :total_weight => total_weight, :sequence_number => '1'}
254
+ )
255
+ ```
256
+
257
+ Parameters for labels 2 through 'n':
258
+ ```ruby
259
+ fedex.label(
260
+ :filename => file_name,
261
+ :shipper => shipper,
262
+ :recipient => recipient,
263
+ :packages => packages,
264
+ :service_type => service_type,
265
+ :shipping_details => shipping_details,
266
+ :shipping_charges_payment => shipping_charges_payment,
267
+ :customs_clearance_detail => customs_clearance_detail,
268
+ :mps => {
269
+ :master_tracking_id => {:tracking_id_type => 'FEDEX', :tracking_number =>tracking_number},
270
+ :package_count => package_count,
271
+ :total_weight => {
272
+ :value => total_weight,
273
+ :units => 'KG'
274
+ }
275
+ :sequence_number => 'n'
276
+ }
277
+ )
278
+ ```
279
+
280
+ ### ** Create COD Shipment **
281
+
282
+ To create a Cash On Delivery label for a shipment:
283
+
284
+ change "commerical_invoice = {:purpose => 'SOLD'}" in customs_clearance_detail
285
+
286
+ add shipping_options with {:cod => {:currency => "currency", :amount => "amount", :collection_type => 'PAYMENT COLLECTION TYPE'}, :special_services => ["COD"] }
287
+
288
+ PAYMENT COLLECTION TYPE - CASH, CHEQUE, DEMAND DRAFT
289
+
290
+ ### ** To add multiple commodities in customs_clearance_detail
291
+
292
+ use this format commodities_1 .... commodities_N
293
+
294
+ example
295
+
296
+ ```
297
+ customer_references_package = [
298
+ {
299
+ :customer_reference_type => "CUSTOMER_REFERENCE",
300
+ :value => 'recipient_email'
301
+ }, {
302
+ :customer_reference_type => "INVOICE_NUMBER",
303
+ :value => "INV123456"
304
+ }, {
305
+ :customer_reference_type => "P_O_NUMBER",
306
+ :value => "OrderNumber123456"
307
+ }
308
+ ]
309
+
310
+ @customs_clearance_detail = {
311
+ :duties_payment => {
312
+ :payment_type => "SENDER",
313
+ :payor => {
314
+ :responsible_party => {
315
+ :account_number => @account_no,
316
+ :address => {
317
+ :country_code => "IN"
318
+ }
319
+ }
320
+ }
321
+ },
322
+ :document_content => "NON_DOCUMENTS",
323
+ :customs_value => {:currency => "INR", :amount => invoice_amount},
324
+ :commercial_invoice => {:purpose => purpose, :customer_references => customer_references_package
325
+ },
326
+ :commodites_1 => {
327
+ :number_of_pieces => "1",
328
+ :description => "desc....",
329
+ :country_of_manufacture => "IN",
330
+ :weight => {
331
+ :units => "KG",
332
+ :value => 1.5
333
+ },
334
+ :quantity => 2,
335
+ :quantity_units => "pieces",
336
+ :unit_price => {
337
+ :currency => "INR",
338
+ :amount => 100
339
+ }
340
+ }
341
+ :commodites_2 => {
342
+ ......
343
+ ......
344
+ ......
345
+ }
346
+ }
347
+
348
+ ```
349
+
350
+ ### ** Masking shipper details in label **
351
+
352
+ this allows you hide shipper details on the label
353
+
354
+ Add customer_specified_detail = {:masked_data_1 => 'SOMETHING', :masked_data_2 => 'SOMETHING'} in :label_specification key
355
+
356
+ Example
357
+
358
+ ```
359
+ customer_specified_detail = {
360
+ :masked_data_1 => "SHIPPER_ACCOUNT_NUMBER",
361
+ :masked_data_2 => "TRANSPORTATION_CHARGES_PAYOR_ACCOUNT_NUMBER",
362
+ :masked_data_3 => "DUTIES_AND_TAXES_PAYOR_ACCOUNT_NUMBER"
363
+ }
364
+
365
+ ```
366
+
367
+ ### ** Delete a shipment **
368
+
369
+ 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.
370
+
371
+ To delete a shipment:
372
+
373
+ ```ruby
374
+ fedex.delete(:tracking_number => "1234567890123")
375
+ ```
376
+
377
+ ### ** Tracking a shipment **
378
+
379
+ To track a shipment:
380
+
381
+ ```ruby
382
+ results = fedex.track(:tracking_number => "1234567890123")
383
+ # => [#<FedexShip::TrackingInformation>]
384
+
385
+ # Pull the first result from the returned array
386
+ #
387
+ tracking_info = results.first
388
+
389
+ tracking_info.tracking_number
390
+ # => "1234567890123"
391
+
392
+ tracking_info.status
393
+ # => "Delivered"
394
+
395
+ tracking_info.events.first.description
396
+ # => "On FedEx vehicle for delivery"
397
+ ```
398
+
399
+ ### ** Verifying an address **
400
+
401
+ To verify an address is valid and deliverable:
402
+
403
+ ```ruby
404
+
405
+ address = {
406
+ :street => "5 Elm Street",
407
+ :city => "Norwalk",
408
+ :state => "CT",
409
+ :postal_code => "06850",
410
+ :country => "USA"
411
+ }
412
+
413
+ address_result = fedex.validate_address(:address => address)
414
+
415
+ address_result.residential
416
+ # => true
417
+
418
+ address_result.score
419
+ # => 100
420
+
421
+ address_result.postal_code
422
+ # => "06850-3901"
423
+ ```
424
+
425
+ ### ** Requesting a Pickup **
426
+
427
+ To request a pickup:
428
+
429
+ ```ruby
430
+
431
+ pickup = fedex.pickup(:carrier_code => 'FDXE',
432
+ :packages => {:weight => {:units => "LB", :value => 10}, :count => 2},
433
+ :ready_timestamp => Date.today.to_datetime + 1.375,
434
+ :close_time => Date.today.to_time + 60 * 60 * 17,
435
+ :country_relationship => "DOMESTIC",
436
+ :pickup_location => shipper)
437
+ puts pickup[:pickup_confirmation_number]
438
+ ```
439
+
440
+ ### ** Getting pickup availability details **
441
+
442
+ To check for pickup availability:
443
+
444
+ ```ruby
445
+
446
+ dispatch = Date.tomorrow.strftime('%Y-%m-%d')
447
+
448
+ pickup_availability = fedex.pickup_availability(:country_code => 'IN',
449
+ :postal_code => '400061',
450
+ :request_type => 'FUTURE_DAY',
451
+ :dispatch_date => dispatch_date,
452
+ :carrier_code => 'FDXE')
453
+
454
+ puts pickup_availability[:options]
455
+ ```
456
+
457
+ ### ** Getting service availability **
458
+
459
+ To check service availability:
460
+
461
+ ```ruby
462
+
463
+ origin = {:postal_code => '400012', :country_code => 'IN'}
464
+ destination = { :postal_code => '400020', :country_code => 'IN'}
465
+ fedex_service_hash = {:origin => origin, :destination => destination, :ship_date => '2014-06-28', :carrier_code => 'FDXE'}
466
+
467
+ service = fedex.service_availability(fedex_service_hash)
468
+
469
+ puts service[:options]
470
+ ```
471
+
472
+ # Services/Options Available
473
+
474
+ ```ruby
475
+ FedexShip::Request::Base::SERVICE_TYPES
476
+ FedexShip::Request::Base::PACKAGING_TYPES
477
+ FedexShip::Request::Base::DROP_OFF_TYPES
478
+ FedexShip::Request::Base::CARRIER_CODES
479
+ ````
480
+
481
+ # Contributors:
482
+ - [shubhamsharma4587] (https://github.com/shubhamsharma4587) (Shubham Sharma)
483
+ - [jazminschroeder] (http://github.com/jazminschroeder) (Jazmin Schroeder)
484
+ - [parndt] (https://github.com/parndt) (Philip Arndt)
485
+ - [mmell] (https://github.com/mmell) (Michael Mell)
486
+ - [jordanbyron] (https://github.com/jordanbyron) (Jordan Byron)
487
+ - [geermc4] (https://github.com/geermc4) (German Garcia)
488
+ - [janders223] (https://github.com/janders223) (Jim Anders)
489
+ - [jlambert121] (https://github.com/jlambert121) (Justin Lambert)
490
+ - [sborsje] (https://github.com/sborsje) (Stefan Borsje)
491
+ - [bradediger] (https://github.com/bradediger) (Brad Ediger)
492
+ - [yevgenko] (https://github.com/yevgenko) (Yevgeniy Viktorov)
493
+ - [smartacus] (https://github.com/smartacus) (Michael Lippold)
494
+ - [jonathandean] (https://github.com/jonathandean) (Jonathan Dean)
495
+ - [chirag7jain] (https://github.com/chirag7jain) (Chirag Jain)
496
+ - and more... (https://github.com/jazminschroeder/fedex/graphs/contributors)