pumi 0.43.0 → 0.44.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: af0e43b667636b342a7ee9257db6408a5409096bc2126050dbdf11f6f3fdbd46
4
- data.tar.gz: 85bf925a75802bcbb59fc0ef5c900e16b402187ecea0de91a5be438d281337bb
3
+ metadata.gz: cbd9437b7cae782b949a59fe67347d9e0bf94743d59df33a876f10592e05fd8f
4
+ data.tar.gz: f0b828a8d9d91ec6f49e6c1e404beb5c9d50e43759118b5ab8fad7aeadd0c355
5
5
  SHA512:
6
- metadata.gz: bd2ed631a79f5bc7d0adeac9ccfabd55ffc0d4904ccac219e36d698ad791f343db1629e0746ffaa759087d61e75f6996612577d48e29c1b59f856d6577a6ceef
7
- data.tar.gz: f19c86b1077e30114ddd2ea90eb30ae2ca7ad9422e362504fe63e52485096d8cc905a573fb0a13522bb8b7a0f9421b92c3e4279b5aae3b248965b3bb23253b12
6
+ metadata.gz: 3a6d44d7cafd27f448bb6f321781d2452a8edcbca1a820f44aaa23b717d7449e697c913e32e996d359eff68f0bf9a566dbe4fc05178f1acb2ac5d06c51a78f64
7
+ data.tar.gz: e9f62183dc460521b8b845fcfb9017ccd147056ac6435c98487b8f17f5804a0488f0ebf80bd64053c65293f194e529d6654a408db110bd3de2955860e334a3ee
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  steps:
13
- - uses: actions/checkout@v6
13
+ - uses: actions/checkout@v7
14
14
 
15
15
  - name: Set up Ruby
16
16
  uses: ruby/setup-ruby@v1
@@ -14,7 +14,7 @@ jobs:
14
14
  with:
15
15
  token: ${{ secrets.PUMI_PERSONAL_ACCESS_TOKEN }}
16
16
 
17
- - uses: actions/checkout@v6
17
+ - uses: actions/checkout@v7
18
18
  if: ${{ steps.release.outputs.release_created }}
19
19
 
20
20
  - uses: ruby/setup-ruby@v1
@@ -3,13 +3,13 @@ name: Update Data
3
3
  on:
4
4
  schedule:
5
5
  - cron: '0 2 * * 0'
6
-
6
+ workflow_dispatch:
7
7
  jobs:
8
8
  fetch_data:
9
9
  runs-on: ubuntu-latest
10
10
 
11
11
  steps:
12
- - uses: actions/checkout@v6
12
+ - uses: actions/checkout@v7
13
13
 
14
14
  - name: Setup Ruby
15
15
  uses: ruby/setup-ruby@v1
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.43.0"
2
+ ".": "0.44.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.44.0](https://github.com/dwilkie/pumi/compare/v0.43.0...v0.44.0) (2026-09-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * Update data ([#134](https://github.com/dwilkie/pumi/issues/134)) ([cee3021](https://github.com/dwilkie/pumi/commit/cee3021d14bc3cc1ef592559d112c44cd74037ea))
9
+
3
10
  ## [0.43.0](https://github.com/dwilkie/pumi/compare/v0.42.0...v0.43.0) (2026-06-01)
4
11
 
5
12
 
data/data/districts.yml CHANGED
@@ -734,7 +734,7 @@ districts:
734
734
  en: District
735
735
  ungegn: Srŏk
736
736
  links:
737
- wikipedia: https://en.wikipedia.org/wiki/Rolea_B%27ier_District
737
+ wikipedia: https://en.wikipedia.org/wiki/Rolea_B'ier_District
738
738
  geodata:
739
739
  lat: '12.2059838'
740
740
  long: '104.6613026'
@@ -1448,7 +1448,7 @@ districts:
1448
1448
  en: District
1449
1449
  ungegn: Srŏk
1450
1450
  links:
1451
- wikipedia: https://en.wikipedia.org/wiki/S%27ang
1451
+ wikipedia: https://en.wikipedia.org/wiki/S'ang
1452
1452
  geodata:
1453
1453
  lat: '11.3605612'
1454
1454
  long: '105.0037187'
@@ -3692,7 +3692,7 @@ districts:
3692
3692
  en: District
3693
3693
  ungegn: Srŏk
3694
3694
  links:
3695
- wikipedia: https://en.wikipedia.org/wiki/Damnak_Chang%27aeur_District
3695
+ wikipedia: https://en.wikipedia.org/wiki/Damnak_Chang'aeur_District
3696
3696
  geodata:
3697
3697
  lat: '10.526653'
3698
3698
  long: '104.36731'
@@ -43,6 +43,26 @@ module Pumi
43
43
 
44
44
  ScraperResult = Struct.new(:code, :wikipedia, :name_ungegn, keyword_init: true)
45
45
 
46
+ class URLParser
47
+ attr_reader :base_url, :link_node
48
+
49
+ def self.parse(...)
50
+ new(...).to_s
51
+ end
52
+
53
+ def initialize(base_url, link_node)
54
+ @base_url = base_url
55
+ @link_node = link_node
56
+ end
57
+
58
+ def to_s
59
+ return if link_node.nil? || link_node[:href].nil?
60
+
61
+ escaped_href = URI::DEFAULT_PARSER.escape(link_node[:href])
62
+ URI.join(base_url, escaped_href).to_s
63
+ end
64
+ end
65
+
46
66
  class WebScraper
47
67
  class ElementNotFoundError < StandardError; end
48
68
 
@@ -79,7 +99,7 @@ module Pumi
79
99
  def find_url(province)
80
100
  td = find_khmer_name_td(province)
81
101
  link = td.at_xpath("preceding-sibling::td/a[contains(@href, '/wiki/')]")
82
- URI.join(URL, link[:href]).to_s
102
+ URLParser.parse(URL, link)
83
103
  end
84
104
 
85
105
  def find_ungegn(province)
@@ -141,7 +161,7 @@ module Pumi
141
161
 
142
162
  return if link.nil?
143
163
 
144
- URI.join(URL, link[:href]).to_s
164
+ URLParser.parse(URL, link)
145
165
  end
146
166
 
147
167
  def find_ungegn(district)
@@ -181,7 +201,7 @@ module Pumi
181
201
 
182
202
  return if link.nil?
183
203
 
184
- URI.join(URL, link[:href]).to_s
204
+ URLParser.parse(URL, link)
185
205
  end
186
206
 
187
207
  def find_ungegn(commune)
data/lib/pumi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pumi
2
- VERSION = "0.43.0".freeze
2
+ VERSION = "0.44.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pumi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.0
4
+ version: 0.44.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wilkie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-01 00:00:00.000000000 Z
11
+ date: 2026-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler