Class: RadioManagerClient::ContactApi

Inherits:
Object
  • Object
show all
Defined in:
lib/radiomanager_client/api/contact_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactApi

Returns a new instance of ContactApi.



19
20
21
# File 'lib/radiomanager_client/api/contact_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/radiomanager_client/api/contact_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_contact(data, opts = {}) ⇒ PostSuccess

Create contact. Create contact.

Parameters:

  • data

    Data **(Required)**

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/radiomanager_client/api/contact_api.rb', line 28

def create_contact(data, opts = {})
  data, _status_code, _headers = create_contact_with_http_info(data, opts)
  return data
end

#create_contact_with_http_info(data, opts = {}) ⇒ Array<(PostSuccess, Fixnum, Hash)>

Create contact. Create contact.

Parameters:

  • data

    Data **(Required)**

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

    the optional parameters

Returns:

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

    PostSuccess data, response status code and response headers



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
# File 'lib/radiomanager_client/api/contact_api.rb', line 38

def create_contact_with_http_info(data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactApi.create_contact ..."
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling ContactApi.create_contact"
  end
  # resource path
  local_var_path = "/contacts"

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

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

#delete_contact_by_id(id, opts = {}) ⇒ Success

Delete contact by id Delete contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Returns:



83
84
85
86
# File 'lib/radiomanager_client/api/contact_api.rb', line 83

def delete_contact_by_id(id, opts = {})
  data, _status_code, _headers = delete_contact_by_id_with_http_info(id, opts)
  return data
end

#delete_contact_by_id_with_http_info(id, opts = {}) ⇒ Array<(Success, Fixnum, Hash)>

Delete contact by id Delete contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Returns:

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

    Success 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
134
135
# File 'lib/radiomanager_client/api/contact_api.rb', line 93

def delete_contact_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactApi.delete_contact_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ContactApi.delete_contact_by_id"
  end
  if @api_client.config.client_side_validation && id < 0
    fail ArgumentError, 'invalid value for "id" when calling ContactApi.delete_contact_by_id, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = "/contacts/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

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

#get_contact_by_id(id, opts = {}) ⇒ ContactResult

Get contact by id Get contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Options Hash (opts):

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:



143
144
145
146
# File 'lib/radiomanager_client/api/contact_api.rb', line 143

def get_contact_by_id(id, opts = {})
  data, _status_code, _headers = get_contact_by_id_with_http_info(id, opts)
  return data
end

#get_contact_by_id_with_http_info(id, opts = {}) ⇒ Array<(ContactResult, Fixnum, Hash)>

Get contact by id Get contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Options Hash (opts):

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:

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

    ContactResult data, response status code and response headers



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
190
191
192
193
194
195
196
197
# File 'lib/radiomanager_client/api/contact_api.rb', line 154

def get_contact_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactApi.get_contact_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ContactApi.get_contact_by_id"
  end
  if @api_client.config.client_side_validation && id < 0
    fail ArgumentError, 'invalid value for "id" when calling ContactApi.get_contact_by_id, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = "/contacts/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API Key']
  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 => 'ContactResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#get_contact_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_contacts(opts = {}) ⇒ ContactResults

Get all contacts. List all contacts.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Current page *(Optional)* (default to 1)

  • :item_id (Integer)

    Search on Item ID *(Optional)* &#x60;(Relation)&#x60;

  • :model_type_id (Integer)

    Search on ModelType ID *(Optional)* &#x60;(Relation)&#x60;

  • :tag_id (Integer)

    Search on Tag ID *(Optional)* &#x60;(Relation)&#x60;

  • :limit (Integer)

    Results per page *(Optional)*

  • :order_by (String)

    Field to order the results *(Optional)*

  • :order_direction (String)

    Direction of ordering *(Optional)*

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:



211
212
213
214
# File 'lib/radiomanager_client/api/contact_api.rb', line 211

def list_contacts(opts = {})
  data, _status_code, _headers = list_contacts_with_http_info(opts)
  return data
end

#list_contacts_with_http_info(opts = {}) ⇒ Array<(ContactResults, Fixnum, Hash)>

Get all contacts. List all contacts.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Current page *(Optional)*

  • :item_id (Integer)

    Search on Item ID *(Optional)* &#x60;(Relation)&#x60;

  • :model_type_id (Integer)

    Search on ModelType ID *(Optional)* &#x60;(Relation)&#x60;

  • :tag_id (Integer)

    Search on Tag ID *(Optional)* &#x60;(Relation)&#x60;

  • :limit (Integer)

    Results per page *(Optional)*

  • :order_by (String)

    Field to order the results *(Optional)*

  • :order_direction (String)

    Direction of ordering *(Optional)*

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:

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

    ContactResults data, response status code and response headers



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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/radiomanager_client/api/contact_api.rb', line 228

def list_contacts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactApi.list_contacts ..."
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ContactApi.list_contacts, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactApi.list_contacts, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactApi.list_contacts, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
    fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
  end
  # resource path
  local_var_path = "/contacts"

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?
  query_params[:'model_type_id'] = opts[:'model_type_id'] if !opts[:'model_type_id'].nil?
  query_params[:'tag_id'] = opts[:'tag_id'] if !opts[:'tag_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API Key']
  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 => 'ContactResults')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#list_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_contact_by_id(id, opts = {}) ⇒ Success

Update contact by id Update contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Options Hash (opts):

Returns:



293
294
295
296
# File 'lib/radiomanager_client/api/contact_api.rb', line 293

def update_contact_by_id(id, opts = {})
  data, _status_code, _headers = update_contact_by_id_with_http_info(id, opts)
  return data
end

#update_contact_by_id_with_http_info(id, opts = {}) ⇒ Array<(Success, Fixnum, Hash)>

Update contact by id Update contact by id

Parameters:

  • id

    ID of Contact **(Required)**

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

    the optional parameters

Options Hash (opts):

Returns:

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

    Success data, response status code and response headers



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/radiomanager_client/api/contact_api.rb', line 304

def update_contact_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ContactApi.update_contact_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ContactApi.update_contact_by_id"
  end
  if @api_client.config.client_side_validation && id < 0
    fail ArgumentError, 'invalid value for "id" when calling ContactApi.update_contact_by_id, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = "/contacts/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'data'])
  auth_names = ['API Key']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Success')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#update_contact_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end