what3words 2.2.0 → 3.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.
- checksums.yaml +5 -5
- data/README.md +306 -72
- data/lib/what3words/api.rb +198 -144
- data/lib/what3words/version.rb +4 -1
- data/lib/what3words.rb +3 -1
- metadata +18 -30
- data/.editorconfig +0 -17
- data/.gitignore +0 -17
- data/.travis.yml +0 -7
- data/Gemfile +0 -2
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -12
- data/spec/config.sample.yaml +0 -1
- data/spec/lib/what3words/what3words_api_spec.rb +0 -150
- data/spec/spec_helper.rb +0 -7
- data/what3words.gemspec +0 -28
@@ -1,150 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
# rubocop:disable Metrics/LineLength
|
5
|
-
describe What3Words::API, 'integration', integration: true do # rubocop:disable Metrics/BlockLength
|
6
|
-
# rubocop:enable Metrics/LineLength
|
7
|
-
before(:all) do
|
8
|
-
WebMock.allow_net_connect!
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:api_key) { ENV['W3W_API_KEY'] }
|
12
|
-
|
13
|
-
let(:w3w) { described_class.new(key: api_key) }
|
14
|
-
|
15
|
-
it 'returns errors from API' do
|
16
|
-
badw3w = described_class.new(key: '')
|
17
|
-
expect { badw3w.forward 'prom.cape.pump' }
|
18
|
-
.to raise_error described_class::ResponseError
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'getting position' do
|
22
|
-
it 'works with string of 3 words separated by \'.\'' do
|
23
|
-
result = w3w.forward 'prom.cape.pump'
|
24
|
-
expect(result).to include(
|
25
|
-
words: 'prom.cape.pump',
|
26
|
-
language: 'en'
|
27
|
-
)
|
28
|
-
expect(result[:geometry]).to include(
|
29
|
-
lat: 51.484463,
|
30
|
-
lng: -0.195405
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'sends lang parameter for 3 words' do
|
35
|
-
result = w3w.forward 'prom.cape.pump', lang: 'fr'
|
36
|
-
expect(result).to include(
|
37
|
-
words: 'concevoir.époque.amasser',
|
38
|
-
language: 'fr'
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'checks 3 words format matches standard regex' do
|
43
|
-
expect { w3w.forward '1.cape.pump' }
|
44
|
-
.to raise_error described_class::WordError
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'gets 3 words' do
|
49
|
-
it 'from position' do
|
50
|
-
result = w3w.reverse [29.567041, 106.587875]
|
51
|
-
expect(result).to include(
|
52
|
-
words: 'disclose.strain.redefined',
|
53
|
-
language: 'en'
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'from position in fr' do
|
58
|
-
result = w3w.reverse [29.567041, 106.587875], lang: 'fr'
|
59
|
-
expect(result).to include(
|
60
|
-
words: 'courgette.rabotons.infrason',
|
61
|
-
language: 'fr'
|
62
|
-
)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
describe 'autosuggest' do
|
66
|
-
it 'simple addr' do
|
67
|
-
# result =
|
68
|
-
w3w.autosuggest 'trop.caler.perdre', 'fr'
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'with focus' do
|
72
|
-
# result =
|
73
|
-
w3w.autosuggest 'disclose.strain.redefin', 'en', [29.567041, 106.587875]
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'with clipping radius around focus' do
|
77
|
-
# result =
|
78
|
-
w3w.autosuggest 'disclose.strain.redefin', 'en', [29.567041, 106.587875],
|
79
|
-
'focus(10)'
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'arabic addr' do
|
83
|
-
# result =
|
84
|
-
w3w.autosuggest 'مربية.الصباح.المده', 'ar'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe 'autosuggest-ml' do
|
89
|
-
it '3 langs (result prefered de)' do
|
90
|
-
# result =
|
91
|
-
w3w.autosuggest_ml 'geschaft.planter.carciofi', 'de'
|
92
|
-
end
|
93
|
-
it '3 langs (result prefered fr)' do
|
94
|
-
# result =
|
95
|
-
w3w.autosuggest_ml 'geschaft.planter.carciofi', 'fr'
|
96
|
-
end
|
97
|
-
it '3 langs (result prefered it)' do
|
98
|
-
# result =
|
99
|
-
w3w.autosuggest_ml 'geschaft.planter.carciofi', 'it'
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe 'standardblend' do
|
104
|
-
it 'simple addr' do
|
105
|
-
# result =
|
106
|
-
w3w.standardblend 'trop.caler.perdre', 'fr'
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'with focus' do
|
110
|
-
# result =
|
111
|
-
w3w.standardblend 'disclose.strain.redefin', 'en', [29.567041, 106.587875]
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe 'standardblend-ml' do
|
116
|
-
it '3 langs (result prefered de)' do
|
117
|
-
# result =
|
118
|
-
w3w.standardblend_ml 'geschaft.planter.carciofi', 'de'
|
119
|
-
end
|
120
|
-
it '3 langs (result prefered fr)' do
|
121
|
-
# result =
|
122
|
-
w3w.standardblend_ml 'geschaft.planter.carciofi', 'fr'
|
123
|
-
end
|
124
|
-
it '3 langs (result prefered it)' do
|
125
|
-
# result =
|
126
|
-
w3w.standardblend_ml 'geschaft.planter.carciofi', 'it'
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe 'grid' do
|
131
|
-
it 'string input' do
|
132
|
-
# result =
|
133
|
-
w3w.grid '52.208867,0.117540,52.207988,0.116126'
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe 'languages' do
|
138
|
-
it 'gets all languages' do
|
139
|
-
# result =
|
140
|
-
w3w.languages
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe 'technical' do
|
145
|
-
it '\'s deep_symbolize_keys helper works' do
|
146
|
-
expect(w3w.deep_symbolize_keys('foo' => { 'bar' => true }))
|
147
|
-
.to eq(foo: { bar: true })
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/what3words.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'what3words/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'what3words'
|
9
|
-
spec.version = What3Words::VERSION
|
10
|
-
spec.authors = ['what3words']
|
11
|
-
spec.email = ['development@what3words.com']
|
12
|
-
spec.summary = 'what3words API wrapper in Ruby'
|
13
|
-
spec.homepage = 'http://rubygems.org/gems/what3words'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^spec/})
|
19
|
-
spec.require_paths = ['lib']
|
20
|
-
|
21
|
-
spec.add_dependency('rest-client', '>= 1.8', '< 3.0')
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '>= 1.7.9'
|
24
|
-
spec.add_development_dependency 'rake', '~> 11.1'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 3.4'
|
26
|
-
spec.add_development_dependency 'webmock', '~> 2.0'
|
27
|
-
spec.add_development_dependency 'rubocop', '~> 0.48.1'
|
28
|
-
end
|