api_geo_client 1.0.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 +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/LICENSE +21 -0
- data/README.md +106 -0
- data/Rakefile +9 -0
- data/api_geo_client.gemspec +45 -0
- data/api_geo_spec.yml +413 -0
- data/config.json +10 -0
- data/docs/Commune.md +18 -0
- data/docs/CommunesApi.md +183 -0
- data/docs/Departement.md +11 -0
- data/docs/DpartementsApi.md +215 -0
- data/docs/Error.md +10 -0
- data/docs/Region.md +9 -0
- data/docs/RgionsApi.md +159 -0
- data/git_push.sh +55 -0
- data/lib/api_geo_client.rb +46 -0
- data/lib/api_geo_client/api/communes_api.rb +245 -0
- data/lib/api_geo_client/api/dpartements_api.rb +262 -0
- data/lib/api_geo_client/api/rgions_api.rb +191 -0
- data/lib/api_geo_client/api_client.rb +388 -0
- data/lib/api_geo_client/api_error.rb +38 -0
- data/lib/api_geo_client/configuration.rb +202 -0
- data/lib/api_geo_client/models/commune.rb +284 -0
- data/lib/api_geo_client/models/departement.rb +213 -0
- data/lib/api_geo_client/models/error.rb +204 -0
- data/lib/api_geo_client/models/region.rb +194 -0
- data/lib/api_geo_client/version.rb +15 -0
- data/spec/api/communes_api_spec.rb +84 -0
- data/spec/api/dpartements_api_spec.rb +87 -0
- data/spec/api/rgions_api_spec.rb +72 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/commune_spec.rb +101 -0
- data/spec/models/departement_spec.rb +59 -0
- data/spec/models/error_spec.rb +53 -0
- data/spec/models/region_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +272 -0
data/config.json
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"gemName": "api_geo_client",
|
3
|
+
"gemAuthor": "Armand Mégrot",
|
4
|
+
"gemAuthorEmail": "armand.megrot@cashbee.fr",
|
5
|
+
"gemSummary": "API Géo Ruby Gem",
|
6
|
+
"gemDescription": "API Géo. More info at https://api.gouv.fr/api/api-geo.html. Generated by Cashbee https://www.cashbee.fr",
|
7
|
+
"gemHomepage": "https://github.com/cashbee-team/api_geo_client",
|
8
|
+
"moduleName": "ApiGeoClient",
|
9
|
+
"gemLicense": "MIT"
|
10
|
+
}
|
data/docs/Commune.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# ApiGeoClient::Commune
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**code** | **String** | Code INSEE de la commune | [optional]
|
7
|
+
**nom** | **String** | Nom de la commune | [optional]
|
8
|
+
**codes_postaux** | **Array<String>** | Liste des codes postaux associés à la commune | [optional]
|
9
|
+
**code_departement** | **String** | Code du département associé à la commune | [optional]
|
10
|
+
**code_region** | **String** | Code de la région associée à la commune | [optional]
|
11
|
+
**departement** | [**Departement**](Departement.md) | | [optional]
|
12
|
+
**region** | [**Region**](Region.md) | | [optional]
|
13
|
+
**population** | **Integer** | Population municipale | [optional]
|
14
|
+
**surface** | **Float** | Surface de la commune, en mètres-carrés | [optional]
|
15
|
+
**centre** | **Object** | Centre de la commune (Point GeoJSON) | [optional]
|
16
|
+
**contour** | **Object** | Contour de la commune (Polygon GeoJSON) | [optional]
|
17
|
+
|
18
|
+
|
data/docs/CommunesApi.md
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
# ApiGeoClient::CommunesApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://geo.api.gouv.fr*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**communes_code_get**](CommunesApi.md#communes_code_get) | **GET** /communes/{code} | Récupérer les informations concernant une commune
|
8
|
+
[**communes_get**](CommunesApi.md#communes_get) | **GET** /communes | Recherche des communes
|
9
|
+
[**departements_code_communes_get**](CommunesApi.md#departements_code_communes_get) | **GET** /departements/{code}/communes | Renvoi les communes d'un département
|
10
|
+
|
11
|
+
|
12
|
+
# **communes_code_get**
|
13
|
+
> Commune communes_code_get(code, opts)
|
14
|
+
|
15
|
+
Récupérer les informations concernant une commune
|
16
|
+
|
17
|
+
### Example
|
18
|
+
```ruby
|
19
|
+
# load the gem
|
20
|
+
require 'api_geo_client'
|
21
|
+
|
22
|
+
api_instance = ApiGeoClient::CommunesApi.new
|
23
|
+
|
24
|
+
code = 'code_example' # String | Code INSEE de la commune
|
25
|
+
|
26
|
+
opts = {
|
27
|
+
fields: ['[\"nom\",\"code\",\"codesPostaux\",\"codeDepartement\",\"codeRegion\",\"population\"]'], # Array<String> | Liste des champs souhaités dans la réponse
|
28
|
+
format: 'json', # String | Format de réponse attendu
|
29
|
+
geometry: 'centre' # String | Géométrie à utiliser pour la sortie géographique
|
30
|
+
}
|
31
|
+
|
32
|
+
begin
|
33
|
+
#Récupérer les informations concernant une commune
|
34
|
+
result = api_instance.communes_code_get(code, opts)
|
35
|
+
p result
|
36
|
+
rescue ApiGeoClient::ApiError => e
|
37
|
+
puts "Exception when calling CommunesApi->communes_code_get: #{e}"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Parameters
|
42
|
+
|
43
|
+
Name | Type | Description | Notes
|
44
|
+
------------- | ------------- | ------------- | -------------
|
45
|
+
**code** | **String**| Code INSEE de la commune |
|
46
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"]]
|
47
|
+
**format** | **String**| Format de réponse attendu | [optional] [default to json]
|
48
|
+
**geometry** | **String**| Géométrie à utiliser pour la sortie géographique | [optional] [default to centre]
|
49
|
+
|
50
|
+
### Return type
|
51
|
+
|
52
|
+
[**Commune**](Commune.md)
|
53
|
+
|
54
|
+
### Authorization
|
55
|
+
|
56
|
+
No authorization required
|
57
|
+
|
58
|
+
### HTTP request headers
|
59
|
+
|
60
|
+
- **Content-Type**: Not defined
|
61
|
+
- **Accept**: application/json
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# **communes_get**
|
66
|
+
> Array<Commune> communes_get(opts)
|
67
|
+
|
68
|
+
Recherche des communes
|
69
|
+
|
70
|
+
### Example
|
71
|
+
```ruby
|
72
|
+
# load the gem
|
73
|
+
require 'api_geo_client'
|
74
|
+
|
75
|
+
api_instance = ApiGeoClient::CommunesApi.new
|
76
|
+
|
77
|
+
opts = {
|
78
|
+
code_postal: 'code_postal_example', # String | Code postal associé
|
79
|
+
lat: 3.4, # Float | Latitude (en degrés)
|
80
|
+
lon: 3.4, # Float | Longitude (en degrés)
|
81
|
+
nom: 'nom_example', # String | Nom de la commune
|
82
|
+
boost: 'boost_example', # String | Mode de boost de la recherche par nom
|
83
|
+
code: 'code_example', # String | Code de la commune
|
84
|
+
code_departement: 'code_departement_example', # String | Code du département associé
|
85
|
+
code_region: 'code_region_example', # String | Code de la région associée
|
86
|
+
fields: ['[\"nom\",\"code\",\"codesPostaux\",\"codeDepartement\",\"codeRegion\",\"population\"]'], # Array<String> | Liste des champs souhaités dans la réponse
|
87
|
+
format: 'json', # String | Format de réponse attendu
|
88
|
+
geometry: 'centre' # String | Géométrie à utiliser pour la sortie géographique
|
89
|
+
}
|
90
|
+
|
91
|
+
begin
|
92
|
+
#Recherche des communes
|
93
|
+
result = api_instance.communes_get(opts)
|
94
|
+
p result
|
95
|
+
rescue ApiGeoClient::ApiError => e
|
96
|
+
puts "Exception when calling CommunesApi->communes_get: #{e}"
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
100
|
+
### Parameters
|
101
|
+
|
102
|
+
Name | Type | Description | Notes
|
103
|
+
------------- | ------------- | ------------- | -------------
|
104
|
+
**code_postal** | **String**| Code postal associé | [optional]
|
105
|
+
**lat** | **Float**| Latitude (en degrés) | [optional]
|
106
|
+
**lon** | **Float**| Longitude (en degrés) | [optional]
|
107
|
+
**nom** | **String**| Nom de la commune | [optional]
|
108
|
+
**boost** | **String**| Mode de boost de la recherche par nom | [optional]
|
109
|
+
**code** | **String**| Code de la commune | [optional]
|
110
|
+
**code_departement** | **String**| Code du département associé | [optional]
|
111
|
+
**code_region** | **String**| Code de la région associée | [optional]
|
112
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"]]
|
113
|
+
**format** | **String**| Format de réponse attendu | [optional] [default to json]
|
114
|
+
**geometry** | **String**| Géométrie à utiliser pour la sortie géographique | [optional] [default to centre]
|
115
|
+
|
116
|
+
### Return type
|
117
|
+
|
118
|
+
[**Array<Commune>**](Commune.md)
|
119
|
+
|
120
|
+
### Authorization
|
121
|
+
|
122
|
+
No authorization required
|
123
|
+
|
124
|
+
### HTTP request headers
|
125
|
+
|
126
|
+
- **Content-Type**: Not defined
|
127
|
+
- **Accept**: application/json
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
# **departements_code_communes_get**
|
132
|
+
> Commune departements_code_communes_get(code, opts)
|
133
|
+
|
134
|
+
Renvoi les communes d'un département
|
135
|
+
|
136
|
+
### Example
|
137
|
+
```ruby
|
138
|
+
# load the gem
|
139
|
+
require 'api_geo_client'
|
140
|
+
|
141
|
+
api_instance = ApiGeoClient::CommunesApi.new
|
142
|
+
|
143
|
+
code = 'code_example' # String | Code du département
|
144
|
+
|
145
|
+
opts = {
|
146
|
+
fields: ['[\"nom\",\"code\",\"codesPostaux\",\"codeDepartement\",\"codeRegion\",\"population\"]'], # Array<String> | Liste des champs souhaités dans la réponse
|
147
|
+
format: 'json', # String | Format de réponse attendu
|
148
|
+
geometry: 'centre' # String | Géométrie à utiliser pour la sortie géographique
|
149
|
+
}
|
150
|
+
|
151
|
+
begin
|
152
|
+
#Renvoi les communes d'un département
|
153
|
+
result = api_instance.departements_code_communes_get(code, opts)
|
154
|
+
p result
|
155
|
+
rescue ApiGeoClient::ApiError => e
|
156
|
+
puts "Exception when calling CommunesApi->departements_code_communes_get: #{e}"
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
160
|
+
### Parameters
|
161
|
+
|
162
|
+
Name | Type | Description | Notes
|
163
|
+
------------- | ------------- | ------------- | -------------
|
164
|
+
**code** | **String**| Code du département |
|
165
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"]]
|
166
|
+
**format** | **String**| Format de réponse attendu | [optional] [default to json]
|
167
|
+
**geometry** | **String**| Géométrie à utiliser pour la sortie géographique | [optional] [default to centre]
|
168
|
+
|
169
|
+
### Return type
|
170
|
+
|
171
|
+
[**Commune**](Commune.md)
|
172
|
+
|
173
|
+
### Authorization
|
174
|
+
|
175
|
+
No authorization required
|
176
|
+
|
177
|
+
### HTTP request headers
|
178
|
+
|
179
|
+
- **Content-Type**: Not defined
|
180
|
+
- **Accept**: application/json
|
181
|
+
|
182
|
+
|
183
|
+
|
data/docs/Departement.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# ApiGeoClient::Departement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**code** | **String** | Code du département | [optional]
|
7
|
+
**nom** | **String** | Nom du département | [optional]
|
8
|
+
**code_region** | **String** | Code de la région | [optional]
|
9
|
+
**region** | [**Region**](Region.md) | | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# ApiGeoClient::DpartementsApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://geo.api.gouv.fr*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**departements_code_communes_get**](DpartementsApi.md#departements_code_communes_get) | **GET** /departements/{code}/communes | Renvoi les communes d'un département
|
8
|
+
[**departements_code_get**](DpartementsApi.md#departements_code_get) | **GET** /departements/{code} | Récupérer les informations concernant un département
|
9
|
+
[**departements_get**](DpartementsApi.md#departements_get) | **GET** /departements | Recherche des départements
|
10
|
+
[**regions_code_departements_get**](DpartementsApi.md#regions_code_departements_get) | **GET** /regions/{code}/departements | Renvoi les départements d'une région
|
11
|
+
|
12
|
+
|
13
|
+
# **departements_code_communes_get**
|
14
|
+
> Commune departements_code_communes_get(code, opts)
|
15
|
+
|
16
|
+
Renvoi les communes d'un département
|
17
|
+
|
18
|
+
### Example
|
19
|
+
```ruby
|
20
|
+
# load the gem
|
21
|
+
require 'api_geo_client'
|
22
|
+
|
23
|
+
api_instance = ApiGeoClient::DpartementsApi.new
|
24
|
+
|
25
|
+
code = 'code_example' # String | Code du département
|
26
|
+
|
27
|
+
opts = {
|
28
|
+
fields: ['[\"nom\",\"code\",\"codesPostaux\",\"codeDepartement\",\"codeRegion\",\"population\"]'], # Array<String> | Liste des champs souhaités dans la réponse
|
29
|
+
format: 'json', # String | Format de réponse attendu
|
30
|
+
geometry: 'centre' # String | Géométrie à utiliser pour la sortie géographique
|
31
|
+
}
|
32
|
+
|
33
|
+
begin
|
34
|
+
#Renvoi les communes d'un département
|
35
|
+
result = api_instance.departements_code_communes_get(code, opts)
|
36
|
+
p result
|
37
|
+
rescue ApiGeoClient::ApiError => e
|
38
|
+
puts "Exception when calling DpartementsApi->departements_code_communes_get: #{e}"
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
### Parameters
|
43
|
+
|
44
|
+
Name | Type | Description | Notes
|
45
|
+
------------- | ------------- | ------------- | -------------
|
46
|
+
**code** | **String**| Code du département |
|
47
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"]]
|
48
|
+
**format** | **String**| Format de réponse attendu | [optional] [default to json]
|
49
|
+
**geometry** | **String**| Géométrie à utiliser pour la sortie géographique | [optional] [default to centre]
|
50
|
+
|
51
|
+
### Return type
|
52
|
+
|
53
|
+
[**Commune**](Commune.md)
|
54
|
+
|
55
|
+
### Authorization
|
56
|
+
|
57
|
+
No authorization required
|
58
|
+
|
59
|
+
### HTTP request headers
|
60
|
+
|
61
|
+
- **Content-Type**: Not defined
|
62
|
+
- **Accept**: application/json
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
# **departements_code_get**
|
67
|
+
> Departement departements_code_get(code, opts)
|
68
|
+
|
69
|
+
Récupérer les informations concernant un département
|
70
|
+
|
71
|
+
### Example
|
72
|
+
```ruby
|
73
|
+
# load the gem
|
74
|
+
require 'api_geo_client'
|
75
|
+
|
76
|
+
api_instance = ApiGeoClient::DpartementsApi.new
|
77
|
+
|
78
|
+
code = 'code_example' # String | Code du département
|
79
|
+
|
80
|
+
opts = {
|
81
|
+
fields: ['[\"nom\",\"code\",\"codeRegion\"]'] # Array<String> | Liste des champs souhaités dans la réponse
|
82
|
+
}
|
83
|
+
|
84
|
+
begin
|
85
|
+
#Récupérer les informations concernant un département
|
86
|
+
result = api_instance.departements_code_get(code, opts)
|
87
|
+
p result
|
88
|
+
rescue ApiGeoClient::ApiError => e
|
89
|
+
puts "Exception when calling DpartementsApi->departements_code_get: #{e}"
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
### Parameters
|
94
|
+
|
95
|
+
Name | Type | Description | Notes
|
96
|
+
------------- | ------------- | ------------- | -------------
|
97
|
+
**code** | **String**| Code du département |
|
98
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codeRegion"]]
|
99
|
+
|
100
|
+
### Return type
|
101
|
+
|
102
|
+
[**Departement**](Departement.md)
|
103
|
+
|
104
|
+
### Authorization
|
105
|
+
|
106
|
+
No authorization required
|
107
|
+
|
108
|
+
### HTTP request headers
|
109
|
+
|
110
|
+
- **Content-Type**: Not defined
|
111
|
+
- **Accept**: application/json
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
# **departements_get**
|
116
|
+
> Array<Departement> departements_get(opts)
|
117
|
+
|
118
|
+
Recherche des départements
|
119
|
+
|
120
|
+
### Example
|
121
|
+
```ruby
|
122
|
+
# load the gem
|
123
|
+
require 'api_geo_client'
|
124
|
+
|
125
|
+
api_instance = ApiGeoClient::DpartementsApi.new
|
126
|
+
|
127
|
+
opts = {
|
128
|
+
code: 'code_example', # String | Code du département
|
129
|
+
code_region: 'code_region_example', # String | Code région associé
|
130
|
+
nom: 'nom_example', # String | Nom du département
|
131
|
+
fields: ['[\"nom\",\"code\",\"codeRegion\"]'] # Array<String> | Liste des champs souhaités dans la réponse
|
132
|
+
}
|
133
|
+
|
134
|
+
begin
|
135
|
+
#Recherche des départements
|
136
|
+
result = api_instance.departements_get(opts)
|
137
|
+
p result
|
138
|
+
rescue ApiGeoClient::ApiError => e
|
139
|
+
puts "Exception when calling DpartementsApi->departements_get: #{e}"
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
143
|
+
### Parameters
|
144
|
+
|
145
|
+
Name | Type | Description | Notes
|
146
|
+
------------- | ------------- | ------------- | -------------
|
147
|
+
**code** | **String**| Code du département | [optional]
|
148
|
+
**code_region** | **String**| Code région associé | [optional]
|
149
|
+
**nom** | **String**| Nom du département | [optional]
|
150
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code","codeRegion"]]
|
151
|
+
|
152
|
+
### Return type
|
153
|
+
|
154
|
+
[**Array<Departement>**](Departement.md)
|
155
|
+
|
156
|
+
### Authorization
|
157
|
+
|
158
|
+
No authorization required
|
159
|
+
|
160
|
+
### HTTP request headers
|
161
|
+
|
162
|
+
- **Content-Type**: Not defined
|
163
|
+
- **Accept**: application/json
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
# **regions_code_departements_get**
|
168
|
+
> Departement regions_code_departements_get(code, opts)
|
169
|
+
|
170
|
+
Renvoi les départements d'une région
|
171
|
+
|
172
|
+
### Example
|
173
|
+
```ruby
|
174
|
+
# load the gem
|
175
|
+
require 'api_geo_client'
|
176
|
+
|
177
|
+
api_instance = ApiGeoClient::DpartementsApi.new
|
178
|
+
|
179
|
+
code = 'code_example' # String | Code de la région
|
180
|
+
|
181
|
+
opts = {
|
182
|
+
fields: ['[\"nom\",\"code\"]'] # Array<String> | Liste des champs souhaités dans la réponse
|
183
|
+
}
|
184
|
+
|
185
|
+
begin
|
186
|
+
#Renvoi les départements d'une région
|
187
|
+
result = api_instance.regions_code_departements_get(code, opts)
|
188
|
+
p result
|
189
|
+
rescue ApiGeoClient::ApiError => e
|
190
|
+
puts "Exception when calling DpartementsApi->regions_code_departements_get: #{e}"
|
191
|
+
end
|
192
|
+
```
|
193
|
+
|
194
|
+
### Parameters
|
195
|
+
|
196
|
+
Name | Type | Description | Notes
|
197
|
+
------------- | ------------- | ------------- | -------------
|
198
|
+
**code** | **String**| Code de la région |
|
199
|
+
**fields** | [**Array<String>**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to ["nom","code"]]
|
200
|
+
|
201
|
+
### Return type
|
202
|
+
|
203
|
+
[**Departement**](Departement.md)
|
204
|
+
|
205
|
+
### Authorization
|
206
|
+
|
207
|
+
No authorization required
|
208
|
+
|
209
|
+
### HTTP request headers
|
210
|
+
|
211
|
+
- **Content-Type**: Not defined
|
212
|
+
- **Accept**: application/json
|
213
|
+
|
214
|
+
|
215
|
+
|
data/docs/Error.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# ApiGeoClient::Error
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**code** | **Integer** | Code HTTP de l'erreur | [optional]
|
7
|
+
**message** | **String** | Libellé de l'erreur | [optional]
|
8
|
+
**description** | **String** | Explication | [optional]
|
9
|
+
|
10
|
+
|