nice 0.1.0 → 1.0.1
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/.release-please-manifest.json +3 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile.lock +5 -4
- data/lib/nice/data_gouv/client.rb +105 -0
- data/lib/nice/data_gouv/dataset.rb +42 -0
- data/lib/nice/data_gouv/organization.rb +29 -0
- data/lib/nice/data_gouv/resource.rb +31 -0
- data/lib/nice/version.rb +3 -1
- data/lib/nice.rb +3 -0
- data/release-please-config.json +9 -0
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2383669fde6abef553cb3f5cfe2cfa277ea687483e8109ff83c56b355b93b8ad
|
|
4
|
+
data.tar.gz: 6c12ca762ff25c2eb8683d58d901fdd113353a4814a01dcaac83cf56d97c551e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da046cd4168816b909a662428a16c6bf5d84fdd738bf6d2b6ac0e7e59ac6f97596b13b651c80d405806a3f5a59dc3e1f9721f45402bb0f9d69ebaa8e7515b233
|
|
7
|
+
data.tar.gz: 3f64640ce6cb5ca6af4f93125a6932c08424b74800d0906d13d0b813ed29504cbbde6639b56bbbb44a4f35bb43f3cd88007c631efd4640ed25d1430443f9ab6c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.1](https://github.com/nicolasleger/nice/compare/v1.0.0...v1.0.1) (2026-02-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add Nice data.gouv ([#5](https://github.com/nicolasleger/nice/issues/5)) ([a660143](https://github.com/nicolasleger/nice/commit/a660143c78ddc0dd808e00c61eec47ab64f87b74))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* CI publish action ([386bbe3](https://github.com/nicolasleger/nice/commit/386bbe3ee07465198a9d790677d1cf93bae11c24))
|
|
14
|
+
* CI release-please version ([b6f3ebf](https://github.com/nicolasleger/nice/commit/b6f3ebfe9acb87f35c7e43fabf1a0475ed73fa4a))
|
|
15
|
+
* CI Ruby version ([67ee027](https://github.com/nicolasleger/nice/commit/67ee027e55ae5f281d7841bb209fbe3d7ddfb14f))
|
|
16
|
+
* main test environment ([e93f5c4](https://github.com/nicolasleger/nice/commit/e93f5c46c2a2e9758893901eb085e3401abc2319))
|
|
17
|
+
* release please config ([fe9b956](https://github.com/nicolasleger/nice/commit/fe9b9569605c84acae79b5dde178baf45f33ba85))
|
|
18
|
+
* release please config ([1ebc7eb](https://github.com/nicolasleger/nice/commit/1ebc7eb580ad6252c7be705023bff7ab4a1056db))
|
|
19
|
+
* version file ([cf0c1f0](https://github.com/nicolasleger/nice/commit/cf0c1f0c9d583af31326b36d728e822fcc286d99))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* release 1.0.0 ([65055e7](https://github.com/nicolasleger/nice/commit/65055e78e6b03cbd4666986e07d1b7ef71b1b48d))
|
|
25
|
+
* release 1.0.1 ([dbe4386](https://github.com/nicolasleger/nice/commit/dbe4386348d050b7270956ac48863a5bcea9656a))
|
|
26
|
+
|
|
27
|
+
## [1.0.0](https://github.com/nicolasleger/nice/compare/v1.0.0...v1.0.0) (2026-02-16)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* add Nice data.gouv ([#5](https://github.com/nicolasleger/nice/issues/5)) ([a660143](https://github.com/nicolasleger/nice/commit/a660143c78ddc0dd808e00c61eec47ab64f87b74))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* CI publish action ([386bbe3](https://github.com/nicolasleger/nice/commit/386bbe3ee07465198a9d790677d1cf93bae11c24))
|
|
38
|
+
* CI release-please version ([b6f3ebf](https://github.com/nicolasleger/nice/commit/b6f3ebfe9acb87f35c7e43fabf1a0475ed73fa4a))
|
|
39
|
+
* CI Ruby version ([67ee027](https://github.com/nicolasleger/nice/commit/67ee027e55ae5f281d7841bb209fbe3d7ddfb14f))
|
|
40
|
+
* main test environment ([e93f5c4](https://github.com/nicolasleger/nice/commit/e93f5c46c2a2e9758893901eb085e3401abc2319))
|
|
41
|
+
* release please config ([1ebc7eb](https://github.com/nicolasleger/nice/commit/1ebc7eb580ad6252c7be705023bff7ab4a1056db))
|
|
42
|
+
* version file ([cf0c1f0](https://github.com/nicolasleger/nice/commit/cf0c1f0c9d583af31326b36d728e822fcc286d99))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Miscellaneous Chores
|
|
46
|
+
|
|
47
|
+
* release 1.0.0 ([65055e7](https://github.com/nicolasleger/nice/commit/65055e78e6b03cbd4666986e07d1b7ef71b1b48d))
|
|
48
|
+
|
|
3
49
|
## 1.0.0 (2026-02-12)
|
|
4
50
|
|
|
5
51
|
|
data/Gemfile.lock
CHANGED
|
@@ -8,7 +8,7 @@ GIT
|
|
|
8
8
|
PATH
|
|
9
9
|
remote: .
|
|
10
10
|
specs:
|
|
11
|
-
nice (0.1
|
|
11
|
+
nice (1.0.1)
|
|
12
12
|
ckan
|
|
13
13
|
httparty (~> 0.21)
|
|
14
14
|
json (~> 2.6)
|
|
@@ -74,7 +74,7 @@ GEM
|
|
|
74
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
75
75
|
rspec-support (~> 3.13.0)
|
|
76
76
|
rspec-support (3.13.7)
|
|
77
|
-
rubocop (1.84.
|
|
77
|
+
rubocop (1.84.2)
|
|
78
78
|
json (~> 2.3)
|
|
79
79
|
language_server-protocol (~> 3.17.0.2)
|
|
80
80
|
lint_roller (~> 1.1.0)
|
|
@@ -101,6 +101,7 @@ GEM
|
|
|
101
101
|
PLATFORMS
|
|
102
102
|
arm64-darwin-25
|
|
103
103
|
ruby
|
|
104
|
+
x86_64-linux
|
|
104
105
|
|
|
105
106
|
DEPENDENCIES
|
|
106
107
|
ckan!
|
|
@@ -132,7 +133,7 @@ CHECKSUMS
|
|
|
132
133
|
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
|
|
133
134
|
mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
|
|
134
135
|
multi_xml (0.8.1) sha256=addba0290bac34e9088bfe73dc4878530297a82a7bbd66cb44dcd0a4b86edf5a
|
|
135
|
-
nice (0.1
|
|
136
|
+
nice (1.0.1)
|
|
136
137
|
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
|
|
137
138
|
parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
|
|
138
139
|
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
@@ -150,7 +151,7 @@ CHECKSUMS
|
|
|
150
151
|
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
151
152
|
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
|
|
152
153
|
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
153
|
-
rubocop (1.84.
|
|
154
|
+
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
|
|
154
155
|
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
|
|
155
156
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
156
157
|
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
require_relative 'organization'
|
|
4
|
+
require_relative 'resource'
|
|
5
|
+
require_relative 'dataset'
|
|
6
|
+
|
|
7
|
+
module Nice
|
|
8
|
+
module DataGouv
|
|
9
|
+
class Client
|
|
10
|
+
include HTTParty
|
|
11
|
+
base_uri 'https://www.data.gouv.fr/api/1'
|
|
12
|
+
follow_redirects true
|
|
13
|
+
|
|
14
|
+
attr_reader :api_key
|
|
15
|
+
|
|
16
|
+
# Manually curated list of organization slugs for the Nice Côte d'Azur region, sorted alphabetically.
|
|
17
|
+
ORGANIZATION_SLUGS = %w[
|
|
18
|
+
association-mediterraneenne-de-secourisme-du-06-1
|
|
19
|
+
banque-populaire-mediterranee
|
|
20
|
+
communaute-dagglomeration-cannes-lerins-1
|
|
21
|
+
communaute-urbaine-nice-cote-dazur
|
|
22
|
+
commune-de-cagnes-sur-mer
|
|
23
|
+
commune-de-fontan
|
|
24
|
+
compagnie-autobus-de-monaco
|
|
25
|
+
compagnie-des-autobus-de-monaco
|
|
26
|
+
conseil-departemental-du-var
|
|
27
|
+
ddtm-alpes-maritimes
|
|
28
|
+
departement-des-alpes-maritimes
|
|
29
|
+
eau-dazur
|
|
30
|
+
ecole-nationale-superieure-d-art-villa-arson-de-nice
|
|
31
|
+
groupement-dassociations-de-defense-de-lenvironnement-et-des-sites-de-la-cote-dazur
|
|
32
|
+
innovevents-reseau-national-dagences-evenementielles
|
|
33
|
+
mairie-de-cannes
|
|
34
|
+
mairie-de-grasse
|
|
35
|
+
mairie-de-la-gaude
|
|
36
|
+
metropole-toulon-provence-mediterranee
|
|
37
|
+
nice-cote-dazur
|
|
38
|
+
office-de-tourisme-metropolitain-nice-cote-dazur
|
|
39
|
+
parc-national-de-port-cros
|
|
40
|
+
prise-de-nice-1
|
|
41
|
+
regie-ligne-dazur
|
|
42
|
+
service-departemental-dincendie-et-de-secours-des-alpes-maritimes
|
|
43
|
+
sictiam
|
|
44
|
+
ville-dantibes
|
|
45
|
+
ville-de-frejus
|
|
46
|
+
ville-de-nice
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
def initialize(api_key: nil)
|
|
50
|
+
@api_key = api_key || ENV['DATA_GOUV_API_KEY']
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Get organization by ID or slug
|
|
54
|
+
def organization(id_or_slug)
|
|
55
|
+
response = self.class.get("/organizations/#{id_or_slug}", headers: headers)
|
|
56
|
+
handle_response(response) do |data|
|
|
57
|
+
Organization.new(data)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# List organization datasets
|
|
62
|
+
def organization_datasets(org_id_or_slug, page: 1, page_size: 20)
|
|
63
|
+
response = self.class.get(
|
|
64
|
+
"/organizations/#{org_id_or_slug}/datasets",
|
|
65
|
+
query: { page: page, page_size: page_size },
|
|
66
|
+
headers: headers
|
|
67
|
+
)
|
|
68
|
+
handle_response(response) do |data|
|
|
69
|
+
(data['data'] || []).map { |d| Dataset.new(d) }
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Get dataset by ID or slug
|
|
74
|
+
def dataset(id_or_slug)
|
|
75
|
+
response = self.class.get("/datasets/#{id_or_slug}/", headers: headers)
|
|
76
|
+
handle_response(response) do |data|
|
|
77
|
+
Dataset.new(data)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
def headers
|
|
84
|
+
headers = { 'Accept' => 'application/json' }
|
|
85
|
+
headers['X-API-KEY'] = @api_key if @api_key
|
|
86
|
+
headers
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def handle_response(response)
|
|
90
|
+
case response.code
|
|
91
|
+
when 200
|
|
92
|
+
yield response.parsed_response
|
|
93
|
+
when 404
|
|
94
|
+
raise Nice::APIError, "Resource not found"
|
|
95
|
+
when 401, 403
|
|
96
|
+
raise Nice::APIError, "Authentication failed or access denied"
|
|
97
|
+
else
|
|
98
|
+
raise Nice::APIError, "API request failed with status #{response.code}: #{response.body}"
|
|
99
|
+
end
|
|
100
|
+
rescue JSON::ParserError => e
|
|
101
|
+
raise Nice::APIError, "Failed to parse API response: #{e.message}"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require_relative 'organization'
|
|
2
|
+
require_relative 'resource'
|
|
3
|
+
|
|
4
|
+
module Nice
|
|
5
|
+
module DataGouv
|
|
6
|
+
class Dataset
|
|
7
|
+
attr_reader :id, :name, :title, :notes, :organization, :resources, :tags, :created_at, :metadata_modified
|
|
8
|
+
|
|
9
|
+
def initialize(attributes = {})
|
|
10
|
+
@id = attributes['id']
|
|
11
|
+
@name = attributes['name']
|
|
12
|
+
@title = attributes['title']
|
|
13
|
+
@notes = attributes['notes']
|
|
14
|
+
@created_at = attributes['metadata_created']
|
|
15
|
+
@metadata_modified = attributes['metadata_modified']
|
|
16
|
+
@tags = (attributes['tags'] || []).map { |t| t.is_a?(Hash) ? t['name'] : t }
|
|
17
|
+
|
|
18
|
+
@organization = if attributes['organization']
|
|
19
|
+
Organization.new(attributes['organization'])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
@resources = (attributes['resources'] || []).map do |resource_data|
|
|
23
|
+
Resource.new(resource_data)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_h
|
|
28
|
+
{
|
|
29
|
+
'id' => @id,
|
|
30
|
+
'name' => @name,
|
|
31
|
+
'title' => @title,
|
|
32
|
+
'notes' => @notes,
|
|
33
|
+
'organization' => @organization&.to_h,
|
|
34
|
+
'resources' => @resources.map(&:to_h),
|
|
35
|
+
'tags' => @tags,
|
|
36
|
+
'created_at' => @created_at,
|
|
37
|
+
'metadata_modified' => @metadata_modified
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Nice
|
|
2
|
+
module DataGouv
|
|
3
|
+
class Organization
|
|
4
|
+
attr_reader :id, :name, :slug, :title, :description, :image_url, :created_at
|
|
5
|
+
|
|
6
|
+
def initialize(attributes = {})
|
|
7
|
+
@id = attributes['id']
|
|
8
|
+
@name = attributes['name']
|
|
9
|
+
@slug = attributes['slug']
|
|
10
|
+
@title = attributes['title'] || attributes['display_name'] || attributes['name']
|
|
11
|
+
@description = attributes['description']
|
|
12
|
+
@image_url = attributes['logo'] || attributes['image_url'] || attributes['image_display_url']
|
|
13
|
+
@created_at = attributes['created_at'] || attributes['created']
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def to_h
|
|
17
|
+
{
|
|
18
|
+
'id' => @id,
|
|
19
|
+
'name' => @name,
|
|
20
|
+
'slug' => @slug,
|
|
21
|
+
'title' => @title,
|
|
22
|
+
'description' => @description,
|
|
23
|
+
'image_url' => @image_url,
|
|
24
|
+
'created_at' => @created_at
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Nice
|
|
2
|
+
module DataGouv
|
|
3
|
+
class Resource
|
|
4
|
+
attr_reader :id, :name, :description, :url, :format, :size, :created_at, :last_modified
|
|
5
|
+
|
|
6
|
+
def initialize(attributes = {})
|
|
7
|
+
@id = attributes['id']
|
|
8
|
+
@name = attributes['name']
|
|
9
|
+
@description = attributes['description']
|
|
10
|
+
@url = attributes['url']
|
|
11
|
+
@format = attributes['format']
|
|
12
|
+
@size = attributes['size']
|
|
13
|
+
@created_at = attributes['created']
|
|
14
|
+
@last_modified = attributes['last_modified']
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_h
|
|
18
|
+
{
|
|
19
|
+
'id' => @id,
|
|
20
|
+
'name' => @name,
|
|
21
|
+
'description' => @description,
|
|
22
|
+
'url' => @url,
|
|
23
|
+
'format' => @format,
|
|
24
|
+
'size' => @size,
|
|
25
|
+
'created_at' => @created_at,
|
|
26
|
+
'last_modified' => @last_modified
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/nice/version.rb
CHANGED
data/lib/nice.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicolas Leger
|
|
@@ -157,6 +157,7 @@ executables: []
|
|
|
157
157
|
extensions: []
|
|
158
158
|
extra_rdoc_files: []
|
|
159
159
|
files:
|
|
160
|
+
- ".release-please-manifest.json"
|
|
160
161
|
- ".rspec"
|
|
161
162
|
- CHANGELOG.md
|
|
162
163
|
- Gemfile
|
|
@@ -166,8 +167,13 @@ files:
|
|
|
166
167
|
- Rakefile
|
|
167
168
|
- lib/nice.rb
|
|
168
169
|
- lib/nice/client.rb
|
|
170
|
+
- lib/nice/data_gouv/client.rb
|
|
171
|
+
- lib/nice/data_gouv/dataset.rb
|
|
172
|
+
- lib/nice/data_gouv/organization.rb
|
|
173
|
+
- lib/nice/data_gouv/resource.rb
|
|
169
174
|
- lib/nice/version.rb
|
|
170
175
|
- nice.gemspec
|
|
176
|
+
- release-please-config.json
|
|
171
177
|
homepage: https://github.com/nicolasleger/nice
|
|
172
178
|
licenses:
|
|
173
179
|
- MIT
|