kinetic_sdk 5.0.27 → 5.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +24 -0
- data/gems/mime-types-3.6.0/Code-of-Conduct.md +128 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/History.md +18 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/README.rdoc +2 -1
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Rakefile +1 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/type.rb +68 -43
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/container.rb +2 -2
- data/gems/mime-types-3.6.0/lib/mime/types/deprecations.rb +56 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/loader.rb +1 -1
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/registry.rb +6 -4
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_type.rb +37 -33
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types.rb +11 -16
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_class.rb +3 -3
- data/gems/{mime-types-data-3.2024.0305/History.md → mime-types-data-3.2025.0107/CHANGELOG.md} +242 -180
- data/gems/mime-types-data-3.2025.0107/CODE_OF_CONDUCT.md +128 -0
- data/gems/{mime-types-data-3.2024.0305/Contributing.md → mime-types-data-3.2025.0107/CONTRIBUTING.md} +39 -133
- data/gems/mime-types-data-3.2025.0107/CONTRIBUTORS.md +52 -0
- data/gems/{mime-types-data-3.2024.0305/Licence.md → mime-types-data-3.2025.0107/LICENCE.md} +1 -1
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/Manifest.txt +6 -17
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/README.md +30 -30
- data/gems/mime-types-data-3.2025.0107/Rakefile +88 -0
- data/gems/mime-types-data-3.2025.0107/SECURITY.md +7 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/content_type_mime.db +4 -3
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/ext_mime.db +4 -3
- data/gems/mime-types-data-3.2025.0107/data/mime-types.json +1 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.content_type.column +71 -5
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.docs.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.encoding.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.flags.column +70 -4
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.friendly.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.pext.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.use_instead.column +69 -3
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.xrefs.column +132 -66
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/lib/mime/types/data.rb +1 -1
- data/lib/kinetic_sdk/core/lib/jwt.rb +1 -1
- data/lib/kinetic_sdk/core/lib/space.rb +17 -8
- data/lib/kinetic_sdk/integrator/integrator-sdk.rb +140 -0
- data/lib/kinetic_sdk/integrator/lib/connections.rb +82 -0
- data/lib/kinetic_sdk/integrator/lib/metadata.rb +31 -0
- data/lib/kinetic_sdk/integrator/lib/operations.rb +102 -0
- data/lib/kinetic_sdk/utils/kinetic-http.rb +20 -20
- data/lib/kinetic_sdk/version.rb +1 -1
- data/lib/kinetic_sdk.rb +3 -2
- metadata +59 -66
- data/gems/mime-types-3.5.2/Code-of-Conduct.md +0 -73
- data/gems/mime-types-3.5.2/lib/mime/types/deprecations.rb +0 -36
- data/gems/mime-types-data-3.2024.0305/Code-of-Conduct.md +0 -75
- data/gems/mime-types-data-3.2024.0305/Rakefile +0 -170
- data/gems/mime-types-data-3.2024.0305/data/mime-types.json +0 -1
- data/gems/mime-types-data-3.2024.0305/types/application.yaml +0 -18611
- data/gems/mime-types-data-3.2024.0305/types/audio.yaml +0 -1740
- data/gems/mime-types-data-3.2024.0305/types/chemical.yaml +0 -71
- data/gems/mime-types-data-3.2024.0305/types/conference.yaml +0 -9
- data/gems/mime-types-data-3.2024.0305/types/drawing.yaml +0 -15
- data/gems/mime-types-data-3.2024.0305/types/font.yaml +0 -65
- data/gems/mime-types-data-3.2024.0305/types/image.yaml +0 -1316
- data/gems/mime-types-data-3.2024.0305/types/message.yaml +0 -241
- data/gems/mime-types-data-3.2024.0305/types/model.yaml +0 -450
- data/gems/mime-types-data-3.2024.0305/types/multipart.yaml +0 -179
- data/gems/mime-types-data-3.2024.0305/types/text.yaml +0 -1257
- data/gems/mime-types-data-3.2024.0305/types/video.yaml +0 -1156
- data/gems/mime-types-data-3.2024.0305/types/world.yaml +0 -8
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Contributing.md +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Licence.md +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Manifest.txt +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/type/columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/_columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/cache.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/full.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/logger.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime-types.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/bad-fixtures/malformed +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/json.json +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/old-data +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/yaml.yaml +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/minitest_helper.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_cache.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_lazy.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_loader.rb +0 -0
- /data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/lib/mime-types-data.rb +0 -0
@@ -39,7 +39,7 @@ module KineticSdk
|
|
39
39
|
|
40
40
|
if response.status == 401
|
41
41
|
raise StandardError.new "#{response.message}: #{response.content["error"]}"
|
42
|
-
elsif response.status == 302
|
42
|
+
elsif response.status == 302 || response.status == 303
|
43
43
|
location = response.headers["location"]
|
44
44
|
if location.nil?
|
45
45
|
raise StandardError.new "Unable to retrieve code: #{response.inspect}"
|
@@ -109,9 +109,12 @@ module KineticSdk
|
|
109
109
|
# space workflows
|
110
110
|
space_workflows = find_space_workflows({ "include" => "details" }, headers).content["workflows"] || []
|
111
111
|
space_workflows.select { |wf| !wf["event"].nil? }.each do |workflow|
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
evt = workflow["event"].to_s.slugify
|
113
|
+
name = workflow["name"].to_s.slugify
|
114
|
+
if evt.empty? || name.empty?
|
115
|
+
raise "Some workflows are currently in an orphaned or missing state. You can open the Workflows tab for the space in the space console, and run the repair to attempt to resolve this issue."
|
116
|
+
end
|
117
|
+
@logger.info(workflow)
|
115
118
|
filename = "#{File.join(@options[:export_directory], "space", "workflows", evt, name)}.json"
|
116
119
|
workflow_json = find_space_workflow(workflow["id"], {}, headers).content["treeJson"]
|
117
120
|
write_object_to_file(filename, workflow_json)
|
@@ -123,8 +126,11 @@ module KineticSdk
|
|
123
126
|
space_content["kapps"].each do |kapp|
|
124
127
|
kapp_workflows = find_kapp_workflows(kapp["slug"], {}, headers).content["workflows"] || []
|
125
128
|
kapp_workflows.select { |wf| !wf["event"].nil? }.each do |workflow|
|
126
|
-
evt = workflow["event"].slugify
|
127
|
-
name = workflow["name"].slugify
|
129
|
+
evt = workflow["event"].to_s.slugify
|
130
|
+
name = workflow["name"].to_s.slugify
|
131
|
+
if evt.empty? || name.empty?
|
132
|
+
raise "Some workflows are currently in an orphaned or missing state. You can open the Workflows tab for the #{kapp["name"]} kapp in the space console, and run the repair to attempt to resolve this issue."
|
133
|
+
end
|
128
134
|
filename = "#{File.join(@options[:export_directory], "space", "kapps", kapp["slug"], "workflows", evt, name)}.json"
|
129
135
|
workflow_json = find_kapp_workflow(kapp["slug"], workflow["id"], {}, headers).content["treeJson"]
|
130
136
|
write_object_to_file(filename, workflow_json)
|
@@ -134,8 +140,11 @@ module KineticSdk
|
|
134
140
|
kapp["forms"].each do |form|
|
135
141
|
form_workflows = find_form_workflows(kapp["slug"], form["slug"], {}, headers).content["workflows"] || []
|
136
142
|
form_workflows.select { |wf| !wf["event"].nil? }.each do |workflow|
|
137
|
-
evt = workflow["event"].slugify
|
138
|
-
name = workflow["name"].slugify
|
143
|
+
evt = workflow["event"].to_s.slugify
|
144
|
+
name = workflow["name"].to_s.slugify
|
145
|
+
if evt.empty? || name.empty?
|
146
|
+
raise "Some workflows are currently in an orphaned or missing state. You can open the Workflows tab for the #{kapp["name"]} > #{form["name"]} form in the space console, and run the repair to attempt to resolve this issue."
|
147
|
+
end
|
139
148
|
filename = "#{File.join(@options[:export_directory], "space", "kapps", kapp["slug"], "forms", form["slug"], "workflows", evt, name)}.json"
|
140
149
|
workflow_json = find_form_workflow(kapp["slug"], form["slug"], workflow["id"], {}, headers).content["treeJson"]
|
141
150
|
write_object_to_file(filename, workflow_json)
|
@@ -314,7 +323,7 @@ module KineticSdk
|
|
314
323
|
@logger.info("Find space workflows")
|
315
324
|
get("#{@api_url}/workflows", params, headers)
|
316
325
|
end
|
317
|
-
|
326
|
+
|
318
327
|
|
319
328
|
# Find a space workflow
|
320
329
|
#
|
@@ -0,0 +1,140 @@
|
|
1
|
+
Dir[File.join(File.dirname(File.expand_path(__FILE__)), "lib", "**", "*.rb")].each { |file| require file }
|
2
|
+
|
3
|
+
module KineticSdk
|
4
|
+
|
5
|
+
# Integrator is a Ruby class that acts as a wrapper for the Kinetic Integrator REST API
|
6
|
+
# without having to make explicit HTTP requests.
|
7
|
+
#
|
8
|
+
class Integrator
|
9
|
+
|
10
|
+
# Include the KineticHttpUtils module
|
11
|
+
include KineticSdk::Utils::KineticHttpUtils
|
12
|
+
|
13
|
+
attr_reader :api_url, :username, :jwt, :options, :space_slug,
|
14
|
+
:server, :version, :logger
|
15
|
+
|
16
|
+
# Initalize the Integrator SDK with the web server URL and configuration user
|
17
|
+
# credentials, along with any custom option values.
|
18
|
+
#
|
19
|
+
# @param opts [Hash] Kinetic Integrator properties
|
20
|
+
# @option opts [String] :config_file optional - path to the YAML configuration file
|
21
|
+
#
|
22
|
+
# * Ex: /opt/config/integrator-configuration1.yaml
|
23
|
+
#
|
24
|
+
# @option opts [String] :app_server_url the URL to the integrator server
|
25
|
+
# @option opts [String] :space_server_url the URL to the Kinetic Request CE web space
|
26
|
+
#
|
27
|
+
# * Ex: <http://192.168.0.1:8080/kinetic/acme> - space slug (`acme`)
|
28
|
+
# * Ex: <http://acme.server.io/kinetic> - space slug (`acme`) as subdomain
|
29
|
+
#
|
30
|
+
# @option opts [String] :space_slug the slug that identifies the Space
|
31
|
+
# @option opts [String] :username the username for the user
|
32
|
+
# @option opts [String] :password the password for the user
|
33
|
+
# @option opts [Hash<Symbol, Object>] :options ({}) optional settings
|
34
|
+
#
|
35
|
+
# * :export_directory (String) (_example: /opt/exports/integrator) directory to write files when exporting,
|
36
|
+
# * :gateway_retry_limit (FixNum) (_defaults to: 5_) max number of times to retry a bad gateway
|
37
|
+
# * :gateway_retry_delay (Float) (_defaults to: 1.0_) number of seconds to delay before retrying a bad gateway
|
38
|
+
# * :log_level (String) (_defaults to: off_) level of logging - off | error | warn | info | debug
|
39
|
+
# * :log_output (String) (_defaults to: STDOUT_) where to send output - STDOUT | STDERR
|
40
|
+
# * :max_redirects (Fixnum) (_defaults to: 5_) maximum number of redirects to follow
|
41
|
+
# * :oauth_client_id (String) id of the Kinetic Core oauth client
|
42
|
+
# * :oauth_client_secret (String) secret of the Kinetic Core oauth client
|
43
|
+
# * :ssl_ca_file (String) full path to PEM certificate used to verify the server
|
44
|
+
# * :ssl_verify_mode (String) (_defaults to: none_) - none | peer
|
45
|
+
#
|
46
|
+
# Example: using a configuration file
|
47
|
+
#
|
48
|
+
# KineticSdk::Integrator.new({
|
49
|
+
# config_file: "/opt/config1.yaml"
|
50
|
+
# })
|
51
|
+
#
|
52
|
+
# Example: space user properties hash
|
53
|
+
#
|
54
|
+
# KineticSdk::Integrator.new({
|
55
|
+
# space_server_url: "https://my-space.domain",
|
56
|
+
# space_slug: "my-space",
|
57
|
+
# username: "admin",
|
58
|
+
# password: "password",
|
59
|
+
# options: {
|
60
|
+
# log_level: "debug",
|
61
|
+
# oauth_client_id: "my-oauth-user-id",
|
62
|
+
# oauth_client_secret: "my-oauth-user-secret",
|
63
|
+
# ssl_verify_mode: "peer",
|
64
|
+
# ssl_ca_file: "/usr/local/self_signing_ca.pem"
|
65
|
+
# }
|
66
|
+
# })
|
67
|
+
#
|
68
|
+
# If the +config_file+ option is present, it will be loaded first, and any additional
|
69
|
+
# options will overwrite any values in the config file
|
70
|
+
#
|
71
|
+
def initialize(opts)
|
72
|
+
# initialize any variables
|
73
|
+
options = {}
|
74
|
+
|
75
|
+
# process the configuration file if it was provided
|
76
|
+
unless opts[:config_file].nil?
|
77
|
+
options.merge!(YAML::load_file opts[:config_file])
|
78
|
+
end
|
79
|
+
|
80
|
+
# process the configuration hash if it was provided
|
81
|
+
options.merge!(opts)
|
82
|
+
|
83
|
+
# allow one of :app_server_url, :space_server_url, or :integrator_server_url
|
84
|
+
# but not more than one
|
85
|
+
if options[:app_server_url] && options[:space_server_url]
|
86
|
+
raise StandardError.new "Expecting either :app_server_url or :space_server_url, but not both."
|
87
|
+
end
|
88
|
+
|
89
|
+
if options[:app_server_url].nil? && options[:space_server_url].nil?
|
90
|
+
raise StandardError.new "Expecting either :app_server_url or :space_server_url."
|
91
|
+
end
|
92
|
+
|
93
|
+
# process any individual options
|
94
|
+
@options = options[:options] || {}
|
95
|
+
# setup logging
|
96
|
+
log_level = @options[:log_level] || @options["log_level"]
|
97
|
+
log_output = @options[:log_output] || @options["log_output"]
|
98
|
+
@logger = KineticSdk::Utils::KLogger.new(log_level, log_output)
|
99
|
+
|
100
|
+
@username = options[:username]
|
101
|
+
@space_slug = options[:space_slug]
|
102
|
+
|
103
|
+
if options[:app_server_url]
|
104
|
+
@server = options[:app_server_url].chomp("/")
|
105
|
+
@api_url = "#{@server}/api"
|
106
|
+
else
|
107
|
+
raise StandardError.new "The :space_slug option is required when using the :space_server_url option" if @space_slug.nil?
|
108
|
+
@server = options[:space_server_url].chomp("/")
|
109
|
+
@api_url = "#{@server}/app/integrator/api"
|
110
|
+
end
|
111
|
+
@jwt = @space_slug.nil? ? nil : generate_jwt(options)
|
112
|
+
@version = 1
|
113
|
+
end
|
114
|
+
|
115
|
+
# Generate a JWT for bearer authentication based on the user credentials,
|
116
|
+
# and oauth client configuration.
|
117
|
+
def generate_jwt(options = {})
|
118
|
+
oauth_client_id = options[:options][:oauth_client_id]
|
119
|
+
oauth_client_secret = options[:options][:oauth_client_secret]
|
120
|
+
jwt_response = kinetic_core_sdk(options).jwt_token(oauth_client_id, oauth_client_secret)
|
121
|
+
jwt_response.content["access_token"]
|
122
|
+
end
|
123
|
+
|
124
|
+
# Creates a reference to the Kinetic Request CE SDK
|
125
|
+
def kinetic_core_sdk(options)
|
126
|
+
kinetic_core_options = {
|
127
|
+
space_slug: options[:space_slug],
|
128
|
+
username: options[:username],
|
129
|
+
password: options[:password],
|
130
|
+
options: options[:options] || {},
|
131
|
+
}
|
132
|
+
if options[:app_server_url]
|
133
|
+
kinetic_core_options[:app_server_url] = options[:app_server_url]
|
134
|
+
else
|
135
|
+
kinetic_core_options[:space_server_url] = options[:space_server_url]
|
136
|
+
end
|
137
|
+
KineticSdk::Core.new(kinetic_core_options)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module KineticSdk
|
2
|
+
class Integrator
|
3
|
+
|
4
|
+
# Add a Connection
|
5
|
+
#
|
6
|
+
# @param properties [Hash] connection properties
|
7
|
+
# - +type+ [String]
|
8
|
+
# - +name+ [String]
|
9
|
+
# - +config+ [Hash]
|
10
|
+
# - +baseUrl+ [String] url to the server hosting the connection API
|
11
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
12
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
13
|
+
def add_connection(properties={}, headers=default_jwt_headers)
|
14
|
+
@logger.info("Adding the #{properties['type']} connection named #{properties['name']}")
|
15
|
+
post("#{@api_url}/connections", properties, headers)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Delete a connection
|
19
|
+
#
|
20
|
+
# @param connection_id [String] id of the connection
|
21
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication
|
22
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
23
|
+
def delete_connection(connection_id, headers=default_jwt_headers)
|
24
|
+
@logger.info("Deleting Connection \"#{connection_id}\"")
|
25
|
+
delete("#{@api_url}/connections/#{connection_id}", headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Find Connections
|
29
|
+
#
|
30
|
+
# @param params [Hash] Query parameters that are added to the URL
|
31
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
32
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
33
|
+
def find_connections(params={}, headers=default_jwt_headers)
|
34
|
+
@logger.info("Finding Connections")
|
35
|
+
get("#{@api_url}/connections", params, headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Find a Connection
|
39
|
+
#
|
40
|
+
# @param connection_id [String] id of the Connection
|
41
|
+
# @param params [Hash] Query parameters that are added to the URL
|
42
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
43
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
44
|
+
def find_connection(connection_id, params={}, headers=default_jwt_headers)
|
45
|
+
@logger.info("Finding Connection \"#{connection_id}\"")
|
46
|
+
get("#{@api_url}/connections/#{connection_id}", params, headers)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update a Connection
|
50
|
+
#
|
51
|
+
# @param connection_id [String] id of the Connection
|
52
|
+
# @param properties [Hash] form properties to update
|
53
|
+
# - +name+ [String]
|
54
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
55
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
56
|
+
def update_connection(connection_id, properties={}, headers=default_jwt_headers)
|
57
|
+
@logger.info("Updating Connection \"#{connection_id}\"")
|
58
|
+
put("#{@api_url}/connections/#{connection_id}", properties, headers)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Test an unsaved Connection
|
62
|
+
#
|
63
|
+
# @param properties [Hash] connection properties to test
|
64
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
65
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
66
|
+
def test_unsaved_connection(properties={}, headers=default_jwt_headers)
|
67
|
+
@logger.info("Testing unsaved connection")
|
68
|
+
post("#{@api_url}/test", properties, headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Test a saved Connection
|
72
|
+
#
|
73
|
+
# @param connection_id [String] id of the Connection
|
74
|
+
# @param properties [Hash] connection properties to test
|
75
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
76
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
77
|
+
def test_saved_connection(connection_id, properties={}, headers=default_jwt_headers)
|
78
|
+
@logger.info("Testing saved connection: #{connection_id}")
|
79
|
+
post("#{@api_url}/connections/#{connection_id}/test", properties, headers)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module KineticSdk
|
2
|
+
class Integrator
|
3
|
+
|
4
|
+
# Retrieve Integrator application version
|
5
|
+
#
|
6
|
+
# @param headers [Hash] hash of headers to send, default is accept JSON content type
|
7
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
8
|
+
def app_version(headers=header_accept_json)
|
9
|
+
@logger.info("Retrieving Integrator version.")
|
10
|
+
get("#{@api_url}/version", {}, headers)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Check Integrator health
|
14
|
+
#
|
15
|
+
# @param headers [Hash] hash of headers to send, default is accept JSON content type
|
16
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
17
|
+
def health(headers=header_accept_json)
|
18
|
+
@logger.info("Retrieving Integrator health.")
|
19
|
+
get("#{@api_url}/healthz", {}, headers)
|
20
|
+
end
|
21
|
+
|
22
|
+
# OpenApi Specification
|
23
|
+
#
|
24
|
+
# @param headers [Hash] hash of headers to send, default is accept JSON content type
|
25
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
26
|
+
def oas(headers=header_accept_json)
|
27
|
+
@logger.info("Retrieving OpenAPI Specification.")
|
28
|
+
get("#{@api_url}/oas", {}, headers)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module KineticSdk
|
2
|
+
class Integrator
|
3
|
+
|
4
|
+
# Add an Operation
|
5
|
+
#
|
6
|
+
# @param connection_id [String] id of the Connection
|
7
|
+
# @param properties [Hash] operation properties
|
8
|
+
# - +name+ [String]
|
9
|
+
# - +type+ [String]
|
10
|
+
# - +name+ [String]
|
11
|
+
# - +config+ [Hash]
|
12
|
+
# - +baseUrl+ [String] url to the server hosting the connection API
|
13
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
14
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
15
|
+
def add_operation(connection_id, properties={}, headers=default_jwt_headers)
|
16
|
+
@logger.info("Adding the #{properties['name']} operation")
|
17
|
+
@logger.info("Operation properties: #{properties.inspect}")
|
18
|
+
post("#{@api_url}/connections/#{connection_id}/operations", properties, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Delete an operation
|
22
|
+
#
|
23
|
+
# @param connection_id [String] id of the connection the operation belongs to
|
24
|
+
# @param operation_id [String] id of the operation
|
25
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication
|
26
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
27
|
+
def delete_operation(connection_id, operation_id, headers=default_jwt_headers)
|
28
|
+
@logger.info("Deleting Operation \"#{operation_id}\"")
|
29
|
+
delete("#{@api_url}/connections/#{connection_id}/operations/#{operation_id}", headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Find Operations for a Connection
|
33
|
+
#
|
34
|
+
# @param connection_id [String] id of the connection the operation belongs to
|
35
|
+
# @param params [Hash] Query parameters that are added to the URL
|
36
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
37
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
38
|
+
def find_operations(connection_id, params={}, headers=default_jwt_headers)
|
39
|
+
@logger.info("Finding Operations")
|
40
|
+
get("#{@api_url}/connections/#{connection_id}/operations", params, headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Find an Operation
|
44
|
+
#
|
45
|
+
# @param connection_id [String] id of the Connection
|
46
|
+
# @param operation_id [String] id of the Operation
|
47
|
+
# @param params [Hash] Query parameters that are added to the URL
|
48
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
49
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
50
|
+
def find_operation(connection_id, operation_id, params={}, headers=default_jwt_headers)
|
51
|
+
@logger.info("Finding Operation \"#{operation_id}\"")
|
52
|
+
get("#{@api_url}/connections/#{connection_id}/operations/#{operation_id}", params, headers)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Update an Operation
|
56
|
+
#
|
57
|
+
# @param connection_id [String] id of the Connection
|
58
|
+
# @param operation_id [String] id of the Operation
|
59
|
+
# @param properties [Hash] form properties to update
|
60
|
+
# - +name+ [String]
|
61
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
62
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
63
|
+
def update_operation(connection_id, operation_id, properties={}, headers=default_jwt_headers)
|
64
|
+
@logger.info("Updating Operation \"#{operation_id}\"")
|
65
|
+
put("#{@api_url}/connections/#{connection_id}/operations/#{operation_id}", properties, headers)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Execute an Operation
|
69
|
+
#
|
70
|
+
# @param connection_id [String] id of the Connection
|
71
|
+
# @param operation_id [String] id of the Operation
|
72
|
+
# @param parameters [Hash] operation execution parameters
|
73
|
+
# @param debug [boolean] execute in debug mode
|
74
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
75
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
76
|
+
def execute_operation(connection_id, operation_id, parameters={}, debug=false, headers=default_jwt_headers)
|
77
|
+
@logger.info("Executing operation #{operation_id}")
|
78
|
+
payload = {
|
79
|
+
"connectionId" => connection_id,
|
80
|
+
"operationId" => operation_id,
|
81
|
+
"parameters" => parameters
|
82
|
+
}
|
83
|
+
url = "#{@api_url}/execute"
|
84
|
+
url = "#{url}?debug=true" if debug
|
85
|
+
post(url, payload, headers)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Inspect an Operation
|
89
|
+
#
|
90
|
+
# @param operation_id [String] id of the Operation
|
91
|
+
# @param headers [Hash] hash of headers to send, default is bearer authentication and accept JSON content type
|
92
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
93
|
+
def inspect_operation(operation_id, headers=default_jwt_headers)
|
94
|
+
@logger.info("Inspecting operation #{operation_id}")
|
95
|
+
payload = {
|
96
|
+
"operationId" => operation_id
|
97
|
+
}
|
98
|
+
url = "#{@api_url}/inspect"
|
99
|
+
post(url, payload, headers)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -15,14 +15,14 @@ module KineticSdk
|
|
15
15
|
# A utilities module that can be used by multiple libraries.
|
16
16
|
module Utils
|
17
17
|
|
18
|
-
# The KineticHttpUtils module provides common HTTP methods, and returns a
|
19
|
-
# {KineticSdk::Utils::KineticHttpResponse} object with all methods. The raw
|
20
|
-
# Net::HTTPResponse is available by calling the
|
18
|
+
# The KineticHttpUtils module provides common HTTP methods, and returns a
|
19
|
+
# {KineticSdk::Utils::KineticHttpResponse} object with all methods. The raw
|
20
|
+
# Net::HTTPResponse is available by calling the
|
21
21
|
# {KineticSdk::Utils::KineticHttpResponse#response} method.
|
22
22
|
module KineticHttpUtils
|
23
23
|
|
24
24
|
# Send an HTTP DELETE request
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# @param url [String] url to send the request to
|
27
27
|
# @param headers [Hash] hash of headers to send
|
28
28
|
# @param http_options [Hash] hash of http options
|
@@ -95,7 +95,7 @@ module KineticSdk
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# Send an HTTP GET request
|
98
|
-
#
|
98
|
+
#
|
99
99
|
# @param url [String] url to send the request to
|
100
100
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
101
101
|
# @param headers [Hash] hash of headers to send
|
@@ -171,7 +171,7 @@ module KineticSdk
|
|
171
171
|
end
|
172
172
|
|
173
173
|
# Send an HTTP HEAD request
|
174
|
-
#
|
174
|
+
#
|
175
175
|
# @param url [String] url to send the request to
|
176
176
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
177
177
|
# @param headers [Hash] hash of headers to send
|
@@ -246,7 +246,7 @@ module KineticSdk
|
|
246
246
|
end
|
247
247
|
|
248
248
|
# Send an HTTP PATCH request
|
249
|
-
#
|
249
|
+
#
|
250
250
|
# @param url [String] url to send the request to
|
251
251
|
# @param data [Hash] the payload to send with the request
|
252
252
|
# @param headers [Hash] hash of headers to send
|
@@ -322,7 +322,7 @@ module KineticSdk
|
|
322
322
|
end
|
323
323
|
|
324
324
|
# Send an HTTP POST request
|
325
|
-
#
|
325
|
+
#
|
326
326
|
# @param url [String] url to send the request to
|
327
327
|
# @param data [Hash] the payload to send with the request
|
328
328
|
# @param headers [Hash] hash of headers to send
|
@@ -398,7 +398,7 @@ module KineticSdk
|
|
398
398
|
end
|
399
399
|
|
400
400
|
# Send a Multipart HTTP POST request
|
401
|
-
#
|
401
|
+
#
|
402
402
|
# @param url [String] url to send the request to
|
403
403
|
# @param data [Hash] payload to send with the request
|
404
404
|
# @param headers [Hash] hash of headers to send
|
@@ -422,7 +422,7 @@ module KineticSdk
|
|
422
422
|
uri = URI.parse(url)
|
423
423
|
|
424
424
|
# prepare the payload
|
425
|
-
payload = data.inject({}) do |h,(k,v)|
|
425
|
+
payload = data.inject({}) do |h,(k,v)|
|
426
426
|
if v.class == File
|
427
427
|
h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))
|
428
428
|
elsif v.class == Array
|
@@ -490,7 +490,7 @@ module KineticSdk
|
|
490
490
|
end
|
491
491
|
|
492
492
|
# Send an HTTP PUT request
|
493
|
-
#
|
493
|
+
#
|
494
494
|
# @param url [String] url to send the request to
|
495
495
|
# @param data [Hash] payload to send with the request
|
496
496
|
# @param headers [Hash] hash of headers to send
|
@@ -566,7 +566,7 @@ module KineticSdk
|
|
566
566
|
end
|
567
567
|
|
568
568
|
# Determine the final redirect location
|
569
|
-
#
|
569
|
+
#
|
570
570
|
# @param url [String] url to send the request to
|
571
571
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
572
572
|
# @param headers [Hash] hash of headers to send
|
@@ -624,7 +624,7 @@ module KineticSdk
|
|
624
624
|
#
|
625
625
|
# Streams the download to limit memory consumption. The user account
|
626
626
|
# utilizing the SDK must have write access to the file path.
|
627
|
-
#
|
627
|
+
#
|
628
628
|
# @param url [String] url to send the request to
|
629
629
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
630
630
|
# @param headers [Hash] hash of headers to send
|
@@ -637,12 +637,12 @@ module KineticSdk
|
|
637
637
|
url = redirect_url(url, params, headers, http_options)
|
638
638
|
# parse the URL
|
639
639
|
uri = URI.parse(url)
|
640
|
-
|
640
|
+
|
641
641
|
@logger.debug("Streaming Download #{uri} #{headers.inspect}")
|
642
|
-
|
642
|
+
|
643
643
|
# build the http object
|
644
644
|
http = build_http(uri)
|
645
|
-
|
645
|
+
|
646
646
|
# prepare the download
|
647
647
|
file = nil
|
648
648
|
file_name = File.basename(file_path)
|
@@ -683,13 +683,13 @@ module KineticSdk
|
|
683
683
|
end
|
684
684
|
|
685
685
|
# Determines the mime-type of a file
|
686
|
-
#
|
686
|
+
#
|
687
687
|
# @param file [File | String] file or filename to detect
|
688
688
|
# @return [Array] MIME::Type of the file
|
689
689
|
def mimetype(file)
|
690
690
|
mime_type = MIME::Types.type_for(file.class == File ? File.basename(file) : file)
|
691
691
|
if mime_type.size == 0
|
692
|
-
mime_type = MIME::Types['text/plain']
|
692
|
+
mime_type = MIME::Types['text/plain']
|
693
693
|
end
|
694
694
|
mime_type
|
695
695
|
end
|
@@ -715,7 +715,7 @@ module KineticSdk
|
|
715
715
|
# The maximum number of times to retry on a bad gateway response.
|
716
716
|
#
|
717
717
|
# Can be passed in as an option when initializing the SDK
|
718
|
-
# with either the @options[:gateway_retry_limit] or
|
718
|
+
# with either the @options[:gateway_retry_limit] or
|
719
719
|
# @options['gateway_retry_limit'] key.
|
720
720
|
#
|
721
721
|
# Expects an integer [Fixnum] value. Setting to -1 will disable retries on
|
@@ -735,7 +735,7 @@ module KineticSdk
|
|
735
735
|
# a bad gateway response is encountered.
|
736
736
|
#
|
737
737
|
# Can be passed in as an option when initializing the SDK
|
738
|
-
# with either the @options[:gateway_retry_delay] or
|
738
|
+
# with either the @options[:gateway_retry_delay] or
|
739
739
|
# @options['gateway_retry_delay'] key.
|
740
740
|
#
|
741
741
|
# Expects a double [Float] value.
|
data/lib/kinetic_sdk/version.rb
CHANGED
data/lib/kinetic_sdk.rb
CHANGED
@@ -8,10 +8,10 @@ gemdir = File.expand_path(File.join(pwd, '..', 'gems'))
|
|
8
8
|
|
9
9
|
# add gem directories to load path if gem is not installed
|
10
10
|
if Gem::Specification.find_all_by_name('mime-types').empty?
|
11
|
-
$:.unshift File.join(gemdir, 'mime-types-3.
|
11
|
+
$:.unshift File.join(gemdir, 'mime-types-3.6.0', 'lib')
|
12
12
|
end
|
13
13
|
if Gem::Specification.find_all_by_name('mime-types-data').empty?
|
14
|
-
$:.unshift File.join(gemdir, 'mime-types-data-3.
|
14
|
+
$:.unshift File.join(gemdir, 'mime-types-data-3.2025.0107', 'lib')
|
15
15
|
end
|
16
16
|
if Gem::Specification.find_all_by_name('multipart-post').empty?
|
17
17
|
$:.unshift File.join(gemdir, 'multipart-post-2.0.0', 'lib')
|
@@ -37,4 +37,5 @@ require File.join(pwd, "kinetic_sdk/bridgehub/bridgehub-sdk")
|
|
37
37
|
require File.join(pwd, "kinetic_sdk/core/core-sdk")
|
38
38
|
require File.join(pwd, "kinetic_sdk/discussions/discussions-sdk")
|
39
39
|
require File.join(pwd, "kinetic_sdk/filehub/filehub-sdk")
|
40
|
+
require File.join(pwd, "kinetic_sdk/integrator/integrator-sdk")
|
40
41
|
require File.join(pwd, "kinetic_sdk/task/task-sdk")
|