Class: ApiGeoClient::RgionsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RgionsApi

Returns a new instance of RgionsApi.



19
20
21
# File 'lib/api_geo_client/api/rgions_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/rgions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#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:



27
28
29
30
# File 'lib/api_geo_client/api/rgions_api.rb', line 27

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



37
38
39
40
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
# File 'lib/api_geo_client/api/rgions_api.rb', line 37

def regions_code_departements_get_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RgionsApi.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 RgionsApi.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: RgionsApi#regions_code_departements_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Récupérer les informations concernant 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:



83
84
85
86
# File 'lib/api_geo_client/api/rgions_api.rb', line 83

def regions_code_get(code, opts = {})
  data, _status_code, _headers = regions_code_get_with_http_info(code, opts)
  data
end

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

Récupérer les informations concernant 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



93
94
95
96
97
98
99
100
101
102
103
104
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
# File 'lib/api_geo_client/api/rgions_api.rb', line 93

def regions_code_get_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RgionsApi.regions_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 RgionsApi.regions_code_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}'.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: RgionsApi#regions_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#regions_get(opts = {}) ⇒ Array<Region>

Recherche des régions

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (String)

    Code de la région

  • :nom (String)

    Nom de la région

  • :fields (Array<String>)

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

Returns:



140
141
142
143
# File 'lib/api_geo_client/api/rgions_api.rb', line 140

def regions_get(opts = {})
  data, _status_code, _headers = regions_get_with_http_info(opts)
  data
end

#regions_get_with_http_info(opts = {}) ⇒ Array<(Array<Region>, Fixnum, Hash)>

Recherche des régions

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (String)

    Code de la région

  • :nom (String)

    Nom de la région

  • :fields (Array<String>)

    Liste des champs souhaités dans la réponse

Returns:

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

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



151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
# File 'lib/api_geo_client/api/rgions_api.rb', line 151

def regions_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RgionsApi.regions_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'

  # query parameters
  query_params = {}
  query_params[:'code'] = opts[:'code'] if !opts[:'code'].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<Region>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RgionsApi#regions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end