workato-connector-sdk 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f52b011085690e264b4e2082fb2f13c1375e74fe
4
- data.tar.gz: 190c0bc7e6264ab9524acdda484e07154dd0b2b8
3
+ metadata.gz: 4348a5f43c1aca0d39967b9b90c04b17d158a74c
4
+ data.tar.gz: befa5442c5eca5641824e0e426cbec67c6a2dc77
5
5
  SHA512:
6
- metadata.gz: 29480d50f931dec0b0f18bf8f7c97f0a6029dd2656ba367ce0a3015a2a32e961bca9981083e01455d9c65cba2244dea5491b34d02e18a9cb8c4ac1a02f9a1d85
7
- data.tar.gz: 1681f2fc8fc0eec6949361ae49ae26fdea3372eab98fb745e9d4a55d192b0e74a34d446655d2b5b08ede89d09cf748d4610ef86b08bab3210165de961004bbb6
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. NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
252
- [--verbose], [--no-verbose]
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. NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
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. NOTE: key from WORKATO_CONNECTOR_MASTER_KEY has higher priority
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 or set WORKATO_API_EMAIL environment variable
424
- [--api-token=API_TOKEN] # Token for accessing Workato API or set WORKATO_API_TOKEN environment variable
425
- [--environment=ENVIRONMENT] # Server to push connector code to
426
- # Default: live
427
- # Possible values: preview, preview-eu, live, live-eu
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
 
@@ -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: 'Path to file with encrypt/decrypt key. '\
45
- "NOTE: key from #{Workato::Connector::Sdk::DEFAULT_MASTER_KEY_ENV} has higher priority"
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: 'Path to file with encrypt/decrypt key. '\
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: 'Email for accessing Workato API or '\
131
- "set #{Workato::Connector::Sdk::WORKATO_API_EMAIL_ENV} environment variable"
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: 'Token for accessing Workato API or ' \
135
- "set #{Workato::Connector::Sdk::WORKATO_API_TOKEN_ENV} environment variable"
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
- enum: Workato::CLI::PushCommand::ENVIRONMENTS.keys,
139
- default: 'live',
140
- desc: 'Server to push connector code to'
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: 'Path to file with encrypt/decrypt key. '\
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
@@ -4,7 +4,7 @@
4
4
  module Workato
5
5
  module Connector
6
6
  module Sdk
7
- VERSION = '1.0.2'
7
+ VERSION = '1.0.3'
8
8
  end
9
9
  end
10
10
  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.2
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-08-08 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport