bplgeo 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.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +32 -0
  3. data/lib/bplgeo/constants.rb +478 -0
  4. data/lib/bplgeo/geonames.rb +146 -0
  5. data/lib/bplgeo/parser.rb +227 -0
  6. data/lib/bplgeo/standardizer.rb +213 -0
  7. data/lib/bplgeo/tgn.rb +314 -0
  8. data/lib/bplgeo/town_lookup.rb +19 -0
  9. data/lib/bplgeo/version.rb +3 -0
  10. data/lib/bplgeo.rb +35 -0
  11. data/lib/tasks/bplgeo_tasks.rake +4 -0
  12. data/test/bplgeo_test.rb +102 -0
  13. data/test/dummy/README.rdoc +28 -0
  14. data/test/dummy/Rakefile +6 -0
  15. data/test/dummy/app/assets/javascripts/application.js +13 -0
  16. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  17. data/test/dummy/app/controllers/application_controller.rb +5 -0
  18. data/test/dummy/app/helpers/application_helper.rb +2 -0
  19. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/test/dummy/bin/bundle +3 -0
  21. data/test/dummy/bin/rails +4 -0
  22. data/test/dummy/bin/rake +4 -0
  23. data/test/dummy/config/application.rb +23 -0
  24. data/test/dummy/config/boot.rb +5 -0
  25. data/test/dummy/config/bplgeo.yml +23 -0
  26. data/test/dummy/config/bplgeo.yml.sample +24 -0
  27. data/test/dummy/config/database.yml +25 -0
  28. data/test/dummy/config/environment.rb +5 -0
  29. data/test/dummy/config/environments/development.rb +29 -0
  30. data/test/dummy/config/environments/production.rb +80 -0
  31. data/test/dummy/config/environments/test.rb +36 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  34. data/test/dummy/config/initializers/inflections.rb +16 -0
  35. data/test/dummy/config/initializers/mime_types.rb +5 -0
  36. data/test/dummy/config/initializers/secret_token.rb +12 -0
  37. data/test/dummy/config/initializers/session_store.rb +3 -0
  38. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  39. data/test/dummy/config/locales/en.yml +23 -0
  40. data/test/dummy/config/routes.rb +56 -0
  41. data/test/dummy/config.ru +4 -0
  42. data/test/dummy/db/test.sqlite3 +0 -0
  43. data/test/dummy/log/development.log +35 -0
  44. data/test/dummy/public/404.html +58 -0
  45. data/test/dummy/public/422.html +58 -0
  46. data/test/dummy/public/500.html +57 -0
  47. data/test/dummy/public/favicon.ico +0 -0
  48. data/test/geonames_test.rb +24 -0
  49. data/test/parser_test.rb +33 -0
  50. data/test/test_helper.rb +15 -0
  51. data/test/tgn_test.rb +19 -0
  52. data/test/town_lookup_test.rb +11 -0
  53. metadata +236 -0
data/test/tgn_test.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ class TGNTest < ActiveSupport::TestCase
4
+ def test_tgn_lookup_from_id
5
+ if Bplgeo::TGN.getty_username != '<username>'
6
+ result = Bplgeo::TGN.get_tgn_data('2051159')
7
+
8
+ assert_equal '45', result[:coords][:latitude]
9
+ assert_equal '-84.1333', result[:coords][:longitude]
10
+ assert_equal '45,-84.1333', result[:coords][:combined]
11
+ assert_equal 'Atlanta', result[:hier_geo][:city]
12
+ assert_equal 'Montmorency', result[:hier_geo][:county]
13
+ assert_equal 'Michigan', result[:hier_geo][:state]
14
+ assert_equal 'United States', result[:hier_geo][:country]
15
+ assert_equal 'North and Central America', result[:hier_geo][:continent]
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class TownLookupTest < ActiveSupport::TestCase
4
+ def test_MA_lookup
5
+ result = Bplgeo::TownLookup.state_town_lookup('MA', "This test was written in Boston, MA.")
6
+ assert_equal '7013445', result
7
+
8
+ #result = Bplgeo::TownLookup.state_town_lookup('MA', "This test was written in East Boston, MA.")
9
+ #assert_equal '7015009', result
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bplgeo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Boston Public Library
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: countries
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: geocoder
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: unidecoder
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: typhoeus
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Parse string for potential geographic matches and return that data along
112
+ with the TGN ID and Geonames ID.
113
+ email:
114
+ - sanderson@bpl.org
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - lib/tasks/bplgeo_tasks.rake
120
+ - lib/bplgeo.rb
121
+ - lib/bplgeo/tgn.rb
122
+ - lib/bplgeo/town_lookup.rb
123
+ - lib/bplgeo/geonames.rb
124
+ - lib/bplgeo/constants.rb
125
+ - lib/bplgeo/version.rb
126
+ - lib/bplgeo/standardizer.rb
127
+ - lib/bplgeo/parser.rb
128
+ - Rakefile
129
+ - test/bplgeo_test.rb
130
+ - test/dummy/Rakefile
131
+ - test/dummy/config.ru
132
+ - test/dummy/public/500.html
133
+ - test/dummy/public/404.html
134
+ - test/dummy/public/422.html
135
+ - test/dummy/public/favicon.ico
136
+ - test/dummy/config/database.yml
137
+ - test/dummy/config/initializers/secret_token.rb
138
+ - test/dummy/config/initializers/filter_parameter_logging.rb
139
+ - test/dummy/config/initializers/backtrace_silencers.rb
140
+ - test/dummy/config/initializers/wrap_parameters.rb
141
+ - test/dummy/config/initializers/mime_types.rb
142
+ - test/dummy/config/initializers/session_store.rb
143
+ - test/dummy/config/initializers/inflections.rb
144
+ - test/dummy/config/locales/en.yml
145
+ - test/dummy/config/routes.rb
146
+ - test/dummy/config/bplgeo.yml.sample
147
+ - test/dummy/config/boot.rb
148
+ - test/dummy/config/environment.rb
149
+ - test/dummy/config/environments/development.rb
150
+ - test/dummy/config/environments/test.rb
151
+ - test/dummy/config/environments/production.rb
152
+ - test/dummy/config/application.rb
153
+ - test/dummy/config/bplgeo.yml
154
+ - test/dummy/db/test.sqlite3
155
+ - test/dummy/app/views/layouts/application.html.erb
156
+ - test/dummy/app/helpers/application_helper.rb
157
+ - test/dummy/app/controllers/application_controller.rb
158
+ - test/dummy/app/assets/javascripts/application.js
159
+ - test/dummy/app/assets/stylesheets/application.css
160
+ - test/dummy/bin/rails
161
+ - test/dummy/bin/bundle
162
+ - test/dummy/bin/rake
163
+ - test/dummy/log/development.log
164
+ - test/dummy/README.rdoc
165
+ - test/test_helper.rb
166
+ - test/tgn_test.rb
167
+ - test/town_lookup_test.rb
168
+ - test/parser_test.rb
169
+ - test/geonames_test.rb
170
+ homepage: http://www.bpl.org
171
+ licenses: []
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 2.0.3
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: Parse string for potential geographic matches and return that data along
193
+ with the TGN ID and Geonames ID.
194
+ test_files:
195
+ - test/bplgeo_test.rb
196
+ - test/dummy/Rakefile
197
+ - test/dummy/config.ru
198
+ - test/dummy/public/500.html
199
+ - test/dummy/public/404.html
200
+ - test/dummy/public/422.html
201
+ - test/dummy/public/favicon.ico
202
+ - test/dummy/config/database.yml
203
+ - test/dummy/config/initializers/secret_token.rb
204
+ - test/dummy/config/initializers/filter_parameter_logging.rb
205
+ - test/dummy/config/initializers/backtrace_silencers.rb
206
+ - test/dummy/config/initializers/wrap_parameters.rb
207
+ - test/dummy/config/initializers/mime_types.rb
208
+ - test/dummy/config/initializers/session_store.rb
209
+ - test/dummy/config/initializers/inflections.rb
210
+ - test/dummy/config/locales/en.yml
211
+ - test/dummy/config/routes.rb
212
+ - test/dummy/config/bplgeo.yml.sample
213
+ - test/dummy/config/boot.rb
214
+ - test/dummy/config/environment.rb
215
+ - test/dummy/config/environments/development.rb
216
+ - test/dummy/config/environments/test.rb
217
+ - test/dummy/config/environments/production.rb
218
+ - test/dummy/config/application.rb
219
+ - test/dummy/config/bplgeo.yml
220
+ - test/dummy/db/test.sqlite3
221
+ - test/dummy/app/views/layouts/application.html.erb
222
+ - test/dummy/app/helpers/application_helper.rb
223
+ - test/dummy/app/controllers/application_controller.rb
224
+ - test/dummy/app/assets/javascripts/application.js
225
+ - test/dummy/app/assets/stylesheets/application.css
226
+ - test/dummy/bin/rails
227
+ - test/dummy/bin/bundle
228
+ - test/dummy/bin/rake
229
+ - test/dummy/log/development.log
230
+ - test/dummy/README.rdoc
231
+ - test/test_helper.rb
232
+ - test/tgn_test.rb
233
+ - test/town_lookup_test.rb
234
+ - test/parser_test.rb
235
+ - test/geonames_test.rb
236
+ has_rdoc: