loqate 0.11.1 → 0.12.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/.tool-versions +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +18 -0
- data/lib/loqate/api_result.rb +13 -0
- data/lib/loqate/client.rb +6 -2
- data/lib/loqate/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: d37f55f57ac91abcb2a381c0389d908114db9c330bdf07379d5ada10a2dea85c
|
4
|
+
data.tar.gz: efde49b8e5cd34031450c7f8043c389d66e509a575bb73cdf0386286246fb903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3fe6bde75397bbaeea6ec97fb764ad0a23c62c3c83f045f42d40962cc8c12686e7534195a502ee48d5f480261e7329d1213c32d8b304b16ce5f49433e7eb8bf
|
7
|
+
data.tar.gz: 850e514eada88d53af951c7a14929a41ef73673ff79ad4d25fc8a47fd05ebf9c6bcca2ca29623d45f311655110c775e87d99fdb24a7b9fe060d906183724e9e6
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.0.1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.12.0] - 2021-04-26
|
8
|
+
## Changed
|
9
|
+
- Set the gem development Ruby version to Ruby `3.0.1`
|
10
|
+
- Ensured compatibility with Ruby `3.0`
|
11
|
+
- Updated the API client to handle internal Loqate errors such as `502`:
|
12
|
+
```
|
13
|
+
JSON::ParserError (767: unexpected token at '<html><head>)
|
14
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
15
|
+
<title>502 Server Error</title>
|
16
|
+
</head>
|
17
|
+
<body text=#000000 bgcolor=#ffffff>
|
18
|
+
<h1>Error: Server Error</h1>
|
19
|
+
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
|
20
|
+
<h2></h2>
|
21
|
+
</body></html>
|
22
|
+
```
|
23
|
+
|
7
24
|
## [0.11.1] - 2021-04-26
|
8
25
|
## Fixed
|
9
26
|
- Fixed the allowed values of the enum `Phone::PhoneNumberValidation::IsValid` by adding `Maybe` as a valid value.
|
@@ -134,6 +151,7 @@ and will always return `false`.
|
|
134
151
|
- Initial core functionality
|
135
152
|
- Codebase maintenance tools
|
136
153
|
|
154
|
+
[0.12.0]: https://github.com/wilsonsilva/loqate/compare/v0.11.1...v0.12.0
|
137
155
|
[0.11.1]: https://github.com/wilsonsilva/loqate/compare/v0.11.0...v0.11.1
|
138
156
|
[0.11.0]: https://github.com/wilsonsilva/loqate/compare/v0.10.4...v0.11.0
|
139
157
|
[0.10.4]: https://github.com/wilsonsilva/loqate/compare/v0.10.3...v0.10.4
|
data/lib/loqate/api_result.rb
CHANGED
@@ -15,6 +15,19 @@ module Loqate
|
|
15
15
|
@items = items
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.error(status:)
|
19
|
+
new(
|
20
|
+
[
|
21
|
+
{
|
22
|
+
'Error' => '-2',
|
23
|
+
'Description' => 'Something went wrong - please try again later',
|
24
|
+
'Resolution' => 'Try again later',
|
25
|
+
'Cause' => "Server returned response with #{status}"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
18
31
|
# Whether the response contains errors
|
19
32
|
#
|
20
33
|
# @return [Boolean] true if the response has errors and false otherwise
|
data/lib/loqate/client.rb
CHANGED
@@ -38,8 +38,12 @@ module Loqate
|
|
38
38
|
|
39
39
|
response = HTTP.headers(headers).get(configuration.host + endpoint, params: formatted_params)
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
if response.status.success?
|
42
|
+
body = JSON.parse(response.body)
|
43
|
+
APIResult.new(body.fetch('Items'))
|
44
|
+
else
|
45
|
+
APIResult.error(status: response.status)
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
49
|
private
|
data/lib/loqate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loqate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wilson Silva
|
@@ -394,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
394
|
- !ruby/object:Gem::Version
|
395
395
|
version: '0'
|
396
396
|
requirements: []
|
397
|
-
rubygems_version: 3.
|
397
|
+
rubygems_version: 3.2.15
|
398
398
|
signing_key:
|
399
399
|
specification_version: 4
|
400
400
|
summary: API client for GBG Loqate
|