workato-connector-sdk 1.3.17 → 1.3.19
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/VERSION +1 -1
- data/lib/workato/cli/exec_command.rb +1 -0
- data/lib/workato/cli/main.rb +1 -0
- data/lib/workato/cli/oauth2_command.rb +14 -12
- data/lib/workato/connector/sdk/connection.rb +21 -4
- data/lib/workato/connector/sdk/dsl/csv_package.rb +8 -1
- data/lib/workato/connector/sdk.rb +3 -0
- data/lib/workato/extension/array.rb +37 -0
- data/lib/workato/extension/date.rb +58 -0
- data/lib/workato/extension/enumerable.rb +44 -1
- data/lib/workato/extension/numeric.rb +38 -0
- data/lib/workato/extension/range.rb +26 -0
- data/lib/workato/extension/time.rb +56 -0
- data/lib/workato/web/app.rb +2 -2
- metadata +15 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a32f763d152f3365eb32bf0628e0772f67ed9dee8b92badb92f0f87b3c43b3cc
|
|
4
|
+
data.tar.gz: 32d4bb1c8fef8c5795aa08cea581dcd259ad63d6c818b33a898ca594d660aafc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e65cfbf21f9dd7cb82846f9aa716f70ce93562f98fb20530d88f05c9edcc15d763e47e5d415f7f9ebebd22d5addd2d8720bd9ebed40d88bf2f248b37589ca36
|
|
7
|
+
data.tar.gz: ac5ab2d7f43787f4c11f6b16c9623af28ba10decf0fdc980464efe531c14a08d00023fdcde069b47473e6a6508884fa8c53c9e5feaf8fe917058d429bb47e695
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.19
|
|
@@ -67,6 +67,7 @@ module Workato
|
|
|
67
67
|
webhook_url: options[:webhook_url],
|
|
68
68
|
oauth2_code: options[:oauth2_code],
|
|
69
69
|
redirect_url: options[:redirect_url],
|
|
70
|
+
query_params: from_json(options[:query_params]),
|
|
70
71
|
refresh_token: options[:refresh_token],
|
|
71
72
|
from: options[:from].to_i,
|
|
72
73
|
frame_size: options[:frame_size]&.to_i || Workato::Connector::Sdk::Stream::DEFAULT_FRAME_SIZE,
|
data/lib/workato/cli/main.rb
CHANGED
|
@@ -60,6 +60,7 @@ module Workato
|
|
|
60
60
|
method_option :output, type: :string, aliases: '-o', desc: 'Write output to JSON file'
|
|
61
61
|
method_option :oauth2_code, type: :string, desc: 'OAuth2 code exchange to tokens pair'
|
|
62
62
|
method_option :redirect_url, type: :string, desc: 'OAuth2 callback url'
|
|
63
|
+
method_option :query_params, type: :string, desc: 'Path to file with OAuth2 query params'
|
|
63
64
|
method_option :refresh_token, type: :string, desc: 'OAuth2 refresh token'
|
|
64
65
|
method_option :from, type: :numeric, desc: 'Stream byte offset to read from'
|
|
65
66
|
method_option :frame_size, type: :numeric, desc: 'Stream chunk read size in bytes. Should be positive'
|
|
@@ -12,8 +12,8 @@ module Workato
|
|
|
12
12
|
include Thor::Shell
|
|
13
13
|
include MultiAuthSelectedFallback
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
AWAIT_CALLBACK_TIMEOUT_INTERVAL = 180 # seconds
|
|
16
|
+
AWAIT_CALLBACK_SLEEP_INTERVAL = 5 # seconds
|
|
17
17
|
|
|
18
18
|
DEFAULT_ADDRESS = '127.0.0.1'
|
|
19
19
|
DEFAULT_PORT = '45555'
|
|
@@ -41,17 +41,17 @@ module Workato
|
|
|
41
41
|
raise "Attempted to open #{authorize_url} and failed because #{exception}"
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
say_status :success, "Receive OAuth2 code=#{code}"
|
|
44
|
+
callback_params = await_callback
|
|
45
|
+
say_status :success, "Receive OAuth2 code=#{callback_params['code']}, state=#{callback_params['state']}"
|
|
46
46
|
|
|
47
|
-
tokens = acquire_token(
|
|
47
|
+
tokens = acquire_token(callback_params)
|
|
48
48
|
say_status :success, 'Receive OAuth2 tokens'
|
|
49
49
|
say JSON.pretty_generate(tokens) if verbose?
|
|
50
50
|
|
|
51
51
|
settings_store.update(tokens)
|
|
52
52
|
say_status :success, 'Update settings file'
|
|
53
53
|
rescue Timeout::Error
|
|
54
|
-
raise "Have not received callback from OAuth2 provider in #{
|
|
54
|
+
raise "Have not received callback from OAuth2 provider in #{AWAIT_CALLBACK_TIMEOUT_INTERVAL} seconds. Aborting!"
|
|
55
55
|
rescue Errno::EADDRINUSE
|
|
56
56
|
raise "Port #{port} already in use. Try to use different port with --port=#{rand(10_000..65_664)}"
|
|
57
57
|
ensure
|
|
@@ -165,22 +165,24 @@ module Workato
|
|
|
165
165
|
)
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
def
|
|
168
|
+
def await_callback
|
|
169
169
|
code_uri = URI("#{base_url}#{Workato::Web::App::CODE_PATH}")
|
|
170
170
|
|
|
171
|
-
Timeout.timeout(
|
|
171
|
+
Timeout.timeout(AWAIT_CALLBACK_TIMEOUT_INTERVAL) do
|
|
172
172
|
loop do
|
|
173
173
|
response = get(code_uri) rescue nil
|
|
174
|
-
break response if response.present?
|
|
174
|
+
break JSON.parse(response).to_hash if response.present?
|
|
175
175
|
|
|
176
|
-
sleep(
|
|
176
|
+
sleep(AWAIT_CALLBACK_SLEEP_INTERVAL)
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
-
def acquire_token(
|
|
181
|
+
def acquire_token(callback_params)
|
|
182
|
+
code = callback_params["code"]
|
|
183
|
+
callback_params.except!("code", "state")
|
|
182
184
|
if connector.connection.authorization.source[:acquire]
|
|
183
|
-
tokens, _, extra_settings = connector.connection.authorization.acquire(nil, code, redirect_url)
|
|
185
|
+
tokens, _, extra_settings = connector.connection.authorization.acquire(nil, code, redirect_url, nil, callback_params)
|
|
184
186
|
tokens ||= {}
|
|
185
187
|
extra_settings ||= {}
|
|
186
188
|
extra_settings.merge(tokens)
|
|
@@ -250,10 +250,12 @@ module Workato
|
|
|
250
250
|
params(
|
|
251
251
|
settings: T.nilable(SorbetTypes::SettingsHash),
|
|
252
252
|
oauth2_code: T.nilable(String),
|
|
253
|
-
redirect_url: T.nilable(String)
|
|
253
|
+
redirect_url: T.nilable(String),
|
|
254
|
+
pkce_verifier: T.nilable(String),
|
|
255
|
+
query_params: T.nilable(T::Hash[T.untyped, T.untyped])
|
|
254
256
|
).returns(T.nilable(SorbetTypes::AcquireOutput))
|
|
255
257
|
end
|
|
256
|
-
def acquire(settings = nil, oauth2_code = nil, redirect_url = nil)
|
|
258
|
+
def acquire(settings = nil, oauth2_code = nil, redirect_url = nil, pkce_verifier = nil, query_params = nil)
|
|
257
259
|
@connection.merge_settings!(settings) if settings
|
|
258
260
|
acquire_proc = source[:acquire]
|
|
259
261
|
raise InvalidDefinitionError, "Expect 'acquire' block" unless acquire_proc
|
|
@@ -269,8 +271,23 @@ module Workato
|
|
|
269
271
|
settings: @connection.settings!
|
|
270
272
|
),
|
|
271
273
|
methods: methods_source
|
|
272
|
-
).execute(
|
|
273
|
-
|
|
274
|
+
).execute(
|
|
275
|
+
settings,
|
|
276
|
+
{
|
|
277
|
+
auth_code: oauth2_code,
|
|
278
|
+
redirect_url: redirect_url,
|
|
279
|
+
pkce_verifier: pkce_verifier,
|
|
280
|
+
query_params: query_params || {}
|
|
281
|
+
}
|
|
282
|
+
) do |connection, input|
|
|
283
|
+
instance_exec(
|
|
284
|
+
connection,
|
|
285
|
+
input[:auth_code],
|
|
286
|
+
input[:redirect_url],
|
|
287
|
+
input[:pkce_verifier],
|
|
288
|
+
input[:query_params],
|
|
289
|
+
&acquire_proc
|
|
290
|
+
)
|
|
274
291
|
end
|
|
275
292
|
end
|
|
276
293
|
|
|
@@ -21,10 +21,17 @@ module Workato
|
|
|
21
21
|
|
|
22
22
|
sig { params(size: Integer, max: Integer).void }
|
|
23
23
|
def initialize(size, max)
|
|
24
|
-
super("CSV file is too big. Max allowed: #{max
|
|
24
|
+
super("CSV file is too big. Max allowed: #{human_size(max)}, got: #{human_size(size)}")
|
|
25
25
|
@size = T.let(size, Integer)
|
|
26
26
|
@max = T.let(max, Integer)
|
|
27
27
|
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
sig { params(var: Integer).returns(T.nilable(String)) }
|
|
32
|
+
def human_size(var)
|
|
33
|
+
var.respond_to?(:to_fs) ? T.unsafe(var).to_fs(:human_size) : var.to_s(:human_size)
|
|
34
|
+
end
|
|
28
35
|
end
|
|
29
36
|
|
|
30
37
|
class CsvFileTooManyLinesError < CsvError
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require 'sorbet-runtime'
|
|
5
|
+
require 'logger' # Required due to https://github.com/rails/rails/issues/54260
|
|
5
6
|
|
|
6
7
|
# Global libs and monkey patches
|
|
7
8
|
require 'active_support/all'
|
|
@@ -18,10 +19,12 @@ require_relative '../extension/date'
|
|
|
18
19
|
require_relative '../extension/enumerable'
|
|
19
20
|
require_relative '../extension/extra_chain_cert'
|
|
20
21
|
require_relative '../extension/hash'
|
|
22
|
+
require_relative '../extension/numeric'
|
|
21
23
|
require_relative '../extension/integer'
|
|
22
24
|
require_relative '../extension/nil_class'
|
|
23
25
|
require_relative '../extension/object'
|
|
24
26
|
require_relative '../extension/phone'
|
|
27
|
+
require_relative '../extension/range'
|
|
25
28
|
require_relative '../extension/string'
|
|
26
29
|
require_relative '../extension/symbol'
|
|
27
30
|
require_relative '../extension/time'
|
|
@@ -125,3 +125,40 @@ module Workato
|
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
Array.prepend(Workato::Extension::Array)
|
|
128
|
+
|
|
129
|
+
class Array
|
|
130
|
+
# In Rails 7.1+, Ruby's `sum` is the preferred implementation.
|
|
131
|
+
# and `sum` patch was removed from ActiveSupport.
|
|
132
|
+
# We bring it back for a smooth upgrade.
|
|
133
|
+
alias_method :_workato_sdk_original_sum, :sum # rubocop:disable Style/Alias
|
|
134
|
+
private :_workato_sdk_original_sum
|
|
135
|
+
|
|
136
|
+
def sum(init = nil, &block)
|
|
137
|
+
if init.is_a?(Numeric) || first.is_a?(Numeric)
|
|
138
|
+
init ||= 0
|
|
139
|
+
_workato_sdk_original_sum(init, &block)
|
|
140
|
+
else
|
|
141
|
+
super
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting arrays
|
|
146
|
+
# and `to_s` patch was removed.
|
|
147
|
+
# We bring it back for a smooth upgrade.
|
|
148
|
+
alias_method :_workato_sdk_to_default_s, :to_s # rubocop:disable Style/Alias
|
|
149
|
+
private :_workato_sdk_to_default_s
|
|
150
|
+
|
|
151
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
152
|
+
def to_s(format = NOT_SET)
|
|
153
|
+
case format
|
|
154
|
+
when :db
|
|
155
|
+
if empty?
|
|
156
|
+
'null'
|
|
157
|
+
else
|
|
158
|
+
map(&:id).join(',')
|
|
159
|
+
end
|
|
160
|
+
else
|
|
161
|
+
_workato_sdk_to_default_s
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -13,3 +13,61 @@ end
|
|
|
13
13
|
|
|
14
14
|
Date.include(Workato::Extension::Date)
|
|
15
15
|
DateTime.include(Workato::Extension::Date)
|
|
16
|
+
|
|
17
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting dates
|
|
18
|
+
# and `to_s` patch was removed.
|
|
19
|
+
# We bring it back for a smooth upgrade.
|
|
20
|
+
class Date
|
|
21
|
+
alias_method :_workato_sdk_to_default_s, :to_s # rubocop:disable Style/Alias
|
|
22
|
+
private :_workato_sdk_to_default_s
|
|
23
|
+
|
|
24
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
25
|
+
def to_s(format = NOT_SET)
|
|
26
|
+
if (formatter = DATE_FORMATS[format])
|
|
27
|
+
if formatter.respond_to?(:call)
|
|
28
|
+
formatter.call(self).to_s
|
|
29
|
+
else
|
|
30
|
+
strftime(formatter)
|
|
31
|
+
end
|
|
32
|
+
elsif format == NOT_SET
|
|
33
|
+
if (formatter = DATE_FORMATS[:default])
|
|
34
|
+
if formatter.respond_to?(:call)
|
|
35
|
+
formatter.call(self).to_s
|
|
36
|
+
else
|
|
37
|
+
strftime(formatter)
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
_workato_sdk_to_default_s
|
|
41
|
+
end
|
|
42
|
+
else
|
|
43
|
+
_workato_sdk_to_default_s
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting arrays
|
|
49
|
+
# and `to_s` patch was removed.
|
|
50
|
+
# We bring it back for a smooth upgrade.
|
|
51
|
+
class DateTime
|
|
52
|
+
alias_method :_workato_sdk_to_default_s, :to_s # rubocop:disable Style/Alias
|
|
53
|
+
private :_workato_sdk_to_default_s
|
|
54
|
+
|
|
55
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
56
|
+
def to_s(format = NOT_SET)
|
|
57
|
+
if (formatter = ::Time::DATE_FORMATS[format])
|
|
58
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
59
|
+
elsif format == NOT_SET
|
|
60
|
+
if (formatter = ::Time::DATE_FORMATS[:default])
|
|
61
|
+
if formatter.respond_to?(:call)
|
|
62
|
+
formatter.call(self).to_s
|
|
63
|
+
else
|
|
64
|
+
strftime(formatter)
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
_workato_sdk_to_default_s
|
|
68
|
+
end
|
|
69
|
+
else
|
|
70
|
+
_workato_sdk_to_default_s
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -18,7 +18,7 @@ module Enumerable
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
map do |val|
|
|
21
|
-
format %
|
|
21
|
+
format % Array.wrap(val).map { |v| v.is_a?(ActiveSupport::HashWithIndifferentAccess) ? v.symbolize_keys : v }
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -51,4 +51,47 @@ module Enumerable
|
|
|
51
51
|
result || nil
|
|
52
52
|
end.compact
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
# In Rails 7.1+, Ruby's `sum` is the preferred implementation.
|
|
56
|
+
# and `sum` patch was removed from ActiveSupport.
|
|
57
|
+
# We bring it back for a smooth upgrade.
|
|
58
|
+
alias_method :_workato_sdk_original_sum_with_required_identity, :sum # rubocop:disable Style/Alias
|
|
59
|
+
private :_workato_sdk_original_sum_with_required_identity
|
|
60
|
+
|
|
61
|
+
# Calculates a sum from the elements.
|
|
62
|
+
#
|
|
63
|
+
# payments.sum { |p| p.price * p.tax_rate }
|
|
64
|
+
# payments.sum(&:price)
|
|
65
|
+
#
|
|
66
|
+
# The latter is a shortcut for:
|
|
67
|
+
#
|
|
68
|
+
# payments.inject(0) { |sum, p| sum + p.price }
|
|
69
|
+
#
|
|
70
|
+
# It can also calculate the sum without the use of a block.
|
|
71
|
+
#
|
|
72
|
+
# [5, 15, 10].sum # => 30
|
|
73
|
+
# ['foo', 'bar'].sum('') # => "foobar"
|
|
74
|
+
# [[1, 2], [3, 1, 5]].sum([]) # => [1, 2, 3, 1, 5]
|
|
75
|
+
#
|
|
76
|
+
# The default sum of an empty list is zero. You can override this default:
|
|
77
|
+
#
|
|
78
|
+
# [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
|
|
79
|
+
def sum(identity = nil, &block)
|
|
80
|
+
if identity
|
|
81
|
+
_workato_sdk_original_sum_with_required_identity(identity, &block)
|
|
82
|
+
elsif block_given?
|
|
83
|
+
map(&block).sum
|
|
84
|
+
else
|
|
85
|
+
first = true
|
|
86
|
+
|
|
87
|
+
reduce(nil) do |sum, value|
|
|
88
|
+
if first
|
|
89
|
+
first = false
|
|
90
|
+
value
|
|
91
|
+
else
|
|
92
|
+
sum + value
|
|
93
|
+
end
|
|
94
|
+
end || 0
|
|
95
|
+
end
|
|
96
|
+
end
|
|
54
97
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting numbers
|
|
5
|
+
# and `to_s` patch was removed.
|
|
6
|
+
# We bring it back for a smooth upgrade.
|
|
7
|
+
module ActiveSupport
|
|
8
|
+
module NumericWithFormat
|
|
9
|
+
def to_s(format = nil, options = nil)
|
|
10
|
+
return super() if format.nil?
|
|
11
|
+
|
|
12
|
+
case format
|
|
13
|
+
when :phone
|
|
14
|
+
ActiveSupport::NumberHelper.number_to_phone(self, options || {})
|
|
15
|
+
when :currency
|
|
16
|
+
ActiveSupport::NumberHelper.number_to_currency(self, options || {})
|
|
17
|
+
when :percentage
|
|
18
|
+
ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
|
|
19
|
+
when :delimited
|
|
20
|
+
ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
|
|
21
|
+
when :rounded
|
|
22
|
+
ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
|
|
23
|
+
when :human
|
|
24
|
+
ActiveSupport::NumberHelper.number_to_human(self, options || {})
|
|
25
|
+
when :human_size
|
|
26
|
+
ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
|
|
27
|
+
when Symbol
|
|
28
|
+
super()
|
|
29
|
+
else
|
|
30
|
+
super(format)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Integer.prepend ActiveSupport::NumericWithFormat
|
|
37
|
+
Float.prepend ActiveSupport::NumericWithFormat
|
|
38
|
+
BigDecimal.prepend ActiveSupport::NumericWithFormat
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# typed: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting arrays
|
|
5
|
+
# and `to_s` patch was removed.
|
|
6
|
+
# We bring it back for a smooth upgrade.
|
|
7
|
+
module ActiveSupport
|
|
8
|
+
module RangeWithFormat
|
|
9
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
10
|
+
def to_s(format = NOT_SET)
|
|
11
|
+
if (formatter = RangeWithFormat::RANGE_FORMATS[format])
|
|
12
|
+
formatter.call(first, last)
|
|
13
|
+
elsif format == NOT_SET
|
|
14
|
+
if (formatter = RangeWithFormat::RANGE_FORMATS[:default])
|
|
15
|
+
formatter.call(first, last)
|
|
16
|
+
else
|
|
17
|
+
super()
|
|
18
|
+
end
|
|
19
|
+
else
|
|
20
|
+
super()
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Range.prepend(ActiveSupport::RangeWithFormat)
|
|
@@ -12,3 +12,59 @@ module Workato
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
Time.include(Workato::Extension::Time)
|
|
15
|
+
|
|
16
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting arrays
|
|
17
|
+
# and `to_s` patch was removed.
|
|
18
|
+
# We bring it back for a smooth upgrade.
|
|
19
|
+
class Time
|
|
20
|
+
alias_method :_workato_sdk_to_default_s, :to_s # rubocop:disable Style/Alias
|
|
21
|
+
private :_workato_sdk_to_default_s
|
|
22
|
+
|
|
23
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
24
|
+
def to_s(format = NOT_SET)
|
|
25
|
+
if (formatter = DATE_FORMATS[format])
|
|
26
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
27
|
+
elsif format == NOT_SET
|
|
28
|
+
if (formatter = ::Time::DATE_FORMATS[:default])
|
|
29
|
+
if formatter.respond_to?(:call)
|
|
30
|
+
formatter.call(self).to_s
|
|
31
|
+
else
|
|
32
|
+
strftime(formatter)
|
|
33
|
+
end
|
|
34
|
+
else
|
|
35
|
+
_workato_sdk_to_default_s
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
_workato_sdk_to_default_s
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
unless public_instance_methods.include?(:to_fs)
|
|
43
|
+
alias_method :to_fs, :to_s # rubocop:disable Style/Alias
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# In Rails 7.1+ `to_fs` is the preferred method for formatting arrays
|
|
48
|
+
# and `to_s` patch was removed.
|
|
49
|
+
# We bring it back for a smooth upgrade.
|
|
50
|
+
module ActiveSupport
|
|
51
|
+
class TimeWithZone
|
|
52
|
+
NOT_SET = Object.new unless defined?(NOT_SET)
|
|
53
|
+
|
|
54
|
+
def to_s(format = NOT_SET)
|
|
55
|
+
if format == :db
|
|
56
|
+
utc.to_fs(format)
|
|
57
|
+
elsif (formatter = ::Time::DATE_FORMATS[format])
|
|
58
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
59
|
+
elsif format == NOT_SET
|
|
60
|
+
if (formatter = ::Time::DATE_FORMATS[:default])
|
|
61
|
+
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
|
62
|
+
else
|
|
63
|
+
"#{time.strftime('%Y-%m-%d %H:%M:%S')} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
"#{time.strftime('%Y-%m-%d %H:%M:%S')} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
data/lib/workato/web/app.rb
CHANGED
|
@@ -11,9 +11,9 @@ module Workato
|
|
|
11
11
|
req = Rack::Request.new(env)
|
|
12
12
|
case req.path_info
|
|
13
13
|
when /#{CODE_PATH}/
|
|
14
|
-
[200, { 'Content-Type' => 'text/plain' }, [@
|
|
14
|
+
[200, { 'Content-Type' => 'text/plain' }, [@params&.to_json.to_s]]
|
|
15
15
|
when /#{CALLBACK_PATH}/
|
|
16
|
-
@
|
|
16
|
+
@params = req.params
|
|
17
17
|
[200, { 'Content-Type' => 'text/plain' }, ['We stored response code. Now you can close the browser window']]
|
|
18
18
|
else
|
|
19
19
|
[404, { 'Content-Type' => 'text/plain' }, ['404: Not Found']]
|
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.3.
|
|
4
|
+
version: 1.3.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Abolmasov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '5.2'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '8.1'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '5.2'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '8.1'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: aws-sigv4
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -54,16 +54,22 @@ dependencies:
|
|
|
54
54
|
name: bundler
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
|
-
- - "
|
|
57
|
+
- - ">="
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '2.0'
|
|
60
|
+
- - "<"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '5.0'
|
|
60
63
|
type: :runtime
|
|
61
64
|
prerelease: false
|
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
63
66
|
requirements:
|
|
64
|
-
- - "
|
|
67
|
+
- - ">="
|
|
65
68
|
- !ruby/object:Gem::Version
|
|
66
69
|
version: '2.0'
|
|
70
|
+
- - "<"
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '5.0'
|
|
67
73
|
- !ruby/object:Gem::Dependency
|
|
68
74
|
name: charlock_holmes
|
|
69
75
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,9 +97,6 @@ dependencies:
|
|
|
91
97
|
- - "~>"
|
|
92
98
|
- !ruby/object:Gem::Version
|
|
93
99
|
version: '1.0'
|
|
94
|
-
- - "!="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: 1.3.5
|
|
97
100
|
type: :runtime
|
|
98
101
|
prerelease: false
|
|
99
102
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -101,9 +104,6 @@ dependencies:
|
|
|
101
104
|
- - "~>"
|
|
102
105
|
- !ruby/object:Gem::Version
|
|
103
106
|
version: '1.0'
|
|
104
|
-
- - "!="
|
|
105
|
-
- !ruby/object:Gem::Version
|
|
106
|
-
version: 1.3.5
|
|
107
107
|
- !ruby/object:Gem::Dependency
|
|
108
108
|
name: em-http-request
|
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -462,8 +462,10 @@ files:
|
|
|
462
462
|
- lib/workato/extension/integer.rb
|
|
463
463
|
- lib/workato/extension/metadata_fix_wrap_kw_args.rb
|
|
464
464
|
- lib/workato/extension/nil_class.rb
|
|
465
|
+
- lib/workato/extension/numeric.rb
|
|
465
466
|
- lib/workato/extension/object.rb
|
|
466
467
|
- lib/workato/extension/phone.rb
|
|
468
|
+
- lib/workato/extension/range.rb
|
|
467
469
|
- lib/workato/extension/string.rb
|
|
468
470
|
- lib/workato/extension/symbol.rb
|
|
469
471
|
- lib/workato/extension/time.rb
|
|
@@ -515,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
515
517
|
- !ruby/object:Gem::Version
|
|
516
518
|
version: '0'
|
|
517
519
|
requirements: []
|
|
518
|
-
rubygems_version: 3.
|
|
520
|
+
rubygems_version: 3.4.19
|
|
519
521
|
signing_key:
|
|
520
522
|
specification_version: 4
|
|
521
523
|
summary: Gem for running adapter's code outside Workato infrastructure
|