workato-connector-sdk 1.3.18 → 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/connector/sdk/dsl/csv_package.rb +8 -1
- data/lib/workato/connector/sdk.rb +2 -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
- metadata +6 -4
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
|
|
@@ -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
|
|
@@ -19,10 +19,12 @@ require_relative '../extension/date'
|
|
|
19
19
|
require_relative '../extension/enumerable'
|
|
20
20
|
require_relative '../extension/extra_chain_cert'
|
|
21
21
|
require_relative '../extension/hash'
|
|
22
|
+
require_relative '../extension/numeric'
|
|
22
23
|
require_relative '../extension/integer'
|
|
23
24
|
require_relative '../extension/nil_class'
|
|
24
25
|
require_relative '../extension/object'
|
|
25
26
|
require_relative '../extension/phone'
|
|
27
|
+
require_relative '../extension/range'
|
|
26
28
|
require_relative '../extension/string'
|
|
27
29
|
require_relative '../extension/symbol'
|
|
28
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
|
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: 2026-01-
|
|
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
|
|
@@ -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
|