kinetic_sdk 0.1.1

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 (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,51 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add a form type on a Kapp
5
+ #
6
+ # @param kapp_slug [String] slug of the Kapp the form type belongs to
7
+ # @param body [Hash] form type properties
8
+ # - +name+ - A descriptive name for the form type
9
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
10
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
11
+ def add_form_type_on_kapp(kapp_slug, body, headers=default_headers)
12
+ raise StandardError.new "Form Type properties is not valid, must be a Hash." unless body.is_a? Hash
13
+ info("Adding Form Type \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
14
+ post("#{@api_url}/kapps/#{kapp_slug}/formTypes", body, headers)
15
+ end
16
+
17
+ # Delete a form type on a Kapp
18
+ #
19
+ # @param kapp_slug [String] slug of the Kapp the form type belongs to
20
+ # @param name [String] name of the form type
21
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
22
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
23
+ def delete_form_type(kapp_slug, name, headers=default_headers)
24
+ info("Deleting form type \"#{name}\" from \"#{kapp_slug}\" kapp")
25
+ delete("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", headers)
26
+ end
27
+
28
+ # Delete all form types on a Kapp
29
+ #
30
+ # @param kapp_slug [String] slug of the Kapp the form types belongs to
31
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
32
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
33
+ def delete_form_types_on_kapp(kapp_slug, headers=default_headers)
34
+ (find_form_types_on_kapp(kapp_slug, {}, headers).content["formTypes"] || []).each do |form_type|
35
+ delete_form_type(kapp_slug, form_type['name'], headers)
36
+ end
37
+ end
38
+
39
+ # Retrieve a list of all form types for a Kapp
40
+ #
41
+ # @param kapp_slug [String] slug of the Kapp the form types belongs to
42
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
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 find_form_types_on_kapp(kapp_slug, params={}, headers=default_headers)
46
+ info("Finding Form Types for \"#{kapp_slug}\" kapp")
47
+ get("#{@api_url}/kapps/#{kapp_slug}/formTypes", params, headers)
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,55 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Gets an authentication code
5
+ #
6
+ # @param client_id [String] the oauth client id
7
+ # @param client_secret [String] the oauth client secret
8
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
9
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
10
+ def jwt_token(client_id, client_secret, headers=default_headers)
11
+ # retrieve the jwt code
12
+ jwt_code = jwt_code(client_id, headers)
13
+ # retrieve the jwt token
14
+ info("Retrieving JWT authorization token")
15
+ url = "#{@server}/app/oauth/token?grant_type=authorization_code&response_type=token&client_id=#{client_id}&code=#{jwt_code}"
16
+ token_headers = header_accept_json.merge(header_basic_auth(client_id, client_secret))
17
+ response = post(url, {}, token_headers, 0)
18
+
19
+ if response.status == 401
20
+ raise StandardError.new "#{response.message}, the oauth client id and secret are invalid."
21
+ elsif response.status == 200
22
+ response
23
+ else
24
+ raise StandardError.new "Unable to retrieve token: #{response}"
25
+ end
26
+ end
27
+
28
+ # Gets an authentication code.
29
+ #
30
+ # This method should really never need to be called externally.
31
+ #
32
+ # @param client_id [String]
33
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
34
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
35
+ def jwt_code(client_id, headers=default_headers)
36
+ info("Retrieving JWT authorization code")
37
+ url = "#{@server}/app/oauth/authorize?grant_type=authorization_code&response_type=code&client_id=#{client_id}"
38
+ response = post(url, {}, headers, -1)
39
+
40
+ if response.status == 401
41
+ raise StandardError.new "#{response.message}: #{response.content['error']}"
42
+ elsif response.status == 302
43
+ location = response.headers['location']
44
+ if location.nil?
45
+ raise StandardError.new "Unable to retrieve code: #{response.inspect}"
46
+ else
47
+ location.split("?code=").last.split("#/").first
48
+ end
49
+ else
50
+ raise StandardError.new "Unable to retrieve code #{response.inspect}"
51
+ end
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,93 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add a Kapp
5
+ #
6
+ # @param kapp_name [String] name of the Kapp
7
+ # @param kapp_slug [String] slug of the Kapp
8
+ # @param properties [Hash] optional properties associated to the Kapp
9
+ # - +afterLogoutPath+
10
+ # - +bundlePath+
11
+ # - +defaultFormDisplayPage+
12
+ # - +defaultFormConfirmationPage+
13
+ # - +defaultSubmissionLabelExpression+
14
+ # - +displayType+
15
+ # - +displayValue+
16
+ # - +loginPage+
17
+ # - +resetPasswordPage+
18
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
19
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
20
+ def add_kapp(kapp_name, kapp_slug, properties={}, headers=default_headers)
21
+ properties.merge!({
22
+ "name" => kapp_name,
23
+ "slug" => kapp_slug
24
+ })
25
+ info("Adding the \"#{kapp_name}\" Kapp.")
26
+ post("#{@api_url}/kapps", properties, headers)
27
+ end
28
+
29
+ # Delete a Kapp
30
+ #
31
+ # @param kapp_slug [String] slug of the Kapp
32
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
33
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
34
+ def delete_kapp(kapp_slug, headers=default_headers)
35
+ info("Deleting the \"#{kapp_slug}\" Kapp.")
36
+ delete("#{@api_url}/kapps/#{kapp_slug}", headers)
37
+ end
38
+
39
+ # Exports a Kapp
40
+ #
41
+ # @param kapp_slug [String] slug of the Kapp
42
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
43
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
44
+ def export_kapp(kapp_slug, headers=default_headers)
45
+ info("Exporting the \"#{kapp_slug}\" Kapp.")
46
+ get("#{@api_url}/kapps/#{kapp_slug}", { 'export' => true }, headers)
47
+ end
48
+
49
+ # Find Kapps
50
+ #
51
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
52
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
53
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
54
+ def find_kapps(params={}, headers=default_headers)
55
+ info("Finding Kapps.")
56
+ get("#{@api_url}/kapps", params, headers)
57
+ end
58
+
59
+ # Find a Kapp
60
+ #
61
+ # @param kapp_slug [String] slug of the Kapp
62
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
63
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
64
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
65
+ def find_kapp(kapp_slug, params={}, headers=default_headers)
66
+ info("Finding Kapp \"#{kapp_slug}\"")
67
+ get("#{@api_url}/kapps/#{kapp_slug}", params, headers)
68
+ end
69
+
70
+ # Update a Kapp
71
+ #
72
+ # @param kapp_slug [String] slug of the Kapp
73
+ # @param properties [Hash] optional properties associated to the Kapp
74
+ # - +afterLogoutPath+
75
+ # - +bundlePath+
76
+ # - +defaultFormDisplayPage+
77
+ # - +defaultFormConfirmationPage+
78
+ # - +defaultSubmissionLabelExpression+
79
+ # - +displayType+
80
+ # - +displayValue+
81
+ # - +loginPage+
82
+ # - +name+
83
+ # - +resetPasswordPage+
84
+ # - +slug+
85
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
86
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
87
+ def update_kapp(kapp_slug, properties={}, headers=default_headers)
88
+ info("Updating the \"#{kapp_slug}\" Kapp.")
89
+ put("#{@api_url}/kapps/#{kapp_slug}", properties, headers)
90
+ end
91
+
92
+ end
93
+ end
@@ -0,0 +1,14 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Retrieve Request CE application version
5
+ #
6
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
7
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
8
+ def app_version(headers=default_headers)
9
+ info("Retrieving Request CE application version.")
10
+ get("#{@api_url}/version", {}, headers)
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add an OAuth client
5
+ #
6
+ # @param options [Hash] oauth client properties
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 add_oauth_client(options, headers=default_headers)
10
+ info("Adding the \"#{options['clientId']}\" OAuth client")
11
+ post("#{@api_url}/oauthClients", options, headers)
12
+ end
13
+
14
+ # Find OAuth client
15
+ #
16
+ # @param client_id [String] - oauth client identifier
17
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
18
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
19
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
20
+ def find_oauth_client(client_id, params={}, headers=default_headers)
21
+ info("Finding OAuth Client \"#{client_id}\"")
22
+ get("#{@api_url}/oauthClients/#{encode(client_id)}", params, headers)
23
+ end
24
+
25
+ # Update an OAuth client
26
+ #
27
+ # @param client_id [String] - oauth client identifier
28
+ # @param options [Hash] oauth client properties
29
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
30
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
31
+ def update_oauth_client(client_id, options, headers=default_headers)
32
+ info("Updating the \"#{client_id}\" OAuth client")
33
+ put("#{@api_url}/oauthClients/#{encode(client_id)}", options, headers)
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,157 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add a Space security policy definition
5
+ #
6
+ # @param body [Hash] properties of the security policy definition
7
+ # - +name+ - name of the security policy definition
8
+ # - +message+ - message for the security policy definition
9
+ # - +rule+ - rule for the security policy definition
10
+ # - +type+ - type of the security policy definition
11
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
12
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
13
+ def add_space_security_policy_definition(body, headers=default_headers)
14
+ info("Adding Space Security Policy Definition \"#{body['name']}\".")
15
+ # Create the space security policy definition
16
+ post("#{@api_url}/securityPolicyDefinitions", body, headers)
17
+ end
18
+
19
+ # Delete a Space security policy definition
20
+ #
21
+ # @param name [String] name of the security policy definition
22
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
23
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
24
+ def delete_space_security_policy_definition(name, headers=default_headers)
25
+ info("Deleting Space Security Policy Definition \"#{name}\".")
26
+ # Delete the space security policy definition
27
+ delete("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", headers)
28
+ end
29
+
30
+ # Delete all Space security policy definitions
31
+ #
32
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
33
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
34
+ def delete_space_security_policy_definitions(headers=default_headers)
35
+ (find_space_security_policy_definitions({}, headers).content["securityPolicyDefinitions"] || []).each do |s|
36
+ delete_space_security_policy_definition(s['name'], headers)
37
+ end
38
+ end
39
+
40
+ # Find all Space security policy definitions
41
+ #
42
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
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 find_space_security_policy_definitions(params={}, headers=default_headers)
46
+ info("Finding Space Security Policy Definitions.")
47
+ get("#{@api_url}/securityPolicyDefinitions", params, headers)
48
+ end
49
+
50
+ # Find a single Space security policy definition
51
+ #
52
+ # @param name [String] name of the security policy definition
53
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
54
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
55
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
56
+ def find_space_security_policy_definition(name, params={}, headers=default_headers)
57
+ info("Finding Space Security Policy Definition \"#{name}\"")
58
+ get("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", params, headers)
59
+ end
60
+
61
+ # Update a Space security policy definition
62
+ #
63
+ # @param name [String] name of the security policy definition
64
+ # @param body [Hash] properties of the security policy definition
65
+ # - +name+ - name of the security policy definition
66
+ # - +message+ - message for the security policy definition
67
+ # - +rule+ - rule for the security policy definition
68
+ # - +type+ - type of the security policy definition
69
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
70
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
71
+ def update_space_security_policy_definition(name, body, headers=default_headers)
72
+ info("Updating Space Security Policy Definition \"#{name}\"")
73
+ put("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", body, headers)
74
+ end
75
+
76
+
77
+
78
+ # Add a Kapp security policy definition
79
+ #
80
+ # @param kapp_slug [String] slug of the kapp
81
+ # @param body [Hash] properties of the security policy definition
82
+ # - +name+ - name of the security policy definition
83
+ # - +message+ - message for the security policy definition
84
+ # - +rule+ - rule for the security policy definition
85
+ # - +type+ - type of the security policy definition
86
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
87
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
88
+ def add_security_policy_definition(kapp_slug, body, headers=default_headers)
89
+ info("Adding Security Policy Definition \"#{body['name']}\" to the \"#{kapp_slug}\" kapp.")
90
+ # Create the kapp security policy definition
91
+ post("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", body, headers)
92
+ end
93
+
94
+ # Delete a Kapp security policy definition
95
+ #
96
+ # @param kapp_slug [String] slug of the kapp
97
+ # @param name [String] name of the security policy definition
98
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
99
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
100
+ def delete_security_policy_definition(kapp_slug, name, headers=default_headers)
101
+ info("Deleting Security Policy Definition \"#{name}\" from the \"#{kapp_slug}\" kapp.")
102
+ # Delete the kapp security policy definition
103
+ delete("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", headers)
104
+ end
105
+
106
+ # Delete all Kapp security policy definitions
107
+ #
108
+ # @param kapp_slug [String] slug of the kapp
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 delete_security_policy_definitions(kapp_slug, headers=default_headers)
112
+ (find_security_policy_definitions(kapp_slug, {}, headers).content["securityPolicyDefinitions"] || []).each do |s|
113
+ delete_security_policy_definition(kapp_slug, s['name'], headers)
114
+ end
115
+ end
116
+
117
+ # Find all Kapp security policy definitions
118
+ #
119
+ # @param kapp_slug [String] slug of the kapp
120
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
121
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
122
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
123
+ def find_security_policy_definitions(kapp_slug, params={}, headers=default_headers)
124
+ info("Listing Security Policy Definitions on the \"#{kapp_slug}\" kapp.")
125
+ get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", params, headers)
126
+ end
127
+
128
+ # Find a single Kapp security policy definition
129
+ #
130
+ # @param kapp_slug [String] slug of the kapp
131
+ # @param name [String] name of the security policy definition
132
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
133
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
134
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
135
+ def find_security_policy_definition(kapp_slug, name, params={}, headers=default_headers)
136
+ info("Finding Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
137
+ get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", params, headers)
138
+ end
139
+
140
+ # Update a Kapp security policy definition
141
+ #
142
+ # @param kapp_slug [String] slug of the kapp
143
+ # @param name [String] name of the security policy definition
144
+ # @param body [Hash] properties of the security policy definition
145
+ # - +name+ - name of the security policy definition
146
+ # - +message+ - message for the security policy definition
147
+ # - +rule+ - rule for the security policy definition
148
+ # - +type+ - type of the security policy definition
149
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
150
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
151
+ def update_security_policy_definition(kapp_slug, name, body, headers=default_headers)
152
+ info("Updating Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
153
+ put("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", body, headers)
154
+ end
155
+
156
+ end
157
+ end
@@ -0,0 +1,89 @@
1
+ module KineticSdk
2
+ class RequestCe
3
+
4
+ # Add an attribute value to the space, or update an attribute if it already exists
5
+ #
6
+ # @param attribute_name [String] name of the attribute
7
+ # @param attribute_value [String] value of the attribute
8
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
9
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
10
+ def add_space_attribute(attribute_name, attribute_value, headers=default_headers)
11
+ # first find the space
12
+ response = find_space({ "include" => "attributes"}, headers)
13
+ # hack to try a second time if space isn't found
14
+ if response.status == 404
15
+ sleep 2
16
+ response = find_space({ "include" => "attributes"}, headers)
17
+ end
18
+ space = response.content["space"]
19
+ attributes = space["attributes"]
20
+ # either add or update the attribute value
21
+ exists = false
22
+ attributes.each do |attribute|
23
+ info("Attribute: #{attribute.inspect}")
24
+ # if the attribute already exists, update it
25
+ if attribute["name"] == attribute_name
26
+ attribute["values"] = [ attribute_value ]
27
+ exists = true
28
+ end
29
+ end
30
+ # add the attribute if it didn't exist
31
+ attributes.push({
32
+ "name" => attribute_name,
33
+ "values" => [ attribute_value ]
34
+ }) unless exists
35
+
36
+ # set the updated attributes list
37
+ body = { "attributes" => attributes }
38
+ if exists
39
+ info("Updating attribute \"#{attribute_name}\" = \"#{attribute_value}\" in the \"#{space_slug}\" space.")
40
+ else
41
+ info("Adding attribute \"#{attribute_name}\" = \"#{attribute_value}\" to the \"#{space_slug}\" space.")
42
+ end
43
+ # Update the space
44
+ put("#{@api_url}/space", body, headers)
45
+ end
46
+
47
+ # Update a space
48
+ #
49
+ # @param body [Hash] properties for the Space
50
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
51
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
52
+ def update_space(body={}, headers=default_headers)
53
+ info("Updating Space \"#{@space_slug}\"")
54
+ put("#{@api_url}/space", body, headers)
55
+ end
56
+
57
+ # Export a space
58
+ #
59
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
60
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
61
+ def export_space(headers=default_headers)
62
+ info("Exporting Space \"#{@space_slug}\"")
63
+ get("#{@api_url}/space", { 'export' => true}, headers)
64
+ end
65
+
66
+ # Find the space
67
+ #
68
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
69
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
70
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
71
+ def find_space(params={}, headers=default_headers)
72
+ info("Finding Space \"#{@space_slug}\"")
73
+ get("#{@api_url}/space", params, headers)
74
+ end
75
+
76
+ # Checks if the space exists
77
+ #
78
+ # @param slug [String] slug of the space
79
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
80
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
81
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
82
+ def space_exists?(slug, params={}, headers=default_headers)
83
+ info("Checking if the \"#{slug}\" space exists")
84
+ response = get("#{@api_url}/spaces/#{slug}", params, headers)
85
+ response.status == 200
86
+ end
87
+
88
+ end
89
+ end