kinetic_sdk 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,91 @@
1
+ module KineticSdk
2
+ class Agent
3
+
4
+ # Add Filestore
5
+ #
6
+ # @param space [String] slug of the space
7
+ # @param body [Hash] properties associated to the Filestore
8
+ # - +adapterClass+
9
+ # - +name+
10
+ # - +slug+
11
+ # - +properties+
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_filestore(space, body, headers=default_headers)
15
+ @logger.info("Adding the \"#{body['name']}\" filestore in the \"#{space}\" space.")
16
+ post("#{@api_url}/spaces/#{space}/filestores", body, headers)
17
+ end
18
+
19
+ # Delete a Filestore
20
+ #
21
+ # @param space [String] slug of the space
22
+ # @param slug [String] slug of the Filestore
23
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
24
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
25
+ def delete_filestore(space, slug, headers=default_headers)
26
+ @logger.info("Deleting the \"#{slug}\" filestore in the \"#{space}\" space.")
27
+ delete("#{@api_url}/spaces/#{space}/filestores/#{slug}", headers)
28
+ end
29
+
30
+ # Find a filestore
31
+ #
32
+ # @param space [String] slug of the space
33
+ # @param slug [String] slug of the filestore
34
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
35
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
36
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
37
+ def find_filestore(space, slug, params={}, headers=default_headers)
38
+ @logger.info("Finding the \"#{slug}\" filestore in the \"#{space}\" space.")
39
+ get("#{@api_url}/spaces/#{space}/filestores/#{slug}", params, headers)
40
+ end
41
+
42
+ # Update a filestore
43
+ #
44
+ # @param space [String] slug of the space
45
+ # @param slug [String] slug of the filestore
46
+ # @param body [Hash] properties of the filestore to update
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 update_filestore(space, slug, body={}, headers=default_headers)
50
+ @logger.info("Updating the \"#{slug}\" filestore in the \"#{space}\" space.")
51
+ put("#{@api_url}/spaces/#{space}/filestores/#{slug}", body, headers)
52
+ end
53
+
54
+ # Find all filestores in a space
55
+ #
56
+ # @param space [String] slug of the space
57
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
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 find_filestores(space, params={}, headers=default_headers)
61
+ @logger.info("Find all filestores in the \"#{space}\" space.")
62
+ get("#{@api_url}/spaces/#{space}/filestores", params, headers)
63
+ end
64
+
65
+ # Add Filestore to Space
66
+ #
67
+ # @param space [String] slug of the space
68
+ # @param body [Hash] properties associated to the Filestore
69
+ # - +space+
70
+ # - +adapterClass+
71
+ # - +slug+
72
+ # - +properties+
73
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
74
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
75
+ def add_space_filestore(body, headers=default_headers)
76
+ @logger.info("Adding the \"#{body['name']}\" filestore in the \"#{body['space']}\" space.")
77
+ post("#{@api_url}/filestores", body, headers)
78
+ end
79
+
80
+ # Find all filestores in the system
81
+ #
82
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
83
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
84
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
85
+ def find_all_filestores(params={}, headers=default_headers)
86
+ @logger.info("Find all filestores.")
87
+ get("#{@api_url}/filestores", params, headers)
88
+ end
89
+
90
+ end
91
+ end
@@ -0,0 +1,91 @@
1
+ module KineticSdk
2
+ class Agent
3
+
4
+ # Add Handler
5
+ #
6
+ # @param space [String] slug of the space
7
+ # @param body [Hash] properties associated to the Handler
8
+ # - +adapterClass+
9
+ # - +name+
10
+ # - +slug+
11
+ # - +properties+
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_handler(space, body, headers=default_headers)
15
+ @logger.info("Adding the \"#{body['name']}\" handler in the \"#{space}\" space.")
16
+ post("#{@api_url}/spaces/#{space}/handlers", body, headers)
17
+ end
18
+
19
+ # Delete a Handler
20
+ #
21
+ # @param space [String] slug of the space
22
+ # @param slug [String] slug of the Handler
23
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
24
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
25
+ def delete_handler(space, slug, headers=default_headers)
26
+ @logger.info("Deleting the \"#{slug}\" handler in the \"#{space}\" space.")
27
+ delete("#{@api_url}/spaces/#{space}/handlers/#{slug}", headers)
28
+ end
29
+
30
+ # Find a handler
31
+ #
32
+ # @param space [String] slug of the space
33
+ # @param slug [String] slug of the handler
34
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
35
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
36
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
37
+ def find_handler(space, slug, params={}, headers=default_headers)
38
+ @logger.info("Finding the \"#{slug}\" handler in the \"#{space}\" space.")
39
+ get("#{@api_url}/spaces/#{space}/handlers/#{slug}", params, headers)
40
+ end
41
+
42
+ # Update a handler
43
+ #
44
+ # @param space [String] slug of the space
45
+ # @param slug [String] slug of the handler
46
+ # @param body [Hash] properties of the handler to update
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 update_handler(space, slug, body={}, headers=default_headers)
50
+ @logger.info("Updating the \"#{slug}\" handler in the \"#{space}\" space.")
51
+ put("#{@api_url}/spaces/#{space}/handlers/#{slug}", body, headers)
52
+ end
53
+
54
+ # Find all handlers in a space
55
+ #
56
+ # @param space [String] slug of the space
57
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
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 find_handlers(space, params={}, headers=default_headers)
61
+ @logger.info("Find all handlers in the \"#{space}\" space.")
62
+ get("#{@api_url}/spaces/#{space}/handlers", params, headers)
63
+ end
64
+
65
+ # Add Handler to Space
66
+ #
67
+ # @param space [String] slug of the space
68
+ # @param body [Hash] properties associated to the Handler
69
+ # - +space+
70
+ # - +definitionId+
71
+ # - +slug+
72
+ # - +properties+
73
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
74
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
75
+ def add_space_handler(body, headers=default_headers)
76
+ @logger.info("Adding the \"#{body['name']}\" handler in the \"#{body['space']}\" space.")
77
+ post("#{@api_url}/handlers", body, headers)
78
+ end
79
+
80
+ # Find all handlers in the system
81
+ #
82
+ # @param params [Hash] Query parameters that are added to the URL, such as +include+
83
+ # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
84
+ # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
85
+ def find_all_handlers(params={}, headers=default_headers)
86
+ @logger.info("Find all handlers.")
87
+ get("#{@api_url}/handlers", params, headers)
88
+ end
89
+
90
+ end
91
+ end
@@ -10,7 +10,7 @@ module KineticSdk
10
10
  # Include the KineticHttpUtils module
11
11
  include KineticSdk::Utils::KineticHttpUtils
12
12
 
13
- attr_reader :api_url, :username, :options, :password, :server, :version
13
+ attr_reader :api_url, :username, :options, :password, :server, :version, :logger
14
14
 
15
15
  # Initalize the BridgeHub SDK with the web server URL and configuration user
16
16
  # credentials, along with any custom option values.
@@ -28,8 +28,11 @@ module KineticSdk
28
28
  # @option opts [String] :password the password for the user
29
29
  # @option opts [Hash<Symbol, Object>] :options ({}) optional settings
30
30
  #
31
- # * :log_level (String) (_defaults to: off_) level of logging - off | info | debug | trace
32
- # * :max_redirects (Fixnum) (_defaults to: 10_) maximum number of redirects to follow
31
+ # * :gateway_retry_limit (FixNum) (_defaults to: 5_) max number of times to retry a bad gateway
32
+ # * :gateway_retry_delay (Float) (_defaults to: 1.0_) number of seconds to delay before retrying a bad gateway
33
+ # * :log_level (String) (_defaults to: off_) level of logging - off | error | warn | info | debug
34
+ # * :log_output (String) (_defaults to: STDOUT_) where to send output - STDOUT | STDERR
35
+ # * :max_redirects (Fixnum) (_defaults to: 5_) maximum number of redirects to follow
33
36
  # * :ssl_ca_file (String) full path to PEM certificate used to verify the server
34
37
  # * :ssl_verify_mode (String) (_defaults to: none_) - none | peer
35
38
  #
@@ -69,6 +72,11 @@ module KineticSdk
69
72
 
70
73
  # process any individual options
71
74
  @options = options.delete(:options) || {}
75
+ # setup logging
76
+ log_level = @options[:log_level] || @options["log_level"]
77
+ log_output = @options[:log_output] || @options["log_output"]
78
+ @logger = KineticSdk::Utils::KLogger.new(log_level, log_output)
79
+
72
80
  @username = options[:username]
73
81
  @password = options[:password]
74
82
  @server = options[:app_server_url].chomp('/')
@@ -11,7 +11,7 @@ module KineticSdk
11
11
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
12
12
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
13
13
  def add_access_key(slug, payload, headers=default_headers)
14
- info("Adding Access Key for Bridge \"#{slug}\"")
14
+ @logger.info("Adding Access Key for Bridge \"#{slug}\"")
15
15
  post("#{@api_url}/bridges/#{slug}/access-keys", payload, headers)
16
16
  end
17
17
 
@@ -22,7 +22,7 @@ module KineticSdk
22
22
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
23
23
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
24
24
  def delete_access_key(slug, id, headers=default_headers)
25
- info("Deleting Access Key #{id} for Bridge \"#{slug}\"")
25
+ @logger.info("Deleting Access Key #{id} for Bridge \"#{slug}\"")
26
26
  delete("#{@api_url}/bridges/#{slug}/access-keys/#{id}", headers)
27
27
  end
28
28
 
@@ -33,7 +33,7 @@ module KineticSdk
33
33
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
34
34
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
35
35
  def find_access_keys(slug, params={}, headers=default_headers)
36
- info("Finding Access Keys for Bridge \"#{slug}\"")
36
+ @logger.info("Finding Access Keys for Bridge \"#{slug}\"")
37
37
  get("#{@api_url}/bridges/#{slug}/access-keys", params, headers)
38
38
  end
39
39
 
@@ -45,7 +45,7 @@ module KineticSdk
45
45
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
46
46
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
47
47
  def find_access_key(slug, id, params={}, headers=default_headers)
48
- info("Finding Access Key \"#{id}\" for Bridge \"#{slug}\"")
48
+ @logger.info("Finding Access Key \"#{id}\" for Bridge \"#{slug}\"")
49
49
  get("#{@api_url}/bridges/#{slug}/access-keys/#{id}", params, headers)
50
50
  end
51
51
 
@@ -59,7 +59,7 @@ module KineticSdk
59
59
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
60
60
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
61
61
  def update_access_key(slug, id, payload, headers=default_headers)
62
- info("Updating Access Key \"#{id}\" for Bridge \"#{slug}\"")
62
+ @logger.info("Updating Access Key \"#{id}\" for Bridge \"#{slug}\"")
63
63
  put("#{@api_url}/bridges/#{slug}/access-keys/#{id}", payload, headers)
64
64
  end
65
65
 
@@ -13,7 +13,7 @@ module KineticSdk
13
13
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
14
14
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
15
15
  def add_bridge(payload, headers=default_headers)
16
- info("Adding Bridge \"#{payload['name']}\" with slug \"#{payload['slug']}\"")
16
+ @logger.info("Adding Bridge \"#{payload['name']}\" with slug \"#{payload['slug']}\"")
17
17
  post("#{@api_url}/bridges", payload, headers)
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ module KineticSdk
23
23
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
24
24
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
25
25
  def delete_bridge(slug, headers=default_headers)
26
- info("Deleting Bridge \"#{slug}\"")
26
+ @logger.info("Deleting Bridge \"#{slug}\"")
27
27
  delete("#{@api_url}/bridges/#{slug}", headers)
28
28
  end
29
29
 
@@ -33,7 +33,7 @@ module KineticSdk
33
33
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
34
34
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
35
35
  def find_bridges(params={}, headers=default_headers)
36
- info("Finding Bridges")
36
+ @logger.info("Finding Bridges")
37
37
  get("#{@api_url}/bridges", params, headers)
38
38
  end
39
39
 
@@ -44,7 +44,7 @@ module KineticSdk
44
44
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
45
45
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
46
46
  def find_bridge(slug, params={}, headers=default_headers)
47
- info("Finding Bridge \"#{slug}\"")
47
+ @logger.info("Finding Bridge \"#{slug}\"")
48
48
  get("#{@api_url}/bridges/#{slug}", params, headers)
49
49
  end
50
50
 
@@ -61,7 +61,7 @@ module KineticSdk
61
61
  # @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
62
62
  # @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
63
63
  def update_bridge(slug, payload, headers=default_headers)
64
- info("Updating Bridge \"#{slug}\"")
64
+ @logger.info("Updating Bridge \"#{slug}\"")
65
65
  put("#{@api_url}/bridges/#{slug}", payload, headers)
66
66
  end
67
67
 
@@ -2,31 +2,35 @@ Dir[File.join(File.dirname(File.expand_path(__FILE__)), "lib", "**", "*.rb")].ea
2
2
 
3
3
  module KineticSdk
4
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.
5
+ # Core is a Ruby class that acts as a wrapper for the Core REST API without
6
+ # having to make explicit HTTP requests.
7
7
  #
8
- class RequestCe
8
+ class Core
9
9
 
10
10
  # Include the KineticHttpUtils module
11
11
  include KineticSdk::Utils::KineticHttpUtils
12
12
 
13
- attr_reader :api_url, :username, :options, :password, :space_slug, :server, :version
13
+ # Include the KineticExportUtils module
14
+ include KineticSdk::Utils::KineticExportUtils
14
15
 
15
- # Initalize the Request CE SDK with the web server URL, the space user
16
+ attr_reader :api_url, :username, :options, :password, :proxy_url,
17
+ :space_slug, :server, :version, :logger
18
+
19
+ # Initalize the Core SDK with the web server URL, the space user
16
20
  # username and password, along with any custom option values.
17
21
  #
18
- # @param [Hash<Symbol, Object>] opts Kinetic Request CE properties
22
+ # @param [Hash<Symbol, Object>] opts Kinetic Core properties
19
23
  # @option opts [String] :config_file optional - path to the YAML configuration file
20
24
  #
21
- # * Ex: /opt/config/request-ce-configuration1.yaml
25
+ # * Ex: /opt/config/core-configuration1.yaml
22
26
  #
23
- # @option opts [String] :app_server_url the URL to the Kinetic Request CE web application
27
+ # @option opts [String] :app_server_url the URL to the Kinetic Core web application
24
28
  #
25
29
  # * Must not be used when `:space_server_url` is also used.
26
30
  # * If space_slug is provided, it will be appended to the URL as a path parameter
27
31
  # * Ex: <http://192.168.0.1:8080/kinetic>
28
32
  #
29
- # @option opts [String] :space_server_url the URL to the Kinetic Request CE space
33
+ # @option opts [String] :space_server_url the URL to the Kinetic Core space
30
34
  #
31
35
  # * Must not be used when `app_server_url` is used
32
36
  # * Typically used when using a proxy server that supports space slugs as subdomains
@@ -44,20 +48,23 @@ module KineticSdk
44
48
  # @option opts [String] :password the password for the user
45
49
  # @option opts [Hash<Symbol, Object>] :options ({}) optional settings
46
50
  #
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
51
+ # * :gateway_retry_limit (FixNum) (_defaults to: 5_) max number of times to retry a bad gateway
52
+ # * :gateway_retry_delay (Float) (_defaults to: 1.0_) number of seconds to delay before retrying a bad gateway
53
+ # * :log_level (String) (_defaults to: off_) level of logging - off | error | warn | info | debug
54
+ # * :log_output (String) (_defaults to: STDOUT_) where to send output - STDOUT | STDERR
55
+ # * :max_redirects (Fixnum) (_defaults to: 5_) maximum number of redirects to follow
49
56
  # * :ssl_ca_file (String) full path to PEM certificate used to verify the server
50
57
  # * :ssl_verify_mode (String) (_defaults to: none_) - none | peer
51
58
  #
52
59
  # Example: using a configuration file
53
60
  #
54
- # KineticSdk::RequestCe.new({
61
+ # KineticSdk::Core.new({
55
62
  # config_file: "/opt/config1.yaml"
56
63
  # })
57
64
  #
58
65
  # Example: space user properties hash
59
66
  #
60
- # KineticSdk::RequestCe.new({
67
+ # KineticSdk::Core.new({
61
68
  # app_server_url: "http://localhost:8080/kinetic",
62
69
  # space_slug: "foo",
63
70
  # username: "space-user-1",
@@ -71,7 +78,7 @@ module KineticSdk
71
78
  #
72
79
  # Example: system user properties hash
73
80
  #
74
- # KineticSdk::RequestCe.new({
81
+ # KineticSdk::Core.new({
75
82
  # app_server_url: "http://localhost:8080/kinetic",
76
83
  # username: "admin",
77
84
  # password: "password",
@@ -88,7 +95,7 @@ module KineticSdk
88
95
  # #
89
96
  # # app_server_url: https://myapp.io
90
97
  #
91
- # KineticSdk::RequestCe.new({
98
+ # KineticSdk::Core.new({
92
99
  # space_server_url: "https://myapp.io/foo",
93
100
  # space_slug: "foo",
94
101
  # username: "space-user-1",
@@ -106,7 +113,7 @@ module KineticSdk
106
113
  # #
107
114
  # # Ex: https://myapp.io/foo
108
115
  #
109
- # KineticSdk::RequestCe.new({
116
+ # KineticSdk::Core.new({
110
117
  # space_server_url: "https://foo.myapp.io",
111
118
  # space_slug: "foo",
112
119
  # username: "space-user-1",
@@ -135,16 +142,23 @@ module KineticSdk
135
142
 
136
143
  # process any individual options
137
144
  @options = options.delete(:options) || {}
145
+ # setup logging
146
+ log_level = @options[:log_level] || @options["log_level"]
147
+ log_output = @options[:log_output] || @options["log_output"]
148
+ @logger = KineticSdk::Utils::KLogger.new(log_level, log_output)
149
+
138
150
  @username = options[:username]
139
151
  @password = options[:password]
140
152
  @space_slug = options[:space_slug]
141
153
  if options[:app_server_url]
142
154
  @server = options[:app_server_url].chomp('/')
143
155
  @api_url = @server + (@space_slug.nil? ? "/app/api/v1" : "/#{@space_slug}/app/api/v1")
156
+ @proxy_url = @space_slug.nil? ? nil : "#{@server}/#{@space_slug}/app/components"
144
157
  else
145
158
  raise StandardError.new "The :space_slug option is required when using the :space_server_url option" if @space_slug.nil?
146
159
  @server = options[:space_server_url].chomp('/')
147
160
  @api_url = "#{@server}/app/api/v1"
161
+ @proxy_url = "#{@server}/app/components"
148
162
  end
149
163
  @version = 1
150
164
  end