api_geo_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,262 @@
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 DpartementsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Renvoi les communes d'un département
23
+ # @param code Code du département
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 departements_code_communes_get(code, opts = {})
30
+ data, _status_code, _headers = departements_code_communes_get_with_http_info(code, opts)
31
+ data
32
+ end
33
+
34
+ # Renvoi les communes d&#39;un département
35
+ # @param code Code du département
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 departements_code_communes_get_with_http_info(code, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_code_communes_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 DpartementsApi.departements_code_communes_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 = '/departements/{code}/communes'.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: DpartementsApi#departements_code_communes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+ # Récupérer les informations concernant un département
91
+ # @param code Code du département
92
+ # @param [Hash] opts the optional parameters
93
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code","codeRegion"])
94
+ # @return [Departement]
95
+ def departements_code_get(code, opts = {})
96
+ data, _status_code, _headers = departements_code_get_with_http_info(code, opts)
97
+ data
98
+ end
99
+
100
+ # Récupérer les informations concernant un département
101
+ # @param code Code du département
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
104
+ # @return [Array<(Departement, Fixnum, Hash)>] Departement data, response status code and response headers
105
+ def departements_code_get_with_http_info(code, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_code_get ...'
108
+ end
109
+ # verify the required parameter 'code' is set
110
+ if @api_client.config.client_side_validation && code.nil?
111
+ fail ArgumentError, "Missing the required parameter 'code' when calling DpartementsApi.departements_code_get"
112
+ end
113
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codeRegion', 'region'].include?(item) }
114
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codeRegion, region'
115
+ end
116
+ # resource path
117
+ local_var_path = '/departements/{code}'.sub('{' + 'code' + '}', code.to_s)
118
+
119
+ # query parameters
120
+ query_params = {}
121
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
122
+
123
+ # header parameters
124
+ header_params = {}
125
+ # HTTP header 'Accept' (if needed)
126
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = nil
133
+ auth_names = []
134
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => 'Departement')
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: DpartementsApi#departements_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+ # Recherche des départements
147
+ # @param [Hash] opts the optional parameters
148
+ # @option opts [String] :code Code du département
149
+ # @option opts [String] :code_region Code région associé
150
+ # @option opts [String] :nom Nom du département
151
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code","codeRegion"])
152
+ # @return [Array<Departement>]
153
+ def departements_get(opts = {})
154
+ data, _status_code, _headers = departements_get_with_http_info(opts)
155
+ data
156
+ end
157
+
158
+ # Recherche des départements
159
+ # @param [Hash] opts the optional parameters
160
+ # @option opts [String] :code Code du département
161
+ # @option opts [String] :code_region Code région associé
162
+ # @option opts [String] :nom Nom du département
163
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
164
+ # @return [Array<(Array<Departement>, Fixnum, Hash)>] Array<Departement> data, response status code and response headers
165
+ def departements_get_with_http_info(opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_get ...'
168
+ end
169
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codeRegion', 'region'].include?(item) }
170
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codeRegion, region'
171
+ end
172
+ # resource path
173
+ local_var_path = '/departements'
174
+
175
+ # query parameters
176
+ query_params = {}
177
+ query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
178
+ query_params[:'codeRegion'] = opts[:'code_region'] if !opts[:'code_region'].nil?
179
+ query_params[:'nom'] = opts[:'nom'] if !opts[:'nom'].nil?
180
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
181
+
182
+ # header parameters
183
+ header_params = {}
184
+ # HTTP header 'Accept' (if needed)
185
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
186
+
187
+ # form parameters
188
+ form_params = {}
189
+
190
+ # http body (model)
191
+ post_body = nil
192
+ auth_names = []
193
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
194
+ :header_params => header_params,
195
+ :query_params => query_params,
196
+ :form_params => form_params,
197
+ :body => post_body,
198
+ :auth_names => auth_names,
199
+ :return_type => 'Array<Departement>')
200
+ if @api_client.config.debugging
201
+ @api_client.config.logger.debug "API called: DpartementsApi#departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
202
+ end
203
+ return data, status_code, headers
204
+ end
205
+ # Renvoi les départements d'une région
206
+ # @param code Code de la région
207
+ # @param [Hash] opts the optional parameters
208
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code"])
209
+ # @return [Departement]
210
+ def regions_code_departements_get(code, opts = {})
211
+ data, _status_code, _headers = regions_code_departements_get_with_http_info(code, opts)
212
+ data
213
+ end
214
+
215
+ # Renvoi les départements d&#39;une région
216
+ # @param code Code de la région
217
+ # @param [Hash] opts the optional parameters
218
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
219
+ # @return [Array<(Departement, Fixnum, Hash)>] Departement data, response status code and response headers
220
+ def regions_code_departements_get_with_http_info(code, opts = {})
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug 'Calling API: DpartementsApi.regions_code_departements_get ...'
223
+ end
224
+ # verify the required parameter 'code' is set
225
+ if @api_client.config.client_side_validation && code.nil?
226
+ fail ArgumentError, "Missing the required parameter 'code' when calling DpartementsApi.regions_code_departements_get"
227
+ end
228
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code'].include?(item) }
229
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code'
230
+ end
231
+ # resource path
232
+ local_var_path = '/regions/{code}/departements'.sub('{' + 'code' + '}', code.to_s)
233
+
234
+ # query parameters
235
+ query_params = {}
236
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
237
+
238
+ # header parameters
239
+ header_params = {}
240
+ # HTTP header 'Accept' (if needed)
241
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
242
+
243
+ # form parameters
244
+ form_params = {}
245
+
246
+ # http body (model)
247
+ post_body = nil
248
+ auth_names = []
249
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
250
+ :header_params => header_params,
251
+ :query_params => query_params,
252
+ :form_params => form_params,
253
+ :body => post_body,
254
+ :auth_names => auth_names,
255
+ :return_type => 'Departement')
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug "API called: DpartementsApi#regions_code_departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
258
+ end
259
+ return data, status_code, headers
260
+ end
261
+ end
262
+ end
@@ -0,0 +1,191 @@
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 RgionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Renvoi les départements d'une région
23
+ # @param code Code de la région
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"])
26
+ # @return [Departement]
27
+ def regions_code_departements_get(code, opts = {})
28
+ data, _status_code, _headers = regions_code_departements_get_with_http_info(code, opts)
29
+ data
30
+ end
31
+
32
+ # Renvoi les départements d&#39;une région
33
+ # @param code Code de la région
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
36
+ # @return [Array<(Departement, Fixnum, Hash)>] Departement data, response status code and response headers
37
+ def regions_code_departements_get_with_http_info(code, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: RgionsApi.regions_code_departements_get ...'
40
+ end
41
+ # verify the required parameter 'code' is set
42
+ if @api_client.config.client_side_validation && code.nil?
43
+ fail ArgumentError, "Missing the required parameter 'code' when calling RgionsApi.regions_code_departements_get"
44
+ end
45
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code'].include?(item) }
46
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code'
47
+ end
48
+ # resource path
49
+ local_var_path = '/regions/{code}/departements'.sub('{' + 'code' + '}', code.to_s)
50
+
51
+ # query parameters
52
+ query_params = {}
53
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
54
+
55
+ # header parameters
56
+ header_params = {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
59
+
60
+ # form parameters
61
+ form_params = {}
62
+
63
+ # http body (model)
64
+ post_body = nil
65
+ auth_names = []
66
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => 'Departement')
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: RgionsApi#regions_code_departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ # Récupérer les informations concernant une région
79
+ # @param code Code de la région
80
+ # @param [Hash] opts the optional parameters
81
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code"])
82
+ # @return [Departement]
83
+ def regions_code_get(code, opts = {})
84
+ data, _status_code, _headers = regions_code_get_with_http_info(code, opts)
85
+ data
86
+ end
87
+
88
+ # Récupérer les informations concernant une région
89
+ # @param code Code de la région
90
+ # @param [Hash] opts the optional parameters
91
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
92
+ # @return [Array<(Departement, Fixnum, Hash)>] Departement data, response status code and response headers
93
+ def regions_code_get_with_http_info(code, opts = {})
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug 'Calling API: RgionsApi.regions_code_get ...'
96
+ end
97
+ # verify the required parameter 'code' is set
98
+ if @api_client.config.client_side_validation && code.nil?
99
+ fail ArgumentError, "Missing the required parameter 'code' when calling RgionsApi.regions_code_get"
100
+ end
101
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code'].include?(item) }
102
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code'
103
+ end
104
+ # resource path
105
+ local_var_path = '/regions/{code}'.sub('{' + 'code' + '}', code.to_s)
106
+
107
+ # query parameters
108
+ query_params = {}
109
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
110
+
111
+ # header parameters
112
+ header_params = {}
113
+ # HTTP header 'Accept' (if needed)
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
115
+
116
+ # form parameters
117
+ form_params = {}
118
+
119
+ # http body (model)
120
+ post_body = nil
121
+ auth_names = []
122
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
123
+ :header_params => header_params,
124
+ :query_params => query_params,
125
+ :form_params => form_params,
126
+ :body => post_body,
127
+ :auth_names => auth_names,
128
+ :return_type => 'Departement')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: RgionsApi#regions_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+ # Recherche des régions
135
+ # @param [Hash] opts the optional parameters
136
+ # @option opts [String] :code Code de la région
137
+ # @option opts [String] :nom Nom de la région
138
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse (default to ["nom","code"])
139
+ # @return [Array<Region>]
140
+ def regions_get(opts = {})
141
+ data, _status_code, _headers = regions_get_with_http_info(opts)
142
+ data
143
+ end
144
+
145
+ # Recherche des régions
146
+ # @param [Hash] opts the optional parameters
147
+ # @option opts [String] :code Code de la région
148
+ # @option opts [String] :nom Nom de la région
149
+ # @option opts [Array<String>] :fields Liste des champs souhaités dans la réponse
150
+ # @return [Array<(Array<Region>, Fixnum, Hash)>] Array<Region> data, response status code and response headers
151
+ def regions_get_with_http_info(opts = {})
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug 'Calling API: RgionsApi.regions_get ...'
154
+ end
155
+ if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code'].include?(item) }
156
+ fail ArgumentError, 'invalid value for "fields", must include one of nom, code'
157
+ end
158
+ # resource path
159
+ local_var_path = '/regions'
160
+
161
+ # query parameters
162
+ query_params = {}
163
+ query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
164
+ query_params[:'nom'] = opts[:'nom'] if !opts[:'nom'].nil?
165
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
166
+
167
+ # header parameters
168
+ header_params = {}
169
+ # HTTP header 'Accept' (if needed)
170
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
171
+
172
+ # form parameters
173
+ form_params = {}
174
+
175
+ # http body (model)
176
+ post_body = nil
177
+ auth_names = []
178
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
179
+ :header_params => header_params,
180
+ :query_params => query_params,
181
+ :form_params => form_params,
182
+ :body => post_body,
183
+ :auth_names => auth_names,
184
+ :return_type => 'Array<Region>')
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug "API called: RgionsApi#regions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
187
+ end
188
+ return data, status_code, headers
189
+ end
190
+ end
191
+ end