postio 0.1.0 → 0.1.2
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/CHANGELOG.md +22 -1
- data/README.md +7 -5
- data/lib/postio/client.rb +1 -1
- data/lib/postio/models.rb +1 -9
- data/lib/postio/version.rb +1 -1
- data/lib/postio.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: 41300707dab2745d0a8a84e53ec508775af91729671c2e59c4469f6e16a1c75c
|
|
4
|
+
data.tar.gz: 749b0014ab03dea3edff07e35a51ae714b2f76c3076ec0d45c71efbe738b85e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6963d95626b108a75dc8e3f9913a1ded082ae2fd917d0aa1860ed8c2596cd82ceb0a922c0e79d2b1b6987b7f48b89adf51d04f1ec13a5ed76c88c08c81f19f1
|
|
7
|
+
data.tar.gz: a5da0053ef0c55b0638a39b6d01b5369144dbe20ab678594a1e90830e203e254901a0ab0a1f46b7dd26703ebfc38cba87cdb4d99fca6d985265c1d91172c67e6
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,26 @@ follows [SemVer](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.2] — 2026-08-12
|
|
10
|
+
|
|
11
|
+
### Removed
|
|
12
|
+
|
|
13
|
+
- `county` from the address model. It came from ONS administrative geography
|
|
14
|
+
rather than Royal Mail data, resolved for only part of the country, and is
|
|
15
|
+
not part of a correct UK postal address — Royal Mail removed postal counties
|
|
16
|
+
from PAF in December 2000. `district` and `ward` remain, and are ONS
|
|
17
|
+
administrative geography rather than postal fields.
|
|
18
|
+
|
|
19
|
+
## [0.1.1] — 2026-05-02
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Drop the SPEC DRIFT block on `PhoneResult`. postio-api 1.0.3 aligned
|
|
24
|
+
the spec with the runtime — `is_reachable` is bool|nil, and the
|
|
25
|
+
runtime now always emits explicit nulls for every nullable field.
|
|
26
|
+
The hash-lookup `.from_hash` already handled either shape, so no
|
|
27
|
+
consumer-visible change.
|
|
28
|
+
|
|
9
29
|
## [0.1.0] — 2026-05-02
|
|
10
30
|
|
|
11
31
|
Initial release. First Postio Ruby SDK on RubyGems.
|
|
@@ -35,5 +55,6 @@ Initial release. First Postio Ruby SDK on RubyGems.
|
|
|
35
55
|
live API returns booleans there even though the spec says
|
|
36
56
|
string-only. Aligned once postio-api ships a spec/runtime fix.
|
|
37
57
|
|
|
38
|
-
[Unreleased]: https://github.com/postio-uk/postio-ruby/compare/v0.1.
|
|
58
|
+
[Unreleased]: https://github.com/postio-uk/postio-ruby/compare/v0.1.1...HEAD
|
|
59
|
+
[0.1.1]: https://github.com/postio-uk/postio-ruby/releases/tag/v0.1.1
|
|
39
60
|
[0.1.0]: https://github.com/postio-uk/postio-ruby/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
[](https://rubygems.org/gems/postio)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
Ruby SDK for
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Ruby SDK for [Postio](https://postio.co.uk) — the UK validation API for
|
|
8
|
+
addresses, emails and phone numbers. Stdlib `net/http` only, zero runtime
|
|
9
|
+
dependencies. Backed by Royal Mail PAF and Ordnance Survey.
|
|
10
|
+
|
|
11
|
+
> **First time?** [Sign up free](https://postio.co.uk) — first 100 lookups on us, no card needed.
|
|
10
12
|
|
|
11
13
|
## Install
|
|
12
14
|
|
|
@@ -27,7 +29,7 @@ Requires Ruby 3.1+.
|
|
|
27
29
|
```ruby
|
|
28
30
|
require "postio"
|
|
29
31
|
|
|
30
|
-
client = Postio::Client.new(api_key: "
|
|
32
|
+
client = Postio::Client.new(api_key: "pk_...") # or set POSTIO_API_KEY
|
|
31
33
|
|
|
32
34
|
result = client.address.search("downing street")
|
|
33
35
|
result.results.each do |hit|
|
|
@@ -84,7 +86,7 @@ the raw `envelope`.
|
|
|
84
86
|
|
|
85
87
|
```ruby
|
|
86
88
|
client = Postio::Client.new(
|
|
87
|
-
api_key: "
|
|
89
|
+
api_key: "pk_...",
|
|
88
90
|
base_url: "https://api.postio.co.uk/v1", # default
|
|
89
91
|
timeout: 10, # seconds
|
|
90
92
|
retries: 2, # 0 to disable
|
data/lib/postio/client.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Postio
|
|
|
13
13
|
#
|
|
14
14
|
# Example:
|
|
15
15
|
#
|
|
16
|
-
# client = Postio::Client.new(api_key: "
|
|
16
|
+
# client = Postio::Client.new(api_key: "pk_...")
|
|
17
17
|
# r = client.address.search("downing street")
|
|
18
18
|
# r.results.each { |hit| puts "#{hit.udprn}: #{hit.suggestion}" }
|
|
19
19
|
#
|
data/lib/postio/models.rb
CHANGED
|
@@ -44,7 +44,7 @@ module Postio
|
|
|
44
44
|
:organisation_name, :department_name, :building_name, :building_number,
|
|
45
45
|
:sub_building_name, :po_box, :thoroughfare, :dependent_thoroughfare,
|
|
46
46
|
:dependent_locality, :double_dependent_locality, :delivery_point_suffix,
|
|
47
|
-
:country, :
|
|
47
|
+
:country, :district, :ward,
|
|
48
48
|
:latitude, :longitude, :eastings, :northings
|
|
49
49
|
) do
|
|
50
50
|
def self.from_hash(h)
|
|
@@ -70,7 +70,6 @@ module Postio
|
|
|
70
70
|
double_dependent_locality: h["double_dependent_locality"],
|
|
71
71
|
delivery_point_suffix: h["delivery_point_suffix"],
|
|
72
72
|
country: h["country"],
|
|
73
|
-
county: h["county"],
|
|
74
73
|
district: h["district"],
|
|
75
74
|
ward: h["ward"],
|
|
76
75
|
latitude: h["latitude"]&.to_f,
|
|
@@ -109,13 +108,6 @@ module Postio
|
|
|
109
108
|
end
|
|
110
109
|
|
|
111
110
|
# PhoneResult — validation verdict for one phone number.
|
|
112
|
-
#
|
|
113
|
-
# SPEC DRIFT (2026-05-02): the OpenAPI spec marks every nullable
|
|
114
|
-
# field as required, but on invalid input the live API drops them
|
|
115
|
-
# entirely. The .from_hash fetcher uses h["..."] which returns nil
|
|
116
|
-
# for missing keys, papering over the drift. Also: spec says
|
|
117
|
-
# is_reachable is string|null, but the live API returns bool — we
|
|
118
|
-
# accept either.
|
|
119
111
|
PhoneResult = Data.define(
|
|
120
112
|
:number, :is_valid, :is_possible, :type, :country_code, :country_name,
|
|
121
113
|
:national_format, :international_format, :e164_format, :original_carrier,
|
data/lib/postio/version.rb
CHANGED
data/lib/postio.rb
CHANGED
|
@@ -7,7 +7,7 @@ require_relative "postio/client"
|
|
|
7
7
|
|
|
8
8
|
# Top-level Postio module. Use Postio::Client to construct the API client.
|
|
9
9
|
#
|
|
10
|
-
# client = Postio::Client.new(api_key: "
|
|
10
|
+
# client = Postio::Client.new(api_key: "pk_...")
|
|
11
11
|
# client.address.search("downing street")
|
|
12
12
|
module Postio
|
|
13
13
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: postio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Postio
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-08-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|