what3words 2.0.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 55fd336afb4874c96702060ac0e07eff723e8ca8
4
- data.tar.gz: 06acf5049cd02703cafc219e2ab747d3462b525e
2
+ SHA256:
3
+ metadata.gz: a4a3183f709f4e5dedca75618f0a486d62f6e4d99f1e2d8709a1cc16837fefa8
4
+ data.tar.gz: 0700e12fafc5949b57f03bb750f2c01efc86a2df198eca6dc71b36472957f561
5
5
  SHA512:
6
- metadata.gz: 01ae762ff9fc1770d9f57d207f32b1c55bdd26885bcc64adaa4e7062965b85370740234e9856b2ac96f8484b07482f3f43f88459b22b9cfe014a78f41cc2349c
7
- data.tar.gz: 372592b00b3ca32b622e007bddac5dc50d248d4ea49578da2eefec0cd3adeb5a13a1dee39fff6618084bc6c38acd7ee1f00a35890e17f44e1bfc3b8b225851dc
6
+ metadata.gz: 05f7639c6f66e11eb961629696cea9b6f79ea2d1df3ccf4eaf0fb061b2e247ce806d5cf9e0abe94f92ce04b3acefc83ee4179c91c54a1fc3f171fd37fa22c1d0
7
+ data.tar.gz: 1559cbe46257ab28cf6a97b08c52a4ffc47544e3e71a6215e845d36246b79845e08afcb783478a8ba08cf399cabc9e2abba995f9b410380cc2a34a2820a765da
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
4
- script: rake spec
3
+ - 2.4
4
+ script: rake rubocop spec
5
5
  notifications:
6
6
  slack:
7
7
  secure: DvejcrOH6RdAdrGEPLUrnia9cES8iCHVlVSFAMwx2vaR/I3T9bfUiHnb3VHfiqx4cvDL+9wT3opG0sZkUCFJGqzA3E//VObKNXjwUFCUptFG68qgR7LZ3vDatWlUqU+32gWeYaHM3FpNP2E/IARjphaiF3jRUZbronqVzJZN2MbMsUYBeGq7v0AaLkgbxVgOWtBnMVcBPOnarEJqHyJlqQ2unYnIy+GNoOFtPMPNZobYTf0zxrycldYpP937yT4CTsY3I7RxuEtnY2sPYW+eFBESGLg6EfnjeOruROY+b9cSHIh1Qzr7Oup6a+oQ3+vCvLbYsGpEO04RTeTTtOGc7aRlUylmvuFPi7qQwOTZ+4KD5aIBh4p7bQiPfvAeqDU4pVJxPHHZirgjFpUpAvofj48SvDgwX9cFyAhAlDZ9qBOctmhphW9KNkcAW4MY421AdVAjFWwc5CU8G5oPdKcyWam3ZB3nHwKgZm6LLAcZgbG0rjZT+iPeQBvTKH3kPx7E1CkxZNkEralHJ3l+bDwY3GdzsgcMpT3bWNl3pLszFzgXljDScMU8my1+xjDQINEnI3TCJA4MhKkzYkRgfrEBkgPb2SiF7qnhbyMzSFbCU4jsM1MLQZolNG9EsjsxJLuL4YTC2wKOHajViUUeaCNIcNU5UXBQuit93RyMu7RrLRM=
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
  gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 What3Words Limited
1
+ Copyright (c) 2016, 2017 What3Words Limited
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,71 +1,94 @@
1
1
  # <img src="https://what3words.com/assets/images/w3w_square_red.png" width="32" height="32" alt="what3words">&nbsp;what3words Ruby wrapper
2
- ![Build Status](https://travis-ci.org/what3words/w3w-ruby-wrapper.svg?branch=master)
3
2
 
4
- Use the what3words API in your Ruby app (see http://developer.what3words.com/api)
3
+ [![Build Status](https://travis-ci.org/what3words/w3w-ruby-wrapper.svg?branch=master)](https://travis-ci.org/what3words/w3w-ruby-wrapper)
4
+
5
+ The Ruby wrapper is useful for Ruby developers who wish to seamlessly integrate the [what3words Public API](https://developer.what3words.com/public-api) into their Ruby applications, without the hassle of having to manage the low level API calls themselves.
6
+
7
+ The what3words API is a fast, simple interface which allows you to convert 3 word addresses such as `///index.home.raft` to latitude and longitude coordinates such as `-0.203586, 51.521251` and vice versa. It features a powerful autosuggest function, which can validate and autocorrect user input and limit it to certain geographic areas (this powers the search box on our map site). It allows you to request a section of the what3words grid (which can be requested as GeoJSON for easy display on online maps), and to request the list of all languages supported by what3words. For advanced users, autosuggest can be used to post-process voice output.
8
+
9
+ All coordinates are latitude,longitude pairs in standard `WGS-84` (as commonly used worldwide in GPS systems). All latitudes must be in the range of `-90 to 90 (inclusive)`.
5
10
 
6
11
  ## Installation
7
12
 
8
- Add this line to your application's Gemfile:
13
+ The library is available through [RubyGems](https://rubygems.org/gems/what3words).
9
14
 
10
- gem 'what3words', '~> 2.0'
15
+ You can simply add this line to your application's Gemfile:
16
+
17
+ ```
18
+ gem 'what3words', '~> 3.0'
19
+ ```
11
20
 
12
21
  And then execute:
13
22
 
23
+ ```shell
14
24
  $ bundle
25
+ ```
15
26
 
16
27
  Or install it yourself as:
17
28
 
29
+ ```shell
18
30
  $ gem install what3words
31
+ ```
19
32
 
20
33
  ## Usage
21
34
 
22
- Sign up for an API key at http://developer.what3words.com
35
+ Sign up for an API key at [https://developer.what3words.com](https://developer.what3words.com)
23
36
 
24
- See https://docs.what3words.com/api/v2/ for all parameters that can be
25
- passed to the API calls
37
+ See [https://developer.what3words.com/public-api/docs](https://developer.what3words.com/public-api/docs) for all parameters that can be passed to the API calls.
26
38
 
27
39
  If not using Bundler, require it:
28
40
 
29
- require "what3words"
41
+ ```ruby
42
+ require 'what3words'
43
+ ```
30
44
 
31
45
  Then:
32
46
 
47
+ ```ruby
33
48
  what3words = What3Words::API.new(:key => "YOURAPIKEY")
49
+ ```
34
50
 
35
- Forward Geocode : convert a 3 word address into GPS coordinates (WGS-84)
51
+ Convert to Coordinates: convert a 3 word address into GPS coordinates (WGS84)
36
52
 
37
- what3words.forward "prom.cape.pump"
38
- # => {:crs=>{:properties=>{:type=>"ogcwkt", :href=>"http://spatialreference.org/ref/epsg/4326/ogcwkt/"}, :type=>"link"}, :bounds=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :words=>"prom.cape.pump", :map=>"http://w3w.co/prom.cape.pump", :language=>"en", :geometry=>{:lng=>-0.195405, :lat=>51.484463}, :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
53
+ ```ruby
54
+ what3words.convert_to_coordinates 'prom.cape.pump'
55
+ # => {:country=>"GB", :square=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :nearestPlace=>"Kensington, London", :coordinates=>{:lng=>-0.195405, :lat=>51.484463}, :words=>"prom.cape.pump", :language=>"en", :map=>"https://w3w.co/prom.cape.pump"}
56
+ ```
39
57
 
40
58
  ## API
41
- ### Forward Geocoding
42
- Convert a 3 word address into GPS coordinates and return 3 words for the same position in a different language
59
+ ### Convert to Coordinates
60
+ Convert a 3 word address into GPS coordinates and return 3 words for the same position.
43
61
 
44
- what3words.forward "prom.cape.pump", :lang => "fr"
45
- # => {:crs=>{:properties=>{:type=>"ogcwkt", :href=>"http://spatialreference.org/ref/epsg/4326/ogcwkt/"}, :type=>"link"}, :bounds=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :words=>"concevoir.époque.amasser", :map=>"http://w3w.co/concevoir.époque.amasser", :language=>"fr", :geometry=>{:lng=>-0.195405, :lat=>51.484463}, :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
62
+ ```ruby
63
+ what3words.convert_to_coordinates "prom.cape.pump"
64
+ # => {:country=>"GB", :square=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :nearestPlace=>"Kensington, London", :coordinates=>{:lng=>-0.195405, :lat=>51.484463}, :words=>"prom.cape.pump", :language=>"en", :map=>"https://w3w.co/prom.cape.pump"}
65
+ ```
66
+ Supported keyword params for `convert_to_coordinates` call:
46
67
 
47
- Supported keyword params for `forward` call:
68
+ * `words` A 3 word address as a string
69
+ * `format` Return data format type. It can be one of json (the default) or geojson
48
70
 
49
- * `lang` (defaults to language of 3 words) - optional language code (only use this if you want to return 3 words in a different language to the language submitted)
50
- * `format` Return data format type; can be one of json (the default), geojson or xml
51
- * `display` Return display type; can be one of full (the default) or terse
52
71
 
53
- ### Reverse Geocoding
54
- Reverse Geocode : Convert position(latitude) information to a 3 word address
72
+ ### Convert to 3WA
73
+ Convert position information, latitude and longitude coordinates, into a 3 word address.
55
74
 
56
- what3words.reverse [51.484463, -0.195405]
57
- # => {:crs=>{:properties=>{:type=>"ogcwkt", :href=>"http://spatialreference.org/ref/epsg/4326/ogcwkt/"}, :type=>"link"}, :bounds=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :words=>"prom.cape.pump", :map=>"http://w3w.co/prom.cape.pump", :language=>"en", :geometry=>{:lng=>-0.195405, :lat=>51.484463}, :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
75
+ ```ruby
76
+ what3words.convert_to_3wa [29.567041, 106.587875]
77
+ # => {:country=>"CN", :square=>{:southwest=>{:lng=>106.58786, :lat=>29.567028}, :northeast=>{:lng=>106.587891, :lat=>29.567055}}, :nearestPlace=>"Chongqing", :coordinates=>{:lng=>106.587875, :lat=>29.567041}, :words=>"disclose.strain.redefined", :language=>"en", :map=>"https://w3w.co/disclose.strain.redefined"}
78
+ ```
58
79
 
59
80
  Convert position information to a 3 word address in a specific language
60
81
 
61
- what3words.reverse [51.484463, -0.195405], :lang => :fr
62
- # => {:crs=>{:properties=>{:type=>"ogcwkt", :href=>"http://spatialreference.org/ref/epsg/4326/ogcwkt/"}, :type=>"link"}, :bounds=>{:southwest=>{:lng=>-0.195426, :lat=>51.484449}, :northeast=>{:lng=>-0.195383, :lat=>51.484476}}, :words=>"concevoir.époque.amasser", :map=>"http://w3w.co/concevoir.époque.amasser", :language=>"fr", :geometry=>{:lng=>-0.195405, :lat=>51.484463}, :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
82
+ ```ruby
83
+ what3words.convert_to_3wa [29.567041, 106.587875], language: 'fr'
84
+ # => :country=>"CN", :square=>{:southwest=>{:lng=>106.58786, :lat=>29.567028}, :northeast=>{:lng=>106.587891, :lat=>29.567055}}, :nearestPlace=>"Chongqing", :coordinates=>{:lng=>106.587875, :lat=>29.567041}, :words=>"courgette.rabotons.infrason", :language=>"fr", :map=>"https://w3w.co/courgette.rabotons.infrason"}
85
+ ```
63
86
 
64
- Supported keyword params for `reverse` call:
87
+ Supported keyword params for `convert_to_3wa` call:
65
88
 
66
- * `lang` (defaults to en) - optional language code
67
- * `format` Return data format type; can be one of json (the default), geojson or xml
68
- * `display` Return display type; can be one of full (the default) or terse
89
+ * `coordinates` The coordinates of the location to convert to 3 word address
90
+ * `language` (defaults to en) - A supported 3 word address language as an ISO 639-1 2 letter code
91
+ * `format` Return data format type. It can be one of json (the default) or geojson
69
92
 
70
93
  ### Autosuggest
71
94
  Returns a list of 3 word addresses based on user input and other parameters.
@@ -78,73 +101,156 @@ This resource provides corrections for the following types of input error:
78
101
 
79
102
  The autosuggest resource determines possible corrections to the supplied 3 word address string based on the probability of the input errors listed above and returns a ranked list of suggestions. This resource can also take into consideration the geographic proximity of possible corrections to a given location to further improve the suggestions returned.
80
103
 
81
- see https://docs.what3words.com/api/v2/#autosuggest for detailed information
104
+ See [https://developer.what3words.com/public-api/docs#autosuggest](https://developer.what3words.com/public-api/docs#autosuggest) for detailed information
82
105
 
83
- Gets suggestions in italian for this address
106
+ Gets suggestions in french for this address:
84
107
 
85
- what3words.autosuggest "trovò.calore.perder", "it"
86
- # => {:suggestions=>[{:score=>12, :country=>"ma", :words=>"trovò.calore.perdere", :rank=>1, :geometry=>{:lng=>-6.665638, :lat=>34.318065}, :place=>"Kenitra, Gharb-Chrarda-Beni Hssen"}, {:score=>12, :country=>"ca", :words=>"trovò.calore.perderò", :rank=>2, :geometry=>{:lng=>-65.036149, :lat=>45.846472}, :place=>"Salisbury, New Brunswick"}, {:score=>17, :country=>"ve", :words=>"trovò.calore.prede", :rank=>3, :geometry=>{:lng=>-70.280645, :lat=>7.24527}, :place=>"Guasdualito, Apure"}], :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
108
+ ```ruby
109
+ what3words.autosuggest 'trop.caler.perdre', language: 'fr'
110
+ # => {:suggestions=>[{:country=>"FR", :nearestPlace=>"Saint-Lary-Soulan, Hautes-Pyrénées", :words=>"trier.caler.perdre", :rank=>1, :language=>"fr"}, {:country=>"ET", :nearestPlace=>"Asbe Teferi, Oromiya", :words=>"trôler.caler.perdre", :rank=>2, :language=>"fr"}, {:country=>"CN", :nearestPlace=>"Ulanhot, Inner Mongolia", :words=>"froc.caler.perdre", :rank=>3, :language=>"fr"}]}
111
+ ```
87
112
 
88
- Supported keyword params for `autosuggest` call:
89
- * `format` Return data format type; can be one of json (the default), geojson or xml
90
- * `display` Return display type; can be one of full (the default) or terse
113
+ Gets suggestions for a different number of suggestions, i.e. 10 for this address:
114
+
115
+ ```ruby
116
+ what3words.autosuggest 'disclose.strain.redefin', language: 'en', 'n-results': 10
117
+ # => {:suggestions=>[{:country=>"SO", :nearestPlace=>"Jamaame, Lower Juba", :words=>"disclose.strain.redefine", :rank=>1, :language=>"en"}, {:country=>"ZW", :nearestPlace=>"Mutoko, Mashonaland East", :words=>"discloses.strain.redefine", :rank=>2, :language=>"en"}, {:country=>"MM", :nearestPlace=>"Mogok, Mandalay", :words=>"disclose.strains.redefine", :rank=>3, :language=>"en"}, {:country=>"CN", :nearestPlace=>"Chongqing", :words=>"disclose.strain.redefined", :rank=>4, :language=>"en"}, {:country=>"ZM", :nearestPlace=>"Binga, Matabeleland North", :words=>"disclosing.strain.redefine", :rank=>5, :language=>"en"}, {:country=>"XH", :nearestPlace=>"Leh, Ladakh", :words=>"disclose.straining.redefine", :rank=>6, :language=>"en"}, {:country=>"US", :nearestPlace=>"Kamas, Utah", :words=>"disclose.strain.redefining", :rank=>7, :language=>"en"}, {:country=>"GN", :nearestPlace=>"Boké", :words=>"disclose.strained.redefine", :rank=>8, :language=>"en"}, {:country=>"BO", :nearestPlace=>"Pailón, Santa Cruz", :words=>"discloses.strains.redefine", :rank=>9, :language=>"en"}, {:country=>"US", :nearestPlace=>"McGrath, Alaska", :words=>"discloses.strain.redefined", :rank=>10, :language=>"en"}]}
118
+ ```
119
+
120
+ Gets suggestions for a different number of focus results for this address:
121
+
122
+ ```ruby
123
+ what3words.autosuggest 'disclose.strain.redefin', language: 'en', 'n-focus-results': 3
124
+ # => {:suggestions=>[{:country=>"SO", :nearestPlace=>"Jamaame, Lower Juba", :words=>"disclose.strain.redefine", :rank=>1, :language=>"en"}, {:country=>"ZW", :nearestPlace=>"Mutoko, Mashonaland East", :words=>"discloses.strain.redefine", :rank=>2, :language=>"en"}, {:country=>"MM", :nearestPlace=>"Mogok, Mandalay", :words=>"disclose.strains.redefine", :rank=>3, :language=>"en"}]}
125
+ ```
126
+
127
+ Gets suggestions for a voice input type mode, i.e. generic-voice, for this address:
128
+
129
+ ```ruby
130
+ what3words.autosuggest 'fun with code', 'input-type': 'generic-voice', language: 'en'
131
+ # => {:suggestions=>[{:country=>"US", :nearestPlace=>"Homer, Alaska", :words=>"fund.with.code", :rank=>1, :language=>"en"}, {:country=>"AU", :nearestPlace=>"Kumpupintil, Western Australia", :words=>"funk.with.code", :rank=>2, :language=>"en"}, {:country=>"US", :nearestPlace=>"Charleston, West Virginia", :words=>"fund.with.cove", :rank=>3, :language=>"en"}]}
132
+ ```
133
+
134
+ Gets suggestions for a restricted area by clipping to conutry for this address:
135
+
136
+ ```ruby
137
+ what3words.autosuggest 'disclose.strain.redefin', 'clip-to-country': 'GB,BE'
138
+ # => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Nether Stowey, Somerset", :words=>"disclose.retrain.redefined", :rank=>1, :language=>"en"}, {:country=>"BE", :nearestPlace=>"Zemst, Flanders", :words=>"disclose.strain.reckon", :rank=>2, :language=>"en"}, {:country=>"GB", :nearestPlace=>"Waddington, Lincolnshire", :words=>"discloses.trains.redefined", :rank=>3, :language=>"en"}]}
139
+ ```
91
140
 
92
- ### Standardblend
93
- Returns a blend of the three most relevant 3 word address candidates for a given location, based on a full or partial 3 word address.
141
+ Gets suggestions for a restricted area by clipping to a bounding-box for this address:
142
+
143
+ ```ruby
144
+ what3words.autosuggest 'disclose.strain.redefin', 'clip-to-bounding-box': [51.521, -0.343, 52.6, 2.3324]
145
+ # => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Saxmundham, Suffolk", :words=>"discloses.strain.reddish", :rank=>1, :language=>"en"}]}
146
+ ```
94
147
 
95
- The specified 3 word address may either be a full 3 word address or a partial 3 word address containing the first 2 words in full and at least 1 character of the 3rd word. The standardblend resource provides the search logic that powers the search box on map.what3words.com and in the what3words mobile apps.
96
148
 
97
- see https://docs.what3words.com/api/v2/#standardblend for detailed information
149
+ Gets suggestions for a restricted area by clipping to a circle in km for this address:
150
+
151
+ ```ruby
152
+ what3words.autosuggest 'disclose.strain.redefin', 'clip-to-circle': [51.521, -0.343, 142]
153
+ # => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Market Harborough, Leicestershire", :words=>"discloses.strain.reduce", :rank=>1, :language=>"en"}]}
154
+ ```
155
+
156
+ Gets suggestions for a restricted area by clipping to a polygon for this address:
157
+
158
+ ```ruby
159
+ what3words.autosuggest 'disclose.strain.redefin', 'clip-to-polygon': [51.521, -0.343, 52.6, 2.3324, 54.234, 8.343, 51.521, -0.343]
160
+ # => {:suggestions=>[{:country=>"GB", :nearestPlace=>"Saxmundham, Suffolk", :words=>"discloses.strain.reddish", :rank=>1, :language=>"en"}]}
161
+ ```
98
162
 
99
- Gets blends in italian for this address
163
+ Gets suggestions for a restricted area by clipping to a polygon for this address:
100
164
 
101
- what3words.standardblend "trovò.calore.perder", "it"
102
- # => {:blends=>[{:country=>"ma", :words=>"trovò.calore.perdere", :rank=>1, :language=>"it", :geometry=>{:lng=>-6.665638, :lat=>34.318065}, :place=>"Kenitra, Gharb-Chrarda-Beni Hssen"}, {:country=>"ca", :words=>"trovò.calore.perderò", :rank=>2, :language=>"it", :geometry=>{:lng=>-65.036149, :lat=>45.846472}, :place=>"Salisbury, New Brunswick"}, {:country=>"ve", :words=>"trovò.calore.prede", :rank=>3, :language=>"it", :geometry=>{:lng=>-70.280645, :lat=>7.24527}, :place=>"Guasdualito, Apure"}], :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
165
+ ```ruby
166
+ what3words.w3w.autosuggest 'disclose.strain.redefin', 'prefer-land': false, 'n-results': 10
167
+ # => {:suggestions=>[{:country=>"SO", :nearestPlace=>"Jamaame, Lower Juba", :words=>"disclose.strain.redefine", :rank=>1, :language=>"en"}, {:country=>"ZW", :nearestPlace=>"Mutoko, Mashonaland East", :words=>"discloses.strain.redefine", :rank=>2, :language=>"en"}, {:country=>"MM", :nearestPlace=>"Mogok, Mandalay", :words=>"disclose.strains.redefine", :rank=>3, :language=>"en"}, {:country=>"CN", :nearestPlace=>"Chongqing", :words=>"disclose.strain.redefined", :rank=>4, :language=>"en"}, {:country=>"ZM", :nearestPlace=>"Binga, Matabeleland North", :words=>"disclosing.strain.redefine", :rank=>5, :language=>"en"}, {:country=>"XH", :nearestPlace=>"Leh, Ladakh", :words=>"disclose.straining.redefine", :rank=>6, :language=>"en"}, {:country=>"US", :nearestPlace=>"Kamas, Utah", :words=>"disclose.strain.redefining", :rank=>7, :language=>"en"}, {:country=>"GN", :nearestPlace=>"Boké", :words=>"disclose.strained.redefine", :rank=>8, :language=>"en"}, {:country=>"BO", :nearestPlace=>"Pailón, Santa Cruz", :words=>"discloses.strains.redefine", :rank=>9, :language=>"en"}, {:country=>"US", :nearestPlace=>"McGrath, Alaska", :words=>"discloses.strain.redefined", :rank=>10, :language=>"en"}]}
168
+ ```
103
169
 
104
- Supported keyword params for `standardblend` call:
105
- * `format` Return data format type; can be one of json (the default), geojson or xml
106
- * `display` Return display type; can be one of full (the default) or terse
170
+ Supported keyword params for `autosuggest` call:
171
+ * `input` The full or partial 3 word address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word.
172
+ * `language` A supported 3 word address language as an ISO 639-1 2 letter code. This setting is on by default. Use false to disable this setting and receive more suggestions in the sea.
173
+ * `n_results` The number of AutoSuggest results to return. A maximum of 100 results can be specified, if a number greater than this is requested, this will be truncated to the maximum. The default is 3.
174
+ * `n_focus_results` Specifies the number of results (must be <= n_results) within the results set which will have a focus. Defaults to n_results. This allows you to run autosuggest with a mix of focussed and unfocussed results, to give you a "blend" of the two.
175
+ * `clip-to-country` Restricts autosuggest to only return results inside the countries specified by comma-separated list of uppercase ISO 3166-1 alpha-2 country codes (for example, to restrict to Belgium and the UK, use clip_to_country="GB,BE").
176
+ * `clip-to-bounding-box` Restrict autosuggest results to a bounding box, specified by coordinates.
177
+ * `clip-to-circle` Restrict autosuggest results to a circle, specified by the center of the circle, latitude and longitude, and a distance in kilometres which represents the radius. For convenience, longitude is allowed to wrap around 180 degrees. For example 181 is equivalent to -179.
178
+ * `clip-to-polygon` Restrict autosuggest results to a polygon, specified by a list of coordinates. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs.
179
+ * `input-type` For power users, used to specify voice input mode. Can be text (default), vocon-hybrid, nmdp-asr or generic-voice.
180
+ * `prefer-land` Makes autosuggest prefer results on land to those in the sea.
107
181
 
108
182
  ### Grid
109
183
  Returns a section of the 3m x 3m what3words grid for a given area.
110
184
 
111
- see https://docs.what3words.com/api/v2/#grid for detailed information
185
+ See [https://developer.what3words.com/public-api/docs#grid-section](https://developer.what3words.com/public-api/docs#grid-section) for detailed information.
112
186
 
113
- Gets grid for these bounding box northeast 52.208867,0.117540, southwest 52.207988,0.116126
187
+ Gets grid for these bounding box northeast 52.208867,0.117540,52.207988,0.116126.
114
188
 
115
- what3words.grid "52.208867,0.117540,52.207988,0.116126"
116
- # => {:lines=>[{:start=>{:lng=>0.11612600000001, :lat=>52.208009918068}, :end=>{:lng=>0.11753999999999, :lat=>52.208009918068}}, ___...___ , :end=>{:lng=>0.11752023935234, :lat=>52.208867}}], :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
189
+ ```ruby
190
+ what3words.grid_section '52.208867,0.117540,52.207988,0.116126'
191
+ # => {:lines=>[{:start=>{:lng=>0.116126, :lat=>52.20801}, :end=>{:lng=>0.11754, :lat=>52.20801}}, {:start=>{:lng=>0.116126, :lat=>52.208037}, :end=>{:lng=>0.11754, :lat=>52.208037}}, {:start=>{:lng=>0.116126, :lat=>52.208064}, :end=>{:lng=>0.11754, :lat=>52.208064}}, ___...___ ]}
192
+ ```
117
193
 
118
- Supported keyword params for `grid` call:
119
- * `format` Return data format type; can be one of json (the default), geojson or xml
120
- * `display` Return display type; can be one of full (the default) or terse
194
+ Supported keyword params for `grid_section` call:
195
+ * `bounding-box` The bounding box is specified by the northeast and southwest corner coordinates, for which the grid should be returned
196
+ * `format` Return data format type. It can be one of json (the default) or geojson
121
197
 
122
198
  ### Get Languages
123
- Get list of available 3 word languages
124
-
125
- what3words.languages
126
- # => {:languages=>[{:name=>"German", :native_name=>"Deutsch", :code=>"de"}, {:name=>"Italian", :native_name=>"Italiano", :code=>"it"}, {:name=>"Turkish", :native_name=>"Türkçe", :code=>"tr"}, {:name=>"Portuguese", :native_name=>"Português", :code=>"pt"}, {:name=>"French", :native_name=>"français, langue française", :code=>"fr"}, {:name=>"Swedish", :native_name=>"svenska", :code=>"sv"}, {:name=>"English", :native_name=>"English", :code=>"en"}, {:name=>"Russian", :native_name=>"русский язык", :code=>"ru"}, {:name=>"Spanish", :native_name=>"español", :code=>"es"}, {:name=>"Swahili", :native_name=>"Kiswahili", :code=>"sw"}], :status=>{:status=>200, :reason=>"OK"}, :thanks=>"Thanks from all of us at index.home.raft for using a what3words API"}
199
+ Retrieve a list of available 3 word languages.
127
200
 
128
- See http://developer.what3words.com for the original API call documentation
129
-
130
- ## Contributing
201
+ ```ruby
202
+ what3words.available_languages
203
+ # => {:languages=>[{:nativeName=>"Deutsch", :code=>"de", :name=>"German"}, {:nativeName=>"हिन्दी", :code=>"hi", :name=>"Hindi"}, {:nativeName=>"Português", :code=>"pt", :name=>"Portuguese"}, {:nativeName=>"Magyar", :code=>"hu", :name=>"Hungarian"}, {:nativeName=>"Українська", :code=>"uk", :name=>"Ukrainian"}, {:nativeName=>"Bahasa Indonesia", :code=>"id", :name=>"Bahasa Indonesia"}, {:nativeName=>"اردو", :code=>"ur", :name=>"Urdu"}, ___...___]}
204
+ ```
131
205
 
132
- 1. Fork it ( http://github.com/what3words/w3w-ruby-wrapper and click "Fork" )
133
- 2. Create your feature branch (`git checkout -b my-new-feature`)
134
- 3. Commit your changes (`git commit -am 'Add some feature'`)
135
- 4. Push to the branch (`git push origin my-new-feature`)
136
- 5. Create new Pull Request
206
+ See [https://developer.what3words.com/public-api/docs#available-languages](https://developer.what3words.com/public-api/docs#available-languages) for the original API call documentation.
137
207
 
138
- ### Testing
208
+ ## Testing
139
209
 
140
210
  * Prerequisite : we are using [bundler](https://rubygems.org/gems/bundler) `$ gem install bundler`
141
211
 
142
- * W3W-API-KEY : For safe storage of your API key on your computer, you can define that API key using your system’s environment variables.
212
+ * W3W-API-KEY: For safe storage of your API key on your computer, you can define that API key using your system’s environment variables.
143
213
  ```bash
144
214
  $ export W3W_API_KEY=<Secret API Key>
145
215
  ```
146
216
 
147
- * on you cloned folder
217
+ * on your cloned folder
148
218
  1. `$ cd w3w-ruby-wrapper`
149
219
  1. `$ bundle update`
150
- 1. `$ rake spec`
220
+ 1. `$ rake rubocop spec`
221
+
222
+ To run the tests, type on your terminal:
223
+ ```bash
224
+ $ bundle exec rspec
225
+ ```
226
+
227
+ ## Issues
228
+
229
+ Find a bug or want to request a new feature? Please let us know by submitting an issue.
230
+
231
+ ## Contributing
232
+ Anyone and everyone is welcome to contribute.
233
+
234
+ 1. Fork it (http://github.com/what3words/w3w-ruby-wrapper and click "Fork")
235
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
236
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
237
+ 1. Don't forget to update README and bump [version](./lib/what3words/version.rb) using [semver](https://semver.org/)
238
+ 1. Push to the branch (`git push origin my-new-feature`)
239
+ 1. Create new Pull Request
240
+
241
+ # Revision History
242
+
243
+ * `v3.0.0` 12/05/22 - Update endpoints and tests to API v3, added HTTP headers
244
+ * `v2.2.0` 03/01/18 - Enforce Ruby 2.4 Support - Thanks to PR from Dimitrios Zorbas [@Zorbash](https://github.com/zorbash)
245
+ * `v2.1.1` 22/05/17 - Update gemspec to use rubocop 0.48.1, and fixes spec accordingly
246
+ * `v2.1.0` 28/03/17 - Added multilingual version of `autosuggest` and `standardblend`
247
+ * `v2.0.4` 27/03/17 - Updated README with `languages` method result updated from live result
248
+ * `v2.0.3` 24/10/16 - Fixed `display` in `assemble_common_request_params`
249
+ * `v2.0.2` 10/06/16 - Added travis-ci builds
250
+ * `v2.0.0` 10/06/16 - Updated wrapper to use what3words API v2
251
+
252
+ ## Licensing
253
+
254
+ The MIT License (MIT)
255
+
256
+ A copy of the license is available in the repository's [license](LICENSE.txt) file.
data/Rakefile CHANGED
@@ -1,9 +1,14 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
2
4
 
3
5
  begin
6
+ require 'rubocop/rake_task'
7
+ RuboCop::RakeTask.new(:rubocop) do |t|
8
+ t.options = ['--display-cop-names']
9
+ end
4
10
  require 'rspec/core/rake_task'
5
-
6
11
  RSpec::Core::RakeTask.new(:spec)
7
- rescue LoadError
8
- # ignore
12
+ rescue LoadError => e
13
+ print e
9
14
  end