kinetic_sdk 5.0.11 → 5.0.16
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +121 -32
- data/lib/kinetic_sdk/agent/lib/bridges.rb +0 -1
- data/lib/kinetic_sdk/agent/lib/filestores.rb +0 -1
- data/lib/kinetic_sdk/agent/lib/handler.rb +0 -1
- data/lib/kinetic_sdk/core/lib/datastore_submissions.rb +55 -6
- data/lib/kinetic_sdk/core/lib/form_types.rb +59 -2
- data/lib/kinetic_sdk/core/lib/platform_components.rb +0 -1
- data/lib/kinetic_sdk/core/lib/submissions.rb +66 -8
- data/lib/kinetic_sdk/core/lib/teams.rb +12 -1
- data/lib/kinetic_sdk/core/lib/webapis.rb +144 -0
- data/lib/kinetic_sdk/core/lib/webhooks.rb +1 -1
- data/lib/kinetic_sdk/task/lib/sources.rb +1 -1
- data/lib/kinetic_sdk/utils/kinetic-http.rb +10 -9
- data/lib/kinetic_sdk/version.rb +1 -1
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c47badd8ed04ccf211a8cd82d6e5fe60df261b66323b41388a8577b3579ca3
|
4
|
+
data.tar.gz: 6799c8a84e1d8cdc973b20075111e255ce69ab16826bf337deeb189ef2166508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f87e5b71ebd1486dfcb78df8245864d6e7f71d4ea928bffd537e3f97509d33a7746fc21eace5fd62b9df0310a3429bd11968e55347f0584565157965c4f843
|
7
|
+
data.tar.gz: 034e6e1b682572da124be0c758ba8289e290b953dac8217944442e8a3e6a2c904fc116d5499c458b9bbf993251e353f0b48196cdff61de46973c6447a1a1ff89
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,128 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [5.0.16](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.9) (2021-02-25)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Implmented ability to remove user from a team
|
8
|
+
|
9
|
+
## [5.0.15](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.15) (2021-01-20)
|
10
|
+
|
11
|
+
**Implemented enhancements:**
|
12
|
+
|
13
|
+
- Bug Fixes
|
14
|
+
|
15
|
+
## [5.0.14](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.14) (2021-01-15)
|
16
|
+
|
17
|
+
**Implemented enhancements:**
|
18
|
+
|
19
|
+
- Support for submitting attachments (datastore and form submissions)
|
20
|
+
- Bug Fixes
|
21
|
+
|
22
|
+
## [5.0.13](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.13) (2020-09-03)
|
23
|
+
|
24
|
+
**Implemented enhancements:**
|
25
|
+
|
26
|
+
- Added missing Form Type methods.
|
27
|
+
- Deprecated some Form Type methods and replaced with simpler names.
|
28
|
+
- Removed an unnecessary logging statement when adding a team attribute.
|
29
|
+
- Removed double URL encoding when deleting a webhook from a Kapp.
|
30
|
+
|
31
|
+
## [5.0.12](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.12) (2020-08-27)
|
32
|
+
|
33
|
+
**Implemented enhancements:**
|
34
|
+
|
35
|
+
- Implemented webapi APIs
|
36
|
+
|
37
|
+
## [5.0.11](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.11) (2020-08-24)
|
38
|
+
|
39
|
+
**Implemented enhancements:**
|
40
|
+
|
41
|
+
- Allow spaces in filenames when exporting items. Spaces were removed in 5.0.10, but they are valid in Windows so allowing them if they exist.
|
42
|
+
|
43
|
+
## [5.0.10](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.10) (2020-08-24)
|
44
|
+
|
45
|
+
**Implemented enhancements:**
|
46
|
+
|
47
|
+
- Changed how filenames are stored when items are exported to be compatible with Windows.
|
48
|
+
|
49
|
+
## [5.0.9](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.9) (2020-06-29)
|
50
|
+
|
51
|
+
**Implemented enhancements:**
|
52
|
+
|
53
|
+
- Bug fixes
|
54
|
+
|
55
|
+
## [5.0.8](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.8) (2020-06-11)
|
56
|
+
|
57
|
+
**Implemented enhancements:**
|
58
|
+
|
59
|
+
- Bug fixes
|
60
|
+
|
61
|
+
## [5.0.7](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.7) (2020-05-15)
|
62
|
+
|
63
|
+
**Implemented enhancements:**
|
64
|
+
|
65
|
+
- Bug fixes
|
66
|
+
|
67
|
+
## [5.0.6](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.6) (2020-04-24)
|
68
|
+
|
69
|
+
**Implemented enhancements:**
|
70
|
+
|
71
|
+
- Bug fixes
|
72
|
+
|
73
|
+
## [5.0.5](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/5.0.5) (2020-04-24)
|
74
|
+
|
75
|
+
**Implemented enhancements:**
|
76
|
+
|
77
|
+
- Bug fixes
|
78
|
+
|
79
|
+
## [5.0.4](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.4) (2020-02-12)
|
80
|
+
|
81
|
+
**Implemented enhancements:**
|
82
|
+
|
83
|
+
- Implemented platform components APIs
|
84
|
+
|
85
|
+
## [5.0.3](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.3) (2020-01-17)
|
86
|
+
|
87
|
+
**Implemented enhancements:**
|
88
|
+
|
89
|
+
- Implemented task engine configuration APIs
|
90
|
+
|
91
|
+
## [5.0.2](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.2) (2020-01-10)
|
92
|
+
|
93
|
+
**Implemented enhancements:**
|
94
|
+
|
95
|
+
- Fixed bug with jetching JWT regarding redirects
|
96
|
+
|
97
|
+
## [5.0.1](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.1) (2020-01-10)
|
98
|
+
|
99
|
+
**Implemented enhancements:**
|
100
|
+
|
101
|
+
- Implemented Task System error API
|
102
|
+
- Fixed typo in Discussions component
|
103
|
+
|
104
|
+
## [5.0.0](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.0) (2019-12-19)
|
105
|
+
|
106
|
+
### **1.x to 5.x Upgrade Warning**
|
107
|
+
|
108
|
+
All platform components (Core, Task, Agent, Discussions...etc) should be running a 5.x release or greater.
|
109
|
+
Unintended behavior is possible if running 5.x of the SDK against any platform component < 5.x.
|
110
|
+
|
111
|
+
## [1.0.2](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/1.0.2) (2019-12-18)
|
112
|
+
|
113
|
+
**Implemented enhancements:**
|
114
|
+
|
115
|
+
- Bug fixes
|
116
|
+
|
117
|
+
## [1.0.1](https://github.com/kineticdata/kinetic-sdk-rb/releases/tag/1.0.1) (2019-12-17)
|
118
|
+
|
119
|
+
**Implemented enhancements:**
|
120
|
+
|
121
|
+
- Bug fixes
|
122
|
+
|
3
123
|
## [1.0.0](https://github.com/kineticdata/kinetic-sdk-rb/tree/1.0.0) (2019-06-13)
|
4
124
|
|
5
|
-
**
|
125
|
+
### **0.x to 1.x Upgrade Warning**
|
6
126
|
|
7
127
|
Export methods have been updated to reflect the folder structure
|
8
128
|
of their respective API routes.
|
@@ -39,34 +159,3 @@ sdk.logger.info("foo")
|
|
39
159
|
- Gateway errors (HTTP codes [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502), [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503), and [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504)) will automatically be retried, and may be controlled by the following options:
|
40
160
|
- :gateway_retry_limit (default 5), set to -1 to disable retrying gateway errors
|
41
161
|
- :gateway_retry_delay (default 1.0)
|
42
|
-
|
43
|
-
## [5.0.0](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.0) (2019-12-19)
|
44
|
-
|
45
|
-
** 1.x to 5.x Upgrade Warning **
|
46
|
-
All platform components (Core, Task, Agent, Discussions...etc) should be running a 5.x release or greater.
|
47
|
-
Unintended behavior is possible if running 5.x of the SDK against any platform component < 5.x.
|
48
|
-
|
49
|
-
## [5.0.1](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.1) (2020-01-10)
|
50
|
-
|
51
|
-
**Implemented enhancements:**
|
52
|
-
|
53
|
-
- Implemented Task System error API
|
54
|
-
- Fixed typo in Discussions component
|
55
|
-
|
56
|
-
## [5.0.2](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.2) (2020-01-10)
|
57
|
-
|
58
|
-
**Implemented enhancements:**
|
59
|
-
|
60
|
-
- Fixed bug with jetching JWT regarding redirects
|
61
|
-
|
62
|
-
## [5.0.3](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.3) (2020-01-17)
|
63
|
-
|
64
|
-
**Implemented enhancements:**
|
65
|
-
|
66
|
-
- Implmented task engine configuration APIs
|
67
|
-
|
68
|
-
## [5.0.4](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.4) (2020-02-12)
|
69
|
-
|
70
|
-
**Implemented enhancements:**
|
71
|
-
|
72
|
-
- Implmented platform components APIs
|
@@ -8,15 +8,16 @@ module KineticSdk
|
|
8
8
|
# - +origin+ - Origin ID of the submission to be added
|
9
9
|
# - +parent+ - Parent ID of the submission to be added
|
10
10
|
# - +values+ - hash of field values for the submission
|
11
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
11
12
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
12
13
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
13
14
|
def add_datastore_submission(form_slug, payload={}, headers=default_headers)
|
14
|
-
# initialize "values" if nil
|
15
|
-
payload["values"] = {} if payload["values"].nil?
|
16
15
|
# set origin hash if origin was passed as a string
|
17
16
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
18
17
|
# set parent hash if parent was passed as a string
|
19
18
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
19
|
+
# prepare any attachment values
|
20
|
+
payload["values"] = prepare_new_datastore_submission_values(form_slug, payload["values"])
|
20
21
|
# Create the submission
|
21
22
|
@logger.info("Adding a submission in the \"#{form_slug}\" Datastore Form.")
|
22
23
|
post("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
|
@@ -30,15 +31,16 @@ module KineticSdk
|
|
30
31
|
# - +origin+ - Origin ID of the submission to be added
|
31
32
|
# - +parent+ - Parent ID of the submission to be added
|
32
33
|
# - +values+ - hash of field values for the submission
|
34
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
33
35
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
34
36
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
35
37
|
def add_datastore_submission_page(form_slug, page_name, payload={}, headers=default_headers)
|
36
|
-
# initialize "values" if nil
|
37
|
-
payload["values"] = {} if payload["values"].nil?
|
38
38
|
# set origin hash if origin was passed as a string
|
39
39
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
40
40
|
# set parent hash if parent was passed as a string
|
41
41
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
42
|
+
# prepare any attachment values
|
43
|
+
payload["values"] = prepare_new_datastore_submission_values(form_slug, payload["values"])
|
42
44
|
# Create the submission
|
43
45
|
@logger.info("Adding a submission page in the \"#{form_slug}\" Datastore Form.")
|
44
46
|
post("#{@api_url}/datastore/forms/#{form_slug}/submissions?page=#{encode(page_name)}", payload, headers)
|
@@ -51,22 +53,47 @@ module KineticSdk
|
|
51
53
|
# - +origin+ - Origin ID of the submission to be patched
|
52
54
|
# - +parent+ - Parent ID of the submission to be patched
|
53
55
|
# - +values+ - hash of field values for the submission
|
56
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
54
57
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
55
58
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
56
59
|
def patch_datastore_submission(form_slug, payload={}, headers=default_headers)
|
57
60
|
# set the currentPage hash if currentPage was passed as a string
|
58
61
|
payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
|
59
|
-
# initialize "values" if nil
|
60
|
-
payload["values"] = {} if payload["values"].nil?
|
61
62
|
# set origin hash if origin was passed as a string
|
62
63
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
63
64
|
# set parent hash if parent was passed as a string
|
64
65
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
66
|
+
# prepare any attachment values
|
67
|
+
payload["values"] = prepare_new_datastore_submission_values(form_slug, payload["values"])
|
65
68
|
# Create the submission
|
66
69
|
@logger.info("Patching a submission in the \"#{form_slug}\" Form.")
|
67
70
|
patch("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
|
68
71
|
end
|
69
72
|
|
73
|
+
# Patch an existing Datastore Submission
|
74
|
+
#
|
75
|
+
# @param submission_id [String] id of the Submission
|
76
|
+
# @param payload [Hash] payload of the submission
|
77
|
+
# - +origin+ - Origin ID of the submission to be patched
|
78
|
+
# - +parent+ - Parent ID of the submission to be patched
|
79
|
+
# - +values+ - hash of field values for the submission
|
80
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
81
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
82
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
83
|
+
def patch_existing_datastore_submission(submission_id, payload={}, headers=default_headers)
|
84
|
+
# set the currentPage hash if currentPage was passed as a string
|
85
|
+
payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
|
86
|
+
# set origin hash if origin was passed as a string
|
87
|
+
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
88
|
+
# set parent hash if parent was passed as a string
|
89
|
+
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
90
|
+
# prepare any attachment values
|
91
|
+
payload["values"] = prepare_updated_datastore_submission_values(submission_id, payload["values"])
|
92
|
+
# Update the submission
|
93
|
+
@logger.info("Patching a submission with id \"#{submission_id}\"")
|
94
|
+
patch("#{@api_url}/datastore/submissions/#{submission_id}", payload, headers)
|
95
|
+
end
|
96
|
+
|
70
97
|
# Find all Submissions for a Datastore Form.
|
71
98
|
#
|
72
99
|
# This method will process pages of form submissions and internally
|
@@ -164,5 +191,27 @@ module KineticSdk
|
|
164
191
|
delete("#{@api_url}/datastore/submissions/#{encode(submission_id)}", headers)
|
165
192
|
end
|
166
193
|
|
194
|
+
private
|
195
|
+
|
196
|
+
# Prepares new datastore submission values for attachment fields
|
197
|
+
#
|
198
|
+
# @param form_slug [String] datastore form slug
|
199
|
+
# @param values [Hash] hash of values being submitted
|
200
|
+
# @return [Hash] hash of values with attachment paths replaced with uploaded file information
|
201
|
+
def prepare_new_datastore_submission_values(form_slug, values)
|
202
|
+
file_upload_url = "#{@api_url.gsub('/api/v1','')}/datastore/forms/#{form_slug}/files"
|
203
|
+
prepare_submission_values(values, file_upload_url)
|
204
|
+
end
|
205
|
+
|
206
|
+
# Prepares updated datastore submission values for attachment fields
|
207
|
+
#
|
208
|
+
# @param submission_id [String] id of the Submission
|
209
|
+
# @param values [Hash] hash of values being submitted
|
210
|
+
# @return [Hash] hash of values with attachment paths replaced with uploaded file information
|
211
|
+
def prepare_updated_datastore_submission_values(submission_id, values)
|
212
|
+
file_upload_url = "#{@api_url.gsub('/api/v1','')}/datastore/submissions/#{submission_id}/files"
|
213
|
+
prepare_submission_values(values, file_upload_url)
|
214
|
+
end
|
215
|
+
|
167
216
|
end
|
168
217
|
end
|
@@ -2,6 +2,7 @@ module KineticSdk
|
|
2
2
|
class Core
|
3
3
|
|
4
4
|
# Add a form type on a Kapp
|
5
|
+
# The method is being depreciated and replaced with add_formtype
|
5
6
|
#
|
6
7
|
# @param kapp_slug [String] slug of the Kapp the form type belongs to
|
7
8
|
# @param body [Hash] form type properties
|
@@ -14,7 +15,30 @@ module KineticSdk
|
|
14
15
|
post("#{@api_url}/kapps/#{kapp_slug}/formTypes", body, headers)
|
15
16
|
end
|
16
17
|
|
18
|
+
alias :add_formtype :add_form_type_on_kapp
|
19
|
+
|
20
|
+
def add_form_type_on_kapp(kapp_slug, body, headers=default_headers)
|
21
|
+
logger.info "Deprecation Warning: add_form_type_on_kapp method will be removed in a future version. Please use #add_formtype"
|
22
|
+
add_formtype(kapp_slug, body, headers=default_headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
# Update a form type on a Kapp
|
27
|
+
#
|
28
|
+
# @param kapp_slug [String] slug of the Kapp the form type belongs to
|
29
|
+
# @param name [String] name of the form type
|
30
|
+
# @param body [Hash] form type properties
|
31
|
+
# - +name+ - A descriptive name for the form type
|
32
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
33
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
34
|
+
def update_formtype(kapp_slug, name, body, headers=default_headers)
|
35
|
+
raise StandardError.new "Form Type properties is not valid, must be a Hash." unless body.is_a? Hash
|
36
|
+
@logger.info("Updating Form Type \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
|
37
|
+
put("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", body, headers)
|
38
|
+
end
|
39
|
+
|
17
40
|
# Delete a form type on a Kapp
|
41
|
+
# The method is being depreciated and replaced with delete_formtype
|
18
42
|
#
|
19
43
|
# @param kapp_slug [String] slug of the Kapp the form type belongs to
|
20
44
|
# @param name [String] name of the form type
|
@@ -24,19 +48,46 @@ module KineticSdk
|
|
24
48
|
@logger.info("Deleting form type \"#{name}\" from \"#{kapp_slug}\" kapp")
|
25
49
|
delete("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", headers)
|
26
50
|
end
|
51
|
+
|
52
|
+
alias :delete_formtype :delete_form_type
|
53
|
+
|
54
|
+
def delete_form_type(kapp_slug, name, headers=default_headers)
|
55
|
+
logger.info "Deprecation Warning: delete_form_type method will be removed in a future version. Please use #delete_formtype"
|
56
|
+
delete_formtype(kapp_slug, name, headers=default_headers)
|
57
|
+
end
|
27
58
|
|
28
59
|
# Delete all form types on a Kapp
|
60
|
+
# The method is being depreciated and replaced with delete_formtypes
|
29
61
|
#
|
30
62
|
# @param kapp_slug [String] slug of the Kapp the form types belongs to
|
31
63
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
32
64
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
33
65
|
def delete_form_types_on_kapp(kapp_slug, headers=default_headers)
|
34
|
-
(
|
35
|
-
|
66
|
+
(find_formtypes(kapp_slug, {}, headers).content["formTypes"] || []).each do |form_type|
|
67
|
+
delete_formtype(kapp_slug, form_type['name'], headers)
|
36
68
|
end
|
37
69
|
end
|
70
|
+
|
71
|
+
alias :delete_formtypes :delete_form_types_on_kapp
|
72
|
+
|
73
|
+
def delete_form_types_on_kapp(kapp_slug, headers=default_headers)
|
74
|
+
logger.info "Deprecation Warning: delete_form_types_on_kapp method will be removed in a future version. Please use #delete_formtypes"
|
75
|
+
delete_formtypes(kapp_slug, headers=default_headers)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Retrieve a single form types for a Kapp
|
79
|
+
#
|
80
|
+
# @param kapp_slug [String] slug of the Kapp the form types belongs to
|
81
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
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 find_formtype(kapp_slug, name, params={}, headers=default_headers)
|
85
|
+
@logger.info("Finding the #{name}Form Type for \"#{kapp_slug}\" kapp")
|
86
|
+
get("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", params, headers)
|
87
|
+
end
|
38
88
|
|
39
89
|
# Retrieve a list of all form types for a Kapp
|
90
|
+
# The method is being depreciated and replaced with find_formtypes
|
40
91
|
#
|
41
92
|
# @param kapp_slug [String] slug of the Kapp the form types belongs to
|
42
93
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
@@ -46,6 +97,12 @@ module KineticSdk
|
|
46
97
|
@logger.info("Finding Form Types for \"#{kapp_slug}\" kapp")
|
47
98
|
get("#{@api_url}/kapps/#{kapp_slug}/formTypes", params, headers)
|
48
99
|
end
|
100
|
+
|
101
|
+
alias :find_formtypes :find_form_types_on_kapp
|
49
102
|
|
103
|
+
def find_form_types_on_kapp(kapp_slug, params={}, headers=default_headers)
|
104
|
+
logger.info "Deprecation Warning: find_form_types_on_kapp method will be removed in a future version. Please use #find_formtypes"
|
105
|
+
find_formtypes(kapp_slug, params={}, headers=default_headers)
|
106
|
+
end
|
50
107
|
end
|
51
108
|
end
|
@@ -79,7 +79,6 @@ module KineticSdk
|
|
79
79
|
# Delete Agent Component
|
80
80
|
#
|
81
81
|
# @param agent_slug [String] the slug of the agent to retrieve
|
82
|
-
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
83
82
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
84
83
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
85
84
|
def delete_agent_component(agent_slug, headers = default_headers)
|
@@ -9,18 +9,19 @@ module KineticSdk
|
|
9
9
|
# - +origin+ - Origin ID of the submission to be added
|
10
10
|
# - +parent+ - Parent ID of the submission to be added
|
11
11
|
# - +values+ - hash of field values for the submission
|
12
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
12
13
|
# @param parameters [Hash] hash of query parameters to append to the URL
|
13
14
|
# - +include+ - comma-separated list of properties to include in the response
|
14
15
|
# - +completed+ - signals that the submission should be completed, default is false
|
15
16
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
16
17
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
17
18
|
def add_submission(kapp_slug, form_slug, payload={}, parameters={}, headers=default_headers)
|
18
|
-
# initialize "values" if nil
|
19
|
-
payload["values"] = {} if payload["values"].nil?
|
20
19
|
# set origin hash if origin was passed as a string
|
21
20
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
22
21
|
# set parent hash if parent was passed as a string
|
23
22
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
23
|
+
# prepare any attachment values
|
24
|
+
payload["values"] = prepare_new_submission_values(kapp_slug, form_slug, payload["values"])
|
24
25
|
# build the uri with the encoded parameters
|
25
26
|
uri = URI.parse("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions")
|
26
27
|
uri.query = URI.encode_www_form(parameters) unless parameters.empty?
|
@@ -38,6 +39,7 @@ module KineticSdk
|
|
38
39
|
# - +origin+ - Origin ID of the submission to be added
|
39
40
|
# - +parent+ - Parent ID of the submission to be added
|
40
41
|
# - +values+ - hash of field values for the submission
|
42
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
41
43
|
# @param parameters [Hash] hash of query parameters to append to the URL
|
42
44
|
# - +include+ - comma-separated list of properties to include in the response
|
43
45
|
# - +staged+ - Indicates whether field validations and page advancement should occur, default is false
|
@@ -45,12 +47,12 @@ module KineticSdk
|
|
45
47
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
46
48
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
47
49
|
def add_submission_page(kapp_slug, form_slug, page_name, payload={}, parameters={}, headers=default_headers)
|
48
|
-
# initialize "values" if nil
|
49
|
-
payload["values"] = {} if payload["values"].nil?
|
50
50
|
# set origin hash if origin was passed as a string
|
51
51
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
52
52
|
# set parent hash if parent was passed as a string
|
53
53
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
54
|
+
# prepare any attachment values
|
55
|
+
payload["values"] = prepare_new_submission_values(kapp_slug, form_slug, payload["values"])
|
54
56
|
# add the page name to the parameters
|
55
57
|
parameters["page"] = page_name
|
56
58
|
# build the uri with the encoded parameters
|
@@ -69,17 +71,18 @@ module KineticSdk
|
|
69
71
|
# - +origin+ - Origin ID of the submission to be patched
|
70
72
|
# - +parent+ - Parent ID of the submission to be patched
|
71
73
|
# - +values+ - hash of field values for the submission
|
74
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
72
75
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
73
76
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
74
77
|
def patch_new_submission(kapp_slug, form_slug, payload={}, headers=default_headers)
|
75
78
|
# set the currentPage hash if currentPage was passed as a string
|
76
79
|
payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
|
77
|
-
# initialize "values" if nil
|
78
|
-
payload["values"] = {} if payload["values"].nil?
|
79
80
|
# set origin hash if origin was passed as a string
|
80
81
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
81
82
|
# set parent hash if parent was passed as a string
|
82
83
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
84
|
+
# prepare any attachment values
|
85
|
+
payload["values"] = prepare_new_submission_values(kapp_slug, form_slug, payload["values"])
|
83
86
|
# Create the submission
|
84
87
|
@logger.info("Patching a submission in the \"#{form_slug}\" Form.")
|
85
88
|
patch("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/submissions", payload, headers)
|
@@ -92,17 +95,18 @@ module KineticSdk
|
|
92
95
|
# - +origin+ - Origin ID of the submission to be patched
|
93
96
|
# - +parent+ - Parent ID of the submission to be patched
|
94
97
|
# - +values+ - hash of field values for the submission
|
98
|
+
# - attachment fields contain an Array of Hashes. Each hash represents an attachment answer for the field. The hash must include a `path` property with a value to represent the local file location.)
|
95
99
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
96
100
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
97
101
|
def patch_existing_submission(submission_id, payload={}, headers=default_headers)
|
98
102
|
# set the currentPage hash if currentPage was passed as a string
|
99
103
|
payload["currentPage"] = { "name" => payload["currentPage"] } if payload["currentPage"].is_a? String
|
100
|
-
# initialize "values" if nil
|
101
|
-
payload["values"] = {} if payload["values"].nil?
|
102
104
|
# set origin hash if origin was passed as a string
|
103
105
|
payload["origin"] = { "id" => payload["origin"] } if payload["origin"].is_a? String
|
104
106
|
# set parent hash if parent was passed as a string
|
105
107
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
108
|
+
# prepare any attachment values
|
109
|
+
payload["values"] = prepare_updated_submission_values(submission_id, payload["values"])
|
106
110
|
# Create the submission
|
107
111
|
@logger.info("Patching a submission with id \"#{submission_id}\"")
|
108
112
|
patch("#{@api_url}/submissions/#{submission_id}", payload, headers)
|
@@ -211,5 +215,59 @@ module KineticSdk
|
|
211
215
|
put("#{@api_url}/submissions/#{encode(submission_id)}", body, headers)
|
212
216
|
end
|
213
217
|
|
218
|
+
private
|
219
|
+
|
220
|
+
# Prepares new submission values for attachment fields
|
221
|
+
#
|
222
|
+
# @param kapp_slug [String] kapp slug
|
223
|
+
# @param form_slug [String] form slug
|
224
|
+
# @param values [Hash] hash of values being submitted
|
225
|
+
# @return [Hash] hash of values with attachment paths replaced with uploaded file information
|
226
|
+
def prepare_new_submission_values(kapp_slug, form_slug, values)
|
227
|
+
file_upload_url = "#{@api_url.gsub('/app/api/v1','')}/#{kapp_slug}/#{form_slug}/files"
|
228
|
+
prepare_submission_values(values, file_upload_url)
|
229
|
+
end
|
230
|
+
|
231
|
+
# Prepares updated submission values for attachment fields
|
232
|
+
#
|
233
|
+
# @param submission_id [String] id of the Submission
|
234
|
+
# @param values [Hash] hash of values being submitted
|
235
|
+
# @return [Hash] hash of values with attachment paths replaced with uploaded file information
|
236
|
+
def prepare_updated_submission_values(submission_id, values)
|
237
|
+
file_upload_url = "#{@api_url.gsub('/app/api/v1','')}/submissions/#{submission_id}/files"
|
238
|
+
prepare_submission_values(values, file_upload_url)
|
239
|
+
end
|
240
|
+
|
241
|
+
# Prepares submission values for attachment fields
|
242
|
+
#
|
243
|
+
# @param values [Hash] hash of values being submitted
|
244
|
+
# @param file_upload_url [String] url to post attachments
|
245
|
+
# @return [Hash] hash of values with attachment paths replaced with uploaded file information
|
246
|
+
def prepare_submission_values(values, file_upload_url)
|
247
|
+
# initialize the values
|
248
|
+
values = {} if values.nil?
|
249
|
+
# handle attachment values
|
250
|
+
values.each do |field, value|
|
251
|
+
# if the value contains an array of files
|
252
|
+
if value.is_a?(Array) && !value.empty? && value.first.is_a?(Hash) && value.first.has_key?('path')
|
253
|
+
value.each_with_index do |file, index|
|
254
|
+
# upload the file to the server
|
255
|
+
file_upload_response = post_multipart(
|
256
|
+
file_upload_url,
|
257
|
+
{ "package" => File.new(file['path']) },
|
258
|
+
default_headers)
|
259
|
+
# update the value with the file upload response
|
260
|
+
if file_upload_response.status == 200
|
261
|
+
values[field][index] = file_upload_response.content.first
|
262
|
+
else
|
263
|
+
raise "Attachment file upload failed: (#{file_upload_response.status}) #{file_upload_response.content_string}"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
# return the values
|
269
|
+
values
|
270
|
+
end
|
271
|
+
|
214
272
|
end
|
215
273
|
end
|
@@ -18,7 +18,6 @@ module KineticSdk
|
|
18
18
|
# either add or update the attribute value
|
19
19
|
exists = false
|
20
20
|
attributes.each do |attribute|
|
21
|
-
@logger.info("Attribute: #{attribute.inspect}")
|
22
21
|
# if the attribute already exists, update it
|
23
22
|
if attribute["name"] == attribute_name
|
24
23
|
attribute["values"] = attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
|
@@ -74,6 +73,18 @@ module KineticSdk
|
|
74
73
|
post("#{@api_url}/memberships/", body, headers)
|
75
74
|
end
|
76
75
|
|
76
|
+
# remove a team membership
|
77
|
+
#
|
78
|
+
# @param team_name [String] the team name
|
79
|
+
# @param username [String] the username to remove to the team
|
80
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
81
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
82
|
+
def remove_team_membership(team_name, username, headers=default_headers)
|
83
|
+
team_slug = Digest::MD5.hexdigest(team_name)
|
84
|
+
@logger.info("Removing user: \"#{username}\" from \"#{team_name}\" team")
|
85
|
+
delete("#{@api_url}/memberships/#{team_slug}_#{username}", body, headers)
|
86
|
+
end
|
87
|
+
|
77
88
|
# Find teams
|
78
89
|
#
|
79
90
|
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module KineticSdk
|
2
|
+
class Core
|
3
|
+
|
4
|
+
# Add a Web API on the Space
|
5
|
+
#
|
6
|
+
# @param body [Hash] hash of Web API properties
|
7
|
+
# - +method+ - The method of the Web API - "GET", "POST", "PUT", or "DELETE"
|
8
|
+
# - +slug+ - The slug of the Web API
|
9
|
+
# - +securityPolicies+ - [Array] Array of hashes
|
10
|
+
# - - +endpoint+ - "Execution"
|
11
|
+
# - - +name+ - Name of an existing Space Security Definition
|
12
|
+
|
13
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
14
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
15
|
+
def add_space_webapi(body, headers=default_headers)
|
16
|
+
raise StandardError.new "Web API properties is not valid, must be a Hash." unless body.is_a? Hash
|
17
|
+
@logger.info("Adding the \"#{body['slug']}\" to the Space.")
|
18
|
+
post("#{@api_url}/webApis", body, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add a Web API on a Kapp
|
22
|
+
#
|
23
|
+
# @param kapp_slug [String] the Kapp slug
|
24
|
+
# @param body [Hash] hash of Web API properties
|
25
|
+
# - +method+ - The method of the Web API - "GET", "POST", "PUT", or "DELETE"
|
26
|
+
# - +slug+ - The slug of the Web API
|
27
|
+
# - +securityPolicies+ - [Array] Array of hashes
|
28
|
+
# - - +endpoint+ - "Execution"
|
29
|
+
# - - +name+ - Name of an existing Space Security Definition
|
30
|
+
|
31
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
32
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
33
|
+
def add_kapp_webapi(kapp_slug, body, headers=default_headers)
|
34
|
+
raise StandardError.new "Web API properties is not valid, must be a Hash." unless body.is_a? Hash
|
35
|
+
@logger.info("Adding the \"#{body['slug']}\" to the \"#{kapp_slug}\" Kapp.")
|
36
|
+
post("#{@api_url}/kapps/#{kapp_slug}/webApis", body, headers)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Find all Web APIs for the Space
|
40
|
+
#
|
41
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
42
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
43
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
44
|
+
def find_space_webapis(params={}, headers=default_headers)
|
45
|
+
@logger.info("Finding all Web APIs on the Space")
|
46
|
+
get("#{@api_url}/webApis", params, headers)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Find a single Web API on the Space
|
50
|
+
#
|
51
|
+
# @param slug [String] slug of the Web API
|
52
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
53
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
54
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
55
|
+
def find_space_webapi(slug, params={}, headers=default_headers)
|
56
|
+
@logger.info("Finding the \"#{slug}\" Web API on the Space")
|
57
|
+
get("#{@api_url}/webApis/#{slug}", params, headers)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Find all Web APIs for a Kapp
|
61
|
+
#
|
62
|
+
# @param kapp_slug [String] the Kapp slug
|
63
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
64
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
65
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
66
|
+
def find_kapp_webapis(kapp_slug, params={}, headers=default_headers)
|
67
|
+
@logger.info("Finding all Web APIs on the \"#{kapp_slug}\" Kapp.")
|
68
|
+
get("#{@api_url}/kapps/#{kapp_slug}/webApis", params, headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Find a single Web API on the Kapp
|
72
|
+
#
|
73
|
+
# @param kapp_slug [String] the Kapp slug
|
74
|
+
# @param slug [String] slug of the Web API
|
75
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
76
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
77
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
78
|
+
def find_kapp_webapi(kapp_slug, slug, params={}, headers=default_headers)
|
79
|
+
@logger.info("Finding the \"#{slug}\" Web API on the \"#{kapp_slug}\" Kapp.")
|
80
|
+
get("#{@api_url}/kapps/#{kapp_slug}/webApis/#{slug}", params, headers)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Update a Web API on the Space
|
84
|
+
#
|
85
|
+
# All of the Web API properties are optional. Only the properties provided
|
86
|
+
# in the Hash will be updated, the other properties will retain their
|
87
|
+
# current values.
|
88
|
+
#
|
89
|
+
# @param slug [String] the slug of the Web API
|
90
|
+
# @param body [Hash] hash of Web API properties
|
91
|
+
# - +method+ - The method of the Web API - "GET", "POST", "PUT", or "DELETE"
|
92
|
+
# - +slug+ - The slug of the Web API
|
93
|
+
# - +securityPolicies+ - [Array] Array of hashes
|
94
|
+
# - - +endpoint+ - "Execution"
|
95
|
+
# - - +name+ - Name of an existing Space Security Definition
|
96
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
97
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
98
|
+
def update_space_webapi(slug, body, headers=default_headers)
|
99
|
+
@logger.info("Updating the \"#{slug}\" Web API on the Space.")
|
100
|
+
put("#{@api_url}/webApis/#{slug}", body, headers)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Update a Web API on a Kapp
|
104
|
+
#
|
105
|
+
# All of the Web API properties are optional. Only the properties provided
|
106
|
+
# in the Hash will be updated, the other properties will retain their
|
107
|
+
# current values.
|
108
|
+
#
|
109
|
+
# @param kapp_slug [String] the Kapp slug
|
110
|
+
# @param slug [String] the slug of the Web API
|
111
|
+
# @param body [Hash] hash of Web API properties
|
112
|
+
# - +method+ - The method of the Web API - "GET", "POST", "PUT", or "DELETE"
|
113
|
+
# - +slug+ - The slug of the Web API
|
114
|
+
# - +securityPolicies+ - [Array] Array of hashes
|
115
|
+
# - - +endpoint+ - "Execution"
|
116
|
+
# - - +name+ - Name of an existing Space Security Definition
|
117
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
118
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
119
|
+
def update_kapp_webapi(kapp_slug, slug, body, headers=default_headers)
|
120
|
+
@logger.info("Updating the \"#{slug}\" Web API on the \"#{kapp_slug}\" Kapp.")
|
121
|
+
put("#{@api_url}/kapps/#{kapp_slug}/webApis/#{slug}", body, headers)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Delete a Web API on the Space
|
125
|
+
# @param slug [String] the slug of the Web API
|
126
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
127
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
128
|
+
def delete_space_webapi(slug, headers=default_headers)
|
129
|
+
@logger.info("Deleting the \"#{slug}\" Web API on the Space.")
|
130
|
+
delete("#{@api_url}/webApis/#{slug}", headers)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Delete a Web API on a Kapp
|
134
|
+
# @param kapp_slug [String] the Kapp slug
|
135
|
+
# @param slug [String] the slug of the Web API
|
136
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
137
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
138
|
+
def delete_kapp_webapi(kapp_slug, slug, headers=default_headers)
|
139
|
+
@logger.info("Deleting the \"#{slug}\" Web API on the \"#{kapp_slug}\" Kapp.")
|
140
|
+
delete("#{@api_url}/kapps/#{kapp_slug}/webApis/#{slug}", headers)
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
@@ -196,7 +196,7 @@ module KineticSdk
|
|
196
196
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
197
197
|
def delete_webhook_on_kapp(kapp_slug, name, headers=default_headers)
|
198
198
|
@logger.info("Deleting the #{name} webhook on the #{kapp_slug}\ kapp.")
|
199
|
-
delete(
|
199
|
+
delete("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}", headers)
|
200
200
|
end
|
201
201
|
|
202
202
|
# Delete a webhook on space
|
@@ -49,7 +49,7 @@ module KineticSdk
|
|
49
49
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
50
50
|
def delete_sources(headers=header_basic_auth)
|
51
51
|
@logger.info("Deleting all sources")
|
52
|
-
(find_sources(headers).content[
|
52
|
+
(find_sources(headers).content["sourceRoots"] || []).each do |source|
|
53
53
|
delete("#{@api_url}/sources/#{encode(source['name'])}", headers)
|
54
54
|
end
|
55
55
|
end
|
@@ -424,13 +424,11 @@ module KineticSdk
|
|
424
424
|
# prepare the payload
|
425
425
|
payload = data.inject({}) do |h,(k,v)|
|
426
426
|
if v.class == File
|
427
|
-
h[k] = UploadIO.new(v, mimetype(v), File.basename(v))
|
427
|
+
h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))
|
428
428
|
elsif v.class == Array
|
429
|
-
# f = v.first
|
430
|
-
# h[k] = UploadIO.new(f, mimetype(f), File.basename(f)) unless f.nil?
|
431
429
|
h[k] = v.inject([]) do |files, part|
|
432
430
|
if part.class == File
|
433
|
-
files << UploadIO.new(part, mimetype(part), File.basename(part))
|
431
|
+
files << UploadIO.new(part, mimetype(part).first, File.basename(part))
|
434
432
|
end
|
435
433
|
end
|
436
434
|
else
|
@@ -634,9 +632,9 @@ module KineticSdk
|
|
634
632
|
# @option http_options [Fixnum] :max_redirects optional - max number of times to redirect
|
635
633
|
# @option http_options [Fixnum] :gateway_retry_limit optional - max number of times to retry a bad gateway
|
636
634
|
# @option http_options [Float] :gateway_retry_delay optional - number of seconds to delay before retrying a bad gateway
|
637
|
-
def stream_download_to_file(file_path, url, params={}, headers={}, http_options=@
|
635
|
+
def stream_download_to_file(file_path, url, params={}, headers={}, http_options=@options)
|
638
636
|
# Determine if redirection is involved
|
639
|
-
url = redirect_url(url, params, headers,
|
637
|
+
url = redirect_url(url, params, headers, http_options)
|
640
638
|
# parse the URL
|
641
639
|
uri = URI.parse(url)
|
642
640
|
|
@@ -645,15 +643,17 @@ module KineticSdk
|
|
645
643
|
# build the http object
|
646
644
|
http = build_http(uri)
|
647
645
|
|
648
|
-
#
|
649
|
-
file =
|
646
|
+
# prepare the download
|
647
|
+
file = nil
|
650
648
|
file_name = File.basename(file_path)
|
651
649
|
response_code = nil
|
652
650
|
message = nil
|
653
651
|
begin
|
652
|
+
# stream the attachment
|
654
653
|
http.request_get(uri.request_uri, headers) do |response|
|
655
654
|
response_code = response.code
|
656
655
|
if response_code == "200"
|
656
|
+
file = File.open(file_path, "wb")
|
657
657
|
response.read_body { |chunk| file.write(chunk) }
|
658
658
|
else
|
659
659
|
message = response.body
|
@@ -668,8 +668,9 @@ module KineticSdk
|
|
668
668
|
rescue StandardError => e
|
669
669
|
@logger.error("Failed to export file attachment \"#{file_name}\": (#{e})")
|
670
670
|
ensure
|
671
|
-
file.close()
|
671
|
+
file.close() unless file.nil?
|
672
672
|
end
|
673
|
+
message
|
673
674
|
end
|
674
675
|
|
675
676
|
|
data/lib/kinetic_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,142 +1,142 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kinetic_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kinetic Data
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: slugify
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - '='
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: 1.0.7
|
19
|
-
name: slugify
|
20
|
-
prerelease: false
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: multipart-post
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - '='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 2.0.0
|
33
|
-
name: multipart-post
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: mime-types
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - '='
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '3.1'
|
47
|
-
name: mime-types
|
48
|
-
prerelease: false
|
49
48
|
type: :runtime
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: parallel
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - '='
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: 1.12.1
|
61
|
-
name: parallel
|
62
|
-
prerelease: false
|
63
62
|
type: :runtime
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.12.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-progressbar
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
73
|
- - '='
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: 1.9.0
|
75
|
-
name: ruby-progressbar
|
76
|
-
prerelease: false
|
77
76
|
type: :runtime
|
77
|
+
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.9.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: kontena-websocket-client
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
87
|
- - '='
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: 0.1.1
|
89
|
-
name: kontena-websocket-client
|
90
|
-
prerelease: false
|
91
90
|
type: :development
|
91
|
+
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.1.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
98
99
|
requirement: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
101
|
- - "~>"
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '1.17'
|
103
|
-
name: bundler
|
104
|
-
prerelease: false
|
105
104
|
type: :development
|
105
|
+
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.17'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
115
|
- - "~>"
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: 13.0.1
|
117
|
-
name: rake
|
118
|
-
prerelease: false
|
119
118
|
type: :development
|
119
|
+
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 13.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
+
name: yard
|
126
127
|
requirement: !ruby/object:Gem::Requirement
|
127
128
|
requirements:
|
128
129
|
- - "~>"
|
129
130
|
- !ruby/object:Gem::Version
|
130
131
|
version: 0.9.25
|
131
|
-
name: yard
|
132
|
-
prerelease: false
|
133
132
|
type: :development
|
133
|
+
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.9.25
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email:
|
141
141
|
- support@kineticdata.com
|
142
142
|
executables:
|
@@ -362,6 +362,7 @@ files:
|
|
362
362
|
- lib/kinetic_sdk/core/lib/system_api.rb
|
363
363
|
- lib/kinetic_sdk/core/lib/teams.rb
|
364
364
|
- lib/kinetic_sdk/core/lib/users.rb
|
365
|
+
- lib/kinetic_sdk/core/lib/webapis.rb
|
365
366
|
- lib/kinetic_sdk/core/lib/webhook_jobs.rb
|
366
367
|
- lib/kinetic_sdk/core/lib/webhooks.rb
|
367
368
|
- lib/kinetic_sdk/discussions/discussions-sdk.rb
|
@@ -407,7 +408,7 @@ homepage: https://github.com/kineticdata/kinetic-sdk-rb
|
|
407
408
|
licenses: []
|
408
409
|
metadata:
|
409
410
|
yard.run: yri
|
410
|
-
post_install_message:
|
411
|
+
post_install_message:
|
411
412
|
rdoc_options: []
|
412
413
|
require_paths:
|
413
414
|
- lib
|
@@ -422,9 +423,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
422
423
|
- !ruby/object:Gem::Version
|
423
424
|
version: '0'
|
424
425
|
requirements: []
|
425
|
-
|
426
|
-
|
427
|
-
signing_key:
|
426
|
+
rubygems_version: 3.0.3
|
427
|
+
signing_key:
|
428
428
|
specification_version: 4
|
429
429
|
summary: Ruby SDK for Kinetic Data application APIs
|
430
430
|
test_files: []
|