what3words 3.1.0 → 3.2.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 +4 -4
- data/README.md +2 -1
- data/lib/what3words/api.rb +5 -5
- data/lib/what3words/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22479c5ad9842970d932052a565ee1b4bfd98c14a05d279297d6ba964d95a902
|
4
|
+
data.tar.gz: bb498f8b643e541acfb83f1925ec9d30e67df710994561cad2629cc73e2b7230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ea16a0b86a7f4348b9c07661365f4bc58197b78f969e0b834686d4b117cd826978e76f20f802a1091d4b95c6ecf06979613d97b8ae9d81c85d6096d03521857
|
7
|
+
data.tar.gz: 206f017da8d6ffa7d1b323479b948552cc830ee523e4781309f4a47b2eed25b271bfeeed824fc3600d663d7a53f8dbf4673f694baf25e130b492909b73199bb6
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ The library is available through [RubyGems](https://rubygems.org/gems/what3words
|
|
15
15
|
You can simply add this line to your application's Gemfile:
|
16
16
|
|
17
17
|
```
|
18
|
-
gem 'what3words', '~> 3.
|
18
|
+
gem 'what3words', '~> 3.2'
|
19
19
|
```
|
20
20
|
|
21
21
|
And then execute:
|
@@ -438,6 +438,7 @@ Anyone and everyone is welcome to contribute.
|
|
438
438
|
|
439
439
|
# Revision History
|
440
440
|
|
441
|
+
* `v3.2.0` 17/07/24 - Update regex patterns
|
441
442
|
* `v3.1.0` 16/07/24 - Update tests and code to host the regex functions
|
442
443
|
* `v3.0.0` 12/05/22 - Update endpoints and tests to API v3, added HTTP headers
|
443
444
|
* `v2.2.0` 03/01/18 - Enforce Ruby 2.4 Support - Thanks to PR from Dimitrios Zorbas [@Zorbash](https://github.com/zorbash)
|
data/lib/what3words/api.rb
CHANGED
@@ -12,7 +12,7 @@ module What3Words
|
|
12
12
|
class ResponseError < Error; end
|
13
13
|
class WordError < Error; end
|
14
14
|
|
15
|
-
REGEX_3_WORD_ADDRESS =
|
15
|
+
REGEX_3_WORD_ADDRESS = /^\/*(?:[^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}[.。。・・︒។։။۔።।][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}[.。。・・︒។։။۔።।][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}|[<.,>?\/\";:£§º©®\s]+[.。。・・︒។։။۔።।][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+|[^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+){1,3}[.。。・・︒។։။۔።।][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+){1,3}[.。。・・︒។։။۔።।][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]+){1,3})$/u.freeze
|
16
16
|
BASE_URL = 'https://api.what3words.com/v3/'
|
17
17
|
|
18
18
|
ENDPOINTS = {
|
@@ -132,7 +132,7 @@ module What3Words
|
|
132
132
|
:param string text: text to check
|
133
133
|
:rtype: Array
|
134
134
|
"""
|
135
|
-
regex_search = /[
|
135
|
+
regex_search = /[^\d`~!@#$%^&*()+\-=\[\]{}\\|'<>.,?\/\";:£§º©®\s]{1,}[.。。・・︒។։။۔።।][^\d`~!@#$%^&*()+\-=\[\]{}\\|'<>.,?\/\";:£§º©®\s]{1,}[.。。・・︒។։။۔።।][^\d`~!@#$%^&*()+\-=\[\]{}\\|'<>.,?\/\";:£§º©®\s]{1,}/u
|
136
136
|
text.scan(regex_search)
|
137
137
|
end
|
138
138
|
|
@@ -146,10 +146,10 @@ module What3Words
|
|
146
146
|
:param string text: text to check
|
147
147
|
:rtype: Boolean
|
148
148
|
"""
|
149
|
-
|
150
|
-
!(text.match(
|
149
|
+
regex_didyoumean = /^\/?[^0-9`~!@#$%^&*()+\-=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002:။^_۔։ ,\\\/+'&\\:;|\u3000-]{1,2}[^0-9`~!@#$%^&*()+\-=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002:။^_۔։ ,\\\/+'&\\:;|\u3000-]{1,2}[^0-9`~!@#$%^&*()+\-=\[\{\]}\\|'<>.,?\/\";:£§º©®\s]{1,}$/u
|
150
|
+
!(text.match(regex_didyoumean).nil?)
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
def isValid3wa(text)
|
154
154
|
"""
|
155
155
|
Determines if the string passed in is a real three word address. It calls the API
|
data/lib/what3words/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what3words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- what3words
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|