workato-connector-sdk 1.0.2 → 1.0.3
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/README.md +17 -11
- data/lib/workato/cli/main.rb +43 -11
- data/lib/workato/cli/push_command.rb +3 -1
- data/lib/workato/cli/schema_command.rb +2 -4
- data/lib/workato/connector/sdk/version.rb +1 -1
- data/lib/workato/connector/sdk.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4348a5f43c1aca0d39967b9b90c04b17d158a74c
|
4
|
+
data.tar.gz: befa5442c5eca5641824e0e426cbec67c6a2dc77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d74275e1a04b3a90059971dc048256ef3f720bbf09db590678353cc920e133ec4627a7870c5832663f1f793e9b8e47d2cfa19f3cdab81bd7c5abf2f0021c5db3
|
7
|
+
data.tar.gz: ebbf0c161b5fcb932db95dac377408ab01b237bc1541a27e2e19c2b2cf9e2dbea60934a2cd1b37ebd56955c1d531e91656342d14904dbcdf66109fe99f7fe14f
|
data/README.md
CHANGED
@@ -248,8 +248,9 @@ Usage:
|
|
248
248
|
workato edit <PATH>
|
249
249
|
|
250
250
|
Options:
|
251
|
-
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
252
|
-
|
251
|
+
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
252
|
+
# NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
|
253
|
+
[--verbose], [--no-verbose]
|
253
254
|
|
254
255
|
Edit encrypted file, e.g. settings.yaml.enc
|
255
256
|
```
|
@@ -261,6 +262,7 @@ Edit encrypted file, e.g. settings.yaml.enc
|
|
261
262
|
### 3.3 workato exec
|
262
263
|
```
|
263
264
|
workato help exec
|
265
|
+
|
264
266
|
Usage:
|
265
267
|
workato exec <PATH>
|
266
268
|
|
@@ -268,7 +270,8 @@ Options:
|
|
268
270
|
-c, [--connector=CONNECTOR] # Path to connector source code
|
269
271
|
-s, [--settings=SETTINGS] # Path to plain or encrypted file with connection configs, passwords, tokens, secrets etc
|
270
272
|
-n, [--connection=CONNECTION] # Connection name if settings file contains multiple settings
|
271
|
-
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
273
|
+
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
274
|
+
# NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
|
272
275
|
-i, [--input=INPUT] # Path to file with input JSON
|
273
276
|
[--closure=CLOSURE] # Path to file with next poll closure JSON
|
274
277
|
[--continue=CONTINUE] # Path to file with next multistep action continue closure JSON
|
@@ -286,7 +289,7 @@ Options:
|
|
286
289
|
[--redirect-url=REDIRECT_URL] # OAuth2 callback url
|
287
290
|
[--refresh-token=REFRESH_TOKEN] # OAuth2 refresh token
|
288
291
|
[--debug], [--no-debug]
|
289
|
-
[--verbose], [--no-verbose]
|
292
|
+
[--verbose], [--no-verbose]
|
290
293
|
|
291
294
|
Description:
|
292
295
|
The 'workato exec' executes connector's lambda block at <PATH>. Lambda's parameters can be provided if needed, see options part.
|
@@ -394,13 +397,14 @@ Options:
|
|
394
397
|
-c, [--connector=CONNECTOR] # Path to connector source code
|
395
398
|
-s, [--settings=SETTINGS] # Path to plain or encrypted file with connection configs, passwords, tokens, secrets etc
|
396
399
|
-n, [--connection=CONNECTION] # Connection name if settings file contains multiple settings
|
397
|
-
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
400
|
+
-k, [--key=KEY] # Path to file with encrypt/decrypt key.
|
401
|
+
# NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
|
398
402
|
[--port=PORT] # Listen requests on specific port
|
399
403
|
# Default: 45555
|
400
404
|
[--ip=IP] # Listen requests on specific interface
|
401
405
|
# Default: 127.0.0.1
|
402
406
|
[--https], [--no-https] # Start HTTPS server using self-signed certificate
|
403
|
-
[--verbose], [--no-verbose]
|
407
|
+
[--verbose], [--no-verbose]
|
404
408
|
|
405
409
|
Implements OAuth Authorization Code flow
|
406
410
|
```
|
@@ -420,11 +424,13 @@ Options:
|
|
420
424
|
-l, [--logo=LOGO] # Path to connector logo: png or jpeg file
|
421
425
|
-n, [--notes=NOTES] # Release notes
|
422
426
|
-c, [--connector=CONNECTOR] # Path to connector source code
|
423
|
-
[--api-email=API_EMAIL] # Email for accessing Workato API
|
424
|
-
|
425
|
-
[--
|
426
|
-
#
|
427
|
-
|
427
|
+
[--api-email=API_EMAIL] # Email for accessing Workato API.
|
428
|
+
# If present overrides value from WORKATO_API_EMAIL environment variable.
|
429
|
+
[--api-token=API_TOKEN] # Token for accessing Workato API.
|
430
|
+
# If present overrides value from WORKATO_API_TOKEN environment variable.
|
431
|
+
[--environment=ENVIRONMENT] # Data center specific URL to push connector code.
|
432
|
+
# If present overrides value from WORKATO_BASE_URL environment variable.
|
433
|
+
# Examples: 'https://app.workato.com', 'https://app.eu.workato.com'
|
428
434
|
[--folder=FOLDER] # Folder ID if you what to push to folder other than Home
|
429
435
|
[--verbose], [--no-verbose]
|
430
436
|
|
data/lib/workato/cli/main.rb
CHANGED
@@ -41,8 +41,8 @@ module Workato
|
|
41
41
|
desc: 'Connection name if settings file contains multiple settings'
|
42
42
|
method_option :key, type: :string, aliases: '-k',
|
43
43
|
lazy_default: Workato::Connector::Sdk::DEFAULT_MASTER_KEY_PATH,
|
44
|
-
desc:
|
45
|
-
|
44
|
+
desc: "Path to file with encrypt/decrypt key.\n"\
|
45
|
+
"NOTE: key from #{Workato::Connector::Sdk::DEFAULT_MASTER_KEY_ENV} has higher priority"
|
46
46
|
method_option :input, type: :string, aliases: '-i', desc: 'Path to file with input JSON'
|
47
47
|
method_option :closure, type: :string, desc: 'Path to file with next poll closure JSON'
|
48
48
|
method_option :continue, type: :string, desc: 'Path to file with next multistep action continue closure JSON'
|
@@ -75,7 +75,7 @@ module Workato
|
|
75
75
|
|
76
76
|
method_option :key, type: :string, aliases: '-k',
|
77
77
|
lazy_default: Workato::Connector::Sdk::DEFAULT_MASTER_KEY_PATH,
|
78
|
-
desc:
|
78
|
+
desc: "Path to file with encrypt/decrypt key.\n"\
|
79
79
|
"NOTE: key from #{Workato::Connector::Sdk::DEFAULT_MASTER_KEY_ENV} has higher priority"
|
80
80
|
|
81
81
|
def edit(path)
|
@@ -127,17 +127,20 @@ module Workato
|
|
127
127
|
lazy_default: Workato::Connector::Sdk::DEFAULT_CONNECTOR_PATH
|
128
128
|
method_option :api_email,
|
129
129
|
type: :string,
|
130
|
-
desc:
|
131
|
-
"
|
130
|
+
desc: "Email for accessing Workato API.\n"\
|
131
|
+
"If present overrides value from #{Workato::Connector::Sdk::WORKATO_API_EMAIL_ENV} "\
|
132
|
+
'environment variable.'
|
132
133
|
method_option :api_token,
|
133
134
|
type: :string,
|
134
|
-
desc:
|
135
|
-
"
|
135
|
+
desc: "Token for accessing Workato API.\n" \
|
136
|
+
"If present overrides value from #{Workato::Connector::Sdk::WORKATO_API_TOKEN_ENV} "\
|
137
|
+
'environment variable.'
|
136
138
|
method_option :environment,
|
137
139
|
type: :string,
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
desc: "Data center specific URL to push connector code.\n"\
|
141
|
+
"If present overrides value from #{Workato::Connector::Sdk::WORKATO_BASE_URL_ENV} "\
|
142
|
+
"environment variable.\n"\
|
143
|
+
"Examples: 'https://app.workato.com', 'https://app.eu.workato.com'"
|
141
144
|
method_option :folder,
|
142
145
|
type: :string,
|
143
146
|
desc: 'Folder ID if you what to push to folder other than Home'
|
@@ -168,7 +171,7 @@ module Workato
|
|
168
171
|
type: :string,
|
169
172
|
aliases: '-k',
|
170
173
|
lazy_default: Workato::Connector::Sdk::DEFAULT_MASTER_KEY_PATH,
|
171
|
-
desc:
|
174
|
+
desc: "Path to file with encrypt/decrypt key.\n"\
|
172
175
|
"NOTE: key from #{Workato::Connector::Sdk::DEFAULT_MASTER_KEY_ENV} has higher priority"
|
173
176
|
method_option :port,
|
174
177
|
type: :string,
|
@@ -187,6 +190,35 @@ module Workato
|
|
187
190
|
options: options
|
188
191
|
).call
|
189
192
|
end
|
193
|
+
|
194
|
+
class << self
|
195
|
+
def print_options(shell, options, group_name = nil)
|
196
|
+
return if options.empty?
|
197
|
+
|
198
|
+
list = []
|
199
|
+
padding = options.map { |o| o.aliases.size }.max.to_i * 4
|
200
|
+
|
201
|
+
options.each do |option|
|
202
|
+
next if option.hide
|
203
|
+
|
204
|
+
description = []
|
205
|
+
description_lines = option.description ? option.description.split("\n") : []
|
206
|
+
first_line = description_lines.shift
|
207
|
+
description << [option.usage(padding), first_line ? "# #{first_line}" : '']
|
208
|
+
description_lines.each do |line|
|
209
|
+
description << ['', "# #{line}"]
|
210
|
+
end
|
211
|
+
|
212
|
+
list.concat(description)
|
213
|
+
list << ['', "# Default: #{option.default}"] if option.show_default?
|
214
|
+
list << ['', "# Possible values: #{option.enum.join(', ')}"] if option.enum
|
215
|
+
end
|
216
|
+
|
217
|
+
shell.say(group_name ? "#{group_name} options:" : 'Options:')
|
218
|
+
shell.print_table(list, indent: 2)
|
219
|
+
shell.say ''
|
220
|
+
end
|
221
|
+
end
|
190
222
|
end
|
191
223
|
end
|
192
224
|
end
|
@@ -32,7 +32,9 @@ module Workato
|
|
32
32
|
|
33
33
|
def initialize(options:)
|
34
34
|
@options = options
|
35
|
-
@api_base_url = ENVIRONMENTS.fetch(options[:environment])
|
35
|
+
@api_base_url = ENVIRONMENTS.fetch(options[:environment]) do
|
36
|
+
options[:environment].presence || Workato::Connector::Sdk::WORKATO_BASE_URL
|
37
|
+
end
|
36
38
|
@api_email = options[:api_email] || ENV[Workato::Connector::Sdk::WORKATO_API_EMAIL_ENV]
|
37
39
|
@api_token = options[:api_token] || ENV[Workato::Connector::Sdk::WORKATO_API_TOKEN_ENV]
|
38
40
|
@folder_id = options[:folder]
|
@@ -9,7 +9,6 @@ module Workato
|
|
9
9
|
SAMPLE_TO_SCHEMA_SUPPORT_TYPES = %w[csv json].freeze
|
10
10
|
CSV_SEPARATORS = %w[comma space tab colon semicolon pipe].freeze
|
11
11
|
|
12
|
-
WORKATO_BASE_URL = ENV['WORKATO_BASE_URL'] || 'https://app.workato.com'
|
13
12
|
API_GENERATE_SCHEMA_PATH = '/api/sdk/generate_schema'
|
14
13
|
|
15
14
|
def initialize(options:)
|
@@ -53,7 +52,7 @@ module Workato
|
|
53
52
|
end
|
54
53
|
|
55
54
|
def sample_to_schema(sample)
|
56
|
-
url = "#{WORKATO_BASE_URL}#{API_GENERATE_SCHEMA_PATH}/#{sample.delete(:type)}"
|
55
|
+
url = "#{Workato::Connector::Sdk::WORKATO_BASE_URL}#{API_GENERATE_SCHEMA_PATH}/#{sample.delete(:type)}"
|
57
56
|
response = RestClient.post(
|
58
57
|
url,
|
59
58
|
sample.to_json,
|
@@ -75,8 +74,7 @@ module Workato
|
|
75
74
|
}
|
76
75
|
end
|
77
76
|
|
78
|
-
private_constant :API_GENERATE_SCHEMA_PATH
|
79
|
-
:WORKATO_BASE_URL
|
77
|
+
private_constant :API_GENERATE_SCHEMA_PATH
|
80
78
|
end
|
81
79
|
end
|
82
80
|
end
|
@@ -26,6 +26,10 @@ module Workato
|
|
26
26
|
|
27
27
|
WORKATO_API_EMAIL_ENV = 'WORKATO_API_EMAIL'
|
28
28
|
WORKATO_API_TOKEN_ENV = 'WORKATO_API_TOKEN'
|
29
|
+
|
30
|
+
WORKATO_BASE_URL_ENV = 'WORKATO_BASE_URL'
|
31
|
+
DEFAULT_WORKATO_BASE_URL = 'https://app.workato.com'
|
32
|
+
WORKATO_BASE_URL = T.let(ENV.fetch(WORKATO_BASE_URL_ENV, DEFAULT_WORKATO_BASE_URL), String)
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workato-connector-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Abolmasov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|