kinetic_sdk 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +7 -0
  2. data/GettingStarted.md +64 -0
  3. data/README.md +383 -0
  4. data/bin/console +12 -0
  5. data/bin/setup +8 -0
  6. data/gems/kontena-websocket-client-0.1.1/Gemfile +4 -0
  7. data/gems/kontena-websocket-client-0.1.1/LICENSE +190 -0
  8. data/gems/kontena-websocket-client-0.1.1/README.md +138 -0
  9. data/gems/kontena-websocket-client-0.1.1/Rakefile +6 -0
  10. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb +45 -0
  11. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark-em.rb +66 -0
  12. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark.rb +161 -0
  13. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark.sh +17 -0
  14. data/gems/kontena-websocket-client-0.1.1/benchmark/websocket-echo-server.go +207 -0
  15. data/gems/kontena-websocket-client-0.1.1/examples/websocket-echo-client.rb +80 -0
  16. data/gems/kontena-websocket-client-0.1.1/kontena-websocket-client.gemspec +24 -0
  17. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client/connection.rb +119 -0
  18. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client/version.rb +13 -0
  19. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client.rb +848 -0
  20. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/error.rb +81 -0
  21. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/logging.rb +55 -0
  22. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/openssl_patch.rb +10 -0
  23. data/gems/kontena-websocket-client-0.1.1/lib/kontena-websocket-client.rb +15 -0
  24. data/gems/mime-types-3.1/Code-of-Conduct.rdoc +74 -0
  25. data/gems/mime-types-3.1/Contributing.rdoc +130 -0
  26. data/gems/mime-types-3.1/History.rdoc +658 -0
  27. data/gems/mime-types-3.1/Licence.rdoc +25 -0
  28. data/gems/mime-types-3.1/Manifest.txt +31 -0
  29. data/gems/mime-types-3.1/README.rdoc +202 -0
  30. data/gems/mime-types-3.1/Rakefile +254 -0
  31. data/gems/mime-types-3.1/lib/mime/type/columnar.rb +55 -0
  32. data/gems/mime-types-3.1/lib/mime/type.rb +573 -0
  33. data/gems/mime-types-3.1/lib/mime/types/_columnar.rb +135 -0
  34. data/gems/mime-types-3.1/lib/mime/types/cache.rb +56 -0
  35. data/gems/mime-types-3.1/lib/mime/types/columnar.rb +1 -0
  36. data/gems/mime-types-3.1/lib/mime/types/container.rb +30 -0
  37. data/gems/mime-types-3.1/lib/mime/types/deprecations.rb +32 -0
  38. data/gems/mime-types-3.1/lib/mime/types/full.rb +17 -0
  39. data/gems/mime-types-3.1/lib/mime/types/loader.rb +148 -0
  40. data/gems/mime-types-3.1/lib/mime/types/logger.rb +37 -0
  41. data/gems/mime-types-3.1/lib/mime/types/registry.rb +81 -0
  42. data/gems/mime-types-3.1/lib/mime/types.rb +228 -0
  43. data/gems/mime-types-3.1/lib/mime-types.rb +1 -0
  44. data/gems/mime-types-3.1/test/bad-fixtures/malformed +9 -0
  45. data/gems/mime-types-3.1/test/fixture/json.json +1 -0
  46. data/gems/mime-types-3.1/test/fixture/old-data +9 -0
  47. data/gems/mime-types-3.1/test/fixture/yaml.yaml +55 -0
  48. data/gems/mime-types-3.1/test/minitest_helper.rb +13 -0
  49. data/gems/mime-types-3.1/test/test_mime_type.rb +603 -0
  50. data/gems/mime-types-3.1/test/test_mime_types.rb +161 -0
  51. data/gems/mime-types-3.1/test/test_mime_types_cache.rb +109 -0
  52. data/gems/mime-types-3.1/test/test_mime_types_class.rb +155 -0
  53. data/gems/mime-types-3.1/test/test_mime_types_lazy.rb +43 -0
  54. data/gems/mime-types-3.1/test/test_mime_types_loader.rb +32 -0
  55. data/gems/mime-types-data-3.2016.0521/Code-of-Conduct.md +75 -0
  56. data/gems/mime-types-data-3.2016.0521/Contributing.md +157 -0
  57. data/gems/mime-types-data-3.2016.0521/History.md +351 -0
  58. data/gems/mime-types-data-3.2016.0521/Licence.md +25 -0
  59. data/gems/mime-types-data-3.2016.0521/Manifest.txt +18 -0
  60. data/gems/mime-types-data-3.2016.0521/README.md +61 -0
  61. data/gems/mime-types-data-3.2016.0521/Rakefile +80 -0
  62. data/gems/mime-types-data-3.2016.0521/data/mime-types.json +1 -0
  63. data/gems/mime-types-data-3.2016.0521/data/mime.content_type.column +1964 -0
  64. data/gems/mime-types-data-3.2016.0521/data/mime.docs.column +1964 -0
  65. data/gems/mime-types-data-3.2016.0521/data/mime.encoding.column +1964 -0
  66. data/gems/mime-types-data-3.2016.0521/data/mime.flags.column +1964 -0
  67. data/gems/mime-types-data-3.2016.0521/data/mime.friendly.column +1964 -0
  68. data/gems/mime-types-data-3.2016.0521/data/mime.pext.column +1964 -0
  69. data/gems/mime-types-data-3.2016.0521/data/mime.use_instead.column +1964 -0
  70. data/gems/mime-types-data-3.2016.0521/data/mime.xrefs.column +1964 -0
  71. data/gems/mime-types-data-3.2016.0521/lib/mime/types/data.rb +21 -0
  72. data/gems/mime-types-data-3.2016.0521/lib/mime-types-data.rb +3 -0
  73. data/gems/multipart-post-2.0.0/Gemfile +14 -0
  74. data/gems/multipart-post-2.0.0/History.txt +60 -0
  75. data/gems/multipart-post-2.0.0/Manifest.txt +9 -0
  76. data/gems/multipart-post-2.0.0/README.md +77 -0
  77. data/gems/multipart-post-2.0.0/Rakefile +9 -0
  78. data/gems/multipart-post-2.0.0/lib/composite_io.rb +108 -0
  79. data/gems/multipart-post-2.0.0/lib/multipart_post.rb +9 -0
  80. data/gems/multipart-post-2.0.0/lib/multipartable.rb +29 -0
  81. data/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +27 -0
  82. data/gems/multipart-post-2.0.0/lib/parts.rb +96 -0
  83. data/gems/multipart-post-2.0.0/multipart-post.gemspec +22 -0
  84. data/gems/multipart-post-2.0.0/test/multibyte.txt +1 -0
  85. data/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +110 -0
  86. data/gems/multipart-post-2.0.0/test/test_composite_io.rb +115 -0
  87. data/gems/multipart-post-2.0.0/test/test_parts.rb +86 -0
  88. data/gems/parallel-1.12.1/MIT-LICENSE.txt +20 -0
  89. data/gems/parallel-1.12.1/lib/parallel/processor_count.rb +93 -0
  90. data/gems/parallel-1.12.1/lib/parallel/version.rb +3 -0
  91. data/gems/parallel-1.12.1/lib/parallel.rb +500 -0
  92. data/gems/ruby-progressbar-1.9.0/LICENSE.txt +19 -0
  93. data/gems/ruby-progressbar-1.9.0/README.md +38 -0
  94. data/gems/ruby-progressbar-1.9.0/Rakefile +2 -0
  95. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/base.rb +183 -0
  96. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/calculators/length.rb +99 -0
  97. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/calculators/running_average.rb +9 -0
  98. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/bar.rb +96 -0
  99. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/percentage.rb +29 -0
  100. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/rate.rb +43 -0
  101. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/time.rb +107 -0
  102. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/title.rb +13 -0
  103. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components.rb +5 -0
  104. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/errors/invalid_progress_error.rb +4 -0
  105. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/formatter.rb +27 -0
  106. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/molecule.rb +59 -0
  107. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/string.rb +36 -0
  108. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format.rb +3 -0
  109. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/output.rb +68 -0
  110. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/non_tty.rb +47 -0
  111. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/null.rb +33 -0
  112. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/tty.rb +32 -0
  113. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/progress.rb +118 -0
  114. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb +25 -0
  115. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements.rb +1 -0
  116. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/throttle.rb +25 -0
  117. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/time.rb +30 -0
  118. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/timer.rb +72 -0
  119. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/version.rb +3 -0
  120. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar.rb +18 -0
  121. data/gems/slugify-1.0.7/README +18 -0
  122. data/gems/slugify-1.0.7/lib/slugify.rb +1012 -0
  123. data/gems/slugify-1.0.7/lib/slugify_string.rb +11 -0
  124. data/gems/slugify-1.0.7/tests/slugify_test.rb +116 -0
  125. data/gems/slugify-1.0.7/tests/string_slugify_test.rb +23 -0
  126. data/gems/websocket-driver-0.6.5/CHANGELOG.md +123 -0
  127. data/gems/websocket-driver-0.6.5/LICENSE.md +22 -0
  128. data/gems/websocket-driver-0.6.5/README.md +369 -0
  129. data/gems/websocket-driver-0.6.5/examples/tcp_server.rb +28 -0
  130. data/gems/websocket-driver-0.6.5/ext/websocket-driver/Makefile +264 -0
  131. data/gems/websocket-driver-0.6.5/ext/websocket-driver/WebsocketMaskService.java +55 -0
  132. data/gems/websocket-driver-0.6.5/ext/websocket-driver/extconf.rb +4 -0
  133. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.bundle +0 -0
  134. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.c +41 -0
  135. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.o +0 -0
  136. data/gems/websocket-driver-0.6.5/lib/websocket/driver/client.rb +140 -0
  137. data/gems/websocket-driver-0.6.5/lib/websocket/driver/draft75.rb +102 -0
  138. data/gems/websocket-driver-0.6.5/lib/websocket/driver/draft76.rb +96 -0
  139. data/gems/websocket-driver-0.6.5/lib/websocket/driver/event_emitter.rb +54 -0
  140. data/gems/websocket-driver-0.6.5/lib/websocket/driver/headers.rb +45 -0
  141. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi/frame.rb +20 -0
  142. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi/message.rb +31 -0
  143. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi.rb +406 -0
  144. data/gems/websocket-driver-0.6.5/lib/websocket/driver/proxy.rb +68 -0
  145. data/gems/websocket-driver-0.6.5/lib/websocket/driver/server.rb +80 -0
  146. data/gems/websocket-driver-0.6.5/lib/websocket/driver/stream_reader.rb +55 -0
  147. data/gems/websocket-driver-0.6.5/lib/websocket/driver.rb +199 -0
  148. data/gems/websocket-driver-0.6.5/lib/websocket/http/headers.rb +112 -0
  149. data/gems/websocket-driver-0.6.5/lib/websocket/http/request.rb +45 -0
  150. data/gems/websocket-driver-0.6.5/lib/websocket/http/response.rb +29 -0
  151. data/gems/websocket-driver-0.6.5/lib/websocket/http.rb +15 -0
  152. data/gems/websocket-driver-0.6.5/lib/websocket/mask.rb +14 -0
  153. data/gems/websocket-driver-0.6.5/lib/websocket/websocket_mask.rb +2 -0
  154. data/gems/websocket-driver-0.6.5/lib/websocket_mask.bundle +0 -0
  155. data/gems/websocket-driver-0.6.5-java/CHANGELOG.md +123 -0
  156. data/gems/websocket-driver-0.6.5-java/LICENSE.md +22 -0
  157. data/gems/websocket-driver-0.6.5-java/README.md +369 -0
  158. data/gems/websocket-driver-0.6.5-java/examples/tcp_server.rb +28 -0
  159. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/WebsocketMaskService.java +55 -0
  160. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/extconf.rb +4 -0
  161. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/websocket_mask.c +41 -0
  162. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/client.rb +140 -0
  163. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/draft75.rb +102 -0
  164. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/draft76.rb +96 -0
  165. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/event_emitter.rb +54 -0
  166. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/headers.rb +45 -0
  167. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi/frame.rb +20 -0
  168. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi/message.rb +31 -0
  169. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi.rb +406 -0
  170. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/proxy.rb +68 -0
  171. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/server.rb +80 -0
  172. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/stream_reader.rb +55 -0
  173. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver.rb +199 -0
  174. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/headers.rb +112 -0
  175. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/request.rb +45 -0
  176. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/response.rb +29 -0
  177. data/gems/websocket-driver-0.6.5-java/lib/websocket/http.rb +15 -0
  178. data/gems/websocket-driver-0.6.5-java/lib/websocket/mask.rb +14 -0
  179. data/gems/websocket-driver-0.6.5-java/lib/websocket/websocket_mask.rb +2 -0
  180. data/gems/websocket-driver-0.6.5-java/lib/websocket_mask.jar +0 -0
  181. data/gems/websocket-extensions-0.1.3/CHANGELOG.md +15 -0
  182. data/gems/websocket-extensions-0.1.3/LICENSE.md +20 -0
  183. data/gems/websocket-extensions-0.1.3/README.md +313 -0
  184. data/gems/websocket-extensions-0.1.3/lib/websocket/extensions/parser.rb +111 -0
  185. data/gems/websocket-extensions-0.1.3/lib/websocket/extensions.rb +181 -0
  186. data/lib/kinetic-sdk.rb +1 -0
  187. data/lib/kinetic_sdk/bridgehub/bridgehub-sdk.rb +80 -0
  188. data/lib/kinetic_sdk/bridgehub/lib/access_keys.rb +67 -0
  189. data/lib/kinetic_sdk/bridgehub/lib/bridge.rb +69 -0
  190. data/lib/kinetic_sdk/discussions/discussions-sdk.rb +165 -0
  191. data/lib/kinetic_sdk/discussions/lib/discussions.rb +107 -0
  192. data/lib/kinetic_sdk/discussions/lib/invitations.rb +120 -0
  193. data/lib/kinetic_sdk/discussions/lib/messages.rb +190 -0
  194. data/lib/kinetic_sdk/discussions/lib/meta.rb +14 -0
  195. data/lib/kinetic_sdk/discussions/lib/participants.rb +64 -0
  196. data/lib/kinetic_sdk/discussions/lib/related_items.rb +54 -0
  197. data/lib/kinetic_sdk/discussions/lib/websockets.rb +96 -0
  198. data/lib/kinetic_sdk/filehub/filehub-sdk.rb +80 -0
  199. data/lib/kinetic_sdk/filehub/lib/access_keys.rb +67 -0
  200. data/lib/kinetic_sdk/filehub/lib/filestores.rb +67 -0
  201. data/lib/kinetic_sdk/request_ce/lib/attribute_definitions.rb +153 -0
  202. data/lib/kinetic_sdk/request_ce/lib/bridges.rb +66 -0
  203. data/lib/kinetic_sdk/request_ce/lib/categories.rb +34 -0
  204. data/lib/kinetic_sdk/request_ce/lib/datastore_form.rb +110 -0
  205. data/lib/kinetic_sdk/request_ce/lib/datastore_submissions.rb +157 -0
  206. data/lib/kinetic_sdk/request_ce/lib/form.rb +99 -0
  207. data/lib/kinetic_sdk/request_ce/lib/form_types.rb +51 -0
  208. data/lib/kinetic_sdk/request_ce/lib/jwt.rb +55 -0
  209. data/lib/kinetic_sdk/request_ce/lib/kapp.rb +93 -0
  210. data/lib/kinetic_sdk/request_ce/lib/meta.rb +14 -0
  211. data/lib/kinetic_sdk/request_ce/lib/oauth.rb +37 -0
  212. data/lib/kinetic_sdk/request_ce/lib/security_policy_definitions.rb +157 -0
  213. data/lib/kinetic_sdk/request_ce/lib/space.rb +89 -0
  214. data/lib/kinetic_sdk/request_ce/lib/submissions.rb +215 -0
  215. data/lib/kinetic_sdk/request_ce/lib/system_api.rb +69 -0
  216. data/lib/kinetic_sdk/request_ce/lib/teams.rb +113 -0
  217. data/lib/kinetic_sdk/request_ce/lib/users.rb +245 -0
  218. data/lib/kinetic_sdk/request_ce/lib/webhook_jobs.rb +142 -0
  219. data/lib/kinetic_sdk/request_ce/lib/webhooks.rb +192 -0
  220. data/lib/kinetic_sdk/request_ce/request-ce-sdk.rb +153 -0
  221. data/lib/kinetic_sdk/task/lib/access_keys.rb +94 -0
  222. data/lib/kinetic_sdk/task/lib/categories.rb +190 -0
  223. data/lib/kinetic_sdk/task/lib/config.rb +202 -0
  224. data/lib/kinetic_sdk/task/lib/engine.rb +42 -0
  225. data/lib/kinetic_sdk/task/lib/environment.rb +14 -0
  226. data/lib/kinetic_sdk/task/lib/errors.rb +165 -0
  227. data/lib/kinetic_sdk/task/lib/groups.rb +112 -0
  228. data/lib/kinetic_sdk/task/lib/handlers.rb +105 -0
  229. data/lib/kinetic_sdk/task/lib/health.rb +28 -0
  230. data/lib/kinetic_sdk/task/lib/license.rb +52 -0
  231. data/lib/kinetic_sdk/task/lib/policy_rules.rb +166 -0
  232. data/lib/kinetic_sdk/task/lib/setup.rb +56 -0
  233. data/lib/kinetic_sdk/task/lib/sources.rb +134 -0
  234. data/lib/kinetic_sdk/task/lib/tasks.rb +17 -0
  235. data/lib/kinetic_sdk/task/lib/trees.rb +274 -0
  236. data/lib/kinetic_sdk/task/lib/users.rb +75 -0
  237. data/lib/kinetic_sdk/task/task-sdk.rb +92 -0
  238. data/lib/kinetic_sdk/utils/kinetic-http-headers.rb +150 -0
  239. data/lib/kinetic_sdk/utils/kinetic-http-response.rb +75 -0
  240. data/lib/kinetic_sdk/utils/kinetic-http.rb +552 -0
  241. data/lib/kinetic_sdk/utils/logger.rb +70 -0
  242. data/lib/kinetic_sdk/utils/random.rb +30 -0
  243. data/lib/kinetic_sdk/version.rb +7 -0
  244. data/lib/kinetic_sdk.rb +57 -0
  245. metadata +414 -0
@@ -0,0 +1,142 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Find space webhook jobs
5
+ #
6
+ # @param params [Hash] Query parameters that are added to the URL, such as +status+
7
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
8
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
9
+ def find_space_webhook_jobs(params={}, headers=default_headers)
10
+ info("Finding webhook jobs in the Space")
11
+ get("#{@api_url}/webhookJobs", params, headers)
12
+ end
13
+
14
+ # Find all Webhook Jobs for a space.
15
+ #
16
+ # This method will process pages of jobs and internally
17
+ # concatenate the results into a single array.
18
+ #
19
+ # Warning - using this method can cause out of memory errors on large
20
+ # result sets.
21
+ #
22
+ #
23
+ # @param params [Hash] Query parameters that are added to the URL, such as +status+
24
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
25
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
26
+ def find_all_space_webhook_jobs(params={}, headers=default_headers)
27
+ # Make the initial request of pages jobs
28
+ response = find_space_webhook_jobs(params, headers)
29
+ # Build Submissions Array
30
+ jobs = response.content["webhookJobs"]
31
+ # if a next page token exists, keep retrieving jobs and add them to the results
32
+ while (!response.content["nextPageToken"].nil?)
33
+ params['pageToken'] = response.content["nextPageToken"]
34
+ response = find_space_webhook_jobs(params, headers)
35
+ # concat the jobs
36
+ jobs.concat(response.content["webhookJobs"] || [])
37
+ end
38
+ final_content = {"webhookJobs" => jobs, "nextPageToken" => nil }
39
+ # Return the results
40
+ response.content=final_content
41
+ response.content_string=final_content.to_json
42
+ response
43
+ end
44
+
45
+ # Find kapp webhook jobs
46
+ #
47
+ # @param kapp_slug [String] the Kapp slug
48
+ # @param params [Hash] Query parameters that are added to the URL, such as +status+
49
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
50
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
51
+ def find_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)
52
+ info("Finding webhook jobs in the \"#{kapp_slug}\" Kapp")
53
+ get("#{@api_url}/kapps/#{kapp_slug}/webhookJobs", params, headers)
54
+ end
55
+
56
+ # Find all Webhook Jobs for a kapp.
57
+ #
58
+ # This method will process pages of jobs and internally
59
+ # concatenate the results into a single array.
60
+ #
61
+ # Warning - using this method can cause out of memory errors on large
62
+ # result sets.
63
+ #
64
+ #
65
+ # @param params [Hash] Query parameters that are added to the URL, such as +status+
66
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
67
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
68
+ def find_all_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)
69
+ # Make the initial request of pages jobs
70
+ response = find_kapp_webhook_jobs(kapp_slug, params, headers)
71
+ # Build Submissions Array
72
+ jobs = response.content["webhookJobs"]
73
+ # if a next page token exists, keep retrieving jobs and add them to the results
74
+ while (!response.content["nextPageToken"].nil?)
75
+ params['pageToken'] = response.content["nextPageToken"]
76
+ response = find_kapp_webhook_jobs(kapp_slug, params, headers)
77
+ # concat the jobs
78
+ jobs.concat(response.content["webhookJobs"] || [])
79
+ end
80
+ final_content = {"webhookJobs" => jobs, "nextPageToken" => nil }
81
+ # Return the results
82
+ response.content=final_content
83
+ response.content_string=final_content.to_json
84
+ response
85
+ end
86
+
87
+ # Update space webhook job
88
+ #
89
+ # @param job_id [String] id of the Job
90
+ # @param job_properties [Hash] Query parameters that are added to the URL, such as +status+
91
+ # - +event+ - "Complete",
92
+ # - +id+ - "00000000-0000-1000-8000-000000000000",
93
+ # - +name+ - "Foo",
94
+ # - +parentId+ - "00000000-0000-1000-8000-000000000000",
95
+ # - +requestContent+ - null,
96
+ # - +responseContent+ - null,
97
+ # - +retryCount+ - 0,
98
+ # - +scheduledAt+ - "2016-04-20T12:00:00Z",
99
+ # - +scopeId+ - "00000000-0000-1000-8000-000000000000",
100
+ # - +scopeType+ - "Kapp",
101
+ # - +status+ - "Queued",
102
+ # - +summary+ - null,
103
+ # - +type+ - "Submission",
104
+ # - +url+ - "http://my.server.com/api",
105
+ # - +webhookId+ - "00000000-0000-1000-8000-000000000000"
106
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
107
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
108
+ def update_space_webhook_job(job_id, job_properties={}, headers=default_headers)
109
+ info("Updating the webhook job #{job_id} in Space")
110
+ put("#{@api_url}/webhookJobs/#{job_id}", job_properties, headers)
111
+ end
112
+
113
+
114
+ # Update kapp webhook job
115
+ #
116
+ # @param kapp_slug [String] the Kapp slug
117
+ # @param job_id [String] id of the Job
118
+ # @param job_properties [Hash] Query parameters that are added to the URL, such as +status+
119
+ # - +event+ - "Complete",
120
+ # - +id+ - "00000000-0000-1000-8000-000000000000",
121
+ # - +name+ - "Foo",
122
+ # - +parentId+ - "00000000-0000-1000-8000-000000000000",
123
+ # - +requestContent+ - null,
124
+ # - +responseContent+ - null,
125
+ # - +retryCount+ - 0,
126
+ # - +scheduledAt+ - "2016-04-20T12:00:00Z",
127
+ # - +scopeId+ - "00000000-0000-1000-8000-000000000000",
128
+ # - +scopeType+ - "Kapp",
129
+ # - +status+ - "Queued",
130
+ # - +summary+ - null,
131
+ # - +type+ - "Submission",
132
+ # - +url+ - "http://my.server.com/api",
133
+ # - +webhookId+ - "00000000-0000-1000-8000-000000000000"
134
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
135
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
136
+ def update_kapp_webhook_job(kapp_slug, job_id, job_properties={}, headers=default_headers)
137
+ info("Updating the webhook job #{job_id} in the \"#{kapp_slug}\" Kapp")
138
+ put("#{@api_url}/kapps/#{kapp_slug}/webhookJobs/#{job_id}", job_properties, headers)
139
+ end
140
+
141
+ end
142
+ end
@@ -0,0 +1,192 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add form webhook
5
+ #
6
+ # @param kapp_slug [String] slug of the Kapp the form webhook belongs to
7
+ # @param webhook_properties [Hash] hash of webhook properties
8
+ # - +event+ - Created | Deleted | Updated
9
+ # - +name+ - A descriptive name for the webhook
10
+ # - +filter+ - A javascript expression to determine when the webhook should fire
11
+ # - +url+ - URL to post the bindings when the event is triggered
12
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
13
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
14
+ def add_form_webhook(kapp_slug, webhook_properties, headers=default_headers)
15
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
16
+ payload = { "type" => "Form" }.merge(webhook_properties)
17
+ add_webhook_on_kapp(kapp_slug, payload, headers)
18
+ end
19
+
20
+ # Add space webhook
21
+ #
22
+ # @param webhook_properties [Hash] hash of webhook properties
23
+ # - +event+ - Login Failure
24
+ # - +name+ - A descriptive name for the webhook
25
+ # - +filter+ - A javascript expression to determine when the webhook should fire
26
+ # - +url+ - URL to post the bindings when the event is triggered
27
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
28
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
29
+ def add_space_webhook(webhook_properties, headers=default_headers)
30
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
31
+ payload = { "type" => "Space" }.merge(webhook_properties)
32
+ add_webhook_on_space(payload, headers)
33
+ end
34
+
35
+ # Add submission webhook
36
+ #
37
+ # @param kapp_slug [String] slug of the Kapp the submission webhook belongs to
38
+ # @param webhook_properties [Hash] hash of webhook properties
39
+ # - +event+ - Closed | Created | Deleted | Saved | Submitted | Updated
40
+ # - +name+ - A descriptive name for the webhook
41
+ # - +filter+ - A javascript expression to determine when the webhook should fire
42
+ # - +url+ - URL to post the bindings when the event is triggered
43
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
44
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
45
+ def add_submission_webhook(kapp_slug, webhook_properties, headers=default_headers)
46
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
47
+ payload = { "type" => "Submission" }.merge(webhook_properties)
48
+ add_webhook_on_kapp(kapp_slug, payload, headers)
49
+ end
50
+
51
+ # Add user webhook
52
+ #
53
+ # @param webhook_properties [Hash] hash of webhook properties
54
+ # - +event+ - Login | Logout
55
+ # - +name+ - A descriptive name for the webhook
56
+ # - +filter+ - A javascript expression to determine when the webhook should fire
57
+ # - +url+ - URL to post the bindings when the event is triggered
58
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
59
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
60
+ def add_user_webhook(webhook_properties, headers=default_headers)
61
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
62
+ payload = { "type" => "User" }.merge(webhook_properties)
63
+ add_webhook_on_space(payload, headers)
64
+ end
65
+
66
+ # Add a webhook on a Kapp (either a Form or Submission webhook)
67
+ #
68
+ # Ideally the shortcut methods (add_form_webhook,
69
+ # add_submission_webhook) would be used instead of this one.
70
+ #
71
+ # @param kapp_slug [String] slug of the Kapp the webhook belongs to
72
+ # @param webhook_properties [Hash] hash of webhook properties
73
+ # - +event+ - depends on +type+
74
+ # - +name+ - A descriptive name for the webhook
75
+ # - +filter+ - A javascript expression to determine when the webhook should fire
76
+ # - +url+ - URL to post the bindings when the event is triggered
77
+ # - +type+ - The type of model the webhook is bound to: Form | Submission
78
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
79
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
80
+ def add_webhook_on_kapp(kapp_slug, webhook_properties, headers=default_headers)
81
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
82
+ info("Adding a \"#{webhook_properties['event']}\" \"#{webhook_properties['type']}\" webhook for #{kapp_slug}")
83
+ post("#{@api_url}/kapps/#{kapp_slug}/webhooks", webhook_properties, headers)
84
+ end
85
+
86
+ # Add a webhook on a Space (either a Space or User webhook)
87
+ #
88
+ # Ideally the shortcut methods (add_space_webhook, add_user_webhook)
89
+ # would be used instead of this one.
90
+ #
91
+ # @param webhook_properties [Hash] hash of webhook properties
92
+ # - +event+ - depends on +type+
93
+ # - +name+ - A descriptive name for the webhook
94
+ # - +filter+ - A javascript expression to determine when the webhook should fire
95
+ # - +url+ - URL to post the bindings when the event is triggered
96
+ # - +type+ - The type of model the webhook is bound to: Space | User
97
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
98
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
99
+ def add_webhook_on_space(webhook_properties, headers=default_headers)
100
+ raise StandardError.new "Webhook properties is not valid, must be a Hash." unless webhook_properties.is_a? Hash
101
+ info("Adding a \"#{webhook_properties['event']}\" \"#{webhook_properties['type']}\" webhook")
102
+ post("#{@api_url}/webhooks", webhook_properties, headers)
103
+ end
104
+
105
+ # Find all webhooks for a Kapp
106
+ #
107
+ # @param kapp_slug [String] the Kapp slug
108
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
109
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
110
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
111
+ def find_webhooks_on_kapp(kapp_slug, params={}, headers=default_headers)
112
+ info("Finding all webhooks on the \"#{kapp_slug}\" Kapp")
113
+ get("#{@api_url}/kapps/#{kapp_slug}/webhooks", params, headers)
114
+ end
115
+
116
+ # Find all webhooks for a Space
117
+ #
118
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
119
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
120
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
121
+ def find_webhooks_on_space(params={}, headers=default_headers)
122
+ info("Finding all webhooks on the Space")
123
+ get("#{@api_url}/webhooks", params, headers)
124
+ end
125
+
126
+ # Find a webhook defined in a Kapp
127
+ #
128
+ # @param kapp_slug [String] the Kapp slug
129
+ # @param name [String] the webhook name
130
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
131
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
132
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
133
+ def find_webhook_on_kapp(kapp_slug, name, params={}, headers=default_headers)
134
+ info("Finding the \"#{name}\" webhook on the \"#{kapp_slug}\" Kapp")
135
+ get("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}", params, headers)
136
+ end
137
+
138
+ # Find a webhook defined in a Space
139
+ #
140
+ # @param name [String] the webhook name
141
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
142
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
143
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
144
+ def finding_webhook_on_space(name, params={}, headers=default_headers)
145
+ info("Finding the \"#{name}\" webhook on the Space")
146
+ get("#{@api_url}/webhooks/#{encode(name)}", params, headers)
147
+ end
148
+
149
+ # Update a webhook on a Kapp (either a Form or Submission webhook)
150
+ #
151
+ # All of the webhook properties are optional. Only the properties provided
152
+ # in the Hash will be updated, the other properties will retain their
153
+ # current values.
154
+ #
155
+ # @param kapp_slug [String] the Kapp slug
156
+ # @param name [String] the webhook name
157
+ # @param webhook_properties [Hash] hash of webhook properties
158
+ # - +event+ - depends on +type+
159
+ # - +name+ - A descriptive name for the webhook
160
+ # - +filter+ - A javascript expression to determine when the webhook should fire
161
+ # - +url+ - URL to post the bindings when the event is triggered
162
+ # - +type+ - The type of model the webhook is bound to: Form | Submission
163
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
164
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
165
+ def update_webhook_on_kapp(kapp_slug, name, webhook_properties, headers=default_headers)
166
+ info("Updating the \"#{name}\" webhook on the \"#{kapp_slug}\" Kapp")
167
+ put("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}", webhook_properties, headers)
168
+ end
169
+
170
+
171
+ # Update a webhook on a Space (either a Space or User webhook)
172
+ #
173
+ # All of the webhook properties are optional. Only the properties provided
174
+ # in the Hash will be updated, the other properties will retain their
175
+ # current values.
176
+ #
177
+ # @param name [String] the webhook name
178
+ # @param webhook_properties [Hash] hash of webhook properties
179
+ # - +event+ - depends on +type+
180
+ # - +name+ - A descriptive name for the webhook
181
+ # - +filter+ - A javascript expression to determine when the webhook should fire
182
+ # - +url+ - URL to post the bindings when the event is triggered
183
+ # - +type+ - The type of model the webhook is bound to: Space | User
184
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
185
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
186
+ def update_webhook_on_space(name, webhook_properties, headers=default_headers)
187
+ info("Updating the \"#{name}\" webhook on the Space")
188
+ put("#{@api_url}/webhooks/#{encode(name)}", webhook_properties, headers)
189
+ end
190
+
191
+ end
192
+ end
@@ -0,0 +1,153 @@
1
+ Dir[File.join(File.dirname(File.expand_path(__FILE__)), "lib", "**", "*.rb")].each {|file| require file }
2
+
3
+ module KineticSdk
4
+
5
+ # RequestCe is a Ruby class that acts as a wrapper for the Kinetic Request CE REST API
6
+ # without having to make explicit HTTP requests.
7
+ #
8
+ class RequestCe
9
+
10
+ # Include the KineticHttpUtils module
11
+ include KineticSdk::Utils::KineticHttpUtils
12
+
13
+ attr_reader :api_url, :username, :options, :password, :space_slug, :server, :version
14
+
15
+ # Initalize the Request CE SDK with the web server URL, the space user
16
+ # username and password, along with any custom option values.
17
+ #
18
+ # @param [Hash<Symbol, Object>] opts Kinetic Request CE properties
19
+ # @option opts [String] :config_file optional - path to the YAML configuration file
20
+ #
21
+ # * Ex: /opt/config/request-ce-configuration1.yaml
22
+ #
23
+ # @option opts [String] :app_server_url the URL to the Kinetic Request CE web application
24
+ #
25
+ # * Must not be used when `:space_server_url` is also used.
26
+ # * If space_slug is provided, it will be appended to the URL as a path parameter
27
+ # * Ex: <http://192.168.0.1:8080/kinetic>
28
+ #
29
+ # @option opts [String] :space_server_url the URL to the Kinetic Request CE space
30
+ #
31
+ # * Must not be used when `app_server_url` is used
32
+ # * Typically used when using a proxy server that supports space slugs as subdomains
33
+ # * Ex: <http://acme.server.io/kinetic> - space slug (`acme`) as subdomain
34
+ # * Ex: <http://localhost:8080/kinetic/acme> - same result as using `:app_server_url` and `:space_slug`
35
+ #
36
+ # @option opts [String] :space_slug the slug that identifies the Space
37
+ #
38
+ # * Optional when `:app_server_url` is used
39
+ # * Required when `:space_server_url` is used
40
+ # * Required to log in to a Space
41
+ # * Must be nil to log in to the System
42
+ #
43
+ # @option opts [String] :username the username for the user
44
+ # @option opts [String] :password the password for the user
45
+ # @option opts [Hash<Symbol, Object>] :options ({}) optional settings
46
+ #
47
+ # * :log_level (String) (_defaults to: off_) level of logging - off | info | debug | trace
48
+ # * :max_redirects (Fixnum) (_defaults to: 10_) maximum number of redirects to follow
49
+ # * :ssl_ca_file (String) full path to PEM certificate used to verify the server
50
+ # * :ssl_verify_mode (String) (_defaults to: none_) - none | peer
51
+ #
52
+ # Example: using a configuration file
53
+ #
54
+ # KineticSdk::RequestCe.new({
55
+ # config_file: "/opt/config1.yaml"
56
+ # })
57
+ #
58
+ # Example: space user properties hash
59
+ #
60
+ # KineticSdk::RequestCe.new({
61
+ # app_server_url: "http://localhost:8080/kinetic",
62
+ # space_slug: "foo",
63
+ # username: "space-user-1",
64
+ # password: "password",
65
+ # options: {
66
+ # log_level: "debug",
67
+ # ssl_verify_mode: "peer",
68
+ # ssl_ca_file: "/usr/local/self_signing_ca.pem"
69
+ # }
70
+ # })
71
+ #
72
+ # Example: system user properties hash
73
+ #
74
+ # KineticSdk::RequestCe.new({
75
+ # app_server_url: "http://localhost:8080/kinetic",
76
+ # username: "admin",
77
+ # password: "password",
78
+ # options: {
79
+ # log_level: "debug",
80
+ # ssl_verify_mode: "peer",
81
+ # ssl_ca_file: "/usr/local/self_signing_ca.pem"
82
+ # }
83
+ # })
84
+ #
85
+ # Example: space user properties hash with the space url
86
+ #
87
+ # # Note: This example results in the same API endpoint as using:
88
+ # #
89
+ # # app_server_url: https://myapp.io
90
+ #
91
+ # KineticSdk::RequestCe.new({
92
+ # space_server_url: "https://myapp.io/foo",
93
+ # space_slug: "foo",
94
+ # username: "space-user-1",
95
+ # password: "password",
96
+ # options: {
97
+ # log_level: "info",
98
+ # max_redirects: 3
99
+ # }
100
+ # })
101
+ #
102
+ # Example: space user properties hash with the space url as a subdomain
103
+ #
104
+ # # Note: This example requires a proxy server to rewrite the space slug
105
+ # # as a request path parameter rather than a subdomain.
106
+ # #
107
+ # # Ex: https://myapp.io/foo
108
+ #
109
+ # KineticSdk::RequestCe.new({
110
+ # space_server_url: "https://foo.myapp.io",
111
+ # space_slug: "foo",
112
+ # username: "space-user-1",
113
+ # password: "password",
114
+ # options: {
115
+ # log_level: "info",
116
+ # max_redirects: 3
117
+ # }
118
+ # })
119
+ #
120
+ def initialize(opts={})
121
+ options = {}
122
+
123
+ # process the configuration file if it was provided
124
+ unless opts[:config_file].nil?
125
+ options.merge!(YAML::load_file opts[:config_file])
126
+ end
127
+
128
+ # process the configuration hash if it was provided
129
+ options.merge!(opts)
130
+
131
+ # allow either :app_server_url or :space_server_url, but not both
132
+ if options[:app_server_url] && options[:space_server_url]
133
+ raise StandardError.new "Expecting one of :app_server_url or :space_server_url, but not both."
134
+ end
135
+
136
+ # process any individual options
137
+ @options = options.delete(:options) || {}
138
+ @username = options[:username]
139
+ @password = options[:password]
140
+ @space_slug = options[:space_slug]
141
+ if options[:app_server_url]
142
+ @server = options[:app_server_url].chomp('/')
143
+ @api_url = @server + (@space_slug.nil? ? "/app/api/v1" : "/#{@space_slug}/app/api/v1")
144
+ else
145
+ raise StandardError.new "The :space_slug option is required when using the :space_server_url option" if @space_slug.nil?
146
+ @server = options[:space_server_url].chomp('/')
147
+ @api_url = "#{@server}/app/api/v1"
148
+ end
149
+ @version = 1
150
+ end
151
+
152
+ end
153
+ end
@@ -0,0 +1,94 @@
1
+ module KineticSdk
2
+ class Task
3
+
4
+ # Add an access key
5
+ #
6
+ # @param access_key [Hash] properties for the access key
7
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
8
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
9
+ #
10
+ # Example
11
+ #
12
+ # add_access_key({
13
+ # "description" => "Description",
14
+ # "identifier" => "X54DLNU",
15
+ # "secret" => "xyz"
16
+ # })
17
+ #
18
+ # Example
19
+ #
20
+ # add_access_key({
21
+ # "description" => "Description"
22
+ # })
23
+ #
24
+ # Example
25
+ #
26
+ # add_access_key()
27
+ #
28
+ def add_access_key(access_key={}, headers=default_headers)
29
+ info("Adding access key " + (access_key.has_key?('identifier') ? access_key['identifier'] : ""))
30
+ post("#{@api_url}/access-keys", access_key, headers)
31
+ end
32
+
33
+ # Delete an access key
34
+ #
35
+ # @param identifier [String] access key identifier
36
+ # @param headers [Hash] hash of headers to send, default is basic authentication
37
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
38
+ def delete_access_key(identifier, headers=header_basic_auth)
39
+ info("Deleting access key \"#{identifier}\"")
40
+ delete("#{@api_url}/access-keys/#{encode(identifier)}", headers)
41
+ end
42
+
43
+ # Delete all access keys
44
+ #
45
+ # @param headers [Hash] hash of headers to send, default is basic authentication
46
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
47
+ def delete_access_keys(headers=header_basic_auth)
48
+ info("Deleting all access keys")
49
+ (find_access_keys(headers).content["accessKeys"] || []).each do |access_key|
50
+ delete("#{@api_url}/access_keys/#{encode(access_key['identifier'])}", headers)
51
+ end
52
+ end
53
+
54
+ # Find all access keys
55
+ #
56
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
57
+ # @param headers [Hash] hash of headers to send, default is basic authentication
58
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
59
+ def find_access_keys(params={}, headers=header_basic_auth)
60
+ info("Finding all access keys")
61
+ get("#{@api_url}/access-keys", params, headers)
62
+ end
63
+
64
+ # Find an access key
65
+ #
66
+ # @param identifier [String] access key identifier
67
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
68
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
69
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
70
+ def find_access_key(identifier, params={}, headers=default_headers)
71
+ info("Finding access key \"#{identifier}\"")
72
+ get("#{@api_url}/access-keys/#{encode(identifier)}", params, headers)
73
+ end
74
+
75
+ # Update an access key
76
+ #
77
+ # @param identifier [String] access key identifier
78
+ # @param body [Hash] properties to update, all optional
79
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
80
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
81
+ #
82
+ # Exammple
83
+ #
84
+ # update_identifier("X54DLNU", {
85
+ # "description": "Updated access key"
86
+ # })
87
+ #
88
+ def update_access_key(identifier, body={}, headers=default_headers)
89
+ info("Updating the \"#{identifier}\" access key")
90
+ put("#{@api_url}/access-keys/#{encode(identifier)}", body, headers)
91
+ end
92
+
93
+ end
94
+ end