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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80544ac9c1c8a40237f2172b461ce36232980fb005ce91859e0214956e69141d
4
- data.tar.gz: f98a92b21dbb2950bf1464cb297f5adff151aa315f891ff8d7fd563e54b790fa
3
+ metadata.gz: 22479c5ad9842970d932052a565ee1b4bfd98c14a05d279297d6ba964d95a902
4
+ data.tar.gz: bb498f8b643e541acfb83f1925ec9d30e67df710994561cad2629cc73e2b7230
5
5
  SHA512:
6
- metadata.gz: 1bf3e7792855a1c0f187bcd92afee0c4a3455d36159a9a65a542b3a7e75fd74bb6a96ff417c2ef84b67377132868b3df38ecb7656184a716cb9ef9137c50c080
7
- data.tar.gz: 2fd293b19039de12b6b52d33bb71588d9e90372723f65f928ccef1a6b6ed56dfc3d909d2aea42b37d5859418d22eb7058b905dc7b13367a318dabb0ac415402d
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.1'
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)
@@ -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 = /^\/{0,3}(?:[^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}|'<,.>?\/\";:£§º©®\s]+[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+|[^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+){1,3}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+){1,3}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+([\u0020\u00A0][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]+){1,3})$/u.freeze
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 = /[^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}[.\uFF61\u3002\uFF65\u30FB\uFE12\u17D4\u0964\u1362\u3002][^0-9`~!@#$%^&*()+\-_=\[\{\]}\\|'<,.>?\/\";:£§º©®\s]{1,}/
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
- regex_match = /^\/?[^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,}$/
150
- !(text.match(regex_match).nil?)
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  # What3Words v3 API wrapper
4
4
  module What3Words
5
- VERSION = '3.1.0' unless defined?(::What3Words::VERSION)
5
+ VERSION = '3.2.0' unless defined?(::What3Words::VERSION)
6
6
  end
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.1.0
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-16 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client