kinetic_sdk 0.1.1 → 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 (74) hide show
  1. checksums.yaml +5 -5
  2. data/.yardoc-includes/yard-helpers.rb +14 -0
  3. data/.yardopts +7 -0
  4. data/CHANGELOG.md +41 -0
  5. data/GettingStarted.md +6 -12
  6. data/README.md +85 -37
  7. data/Rakefile +13 -0
  8. data/kinetic_sdk.gemspec +33 -0
  9. data/lib/kinetic_sdk/agent/agent-sdk.rb +90 -0
  10. data/lib/kinetic_sdk/agent/lib/bridges.rb +92 -0
  11. data/lib/kinetic_sdk/agent/lib/filestores.rb +91 -0
  12. data/lib/kinetic_sdk/agent/lib/handler.rb +91 -0
  13. data/lib/kinetic_sdk/bridgehub/bridgehub-sdk.rb +11 -3
  14. data/lib/kinetic_sdk/bridgehub/lib/access_keys.rb +5 -5
  15. data/lib/kinetic_sdk/bridgehub/lib/bridge.rb +5 -5
  16. data/lib/kinetic_sdk/{request_ce/request-ce-sdk.rb → core/core-sdk.rb} +30 -16
  17. data/lib/kinetic_sdk/core/lib/attribute_definitions.rb +500 -0
  18. data/lib/kinetic_sdk/core/lib/bridges.rb +141 -0
  19. data/lib/kinetic_sdk/{request_ce → core}/lib/categories.rb +3 -3
  20. data/lib/kinetic_sdk/{request_ce → core}/lib/datastore_form.rb +8 -8
  21. data/lib/kinetic_sdk/{request_ce → core}/lib/datastore_submissions.rb +20 -9
  22. data/lib/kinetic_sdk/{request_ce → core}/lib/form.rb +7 -7
  23. data/lib/kinetic_sdk/{request_ce → core}/lib/form_types.rb +4 -4
  24. data/lib/kinetic_sdk/{request_ce → core}/lib/jwt.rb +4 -4
  25. data/lib/kinetic_sdk/{request_ce → core}/lib/kapp.rb +7 -7
  26. data/lib/kinetic_sdk/{request_ce → core}/lib/meta.rb +3 -3
  27. data/lib/kinetic_sdk/{request_ce → core}/lib/oauth.rb +4 -4
  28. data/lib/kinetic_sdk/{request_ce → core}/lib/security_policy_definitions.rb +11 -11
  29. data/lib/kinetic_sdk/core/lib/space.rb +156 -0
  30. data/lib/kinetic_sdk/{request_ce → core}/lib/submissions.rb +11 -11
  31. data/lib/kinetic_sdk/{request_ce → core}/lib/system_api.rb +19 -7
  32. data/lib/kinetic_sdk/{request_ce → core}/lib/teams.rb +9 -9
  33. data/lib/kinetic_sdk/{request_ce → core}/lib/users.rb +15 -15
  34. data/lib/kinetic_sdk/{request_ce → core}/lib/webhook_jobs.rb +5 -5
  35. data/lib/kinetic_sdk/{request_ce → core}/lib/webhooks.rb +9 -9
  36. data/lib/kinetic_sdk/discussions/discussions-sdk.rb +12 -4
  37. data/lib/kinetic_sdk/discussions/lib/discussions.rb +8 -8
  38. data/lib/kinetic_sdk/discussions/lib/invitations.rb +9 -9
  39. data/lib/kinetic_sdk/discussions/lib/messages.rb +8 -8
  40. data/lib/kinetic_sdk/discussions/lib/meta.rb +1 -1
  41. data/lib/kinetic_sdk/discussions/lib/participants.rb +5 -5
  42. data/lib/kinetic_sdk/discussions/lib/related_items.rb +4 -4
  43. data/lib/kinetic_sdk/discussions/lib/websockets.rb +9 -9
  44. data/lib/kinetic_sdk/filehub/filehub-sdk.rb +11 -3
  45. data/lib/kinetic_sdk/filehub/lib/access_keys.rb +5 -5
  46. data/lib/kinetic_sdk/filehub/lib/filestores.rb +5 -5
  47. data/lib/kinetic_sdk/task/lib/access_keys.rb +35 -7
  48. data/lib/kinetic_sdk/task/lib/categories.rb +30 -17
  49. data/lib/kinetic_sdk/task/lib/config.rb +14 -14
  50. data/lib/kinetic_sdk/task/lib/engine.rb +1 -1
  51. data/lib/kinetic_sdk/task/lib/errors.rb +10 -10
  52. data/lib/kinetic_sdk/task/lib/export.rb +32 -0
  53. data/lib/kinetic_sdk/task/lib/groups.rb +23 -10
  54. data/lib/kinetic_sdk/task/lib/handlers.rb +27 -11
  55. data/lib/kinetic_sdk/task/lib/health.rb +11 -3
  56. data/lib/kinetic_sdk/task/lib/license.rb +4 -4
  57. data/lib/kinetic_sdk/task/lib/policy_rules.rb +25 -12
  58. data/lib/kinetic_sdk/task/lib/runs.rb +43 -0
  59. data/lib/kinetic_sdk/task/lib/setup.rb +2 -2
  60. data/lib/kinetic_sdk/task/lib/sources.rb +39 -8
  61. data/lib/kinetic_sdk/task/lib/tasks.rb +1 -1
  62. data/lib/kinetic_sdk/task/lib/trees.rb +84 -28
  63. data/lib/kinetic_sdk/task/lib/users.rb +6 -6
  64. data/lib/kinetic_sdk/task/task-sdk.rb +16 -4
  65. data/lib/kinetic_sdk/utils/kinetic-export-utils.rb +157 -0
  66. data/lib/kinetic_sdk/utils/kinetic-http.rb +388 -98
  67. data/lib/kinetic_sdk/utils/logger.rb +82 -46
  68. data/lib/kinetic_sdk/utils/prettier-xml-formatter.rb +60 -0
  69. data/lib/kinetic_sdk/version.rb +1 -1
  70. data/lib/kinetic_sdk.rb +5 -2
  71. metadata +41 -27
  72. data/lib/kinetic_sdk/request_ce/lib/attribute_definitions.rb +0 -153
  73. data/lib/kinetic_sdk/request_ce/lib/bridges.rb +0 -66
  74. data/lib/kinetic_sdk/request_ce/lib/space.rb +0 -89
@@ -1,70 +1,106 @@
1
+ require 'logger'
2
+
1
3
  module KineticSdk
2
4
  module Utils
3
5
 
4
- # The Logger module provides methods to output at different levels based on
6
+ # The KLogger class provides methods to output at different levels based on
5
7
  # a configuration property. The default log level is `off`, but can be
6
8
  # turned on by passing in the `log_level` option.
7
9
  #
8
- # Available Levels: `trace`, `debug`, `info`, `off`
10
+ # Available Levels: `debug`, `info`, `warn`, `error`, `off`
11
+ #
12
+ # The default output is to `STDOUT`, but can also be set to `STDERR` by
13
+ # passing in the `log_output` option.
14
+ #
15
+ # Available Outputs: `STDOUT`, `STDERR`
9
16
  #
10
- module Logger
17
+ class KLogger
11
18
 
12
- # Logs the message if the log level is set to debug or lower.
19
+ # Constructor
13
20
  #
14
- # @param message [String] The message to log at debug level
15
- def debug(message)
16
- puts message if debug?
21
+ # @param level [String] log level (off): `debug`, `info`, `warn`, `error`, `off`
22
+ # @param output [String] log output (stdout): `stdout`, `stderr`
23
+ def initialize(level, output="stdout")
24
+ log_level = level.to_s.downcase
25
+ log_output = output.to_s.downcase == "stderr" ? STDERR : STDOUT
26
+
27
+ @logger = Logger.new(log_output)
28
+
29
+ case log_level
30
+ when "error"
31
+ @logger.level= Logger::ERROR
32
+ when "warn"
33
+ @logger.level= Logger::WARN
34
+ when "info"
35
+ @logger.level= Logger::INFO
36
+ when "debug"
37
+ @logger.level= Logger::DEBUG
38
+ else
39
+ @logger.level= Logger::FATAL
40
+ end
41
+
42
+ # define the string output format
43
+ @logger.formatter = proc do |severity, datetime, progname, msg|
44
+ date_format = datetime.utc.strftime("%Y-%m-%dT%H:%M:%S.%LZ")
45
+ "[#{date_format}] #{severity}: #{msg}\n"
46
+ end
17
47
  end
18
48
 
19
- # Indicates if the log level is set to debug or lower.
49
+ # Print the message if level is Logger::DEBUG or lower
20
50
  #
21
- # @return [Boolean] true if debug or trace, else false
22
- def debug?
23
- @options &&
24
- (
25
- @options[:log_level].to_s.downcase == "debug" ||
26
- @options['log_level'].to_s.downcase == "debug" ||
27
- trace?
28
- )
29
- end
51
+ # @param msg [String] the message to log
52
+ def debug(msg); @logger.debug(msg); end
30
53
 
31
- # Logs the message if the log level is set to info or lower.
54
+ # Is the current log level set to Logger::DEBUG or lower?
32
55
  #
33
- # @param message [String] The message to log at info level
34
- def info(message)
35
- puts message if info?
36
- end
56
+ # @return [Boolean] true if level is debug or lower
57
+ def debug?; @logger.debug? end
37
58
 
38
- # Indicates if the log level is set to info or lower.
59
+ # Print the message if level is Logger::ERROR or lower
39
60
  #
40
- # @return [Boolean] true if info, debug or trace, else false
41
- def info?
42
- @options &&
43
- (
44
- @options[:log_level].to_s.downcase == "info" ||
45
- @options['log_level'].to_s.downcase == "info" ||
46
- debug?
47
- )
48
- end
61
+ # @param msg [String] the message to log
62
+ def error(msg); @logger.error(msg); end
49
63
 
50
- # Logs the message if the log level is set to trace.
64
+ # Is the current log level set to Logger::ERROR or lower?
51
65
  #
52
- # @param message [String] The message to log at trace level
53
- def trace(message)
54
- puts message if trace?
55
- end
66
+ # @return [Boolean] true if level is error or lower
67
+ def error?; @logger.error? end
56
68
 
57
- # Indicates if the log level is set to trace.
69
+ # Print the message if level is Logger::FATAL or lower
58
70
  #
59
- # @return [Boolean] true if trace, else false
60
- def trace?
61
- @options &&
62
- (
63
- @options[:log_level].to_s.downcase == "trace" ||
64
- @options['log_level'].to_s.downcase == "trace"
65
- )
66
- end
71
+ # @param msg [String] the message to log
72
+ def fatal(msg); @logger.fatal(msg); end
67
73
 
74
+ # Is the current log level set to Logger::FATAL or lower?
75
+ #
76
+ # @return [Boolean] true if level is fatal or lower
77
+ def fatal?; @logger.fatal? end
78
+
79
+ # Print the message if level is Logger::INFO or lower
80
+ #
81
+ # @param msg [String] the message to log
82
+ def info(msg); @logger.info(msg); end
83
+
84
+ # Is the current log level set to Logger::INFO or lower?
85
+ #
86
+ # @return [Boolean] true if level is info or lower
87
+ def info?; @logger.info? end
88
+
89
+ # Print the message if level is Logger::WARN or lower
90
+ #
91
+ # @param msg [String] the message to log
92
+ def warn(msg); @logger.warn(msg); end
93
+
94
+ # Is the current log level set to Logger::WARN or lower?
95
+ #
96
+ # @return [Boolean] true if level is warn or lower
97
+ def warn?; @logger.warn?; end
98
+
99
+ # Get the logger level
100
+ #
101
+ # @return [Integer]
102
+ def level; @logger.level; end;
68
103
  end
104
+
69
105
  end
70
106
  end
@@ -0,0 +1,60 @@
1
+ require 'rexml/document'
2
+
3
+ # Custom REXML formatter that removes blank lines, extra whitespace,
4
+ # and ensures lines are indented properly.
5
+ #
6
+ # This class is used for pre-4.4 Kinetic Task servers to format tree xml
7
+ # content when exporting trees and routines.
8
+ class Prettier < REXML::Formatters::Default
9
+
10
+ def initialize( indentation = 4 )
11
+ @indentation = indentation
12
+ @level = 0
13
+ end
14
+
15
+ protected
16
+ def write_element( node, output )
17
+ output << "<#{node.expanded_name}"
18
+
19
+ att = node.attributes
20
+ class <<att
21
+ def each_attribute_sorted(&b)
22
+ to_enum(:each_attribute).sort_by {|x| x.name}.each(&b)
23
+ end
24
+ end
25
+
26
+ node.attributes.each_attribute_sorted do |attr|
27
+ output << " "
28
+ attr.write( output )
29
+ end unless node.attributes.empty?
30
+
31
+ if node.children.empty?
32
+ output << "></#{node.expanded_name}>"
33
+ else
34
+ element_nodes = node.children.select { |child| child.kind_of?(REXML::Element) }.size
35
+ processed_element_nodes = 0
36
+
37
+ output << ">"
38
+ @level += @indentation
39
+ node.children.each_index { |index|
40
+ child = node.children[index]
41
+ next if child.kind_of?(REXML::Text) && node.expanded_name != "parameter" && child.to_s.strip.length == 0
42
+ if child.kind_of?(REXML::Element) then
43
+ processed_element_nodes += 1
44
+ write_indent_level(output, true)
45
+ end
46
+ write( child, output )
47
+ }
48
+ @level -= @indentation if @level >= @indentation
49
+ write_indent_level(output, true) if element_nodes > 0 && processed_element_nodes == element_nodes
50
+ output << "</#{node.expanded_name}>"
51
+ end
52
+ end
53
+
54
+ private
55
+ def write_indent_level(output, newline = false)
56
+ output << "\n" if newline
57
+ output << ' ' * @level
58
+ end
59
+
60
+ end
@@ -3,5 +3,5 @@ module KineticSdk
3
3
  # Version of Kinetic SDK
4
4
  #
5
5
  # @return [String] Version of the SDK
6
- VERSION = "0.1.1"
6
+ VERSION = "1.0.0"
7
7
  end
data/lib/kinetic_sdk.rb CHANGED
@@ -45,13 +45,16 @@ require 'slugify'
45
45
  require File.join(pwd, "kinetic_sdk/version")
46
46
 
47
47
  require File.join(pwd, "kinetic_sdk/utils/logger")
48
- require File.join(pwd, "kinetic_sdk/utils/random")
48
+ require File.join(pwd, "kinetic_sdk/utils/kinetic-export-utils")
49
49
  require File.join(pwd, "kinetic_sdk/utils/kinetic-http-headers")
50
50
  require File.join(pwd, "kinetic_sdk/utils/kinetic-http-response")
51
51
  require File.join(pwd, "kinetic_sdk/utils/kinetic-http")
52
+ require File.join(pwd, "kinetic_sdk/utils/prettier-xml-formatter")
53
+ require File.join(pwd, "kinetic_sdk/utils/random")
52
54
 
55
+ require File.join(pwd, "kinetic_sdk/agent/agent-sdk")
53
56
  require File.join(pwd, "kinetic_sdk/bridgehub/bridgehub-sdk")
57
+ require File.join(pwd, "kinetic_sdk/core/core-sdk")
54
58
  require File.join(pwd, "kinetic_sdk/discussions/discussions-sdk")
55
59
  require File.join(pwd, "kinetic_sdk/filehub/filehub-sdk")
56
- require File.join(pwd, "kinetic_sdk/request_ce/request-ce-sdk")
57
60
  require File.join(pwd, "kinetic_sdk/task/task-sdk")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kinetic_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kinetic Data
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: 0.1.1
89
89
  name: kontena-websocket-client
90
90
  prerelease: false
91
- type: :runtime
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
@@ -127,7 +127,7 @@ dependencies:
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 0.9.12
130
+ version: 0.9.20
131
131
  name: yard
132
132
  prerelease: false
133
133
  type: :development
@@ -135,7 +135,7 @@ dependencies:
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.9.12
138
+ version: 0.9.20
139
139
  description:
140
140
  email:
141
141
  - support@kineticdata.com
@@ -145,8 +145,12 @@ executables:
145
145
  extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
+ - ".yardoc-includes/yard-helpers.rb"
149
+ - ".yardopts"
150
+ - CHANGELOG.md
148
151
  - GettingStarted.md
149
152
  - README.md
153
+ - Rakefile
150
154
  - bin/console
151
155
  - bin/setup
152
156
  - gems/kontena-websocket-client-0.1.1/Gemfile
@@ -329,11 +333,36 @@ files:
329
333
  - gems/websocket-extensions-0.1.3/README.md
330
334
  - gems/websocket-extensions-0.1.3/lib/websocket/extensions.rb
331
335
  - gems/websocket-extensions-0.1.3/lib/websocket/extensions/parser.rb
336
+ - kinetic_sdk.gemspec
332
337
  - lib/kinetic-sdk.rb
333
338
  - lib/kinetic_sdk.rb
339
+ - lib/kinetic_sdk/agent/agent-sdk.rb
340
+ - lib/kinetic_sdk/agent/lib/bridges.rb
341
+ - lib/kinetic_sdk/agent/lib/filestores.rb
342
+ - lib/kinetic_sdk/agent/lib/handler.rb
334
343
  - lib/kinetic_sdk/bridgehub/bridgehub-sdk.rb
335
344
  - lib/kinetic_sdk/bridgehub/lib/access_keys.rb
336
345
  - lib/kinetic_sdk/bridgehub/lib/bridge.rb
346
+ - lib/kinetic_sdk/core/core-sdk.rb
347
+ - lib/kinetic_sdk/core/lib/attribute_definitions.rb
348
+ - lib/kinetic_sdk/core/lib/bridges.rb
349
+ - lib/kinetic_sdk/core/lib/categories.rb
350
+ - lib/kinetic_sdk/core/lib/datastore_form.rb
351
+ - lib/kinetic_sdk/core/lib/datastore_submissions.rb
352
+ - lib/kinetic_sdk/core/lib/form.rb
353
+ - lib/kinetic_sdk/core/lib/form_types.rb
354
+ - lib/kinetic_sdk/core/lib/jwt.rb
355
+ - lib/kinetic_sdk/core/lib/kapp.rb
356
+ - lib/kinetic_sdk/core/lib/meta.rb
357
+ - lib/kinetic_sdk/core/lib/oauth.rb
358
+ - lib/kinetic_sdk/core/lib/security_policy_definitions.rb
359
+ - lib/kinetic_sdk/core/lib/space.rb
360
+ - lib/kinetic_sdk/core/lib/submissions.rb
361
+ - lib/kinetic_sdk/core/lib/system_api.rb
362
+ - lib/kinetic_sdk/core/lib/teams.rb
363
+ - lib/kinetic_sdk/core/lib/users.rb
364
+ - lib/kinetic_sdk/core/lib/webhook_jobs.rb
365
+ - lib/kinetic_sdk/core/lib/webhooks.rb
337
366
  - lib/kinetic_sdk/discussions/discussions-sdk.rb
338
367
  - lib/kinetic_sdk/discussions/lib/discussions.rb
339
368
  - lib/kinetic_sdk/discussions/lib/invitations.rb
@@ -345,52 +374,37 @@ files:
345
374
  - lib/kinetic_sdk/filehub/filehub-sdk.rb
346
375
  - lib/kinetic_sdk/filehub/lib/access_keys.rb
347
376
  - lib/kinetic_sdk/filehub/lib/filestores.rb
348
- - lib/kinetic_sdk/request_ce/lib/attribute_definitions.rb
349
- - lib/kinetic_sdk/request_ce/lib/bridges.rb
350
- - lib/kinetic_sdk/request_ce/lib/categories.rb
351
- - lib/kinetic_sdk/request_ce/lib/datastore_form.rb
352
- - lib/kinetic_sdk/request_ce/lib/datastore_submissions.rb
353
- - lib/kinetic_sdk/request_ce/lib/form.rb
354
- - lib/kinetic_sdk/request_ce/lib/form_types.rb
355
- - lib/kinetic_sdk/request_ce/lib/jwt.rb
356
- - lib/kinetic_sdk/request_ce/lib/kapp.rb
357
- - lib/kinetic_sdk/request_ce/lib/meta.rb
358
- - lib/kinetic_sdk/request_ce/lib/oauth.rb
359
- - lib/kinetic_sdk/request_ce/lib/security_policy_definitions.rb
360
- - lib/kinetic_sdk/request_ce/lib/space.rb
361
- - lib/kinetic_sdk/request_ce/lib/submissions.rb
362
- - lib/kinetic_sdk/request_ce/lib/system_api.rb
363
- - lib/kinetic_sdk/request_ce/lib/teams.rb
364
- - lib/kinetic_sdk/request_ce/lib/users.rb
365
- - lib/kinetic_sdk/request_ce/lib/webhook_jobs.rb
366
- - lib/kinetic_sdk/request_ce/lib/webhooks.rb
367
- - lib/kinetic_sdk/request_ce/request-ce-sdk.rb
368
377
  - lib/kinetic_sdk/task/lib/access_keys.rb
369
378
  - lib/kinetic_sdk/task/lib/categories.rb
370
379
  - lib/kinetic_sdk/task/lib/config.rb
371
380
  - lib/kinetic_sdk/task/lib/engine.rb
372
381
  - lib/kinetic_sdk/task/lib/environment.rb
373
382
  - lib/kinetic_sdk/task/lib/errors.rb
383
+ - lib/kinetic_sdk/task/lib/export.rb
374
384
  - lib/kinetic_sdk/task/lib/groups.rb
375
385
  - lib/kinetic_sdk/task/lib/handlers.rb
376
386
  - lib/kinetic_sdk/task/lib/health.rb
377
387
  - lib/kinetic_sdk/task/lib/license.rb
378
388
  - lib/kinetic_sdk/task/lib/policy_rules.rb
389
+ - lib/kinetic_sdk/task/lib/runs.rb
379
390
  - lib/kinetic_sdk/task/lib/setup.rb
380
391
  - lib/kinetic_sdk/task/lib/sources.rb
381
392
  - lib/kinetic_sdk/task/lib/tasks.rb
382
393
  - lib/kinetic_sdk/task/lib/trees.rb
383
394
  - lib/kinetic_sdk/task/lib/users.rb
384
395
  - lib/kinetic_sdk/task/task-sdk.rb
396
+ - lib/kinetic_sdk/utils/kinetic-export-utils.rb
385
397
  - lib/kinetic_sdk/utils/kinetic-http-headers.rb
386
398
  - lib/kinetic_sdk/utils/kinetic-http-response.rb
387
399
  - lib/kinetic_sdk/utils/kinetic-http.rb
388
400
  - lib/kinetic_sdk/utils/logger.rb
401
+ - lib/kinetic_sdk/utils/prettier-xml-formatter.rb
389
402
  - lib/kinetic_sdk/utils/random.rb
390
403
  - lib/kinetic_sdk/version.rb
391
404
  homepage: https://github.com/kineticdata/kinetic-sdk-rb
392
405
  licenses: []
393
- metadata: {}
406
+ metadata:
407
+ yard.run: yri
394
408
  post_install_message:
395
409
  rdoc_options: []
396
410
  require_paths:
@@ -407,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
421
  version: '0'
408
422
  requirements: []
409
423
  rubyforge_project:
410
- rubygems_version: 2.6.14
424
+ rubygems_version: 2.6.11
411
425
  signing_key:
412
426
  specification_version: 4
413
427
  summary: Ruby SDK for Kinetic Data application APIs
@@ -1,153 +0,0 @@
1
- module KineticSdk
2
- class RequestCe
3
-
4
- # Add a new user attribute definition.
5
- #
6
- # @param name [String] name of the attribute definition
7
- # @param description [String] description of the attribute definition
8
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
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_user_attribute_definition(name, description, allows_multiple, headers=default_headers)
12
- body = {
13
- "allowsMultiple" => allows_multiple,
14
- "description" => description,
15
- "name" => name
16
- }
17
- info("Adding User attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
18
- # Create the user attribute definition
19
- post("#{@api_url}/userAttributeDefinitions", body, headers)
20
- end
21
-
22
- # Add a new user profile attribute definition.
23
- #
24
- # @param name [String] name of the attribute definition
25
- # @param description [String] description of the attribute definition
26
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
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_user_profile_attribute_definition(name, description, allows_multiple, headers=default_headers)
30
- body = {
31
- "allowsMultiple" => allows_multiple,
32
- "description" => description,
33
- "name" => name
34
- }
35
- info("Adding User attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
36
- # Create the user attribute definition
37
- post("#{@api_url}/userProfileAttributeDefinitions", body, headers)
38
- end
39
-
40
- # Add a new space attribute definition.
41
- #
42
- # @param name [String] name of the attribute definition
43
- # @param description [String] description of the attribute definition
44
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
45
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
46
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
47
- def add_space_attribute_definition(name, description, allows_multiple, headers=default_headers)
48
- body = {
49
- "allowsMultiple" => allows_multiple,
50
- "description" => description,
51
- "name" => name
52
- }
53
- info("Adding Space attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
54
- # Create the attribute definition
55
- post("#{@api_url}/spaceAttributeDefinitions", body, headers)
56
- end
57
-
58
- # Add a new datastore form attribute definition.
59
- #
60
- # @param name [String] name of the attribute definition
61
- # @param description [String] description of the attribute definition
62
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
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 add_datastore_form_attribute_definition(name, description, allows_multiple, headers=default_headers)
66
- body = {
67
- "allowsMultiple" => allows_multiple,
68
- "description" => description,
69
- "name" => name
70
- }
71
- info("Adding Datastore Form attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
72
- # Create the attribute definition
73
- post("#{@api_url}/datastoreFormAttributeDefinitions", body, headers)
74
- end
75
-
76
- # Add a new category attribute definition.
77
- #
78
- # @param kapp_slug [String] slug of the kapp where the category exists
79
- # @param name [String] name of the attribute definition
80
- # @param description [String] description of the attribute definition
81
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
82
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
83
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
84
- def add_category_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
85
- body = {
86
- "allowsMultiple" => allows_multiple,
87
- "description" => description,
88
- "name" => name
89
- }
90
- info("Adding Category attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
91
- # Create the attribute definition
92
- post("#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions", body, headers)
93
- end
94
-
95
- # Add a new form attribute definition.
96
- #
97
- # @param kapp_slug [String] slug of the kapp where the form exists
98
- # @param name [String] name of the attribute definition
99
- # @param description [String] description of the attribute definition
100
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
101
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
102
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
103
- def add_form_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
104
- body = {
105
- "allowsMultiple" => allows_multiple,
106
- "description" => description,
107
- "name" => name
108
- }
109
- info("Adding Form attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
110
- # Create the attribute definition
111
- post("#{@api_url}/kapps/#{kapp_slug}/formAttributeDefinitions", body, headers)
112
- end
113
-
114
- # Add a new kapp attribute definition.
115
- #
116
- # @param kapp_slug [String] slug of the kapp
117
- # @param name [String] name of the attribute definition
118
- # @param description [String] description of the attribute definition
119
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
120
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
121
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
122
- def add_kapp_attribute_definition(kapp_slug, name, description, allows_multiple, headers=default_headers)
123
- body = {
124
- "allowsMultiple" => allows_multiple,
125
- "description" => description,
126
- "name" => name
127
- }
128
- info("Adding Kapp attribute definition \"#{name}\" to the \"#{kapp_slug}\" kapp.")
129
- # Create the attribute definition
130
- post("#{@api_url}/kapps/#{kapp_slug}/kappAttributeDefinitions", body, headers)
131
- end
132
-
133
- # Add a new team attribute definition.
134
- #
135
- # @param name [String] name of the attribute definition
136
- # @param description [String] description of the attribute definition
137
- # @param allows_multiple [Boolean] whether the attribute allows multiple values
138
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
139
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
140
- def add_team_attribute_definition(name, description, allows_multiple, headers=default_headers)
141
- body = {
142
- "allowsMultiple" => allows_multiple,
143
- "description" => description,
144
- "name" => name
145
- }
146
- info("Adding Team attribute definition \"#{name}\" to the \"#{space_slug}\" space.")
147
- # Create the team attribute definition
148
- post("#{@api_url}/teamAttributeDefinitions", body, headers)
149
- end
150
-
151
-
152
- end
153
- end
@@ -1,66 +0,0 @@
1
- module KineticSdk
2
- class RequestCe
3
-
4
- # Add a Bridge
5
- #
6
- # @param body [Hash] optional properties associated to the Bridge
7
- # - +name+
8
- # - +status+
9
- # - +url+
10
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
11
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
12
- def add_bridge(body={}, headers=default_headers)
13
- info("Adding the \"#{body['name']}\" Bridge.")
14
- post("#{@api_url}/bridges", body, headers)
15
- end
16
-
17
- # Add a Bridge Model
18
- #
19
- # @param body [Hash] optional properties associated to the Bridge Model
20
- # - +name+
21
- # - +status+
22
- # - +activeMappingName+
23
- # - +attributes+
24
- # - +mappings+
25
- # - +qualifications+
26
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
27
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
28
- def add_bridge_model(body={}, headers=default_headers)
29
- info("Adding the \"#{body['name']}\" Bridge Model and Mappings.")
30
- post("#{@api_url}/models", body, headers)
31
- end
32
-
33
- # Find a list of bridges
34
- #
35
- # @param params [Hash] Query parameters that are added to the URL, such as +include+
36
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
37
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
38
- def find_bridges(params={}, headers=default_headers)
39
- info("Find Bridges.")
40
- get("#{@api_url}/bridges", params, headers)
41
- end
42
-
43
- # Find a bridge
44
- #
45
- # @param name [String] name of the bridge
46
- # @param params [Hash] Query parameters that are added to the URL, such as +include+
47
- # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
48
- # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
49
- def find_bridge(name, params={}, headers=default_headers)
50
- info("Finding the \"#{name}\" Bridge.")
51
- get("#{@api_url}/bridges/#{encode{name}}", params, headers)
52
- end
53
-
54
- # Update a bridge
55
- #
56
- # @param name [String] name of the bridge
57
- # @param body [Hash] properties of the bridge to update
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 update_bridge(name, body={}, headers=default_headers)
61
- info("Updating the \"#{name}\" Bridge.")
62
- put("#{@api_url}/bridges/#{encode(name)}", body, headers)
63
- end
64
-
65
- end
66
- end