Class: ApiGeoClient::DpartementsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/api_geo_client/api/dpartements_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DpartementsApi

Returns a new instance of DpartementsApi.



19
20
21
# File 'lib/api_geo_client/api/dpartements_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/api_geo_client/api/dpartements_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#departements_code_communes_get(code, opts = {}) ⇒ Commune

Renvoi les communes d’un département

Parameters:

  • code

    Code du département

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse (default to [“nom”,“code”,“codesPostaux”,“codeDepartement”,“codeRegion”,“population”])

  • :format (String)

    Format de réponse attendu (default to json)

  • :geometry (String)

    Géométrie à utiliser pour la sortie géographique (default to centre)

Returns:



29
30
31
32
# File 'lib/api_geo_client/api/dpartements_api.rb', line 29

def departements_code_communes_get(code, opts = {})
  data, _status_code, _headers = departements_code_communes_get_with_http_info(code, opts)
  data
end

#departements_code_communes_get_with_http_info(code, opts = {}) ⇒ Array<(Commune, Fixnum, Hash)>

Renvoi les communes d&#39;un département

Parameters:

  • code

    Code du département

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse

  • :format (String)

    Format de réponse attendu

  • :geometry (String)

    Géométrie à utiliser pour la sortie géographique

Returns:

  • (Array<(Commune, Fixnum, Hash)>)

    Commune data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/api_geo_client/api/dpartements_api.rb', line 41

def departements_code_communes_get_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_code_communes_get ...'
  end
  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling DpartementsApi.departements_code_communes_get"
  end
  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) }
    fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codesPostaux, centre, surface, contour, codeDepartement, departement, codeRegion, region, population'
  end
  if @api_client.config.client_side_validation && opts[:'format'] && !['json', 'geojson'].include?(opts[:'format'])
    fail ArgumentError, 'invalid value for "format", must be one of json, geojson'
  end
  if @api_client.config.client_side_validation && opts[:'geometry'] && !['centre', 'contour'].include?(opts[:'geometry'])
    fail ArgumentError, 'invalid value for "geometry", must be one of centre, contour'
  end
  # resource path
  local_var_path = '/departements/{code}/communes'.sub('{' + 'code' + '}', code.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'geometry'] = opts[:'geometry'] if !opts[:'geometry'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Commune')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DpartementsApi#departements_code_communes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#departements_code_get(code, opts = {}) ⇒ Departement

Récupérer les informations concernant un département

Parameters:

  • code

    Code du département

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse (default to [“nom”,“code”,“codeRegion”])

Returns:



95
96
97
98
# File 'lib/api_geo_client/api/dpartements_api.rb', line 95

def departements_code_get(code, opts = {})
  data, _status_code, _headers = departements_code_get_with_http_info(code, opts)
  data
end

#departements_code_get_with_http_info(code, opts = {}) ⇒ Array<(Departement, Fixnum, Hash)>

Récupérer les informations concernant un département

Parameters:

  • code

    Code du département

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse

Returns:

  • (Array<(Departement, Fixnum, Hash)>)

    Departement data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/api_geo_client/api/dpartements_api.rb', line 105

def departements_code_get_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_code_get ...'
  end
  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling DpartementsApi.departements_code_get"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codeRegion', 'region'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codeRegion, region'
  end
  # resource path
  local_var_path = '/departements/{code}'.sub('{' + 'code' + '}', code.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Departement')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DpartementsApi#departements_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#departements_get(opts = {}) ⇒ Array<Departement>

Recherche des départements

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)

    Code du département

  • :code_region (String)

    Code région associé

  • :nom (String)

    Nom du département

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse (default to [“nom”,“code”,“codeRegion”])

Returns:



153
154
155
156
# File 'lib/api_geo_client/api/dpartements_api.rb', line 153

def departements_get(opts = {})
  data, _status_code, _headers = departements_get_with_http_info(opts)
  data
end

#departements_get_with_http_info(opts = {}) ⇒ Array<(Array<Departement>, Fixnum, Hash)>

Recherche des départements

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)

    Code du département

  • :code_region (String)

    Code région associé

  • :nom (String)

    Nom du département

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse

Returns:

  • (Array<(Array<Departement>, Fixnum, Hash)>)

    Array<Departement> data, response status code and response headers



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/api_geo_client/api/dpartements_api.rb', line 165

def departements_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DpartementsApi.departements_get ...'
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code', 'codeRegion', 'region'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of nom, code, codeRegion, region'
  end
  # resource path
  local_var_path = '/departements'

  # query parameters
  query_params = {}
  query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
  query_params[:'codeRegion'] = opts[:'code_region'] if !opts[:'code_region'].nil?
  query_params[:'nom'] = opts[:'nom'] if !opts[:'nom'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Departement>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DpartementsApi#departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#regions_code_departements_get(code, opts = {}) ⇒ Departement

Renvoi les départements d’une région

Parameters:

  • code

    Code de la région

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse (default to [“nom”,“code”])

Returns:



210
211
212
213
# File 'lib/api_geo_client/api/dpartements_api.rb', line 210

def regions_code_departements_get(code, opts = {})
  data, _status_code, _headers = regions_code_departements_get_with_http_info(code, opts)
  data
end

#regions_code_departements_get_with_http_info(code, opts = {}) ⇒ Array<(Departement, Fixnum, Hash)>

Renvoi les départements d&#39;une région

Parameters:

  • code

    Code de la région

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse

Returns:

  • (Array<(Departement, Fixnum, Hash)>)

    Departement data, response status code and response headers



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/api_geo_client/api/dpartements_api.rb', line 220

def regions_code_departements_get_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DpartementsApi.regions_code_departements_get ...'
  end
  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling DpartementsApi.regions_code_departements_get"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['nom', 'code'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of nom, code'
  end
  # resource path
  local_var_path = '/regions/{code}/departements'.sub('{' + 'code' + '}', code.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Departement')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DpartementsApi#regions_code_departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end