un_locode 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3793656f2e8a019e5f31026caac9967ec35946e5
4
+ data.tar.gz: 62959bd158236bde648d9a68a690adaf3d53ba20
5
+ SHA512:
6
+ metadata.gz: c21c0b8702f0d0e70846d08cdc91c55340510c4d70ecb4780b74a8671d2640e6fe73c8a472a08f39bc89e4246bdb571544ec8f75404eb76be1192426366323e1
7
+ data.tar.gz: f6437cc441506e37f35987c02d7a4344b31adc4f9853b79a19d31bfedd5982341abe65771e8c6caa2b1d61058187333d2a06dfd49bf86635b73cded7f010b9c4
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ *.iml
20
+ .rakeTasks
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in un_locode.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Michel de Graaf
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Locode
2
+
3
+ The Locode gem gives you the ability to lookup UN/LOCODE codes. You can read more about the UN/LOCODE specifications here: [wiki](http://en.wikipedia.org/wiki/UN/LOCODE).
4
+
5
+ All data used by this gem has been taken from the *UN Centre for Trade Facilitation and E-business* official website. **No guarantees for the accuracy or up-to-dateness are given.**
6
+
7
+ `http://www.unece.org/cefact/locode/welcome.html` and `http://www.unece.org/cefact/codesfortrade/codes_index.html`
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'un_locode'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install un_locode
22
+
23
+ ## Usage
24
+
25
+ Find locations whose name is like the supplied search string. The search is case insensitive and also tries to match
26
+ location name without diacritics (and also alternative names when available). By default the amount of locations
27
+ returned are 10 but you can override this value by passing a number as second argument.
28
+
29
+ UnLocode::Locode.find_by_fuzzy_name('Göte', 5)
30
+ #=> [#<UnLocode::Locode city_code: "GOT", name: "Göteborg", ...
31
+
32
+
33
+ Same search mechanisms as above but filter by function. You can find a list of possible functions @ UnLocode::FUNCTIONS.
34
+ Like above you can limit the query result.
35
+
36
+ UnLocode::Locode.find_by_name_and_function('US', :port)
37
+ #=> [<UnLocode::Locode: city_code: "GOT", name: ">,>
38
+ <UnLocode::Locode: 'US LAX'>, ... ]
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require './data/locode_data_update'
3
+ require 'benchmark'
4
+
5
+ desc 'Update the datasource of the gem from csv files'
6
+ task :dataupdate do
7
+ puts 'updating data'
8
+ puts Benchmark.measure { LocodeDataUpdate.parse }
9
+ puts 'end of data update'
10
+ end