Class: Supportify::SupportifyApi

Inherits:
Object
  • Object
show all
Defined in:
lib/supportify_client/api/supportify_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = nil) ⇒ SupportifyApi

Returns a new instance of SupportifyApi.



7
8
9
# File 'lib/supportify_client/api/supportify_api.rb', line 7

def initialize(api_client = nil)
  @api_client = api_client || Configuration.api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/supportify_client/api/supportify_api.rb', line 5

def api_client
  @api_client
end

Instance Method Details

#create_faq(answer, author, question, opts = {}) ⇒ nil

Create a new content entry and add it to the application.

Parameters:

  • answer

    The body of the content entry. Can be an answer to a FAQ, a knowledge base entry, or any other type of string. This is a non-encoded string and may contain HTML.

  • author

    The e-mail address of the user that created the content entry. This e-mail address must correspond to a user on your Supportify account.

  • question

    The title of the content entry. Can be a question, a title, or any other type of string. This is a non-encoded string and may contain HTML.

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

    the optional parameters

Options Hash (opts):

  • :categories (Array<String>)

    The categories that the content entry belongs to.

  • :format (String)

    The format of the content that has been posted. Currently, the only accepted values are &#39;markdown&#39; and &#39;html&#39;.

  • :tags (Array<String>)

    The tags that the content entry belongs to.

Returns:

  • (nil)


182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/supportify_client/api/supportify_api.rb', line 182

def create_faq(answer, author, question, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#create_faq ..."
  end
  
  # verify the required parameter 'answer' is set
  fail "Missing the required parameter 'answer' when calling create_faq" if answer.nil?
  
  # verify the required parameter 'author' is set
  fail "Missing the required parameter 'author' when calling create_faq" if author.nil?
  
  # verify the required parameter 'question' is set
  fail "Missing the required parameter 'question' when calling create_faq" if question.nil?
  
  # resource path
  path = "/faqs".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}
  form_params["answer"] = answer
  form_params["author"] = author
  form_params["question"] = question
  form_params["categories"] = opts[:'categories'] if opts[:'categories']
  form_params["format"] = opts[:'format'] if opts[:'format']
  form_params["tags"] = opts[:'tags'] if opts[:'tags']

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  @api_client.call_api(:POST, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#create_faq"
  end
  return nil
end

#get_categories(opts = {}) ⇒ Array<Category>

Returns all categories from the application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The maximum number of entries to return in the collection.

  • :skip (Integer)

    The number of entries to skip over when returning the results.

  • :sort (String)

    The sort order and method of the results.

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
# File 'lib/supportify_client/api/supportify_api.rb', line 18

def get_categories(opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_categories ..."
  end
  
  # resource path
  path = "/categories".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
  query_params[:'sort'] = opts[:'sort'] if opts[:'sort']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Category>')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_categories. Result: #{result.inspect}"
  end
  return result
end

#get_category_by_id(id, opts = {}) ⇒ Category

Returns a category based on a single ID.

Parameters:

  • id

    ID of category to fetch

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

    the optional parameters

Returns:



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/supportify_client/api/supportify_api.rb', line 69

def get_category_by_id(id, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_category_by_id ..."
  end
  
  # verify the required parameter 'id' is set
  fail "Missing the required parameter 'id' when calling get_category_by_id" if id.nil?
  
  # resource path
  path = "/categories/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Category')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_category_by_id. Result: #{result.inspect}"
  end
  return result
end

#get_faq_by_id(id, opts = {}) ⇒ Faq

Returns a content entry based on a single ID.

Parameters:

  • id

    ID of the content entry to fetch.

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

    the optional parameters

Returns:



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
286
287
288
# File 'lib/supportify_client/api/supportify_api.rb', line 244

def get_faq_by_id(id, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_faq_by_id ..."
  end
  
  # verify the required parameter 'id' is set
  fail "Missing the required parameter 'id' when calling get_faq_by_id" if id.nil?
  
  # resource path
  path = "/faqs/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Faq')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_faq_by_id. Result: #{result.inspect}"
  end
  return result
end

#get_faqs(opts = {}) ⇒ Array<Faq>

Returns all content entries from the application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :categories (Array<String>)

    categories to filter by

  • :limit (Integer)

    The maximum number of entries to return in the collection.

  • :skip (Integer)

    The number of entries to skip over when returning the results.

  • :sort (String)

    The sort order and method of the results.

  • :tags (Array<String>)

    tags to filter by

Returns:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/supportify_client/api/supportify_api.rb', line 124

def get_faqs(opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_faqs ..."
  end
  
  # resource path
  path = "/faqs".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'categories'] = opts[:'categories'] if opts[:'categories']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
  query_params[:'sort'] = opts[:'sort'] if opts[:'sort']
  query_params[:'tags'] = opts[:'tags'] if opts[:'tags']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Faq>')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_faqs. Result: #{result.inspect}"
  end
  return result
end

#get_info(opts = {}) ⇒ Info

The Info endpoint returns an information object containing details of the application being accessed.nnThis endpoint is mostly used for diagnostic purposes.

Parameters:

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

    the optional parameters

Returns:



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/supportify_client/api/supportify_api.rb', line 349

def get_info(opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_info ..."
  end
  
  # resource path
  path = "/info".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Info')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_info. Result: #{result.inspect}"
  end
  return result
end

#get_tag_by_id(id, opts = {}) ⇒ Tag

Returns a tag based on a single ID.

Parameters:

  • id

    ID of tag to fetch

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

    the optional parameters

Returns:



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/supportify_client/api/supportify_api.rb', line 510

def get_tag_by_id(id, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_tag_by_id ..."
  end
  
  # verify the required parameter 'id' is set
  fail "Missing the required parameter 'id' when calling get_tag_by_id" if id.nil?
  
  # resource path
  path = "/tags/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Tag')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_tag_by_id. Result: #{result.inspect}"
  end
  return result
end

#get_tags(opts = {}) ⇒ Array<Tag>

Returns all tags from the application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The maximum number of entries to return in the collection.

  • :skip (Integer)

    The number of entries to skip over when returning the results.

  • :sort (String)

    The sort order and method of the results.

Returns:



459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/supportify_client/api/supportify_api.rb', line 459

def get_tags(opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#get_tags ..."
  end
  
  # resource path
  path = "/tags".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
  query_params[:'sort'] = opts[:'sort'] if opts[:'sort']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Tag>')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#get_tags. Result: #{result.inspect}"
  end
  return result
end

#search(query, opts = {}) ⇒ Array<Faq>

Search for a collection of content entries that match the supplied query.

Parameters:

  • query

    The string to match the content entry against.

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

    the optional parameters

Options Hash (opts):

  • :categories (Array<String>)

    categories to filter by

  • :limit (Integer)

    The maximum number of entries to return in the collection.

  • :skip (Integer)

    The number of entries to skip over when returning the results.

  • :tags (Array<String>)

    tags to filter by

Returns:



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/supportify_client/api/supportify_api.rb', line 401

def search(query, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#search ..."
  end
  
  # verify the required parameter 'query' is set
  fail "Missing the required parameter 'query' when calling search" if query.nil?
  
  # resource path
  path = "/search".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'query'] = query
  query_params[:'categories'] = opts[:'categories'] if opts[:'categories']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
  query_params[:'tags'] = opts[:'tags'] if opts[:'tags']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  result = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Faq>')
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#search. Result: #{result.inspect}"
  end
  return result
end

#vote_on_faq(id, vote, opts = {}) ⇒ nil

Record a vote for a content entry.

Parameters:

  • id

    ID of the content entry to record the vote for.

  • vote

    The direction of the vote to be recorded. Currently, the only accepted values are &#39;up&#39; and &#39;down&#39;.

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

    the optional parameters

Returns:

  • (nil)


296
297
298
299
300
301
302
303
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
# File 'lib/supportify_client/api/supportify_api.rb', line 296

def vote_on_faq(id, vote, opts = {})
  if Configuration.debugging
    Configuration.logger.debug "Calling API: SupportifyApi#vote_on_faq ..."
  end
  
  # verify the required parameter 'id' is set
  fail "Missing the required parameter 'id' when calling vote_on_faq" if id.nil?
  
  # verify the required parameter 'vote' is set
  fail "Missing the required parameter 'vote' when calling vote_on_faq" if vote.nil?
  
  # resource path
  path = "/faqs/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}
  form_params["vote"] = vote

  # http body (model)
  post_body = nil
  

  auth_names = ['api_key', 'app_key']
  @api_client.call_api(:POST, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if Configuration.debugging
    Configuration.logger.debug "API called: SupportifyApi#vote_on_faq"
  end
  return nil
end