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.
data/docs/Region.md ADDED
@@ -0,0 +1,9 @@
1
+ # ApiGeoClient::Region
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **code** | **String** | Code de la région | [optional]
7
+ **nom** | **String** | Nom de la région | [optional]
8
+
9
+
data/docs/RgionsApi.md ADDED
@@ -0,0 +1,159 @@
1
+ # ApiGeoClient::RgionsApi
2
+
3
+ All URIs are relative to *https://geo.api.gouv.fr*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**regions_code_departements_get**](RgionsApi.md#regions_code_departements_get) | **GET** /regions/{code}/departements | Renvoi les départements d'une région
8
+ [**regions_code_get**](RgionsApi.md#regions_code_get) | **GET** /regions/{code} | Récupérer les informations concernant une région
9
+ [**regions_get**](RgionsApi.md#regions_get) | **GET** /regions | Recherche des régions
10
+
11
+
12
+ # **regions_code_departements_get**
13
+ > Departement regions_code_departements_get(code, opts)
14
+
15
+ Renvoi les départements d'une région
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'api_geo_client'
21
+
22
+ api_instance = ApiGeoClient::RgionsApi.new
23
+
24
+ code = 'code_example' # String | Code de la région
25
+
26
+ opts = {
27
+ fields: ['[\"nom\",\"code\"]'] # Array<String> | Liste des champs souhaités dans la réponse
28
+ }
29
+
30
+ begin
31
+ #Renvoi les départements d'une région
32
+ result = api_instance.regions_code_departements_get(code, opts)
33
+ p result
34
+ rescue ApiGeoClient::ApiError => e
35
+ puts "Exception when calling RgionsApi->regions_code_departements_get: #{e}"
36
+ end
37
+ ```
38
+
39
+ ### Parameters
40
+
41
+ Name | Type | Description | Notes
42
+ ------------- | ------------- | ------------- | -------------
43
+ **code** | **String**| Code de la région |
44
+ **fields** | [**Array&lt;String&gt;**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to [&quot;nom&quot;,&quot;code&quot;]]
45
+
46
+ ### Return type
47
+
48
+ [**Departement**](Departement.md)
49
+
50
+ ### Authorization
51
+
52
+ No authorization required
53
+
54
+ ### HTTP request headers
55
+
56
+ - **Content-Type**: Not defined
57
+ - **Accept**: application/json
58
+
59
+
60
+
61
+ # **regions_code_get**
62
+ > Departement regions_code_get(code, opts)
63
+
64
+ Récupérer les informations concernant une région
65
+
66
+ ### Example
67
+ ```ruby
68
+ # load the gem
69
+ require 'api_geo_client'
70
+
71
+ api_instance = ApiGeoClient::RgionsApi.new
72
+
73
+ code = 'code_example' # String | Code de la région
74
+
75
+ opts = {
76
+ fields: ['[\"nom\",\"code\"]'] # Array<String> | Liste des champs souhaités dans la réponse
77
+ }
78
+
79
+ begin
80
+ #Récupérer les informations concernant une région
81
+ result = api_instance.regions_code_get(code, opts)
82
+ p result
83
+ rescue ApiGeoClient::ApiError => e
84
+ puts "Exception when calling RgionsApi->regions_code_get: #{e}"
85
+ end
86
+ ```
87
+
88
+ ### Parameters
89
+
90
+ Name | Type | Description | Notes
91
+ ------------- | ------------- | ------------- | -------------
92
+ **code** | **String**| Code de la région |
93
+ **fields** | [**Array&lt;String&gt;**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to [&quot;nom&quot;,&quot;code&quot;]]
94
+
95
+ ### Return type
96
+
97
+ [**Departement**](Departement.md)
98
+
99
+ ### Authorization
100
+
101
+ No authorization required
102
+
103
+ ### HTTP request headers
104
+
105
+ - **Content-Type**: Not defined
106
+ - **Accept**: application/json
107
+
108
+
109
+
110
+ # **regions_get**
111
+ > Array&lt;Region&gt; regions_get(opts)
112
+
113
+ Recherche des régions
114
+
115
+ ### Example
116
+ ```ruby
117
+ # load the gem
118
+ require 'api_geo_client'
119
+
120
+ api_instance = ApiGeoClient::RgionsApi.new
121
+
122
+ opts = {
123
+ code: 'code_example', # String | Code de la région
124
+ nom: 'nom_example', # String | Nom de la région
125
+ fields: ['[\"nom\",\"code\"]'] # Array<String> | Liste des champs souhaités dans la réponse
126
+ }
127
+
128
+ begin
129
+ #Recherche des régions
130
+ result = api_instance.regions_get(opts)
131
+ p result
132
+ rescue ApiGeoClient::ApiError => e
133
+ puts "Exception when calling RgionsApi->regions_get: #{e}"
134
+ end
135
+ ```
136
+
137
+ ### Parameters
138
+
139
+ Name | Type | Description | Notes
140
+ ------------- | ------------- | ------------- | -------------
141
+ **code** | **String**| Code de la région | [optional]
142
+ **nom** | **String**| Nom de la région | [optional]
143
+ **fields** | [**Array&lt;String&gt;**](String.md)| Liste des champs souhaités dans la réponse | [optional] [default to [&quot;nom&quot;,&quot;code&quot;]]
144
+
145
+ ### Return type
146
+
147
+ [**Array&lt;Region&gt;**](Region.md)
148
+
149
+ ### Authorization
150
+
151
+ No authorization required
152
+
153
+ ### HTTP request headers
154
+
155
+ - **Content-Type**: Not defined
156
+ - **Accept**: application/json
157
+
158
+
159
+
data/git_push.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
+ #
7
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
8
+
9
+ git_user_id=$1
10
+ git_repo_id=$2
11
+ release_note=$3
12
+
13
+ if [ "$git_user_id" = "" ]; then
14
+ git_user_id="GIT_USER_ID"
15
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
+ fi
17
+
18
+ if [ "$git_repo_id" = "" ]; then
19
+ git_repo_id="GIT_REPO_ID"
20
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
+ fi
22
+
23
+ if [ "$release_note" = "" ]; then
24
+ release_note="Minor update"
25
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
+ fi
27
+
28
+ # Initialize the local directory as a Git repository
29
+ git init
30
+
31
+ # Adds the files in the local repository and stages them for commit.
32
+ git add .
33
+
34
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
+ git commit -m "$release_note"
36
+
37
+ # Sets the new remote
38
+ git_remote=`git remote`
39
+ if [ "$git_remote" = "" ]; then # git remote not defined
40
+
41
+ if [ "$GIT_TOKEN" = "" ]; then
42
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
+ else
45
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
+ fi
47
+
48
+ fi
49
+
50
+ git pull origin master
51
+
52
+ # Pushes (Forces) the changes in the local repository up to the remote repository
53
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
+ git push origin master 2>&1 | grep -v 'To https'
55
+
@@ -0,0 +1,46 @@
1
+ =begin
2
+ #API Référentiels géographiques
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0-beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'api_geo_client/api_client'
15
+ require 'api_geo_client/api_error'
16
+ require 'api_geo_client/version'
17
+ require 'api_geo_client/configuration'
18
+
19
+ # Models
20
+ require 'api_geo_client/models/commune'
21
+ require 'api_geo_client/models/departement'
22
+ require 'api_geo_client/models/error'
23
+ require 'api_geo_client/models/region'
24
+
25
+ # APIs
26
+ require 'api_geo_client/api/communes_api'
27
+ require 'api_geo_client/api/dpartements_api'
28
+ require 'api_geo_client/api/rgions_api'
29
+
30
+ module ApiGeoClient
31
+ class << self
32
+ # Customize default settings for the SDK using block.
33
+ # ApiGeoClient.configure do |config|
34
+ # config.username = "xxx"
35
+ # config.password = "xxx"
36
+ # end
37
+ # If no block given, return the default Configuration object.
38
+ def configure
39
+ if block_given?
40
+ yield(Configuration.default)
41
+ else
42
+ Configuration.default
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,245 @@
1
+ =begin
2
+ #API Référentiels géographiques
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0-beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.5
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module ApiGeoClient
16
+ class CommunesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Récupérer les informations concernant une commune
23
+ # @param code Code INSEE de la commune
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"])
26
+ # @option opts [String] :format Format de réponse attendu (default to json)
27
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique (default to centre)
28
+ # @return [Commune]
29
+ def communes_code_get(code, opts = {})
30
+ data, _status_code, _headers = communes_code_get_with_http_info(code, opts)
31
+ data
32
+ end
33
+
34
+ # Récupérer les informations concernant une commune
35
+ # @param code Code INSEE de la commune
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
38
+ # @option opts [String] :format Format de réponse attendu
39
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique
40
+ # @return [Array<(Commune, Fixnum, Hash)>] Commune data, response status code and response headers
41
+ def communes_code_get_with_http_info(code, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: CommunesApi.communes_code_get ...'
44
+ end
45
+ # verify the required parameter 'code' is set
46
+ if @api_client.config.client_side_validation && code.nil?
47
+ fail ArgumentError, "Missing the required parameter 'code' when calling CommunesApi.communes_code_get"
48
+ end
49
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codesPostaux', 'centre', 'surface', 'contour', 'codeDepartement', 'departement', 'codeRegion', 'region', 'population'].include?(item) }
50
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codesPostaux, centre, surface, contour, codeDepartement, departement, codeRegion, region, population'
51
+ end
52
+ if @api_client.config.client_side_validation && opts[:'format'] && !['json', 'geojson'].include?(opts[:'format'])
53
+ fail ArgumentError, 'invalid value for "format", must be one of json, geojson'
54
+ end
55
+ if @api_client.config.client_side_validation && opts[:'geometry'] && !['centre', 'contour'].include?(opts[:'geometry'])
56
+ fail ArgumentError, 'invalid value for "geometry", must be one of centre, contour'
57
+ end
58
+ # resource path
59
+ local_var_path = '/communes/{code}'.sub('{' + 'code' + '}', code.to_s)
60
+
61
+ # query parameters
62
+ query_params = {}
63
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
64
+ query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
65
+ query_params[:'geometry'] = opts[:'geometry'] if !opts[:'geometry'].nil?
66
+
67
+ # header parameters
68
+ header_params = {}
69
+ # HTTP header 'Accept' (if needed)
70
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
71
+
72
+ # form parameters
73
+ form_params = {}
74
+
75
+ # http body (model)
76
+ post_body = nil
77
+ auth_names = []
78
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => 'Commune')
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: CommunesApi#communes_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+ # Recherche des communes
91
+ # @param [Hash] opts the optional parameters
92
+ # @option opts [String] :code_postal Code postal associé
93
+ # @option opts [Float] :lat Latitude (en degrés)
94
+ # @option opts [Float] :lon Longitude (en degrés)
95
+ # @option opts [String] :nom Nom de la commune
96
+ # @option opts [String] :boost Mode de boost de la recherche par nom
97
+ # @option opts [String] :code Code de la commune
98
+ # @option opts [String] :code_departement Code du département associé
99
+ # @option opts [String] :code_region Code de la région associée
100
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"])
101
+ # @option opts [String] :format Format de réponse attendu (default to json)
102
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique (default to centre)
103
+ # @return [Array<Commune>]
104
+ def communes_get(opts = {})
105
+ data, _status_code, _headers = communes_get_with_http_info(opts)
106
+ data
107
+ end
108
+
109
+ # Recherche des communes
110
+ # @param [Hash] opts the optional parameters
111
+ # @option opts [String] :code_postal Code postal associé
112
+ # @option opts [Float] :lat Latitude (en degrés)
113
+ # @option opts [Float] :lon Longitude (en degrés)
114
+ # @option opts [String] :nom Nom de la commune
115
+ # @option opts [String] :boost Mode de boost de la recherche par nom
116
+ # @option opts [String] :code Code de la commune
117
+ # @option opts [String] :code_departement Code du département associé
118
+ # @option opts [String] :code_region Code de la région associée
119
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
120
+ # @option opts [String] :format Format de réponse attendu
121
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique
122
+ # @return [Array<(Array<Commune>, Fixnum, Hash)>] Array<Commune> data, response status code and response headers
123
+ def communes_get_with_http_info(opts = {})
124
+ if @api_client.config.debugging
125
+ @api_client.config.logger.debug 'Calling API: CommunesApi.communes_get ...'
126
+ end
127
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codesPostaux', 'centre', 'surface', 'contour', 'codeDepartement', 'departement', 'codeRegion', 'region', 'population'].include?(item) }
128
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codesPostaux, centre, surface, contour, codeDepartement, departement, codeRegion, region, population'
129
+ end
130
+ if @api_client.config.client_side_validation && opts[:'format'] && !['json', 'geojson'].include?(opts[:'format'])
131
+ fail ArgumentError, 'invalid value for "format", must be one of json, geojson'
132
+ end
133
+ if @api_client.config.client_side_validation && opts[:'geometry'] && !['centre', 'contour'].include?(opts[:'geometry'])
134
+ fail ArgumentError, 'invalid value for "geometry", must be one of centre, contour'
135
+ end
136
+ # resource path
137
+ local_var_path = '/communes'
138
+
139
+ # query parameters
140
+ query_params = {}
141
+ query_params[:'codePostal'] = opts[:'code_postal'] if !opts[:'code_postal'].nil?
142
+ query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
143
+ query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
144
+ query_params[:'nom'] = opts[:'nom'] if !opts[:'nom'].nil?
145
+ query_params[:'boost'] = opts[:'boost'] if !opts[:'boost'].nil?
146
+ query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
147
+ query_params[:'codeDepartement'] = opts[:'code_departement'] if !opts[:'code_departement'].nil?
148
+ query_params[:'codeRegion'] = opts[:'code_region'] if !opts[:'code_region'].nil?
149
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
150
+ query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
151
+ query_params[:'geometry'] = opts[:'geometry'] if !opts[:'geometry'].nil?
152
+
153
+ # header parameters
154
+ header_params = {}
155
+ # HTTP header 'Accept' (if needed)
156
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
157
+
158
+ # form parameters
159
+ form_params = {}
160
+
161
+ # http body (model)
162
+ post_body = nil
163
+ auth_names = []
164
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
165
+ :header_params => header_params,
166
+ :query_params => query_params,
167
+ :form_params => form_params,
168
+ :body => post_body,
169
+ :auth_names => auth_names,
170
+ :return_type => 'Array<Commune>')
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: CommunesApi#communes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+ # Renvoi les communes d'un département
177
+ # @param code Code du département
178
+ # @param [Hash] opts the optional parameters
179
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code","codesPostaux","codeDepartement","codeRegion","population"])
180
+ # @option opts [String] :format Format de réponse attendu (default to json)
181
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique (default to centre)
182
+ # @return [Commune]
183
+ def departements_code_communes_get(code, opts = {})
184
+ data, _status_code, _headers = departements_code_communes_get_with_http_info(code, opts)
185
+ data
186
+ end
187
+
188
+ # Renvoi les communes d&#39;un département
189
+ # @param code Code du département
190
+ # @param [Hash] opts the optional parameters
191
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
192
+ # @option opts [String] :format Format de réponse attendu
193
+ # @option opts [String] :geometry Géométrie à utiliser pour la sortie géographique
194
+ # @return [Array<(Commune, Fixnum, Hash)>] Commune data, response status code and response headers
195
+ def departements_code_communes_get_with_http_info(code, opts = {})
196
+ if @api_client.config.debugging
197
+ @api_client.config.logger.debug 'Calling API: CommunesApi.departements_code_communes_get ...'
198
+ end
199
+ # verify the required parameter 'code' is set
200
+ if @api_client.config.client_side_validation && code.nil?
201
+ fail ArgumentError, "Missing the required parameter 'code' when calling CommunesApi.departements_code_communes_get"
202
+ end
203
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codesPostaux', 'centre', 'surface', 'contour', 'codeDepartement', 'departement', 'codeRegion', 'region', 'population'].include?(item) }
204
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codesPostaux, centre, surface, contour, codeDepartement, departement, codeRegion, region, population'
205
+ end
206
+ if @api_client.config.client_side_validation && opts[:'format'] && !['json', 'geojson'].include?(opts[:'format'])
207
+ fail ArgumentError, 'invalid value for "format", must be one of json, geojson'
208
+ end
209
+ if @api_client.config.client_side_validation && opts[:'geometry'] && !['centre', 'contour'].include?(opts[:'geometry'])
210
+ fail ArgumentError, 'invalid value for "geometry", must be one of centre, contour'
211
+ end
212
+ # resource path
213
+ local_var_path = '/departements/{code}/communes'.sub('{' + 'code' + '}', code.to_s)
214
+
215
+ # query parameters
216
+ query_params = {}
217
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
218
+ query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
219
+ query_params[:'geometry'] = opts[:'geometry'] if !opts[:'geometry'].nil?
220
+
221
+ # header parameters
222
+ header_params = {}
223
+ # HTTP header 'Accept' (if needed)
224
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
225
+
226
+ # form parameters
227
+ form_params = {}
228
+
229
+ # http body (model)
230
+ post_body = nil
231
+ auth_names = []
232
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
233
+ :header_params => header_params,
234
+ :query_params => query_params,
235
+ :form_params => form_params,
236
+ :body => post_body,
237
+ :auth_names => auth_names,
238
+ :return_type => 'Commune')
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug "API called: CommunesApi#departements_code_communes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
241
+ end
242
+ return data, status_code, headers
243
+ end
244
+ end
245
+ end