supportify_client 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -4
  3. data/Gemfile.lock +47 -39
  4. data/Rakefile +4 -4
  5. data/VERSION +1 -1
  6. data/lib/supportify_client/api/supportify_api.rb +560 -0
  7. data/lib/supportify_client/api_client.rb +271 -0
  8. data/lib/supportify_client/api_error.rb +24 -0
  9. data/lib/supportify_client/configuration.rb +187 -0
  10. data/lib/supportify_client/models/base_object.rb +87 -0
  11. data/lib/supportify_client/models/category.rb +53 -0
  12. data/lib/supportify_client/models/error.rb +53 -0
  13. data/lib/supportify_client/models/faq.rb +161 -0
  14. data/lib/supportify_client/models/info.rb +45 -0
  15. data/lib/supportify_client/models/tag.rb +53 -0
  16. data/lib/supportify_client/models/user.rb +45 -0
  17. data/lib/supportify_client.rb +30 -14
  18. data/spec/features/.gitkeep +0 -0
  19. data/supportify_client.gemspec +27 -27
  20. metadata +38 -26
  21. data/lib/supportify_client/api/category.rb +0 -17
  22. data/lib/supportify_client/api/error.rb +0 -13
  23. data/lib/supportify_client/api/faq.rb +0 -23
  24. data/lib/supportify_client/api/search.rb +0 -9
  25. data/lib/supportify_client/api/tag.rb +0 -17
  26. data/lib/supportify_client/api.rb +0 -5
  27. data/lib/supportify_client/client.rb +0 -49
  28. data/lib/supportify_client/factory.rb +0 -29
  29. data/lib/supportify_client/gateway.rb +0 -32
  30. data/lib/supportify_client/repository.rb +0 -23
  31. data/spec/features/categories_spec.rb +0 -55
  32. data/spec/features/client_spec.rb +0 -50
  33. data/spec/features/errors_spec.rb +0 -96
  34. data/spec/features/faqs_spec.rb +0 -55
  35. data/spec/features/search_spec.rb +0 -29
  36. data/spec/features/tags_spec.rb +0 -55
@@ -0,0 +1,560 @@
1
+ require "uri"
2
+
3
+ module Supportify
4
+ class SupportifyApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = nil)
8
+ @api_client = api_client || Configuration.api_client
9
+ end
10
+
11
+ #
12
+ # Returns all categories from the application.
13
+ # @param [Hash] opts the optional parameters
14
+ # @option opts [Integer] :limit The maximum number of entries to return in the collection.
15
+ # @option opts [Integer] :skip The number of entries to skip over when returning the results.
16
+ # @option opts [String] :sort The sort order and method of the results.
17
+ # @return [Array<Category>]
18
+ def get_categories(opts = {})
19
+ if Configuration.debugging
20
+ Configuration.logger.debug "Calling API: SupportifyApi#get_categories ..."
21
+ end
22
+
23
+ # resource path
24
+ path = "/categories".sub('{format}','json')
25
+
26
+ # query parameters
27
+ query_params = {}
28
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
29
+ query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
30
+ query_params[:'sort'] = opts[:'sort'] if opts[:'sort']
31
+
32
+ # header parameters
33
+ header_params = {}
34
+
35
+ # HTTP header 'Accept' (if needed)
36
+ _header_accept = ['application/json']
37
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
38
+
39
+ # HTTP header 'Content-Type'
40
+ _header_content_type = []
41
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
42
+
43
+ # form parameters
44
+ form_params = {}
45
+
46
+ # http body (model)
47
+ post_body = nil
48
+
49
+
50
+ auth_names = ['api_key', 'app_key']
51
+ result = @api_client.call_api(:GET, path,
52
+ :header_params => header_params,
53
+ :query_params => query_params,
54
+ :form_params => form_params,
55
+ :body => post_body,
56
+ :auth_names => auth_names,
57
+ :return_type => 'Array<Category>')
58
+ if Configuration.debugging
59
+ Configuration.logger.debug "API called: SupportifyApi#get_categories. Result: #{result.inspect}"
60
+ end
61
+ return result
62
+ end
63
+
64
+ #
65
+ # Returns a category based on a single ID.
66
+ # @param id ID of category to fetch
67
+ # @param [Hash] opts the optional parameters
68
+ # @return [Category]
69
+ def get_category_by_id(id, opts = {})
70
+ if Configuration.debugging
71
+ Configuration.logger.debug "Calling API: SupportifyApi#get_category_by_id ..."
72
+ end
73
+
74
+ # verify the required parameter 'id' is set
75
+ fail "Missing the required parameter 'id' when calling get_category_by_id" if id.nil?
76
+
77
+ # resource path
78
+ path = "/categories/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
79
+
80
+ # query parameters
81
+ query_params = {}
82
+
83
+ # header parameters
84
+ header_params = {}
85
+
86
+ # HTTP header 'Accept' (if needed)
87
+ _header_accept = ['application/json']
88
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
89
+
90
+ # HTTP header 'Content-Type'
91
+ _header_content_type = []
92
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
93
+
94
+ # form parameters
95
+ form_params = {}
96
+
97
+ # http body (model)
98
+ post_body = nil
99
+
100
+
101
+ auth_names = ['api_key', 'app_key']
102
+ result = @api_client.call_api(:GET, path,
103
+ :header_params => header_params,
104
+ :query_params => query_params,
105
+ :form_params => form_params,
106
+ :body => post_body,
107
+ :auth_names => auth_names,
108
+ :return_type => 'Category')
109
+ if Configuration.debugging
110
+ Configuration.logger.debug "API called: SupportifyApi#get_category_by_id. Result: #{result.inspect}"
111
+ end
112
+ return result
113
+ end
114
+
115
+ #
116
+ # Returns all content entries from the application.
117
+ # @param [Hash] opts the optional parameters
118
+ # @option opts [Array<String>] :categories categories to filter by
119
+ # @option opts [Integer] :limit The maximum number of entries to return in the collection.
120
+ # @option opts [Integer] :skip The number of entries to skip over when returning the results.
121
+ # @option opts [String] :sort The sort order and method of the results.
122
+ # @option opts [Array<String>] :tags tags to filter by
123
+ # @return [Array<Faq>]
124
+ def get_faqs(opts = {})
125
+ if Configuration.debugging
126
+ Configuration.logger.debug "Calling API: SupportifyApi#get_faqs ..."
127
+ end
128
+
129
+ # resource path
130
+ path = "/faqs".sub('{format}','json')
131
+
132
+ # query parameters
133
+ query_params = {}
134
+ query_params[:'categories'] = opts[:'categories'] if opts[:'categories']
135
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
136
+ query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
137
+ query_params[:'sort'] = opts[:'sort'] if opts[:'sort']
138
+ query_params[:'tags'] = opts[:'tags'] if opts[:'tags']
139
+
140
+ # header parameters
141
+ header_params = {}
142
+
143
+ # HTTP header 'Accept' (if needed)
144
+ _header_accept = ['application/json']
145
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
146
+
147
+ # HTTP header 'Content-Type'
148
+ _header_content_type = []
149
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
150
+
151
+ # form parameters
152
+ form_params = {}
153
+
154
+ # http body (model)
155
+ post_body = nil
156
+
157
+
158
+ auth_names = ['api_key', 'app_key']
159
+ result = @api_client.call_api(:GET, path,
160
+ :header_params => header_params,
161
+ :query_params => query_params,
162
+ :form_params => form_params,
163
+ :body => post_body,
164
+ :auth_names => auth_names,
165
+ :return_type => 'Array<Faq>')
166
+ if Configuration.debugging
167
+ Configuration.logger.debug "API called: SupportifyApi#get_faqs. Result: #{result.inspect}"
168
+ end
169
+ return result
170
+ end
171
+
172
+ #
173
+ # Create a new content entry and add it to the application.
174
+ # @param 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.
175
+ # @param 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.
176
+ # @param 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.
177
+ # @param [Hash] opts the optional parameters
178
+ # @option opts [Array<String>] :categories The categories that the content entry belongs to.
179
+ # @option opts [String] :format The format of the content that has been posted. Currently, the only accepted values are &#39;markdown&#39; and &#39;html&#39;.
180
+ # @option opts [Array<String>] :tags The tags that the content entry belongs to.
181
+ # @return [nil]
182
+ def create_faq(answer, author, question, opts = {})
183
+ if Configuration.debugging
184
+ Configuration.logger.debug "Calling API: SupportifyApi#create_faq ..."
185
+ end
186
+
187
+ # verify the required parameter 'answer' is set
188
+ fail "Missing the required parameter 'answer' when calling create_faq" if answer.nil?
189
+
190
+ # verify the required parameter 'author' is set
191
+ fail "Missing the required parameter 'author' when calling create_faq" if author.nil?
192
+
193
+ # verify the required parameter 'question' is set
194
+ fail "Missing the required parameter 'question' when calling create_faq" if question.nil?
195
+
196
+ # resource path
197
+ path = "/faqs".sub('{format}','json')
198
+
199
+ # query parameters
200
+ query_params = {}
201
+
202
+ # header parameters
203
+ header_params = {}
204
+
205
+ # HTTP header 'Accept' (if needed)
206
+ _header_accept = ['application/json']
207
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
208
+
209
+ # HTTP header 'Content-Type'
210
+ _header_content_type = []
211
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
212
+
213
+ # form parameters
214
+ form_params = {}
215
+ form_params["answer"] = answer
216
+ form_params["author"] = author
217
+ form_params["question"] = question
218
+ form_params["categories"] = opts[:'categories'] if opts[:'categories']
219
+ form_params["format"] = opts[:'format'] if opts[:'format']
220
+ form_params["tags"] = opts[:'tags'] if opts[:'tags']
221
+
222
+ # http body (model)
223
+ post_body = nil
224
+
225
+
226
+ auth_names = ['api_key', 'app_key']
227
+ @api_client.call_api(:POST, path,
228
+ :header_params => header_params,
229
+ :query_params => query_params,
230
+ :form_params => form_params,
231
+ :body => post_body,
232
+ :auth_names => auth_names)
233
+ if Configuration.debugging
234
+ Configuration.logger.debug "API called: SupportifyApi#create_faq"
235
+ end
236
+ return nil
237
+ end
238
+
239
+ #
240
+ # Returns a content entry based on a single ID.
241
+ # @param id ID of the content entry to fetch.
242
+ # @param [Hash] opts the optional parameters
243
+ # @return [Faq]
244
+ def get_faq_by_id(id, opts = {})
245
+ if Configuration.debugging
246
+ Configuration.logger.debug "Calling API: SupportifyApi#get_faq_by_id ..."
247
+ end
248
+
249
+ # verify the required parameter 'id' is set
250
+ fail "Missing the required parameter 'id' when calling get_faq_by_id" if id.nil?
251
+
252
+ # resource path
253
+ path = "/faqs/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
254
+
255
+ # query parameters
256
+ query_params = {}
257
+
258
+ # header parameters
259
+ header_params = {}
260
+
261
+ # HTTP header 'Accept' (if needed)
262
+ _header_accept = ['application/json']
263
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
264
+
265
+ # HTTP header 'Content-Type'
266
+ _header_content_type = []
267
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
268
+
269
+ # form parameters
270
+ form_params = {}
271
+
272
+ # http body (model)
273
+ post_body = nil
274
+
275
+
276
+ auth_names = ['api_key', 'app_key']
277
+ result = @api_client.call_api(:GET, path,
278
+ :header_params => header_params,
279
+ :query_params => query_params,
280
+ :form_params => form_params,
281
+ :body => post_body,
282
+ :auth_names => auth_names,
283
+ :return_type => 'Faq')
284
+ if Configuration.debugging
285
+ Configuration.logger.debug "API called: SupportifyApi#get_faq_by_id. Result: #{result.inspect}"
286
+ end
287
+ return result
288
+ end
289
+
290
+ #
291
+ # Record a vote for a content entry.
292
+ # @param id ID of the content entry to record the vote for.
293
+ # @param vote The direction of the vote to be recorded. Currently, the only accepted values are &#39;up&#39; and &#39;down&#39;.
294
+ # @param [Hash] opts the optional parameters
295
+ # @return [nil]
296
+ def vote_on_faq(id, vote, opts = {})
297
+ if Configuration.debugging
298
+ Configuration.logger.debug "Calling API: SupportifyApi#vote_on_faq ..."
299
+ end
300
+
301
+ # verify the required parameter 'id' is set
302
+ fail "Missing the required parameter 'id' when calling vote_on_faq" if id.nil?
303
+
304
+ # verify the required parameter 'vote' is set
305
+ fail "Missing the required parameter 'vote' when calling vote_on_faq" if vote.nil?
306
+
307
+ # resource path
308
+ path = "/faqs/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
309
+
310
+ # query parameters
311
+ query_params = {}
312
+
313
+ # header parameters
314
+ header_params = {}
315
+
316
+ # HTTP header 'Accept' (if needed)
317
+ _header_accept = ['application/json']
318
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
319
+
320
+ # HTTP header 'Content-Type'
321
+ _header_content_type = []
322
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
323
+
324
+ # form parameters
325
+ form_params = {}
326
+ form_params["vote"] = vote
327
+
328
+ # http body (model)
329
+ post_body = nil
330
+
331
+
332
+ auth_names = ['api_key', 'app_key']
333
+ @api_client.call_api(:POST, path,
334
+ :header_params => header_params,
335
+ :query_params => query_params,
336
+ :form_params => form_params,
337
+ :body => post_body,
338
+ :auth_names => auth_names)
339
+ if Configuration.debugging
340
+ Configuration.logger.debug "API called: SupportifyApi#vote_on_faq"
341
+ end
342
+ return nil
343
+ end
344
+
345
+ #
346
+ # The Info endpoint returns an information object containing details of the application being accessed.\n\nThis endpoint is mostly used for diagnostic purposes.
347
+ # @param [Hash] opts the optional parameters
348
+ # @return [Info]
349
+ def get_info(opts = {})
350
+ if Configuration.debugging
351
+ Configuration.logger.debug "Calling API: SupportifyApi#get_info ..."
352
+ end
353
+
354
+ # resource path
355
+ path = "/info".sub('{format}','json')
356
+
357
+ # query parameters
358
+ query_params = {}
359
+
360
+ # header parameters
361
+ header_params = {}
362
+
363
+ # HTTP header 'Accept' (if needed)
364
+ _header_accept = ['application/json']
365
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
366
+
367
+ # HTTP header 'Content-Type'
368
+ _header_content_type = []
369
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
370
+
371
+ # form parameters
372
+ form_params = {}
373
+
374
+ # http body (model)
375
+ post_body = nil
376
+
377
+
378
+ auth_names = ['api_key', 'app_key']
379
+ result = @api_client.call_api(:GET, path,
380
+ :header_params => header_params,
381
+ :query_params => query_params,
382
+ :form_params => form_params,
383
+ :body => post_body,
384
+ :auth_names => auth_names,
385
+ :return_type => 'Info')
386
+ if Configuration.debugging
387
+ Configuration.logger.debug "API called: SupportifyApi#get_info. Result: #{result.inspect}"
388
+ end
389
+ return result
390
+ end
391
+
392
+ #
393
+ # Search for a collection of content entries that match the supplied query.
394
+ # @param query The string to match the content entry against.
395
+ # @param [Hash] opts the optional parameters
396
+ # @option opts [Array<String>] :categories categories to filter by
397
+ # @option opts [Integer] :limit The maximum number of entries to return in the collection.
398
+ # @option opts [Integer] :skip The number of entries to skip over when returning the results.
399
+ # @option opts [Array<String>] :tags tags to filter by
400
+ # @return [Array<Faq>]
401
+ def search(query, opts = {})
402
+ if Configuration.debugging
403
+ Configuration.logger.debug "Calling API: SupportifyApi#search ..."
404
+ end
405
+
406
+ # verify the required parameter 'query' is set
407
+ fail "Missing the required parameter 'query' when calling search" if query.nil?
408
+
409
+ # resource path
410
+ path = "/search".sub('{format}','json')
411
+
412
+ # query parameters
413
+ query_params = {}
414
+ query_params[:'query'] = query
415
+ query_params[:'categories'] = opts[:'categories'] if opts[:'categories']
416
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
417
+ query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
418
+ query_params[:'tags'] = opts[:'tags'] if opts[:'tags']
419
+
420
+ # header parameters
421
+ header_params = {}
422
+
423
+ # HTTP header 'Accept' (if needed)
424
+ _header_accept = ['application/json']
425
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
426
+
427
+ # HTTP header 'Content-Type'
428
+ _header_content_type = []
429
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
430
+
431
+ # form parameters
432
+ form_params = {}
433
+
434
+ # http body (model)
435
+ post_body = nil
436
+
437
+
438
+ auth_names = ['api_key', 'app_key']
439
+ result = @api_client.call_api(:GET, path,
440
+ :header_params => header_params,
441
+ :query_params => query_params,
442
+ :form_params => form_params,
443
+ :body => post_body,
444
+ :auth_names => auth_names,
445
+ :return_type => 'Array<Faq>')
446
+ if Configuration.debugging
447
+ Configuration.logger.debug "API called: SupportifyApi#search. Result: #{result.inspect}"
448
+ end
449
+ return result
450
+ end
451
+
452
+ #
453
+ # Returns all tags from the application.
454
+ # @param [Hash] opts the optional parameters
455
+ # @option opts [Integer] :limit The maximum number of entries to return in the collection.
456
+ # @option opts [Integer] :skip The number of entries to skip over when returning the results.
457
+ # @option opts [String] :sort The sort order and method of the results.
458
+ # @return [Array<Tag>]
459
+ def get_tags(opts = {})
460
+ if Configuration.debugging
461
+ Configuration.logger.debug "Calling API: SupportifyApi#get_tags ..."
462
+ end
463
+
464
+ # resource path
465
+ path = "/tags".sub('{format}','json')
466
+
467
+ # query parameters
468
+ query_params = {}
469
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
470
+ query_params[:'skip'] = opts[:'skip'] if opts[:'skip']
471
+ query_params[:'sort'] = opts[:'sort'] if opts[:'sort']
472
+
473
+ # header parameters
474
+ header_params = {}
475
+
476
+ # HTTP header 'Accept' (if needed)
477
+ _header_accept = ['application/json']
478
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
479
+
480
+ # HTTP header 'Content-Type'
481
+ _header_content_type = []
482
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
483
+
484
+ # form parameters
485
+ form_params = {}
486
+
487
+ # http body (model)
488
+ post_body = nil
489
+
490
+
491
+ auth_names = ['api_key', 'app_key']
492
+ result = @api_client.call_api(:GET, path,
493
+ :header_params => header_params,
494
+ :query_params => query_params,
495
+ :form_params => form_params,
496
+ :body => post_body,
497
+ :auth_names => auth_names,
498
+ :return_type => 'Array<Tag>')
499
+ if Configuration.debugging
500
+ Configuration.logger.debug "API called: SupportifyApi#get_tags. Result: #{result.inspect}"
501
+ end
502
+ return result
503
+ end
504
+
505
+ #
506
+ # Returns a tag based on a single ID.
507
+ # @param id ID of tag to fetch
508
+ # @param [Hash] opts the optional parameters
509
+ # @return [Tag]
510
+ def get_tag_by_id(id, opts = {})
511
+ if Configuration.debugging
512
+ Configuration.logger.debug "Calling API: SupportifyApi#get_tag_by_id ..."
513
+ end
514
+
515
+ # verify the required parameter 'id' is set
516
+ fail "Missing the required parameter 'id' when calling get_tag_by_id" if id.nil?
517
+
518
+ # resource path
519
+ path = "/tags/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
520
+
521
+ # query parameters
522
+ query_params = {}
523
+
524
+ # header parameters
525
+ header_params = {}
526
+
527
+ # HTTP header 'Accept' (if needed)
528
+ _header_accept = ['application/json']
529
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
530
+
531
+ # HTTP header 'Content-Type'
532
+ _header_content_type = []
533
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
534
+
535
+ # form parameters
536
+ form_params = {}
537
+
538
+ # http body (model)
539
+ post_body = nil
540
+
541
+
542
+ auth_names = ['api_key', 'app_key']
543
+ result = @api_client.call_api(:GET, path,
544
+ :header_params => header_params,
545
+ :query_params => query_params,
546
+ :form_params => form_params,
547
+ :body => post_body,
548
+ :auth_names => auth_names,
549
+ :return_type => 'Tag')
550
+ if Configuration.debugging
551
+ Configuration.logger.debug "API called: SupportifyApi#get_tag_by_id. Result: #{result.inspect}"
552
+ end
553
+ return result
554
+ end
555
+ end
556
+ end
557
+
558
+
559
+
560
+