workato-connector-sdk 0.1.1 → 0.4.0

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.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +57 -30
  3. data/exe/workato +12 -1
  4. data/lib/workato/cli/edit_command.rb +1 -3
  5. data/lib/workato/cli/exec_command.rb +23 -7
  6. data/lib/workato/cli/generate_command.rb +1 -2
  7. data/lib/workato/cli/generators/connector_generator.rb +4 -1
  8. data/lib/workato/cli/main.rb +50 -3
  9. data/lib/workato/cli/oauth2_command.rb +180 -0
  10. data/lib/workato/cli/push_command.rb +36 -24
  11. data/lib/workato/connector/sdk/action.rb +52 -4
  12. data/lib/workato/connector/sdk/connection.rb +144 -0
  13. data/lib/workato/connector/sdk/connector.rb +24 -9
  14. data/lib/workato/connector/sdk/dsl/aws.rb +225 -0
  15. data/lib/workato/connector/sdk/dsl/error.rb +1 -1
  16. data/lib/workato/connector/sdk/dsl/http.rb +19 -0
  17. data/lib/workato/connector/sdk/dsl/time.rb +8 -1
  18. data/lib/workato/connector/sdk/dsl/workato_code_lib.rb +21 -4
  19. data/lib/workato/connector/sdk/dsl.rb +2 -0
  20. data/lib/workato/connector/sdk/errors.rb +16 -1
  21. data/lib/workato/connector/sdk/object_definitions.rb +10 -10
  22. data/lib/workato/connector/sdk/operation.rb +38 -40
  23. data/lib/workato/connector/sdk/request.rb +11 -7
  24. data/lib/workato/connector/sdk/schema/field/array.rb +25 -0
  25. data/lib/workato/connector/sdk/schema/field/convertors.rb +189 -0
  26. data/lib/workato/connector/sdk/schema/field/date.rb +28 -0
  27. data/lib/workato/connector/sdk/schema/field/date_time.rb +28 -0
  28. data/lib/workato/connector/sdk/schema/field/integer.rb +27 -0
  29. data/lib/workato/connector/sdk/schema/field/number.rb +27 -0
  30. data/lib/workato/connector/sdk/schema/field/object.rb +25 -0
  31. data/lib/workato/connector/sdk/schema/field/string.rb +26 -0
  32. data/lib/workato/connector/sdk/schema/type/time.rb +53 -0
  33. data/lib/workato/connector/sdk/schema/type/unicode_string.rb +22 -0
  34. data/lib/workato/connector/sdk/schema.rb +230 -0
  35. data/lib/workato/connector/sdk/settings.rb +6 -3
  36. data/lib/workato/connector/sdk/trigger.rb +25 -0
  37. data/lib/workato/connector/sdk/version.rb +1 -1
  38. data/lib/workato/connector/sdk.rb +1 -0
  39. data/lib/workato/extension/string.rb +20 -10
  40. data/lib/workato/web/app.rb +23 -0
  41. data/templates/Gemfile.erb +1 -0
  42. data/templates/spec/action_spec.rb.erb +7 -1
  43. data/templates/spec/trigger_spec.rb.erb +6 -0
  44. metadata +102 -4
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './convertors'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Field
10
+ class DateTime < SimpleDelegator
11
+ include Convertors
12
+
13
+ DEFAULT_ATTRIBUTES = {
14
+ type: 'date_time',
15
+ control_type: 'date_time',
16
+ render_input: 'date_time_conversion',
17
+ parse_output: 'date_time_conversion'
18
+ }.with_indifferent_access.freeze
19
+
20
+ def initialize(field)
21
+ super(DEFAULT_ATTRIBUTES.merge(field))
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './convertors'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Field
10
+ class Integer < SimpleDelegator
11
+ include Convertors
12
+
13
+ DEFAULT_ATTRIBUTES = {
14
+ type: 'integer',
15
+ control_type: 'number',
16
+ parse_output: 'integer_conversion'
17
+ }.with_indifferent_access.freeze
18
+
19
+ def initialize(field)
20
+ super(DEFAULT_ATTRIBUTES.merge(field))
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './convertors'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Field
10
+ class Number < SimpleDelegator
11
+ include Convertors
12
+
13
+ DEFAULT_ATTRIBUTES = {
14
+ type: 'number',
15
+ control_type: 'number',
16
+ parse_output: 'float_conversion'
17
+ }.with_indifferent_access.freeze
18
+
19
+ def initialize(field)
20
+ super(DEFAULT_ATTRIBUTES.merge(field))
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './convertors'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Field
10
+ class Object < SimpleDelegator
11
+ include Convertors
12
+
13
+ DEFAULT_ATTRIBUTES = {
14
+ type: 'object'
15
+ }.with_indifferent_access.freeze
16
+
17
+ def initialize(field)
18
+ super(DEFAULT_ATTRIBUTES.merge(field))
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './convertors'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Field
10
+ class String < SimpleDelegator
11
+ include Convertors
12
+
13
+ DEFAULT_ATTRIBUTES = {
14
+ type: 'string',
15
+ control_type: 'text'
16
+ }.with_indifferent_access.freeze
17
+
18
+ def initialize(field)
19
+ super(DEFAULT_ATTRIBUTES.merge(field))
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'time'
4
+
5
+ module Workato
6
+ module Connector
7
+ module Sdk
8
+ class Schema
9
+ module Type
10
+ class Time < ::Time
11
+ PRECISION = 6
12
+
13
+ def to_s(*args)
14
+ if args.present?
15
+ super
16
+ else
17
+ xmlschema(PRECISION)
18
+ end
19
+ end
20
+
21
+ def self.from_time(value)
22
+ new(
23
+ value.year,
24
+ value.month,
25
+ value.day,
26
+ value.hour,
27
+ value.min,
28
+ value.sec + Rational(value.nsec, 1_000_000_000),
29
+ value.utc_offset
30
+ )
31
+ end
32
+
33
+ def self.from_date_time(value)
34
+ new(
35
+ value.year,
36
+ value.month,
37
+ value.day,
38
+ value.hour,
39
+ value.min,
40
+ value.sec + Rational(value.nsec, 1_000_000_000),
41
+ value.zone
42
+ )
43
+ end
44
+
45
+ def self.xmlschema(str)
46
+ from_time(super(str))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Workato
4
+ module Connector
5
+ module Sdk
6
+ class Schema
7
+ module Type
8
+ class UnicodeString < ::String
9
+ def initialize(str)
10
+ super(str, {})
11
+ encode!('UTF-8')
12
+ end
13
+
14
+ def binary?
15
+ false
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,230 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Workato
4
+ module Connector
5
+ module Sdk
6
+ class Schema < SimpleDelegator
7
+ def initialize(schema: [])
8
+ super(Fields.new(::Array.wrap(schema).map(&:with_indifferent_access)))
9
+ end
10
+
11
+ def trim(input)
12
+ input.with_indifferent_access.keep_if { |property_name| includes_property?(property_name) }
13
+ end
14
+
15
+ def apply(input, enforce_required:, &block)
16
+ input.with_indifferent_access.tap do |input_with_indifferent_access|
17
+ apply_to_hash(self, input_with_indifferent_access, enforce_required: enforce_required, &block)
18
+ end
19
+ end
20
+
21
+ def +(other)
22
+ if other.is_a?(Schema)
23
+ Schema.new.tap do |schema|
24
+ schema.__setobj__(__getobj__ + other.__getobj__)
25
+ end
26
+ else
27
+ Schema.new(schema: __getobj__ + other)
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def includes_property?(name)
34
+ find_property_by_name(name).present?
35
+ end
36
+
37
+ def find_property_by_name(name)
38
+ find do |property|
39
+ (property[:name].to_s == name.to_s) || (property.dig(:toggle_field, :name).to_s == name.to_s)
40
+ end
41
+ end
42
+
43
+ def apply_to_hash(properties, object, enforce_required: false, &block)
44
+ return if properties.blank? || object.nil?
45
+
46
+ properties.each do |property|
47
+ apply_to_value(property, object, property[:name], object[property[:name]], &block)
48
+ if (toggle_property = property[:toggle_field])
49
+ apply_to_value(toggle_property, object, toggle_property[:name], object[toggle_property[:name]], &block)
50
+ end
51
+
52
+ next unless enforce_required
53
+ next if optional_or_present?(property, object) || optional_or_present?(property[:toggle_field], object)
54
+
55
+ raise MissingRequiredInput.new(property[:label], property.dig(:toggle_field, :label))
56
+ end
57
+ end
58
+
59
+ def optional_or_present?(property, object)
60
+ property.present? && (
61
+ property[:optional] ||
62
+ property[:runtime_optional] ||
63
+ (value = object[property[:name]]).present? ||
64
+ value.is_a?(FalseClass) ||
65
+ (value.is_a?(::String) && !value.empty?)
66
+ )
67
+ end
68
+
69
+ def apply_to_array(property, array, &block)
70
+ array.each_with_index do |item, index|
71
+ apply_to_value(property, array, index, item, &block)
72
+ end
73
+ end
74
+
75
+ def apply_to_value(property, container, index, value, &block)
76
+ return unless property.present? && value.present?
77
+
78
+ if value.respond_to?(:each_key)
79
+ apply_to_hash(property[:properties], value, &block)
80
+ elsif value.respond_to?(:each_with_index)
81
+ apply_to_array(property, value, &block)
82
+ end
83
+
84
+ container[index] = if !value.nil? && block
85
+ normalize_value(yield(value, property))
86
+ else
87
+ normalize_value(value)
88
+ end
89
+ end
90
+
91
+ def normalize_value(value)
92
+ return value if value.blank?
93
+
94
+ case value
95
+ when ::Time
96
+ return Type::Time.from_time(value)
97
+ when ::DateTime
98
+ return Type::Time.from_date_time(value)
99
+ when ::Date
100
+ return value.to_date
101
+ when ::Numeric, ::TrueClass, ::FalseClass, Workato::Extension::Binary, Type::UnicodeString,
102
+ ::Array, ::Hash
103
+ return value
104
+ when Extension::Array::ArrayWhere
105
+ return value.to_a
106
+ when ::String
107
+ if value.encoding == Encoding::ASCII_8BIT
108
+ return Workato::Extension::Binary.new(value)
109
+ end
110
+
111
+ return Type::UnicodeString.new(value)
112
+ else
113
+ if value.respond_to?(:to_time)
114
+ return Type::Time.from_time(value.to_time)
115
+ end
116
+
117
+ if value.respond_to?(:read) && value.respond_to?(:rewind)
118
+ value.rewind
119
+ return Workato::Extension::Binary.new(value.read.force_encoding(Encoding::ASCII_8BIT))
120
+ end
121
+ end
122
+
123
+ raise ArgumentError, "Unsupported data type: #{value.class}"
124
+ end
125
+ end
126
+
127
+ class Fields < ::Array
128
+ def initialize(fields)
129
+ ::Array.wrap(fields).each do |field|
130
+ field = prepare_attributes(field)
131
+ self << field_with_defaults(field)
132
+ end
133
+ end
134
+
135
+ private
136
+
137
+ def prepare_attributes(field)
138
+ if (render_input = field.delete(:convert_input) || field[:render_input])
139
+ field[:render_input] = render_input.is_a?(Proc) ? nil : render_input
140
+ end
141
+ if (parse_output = field.delete(:convert_output) || field[:parse_output])
142
+ field[:parse_output] = parse_output.is_a?(Proc) ? nil : parse_output
143
+ end
144
+ field[:optional] = true unless field.key?(:optional)
145
+ field[:label] ||= field[:name].labelize
146
+
147
+ clean_values(field)
148
+
149
+ if (toggle_field = field[:toggle_field]).present?
150
+ raise InvalidSchemaError, 'toggle_hint not present' if field[:toggle_hint].blank?
151
+
152
+ unless toggle_field[:name].present? && toggle_field[:type].present?
153
+ raise InvalidSchemaError, 'toggle_field not complete'
154
+ end
155
+
156
+ if toggle_field[:optional].present? && (toggle_field[:optional] != field[:optional])
157
+ raise InvalidSchemaError, 'toggle field cannot change optional attribute'
158
+ end
159
+
160
+ field[:toggle_field] = field_with_defaults(field[:toggle_field]).tap do |tg_field|
161
+ tg_field.except!(:render_input, :parse_output, :control_type)
162
+ tg_field[:control_type] = toggle_field[:control_type]
163
+ clean_values(tg_field)
164
+ end
165
+ end
166
+
167
+ if field[:control_type].try(:start_with?, 'small-')
168
+ field[:control_type].remove!(/^small-/)
169
+ elsif field[:control_type].try(:start_with?, 'medium-')
170
+ field[:control_type].remove!(/^medium-/)
171
+ end
172
+
173
+ field
174
+ end
175
+
176
+ def clean_values(field)
177
+ field.transform_values! do |value|
178
+ value.presence && (value.is_a?(::Symbol) && value.to_s || value)
179
+ end
180
+ field.compact!
181
+ field
182
+ end
183
+
184
+ def field_with_defaults(field)
185
+ type = field.delete(:type).to_s
186
+
187
+ case type
188
+ when 'integer'
189
+ Schema::Field::Integer.new(field)
190
+ when 'number', 'boolean'
191
+ Schema::Field::Number.new(field)
192
+ when 'date_time', 'timestamp'
193
+ Schema::Field::DateTime.new(field)
194
+ when 'date'
195
+ Schema::Field::Date.new(field)
196
+ when 'object'
197
+ field[:properties] = Fields.new(field[:properties])
198
+ field.delete(:control_type)
199
+ Schema::Field::Object.new(field)
200
+ when 'array'
201
+ of = field[:of] = (field[:of] || 'object').to_s
202
+ if of == 'object'
203
+ field[:properties] = Fields.new(field[:properties])
204
+ else
205
+ field.merge(
206
+ field_with_defaults(field.merge(type: of)).except(:render_input, :parse_output)
207
+ )
208
+ end
209
+ Schema::Field::Array.new(field)
210
+ else
211
+ Schema::Field::String.new(field)
212
+ end
213
+ end
214
+ end
215
+
216
+ private_constant :Fields
217
+ end
218
+ end
219
+ end
220
+
221
+ require_relative './schema/field/array'
222
+ require_relative './schema/field/date'
223
+ require_relative './schema/field/date_time'
224
+ require_relative './schema/field/integer'
225
+ require_relative './schema/field/number'
226
+ require_relative './schema/field/object'
227
+ require_relative './schema/field/string'
228
+
229
+ require_relative './schema/type/time'
230
+ require_relative './schema/type/unicode_string'
@@ -45,6 +45,8 @@ module Workato
45
45
  begin
46
46
  @encrypted = false
47
47
  read_plain_file
48
+ rescue KeyError
49
+ raise
48
50
  rescue StandardError
49
51
  @encrypted = true
50
52
  read_encrypted_file
@@ -76,7 +78,7 @@ module Workato
76
78
  YAML.safe_load(f.read, [::Symbol]).to_hash.with_indifferent_access
77
79
  end
78
80
 
79
- name ? all_settings.fetch(name) : all_settings
81
+ (name ? all_settings.fetch(name) : all_settings) || {}
80
82
  end
81
83
 
82
84
  def update_plain_file(new_settings)
@@ -93,7 +95,7 @@ module Workato
93
95
  def read_encrypted_file
94
96
  all_settings = encrypted_configuration.config.with_indifferent_access
95
97
 
96
- name ? all_settings.fetch(name) : all_settings
98
+ (name ? all_settings.fetch(name) : all_settings) || {}
97
99
  end
98
100
 
99
101
  def update_encrypted_file(new_settings)
@@ -106,7 +108,8 @@ module Workato
106
108
 
107
109
  def merge_settings(all_settings, new_settings)
108
110
  if name
109
- all_settings[name] = new_settings
111
+ all_settings[name] ||= {}
112
+ all_settings[name].merge!(new_settings)
110
113
  else
111
114
  all_settings.merge!(new_settings)
112
115
  end
@@ -89,7 +89,32 @@ module Workato
89
89
  end
90
90
  end
91
91
 
92
+ def invoke(input = {}, payload = {}, headers = {}, params = {})
93
+ extended_schema = extended_schema(nil, input)
94
+ config_schema = Schema.new(schema: config_fields_schema)
95
+ input_schema = Schema.new(schema: extended_schema[:input])
96
+ output_schema = Schema.new(schema: extended_schema[:output])
97
+
98
+ input = apply_input_schema(input, config_schema + input_schema)
99
+ output = if webhook_notification?
100
+ webhook_notification(input, payload, input_schema, output_schema, headers, params)
101
+ else
102
+ poll(nil, input, nil, input_schema, output_schema)
103
+ end
104
+ output[:events].each do |event|
105
+ apply_output_schema(event, output_schema)
106
+ end
107
+
108
+ output
109
+ end
110
+
111
+ private
112
+
92
113
  alias trigger operation
114
+
115
+ def webhook_notification?
116
+ trigger[:webhook_notification].present?
117
+ end
93
118
  end
94
119
  end
95
120
  end
@@ -3,7 +3,7 @@
3
3
  module Workato
4
4
  module Connector
5
5
  module Sdk
6
- VERSION = '0.1.1'
6
+ VERSION = '0.4.0'
7
7
  end
8
8
  end
9
9
  end
@@ -43,6 +43,7 @@ require_relative '../extension/time'
43
43
 
44
44
  require_relative './sdk/account_properties'
45
45
  require_relative './sdk/action'
46
+ require_relative './sdk/connection'
46
47
  require_relative './sdk/connector'
47
48
  require_relative './sdk/dsl'
48
49
  require_relative './sdk/errors'
@@ -98,7 +98,7 @@ module Workato
98
98
  alias encode_hex to_hex
99
99
 
100
100
  def decode_hex
101
- Binary.new([self].pack('H*'))
101
+ Extension::Binary.new([self].pack('H*'))
102
102
  end
103
103
 
104
104
  def encode_base64
@@ -106,7 +106,7 @@ module Workato
106
106
  end
107
107
 
108
108
  def decode_base64
109
- Binary.new(Base64.decode64(self))
109
+ Extension::Binary.new(Base64.decode64(self))
110
110
  end
111
111
 
112
112
  def encode_urlsafe_base64
@@ -117,22 +117,32 @@ module Workato
117
117
  ::ERB::Util.url_encode(self)
118
118
  end
119
119
 
120
+ def decode_url
121
+ CGI.unescape(self)
122
+ end
123
+
120
124
  def decode_urlsafe_base64
121
- Binary.new(Base64.urlsafe_decode64(self))
125
+ Extension::Binary.new(Base64.urlsafe_decode64(self))
122
126
  end
123
127
 
124
128
  def encode_sha256
125
- Binary.new(::Digest::SHA256.digest(self))
129
+ Extension::Binary.new(::Digest::SHA256.digest(self))
126
130
  end
127
131
 
128
132
  def hmac_sha256(key)
129
133
  digest = ::OpenSSL::Digest.new('sha256')
130
- Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
134
+ Extension::Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
131
135
  end
132
136
 
133
137
  def hmac_sha512(key)
134
138
  digest = ::OpenSSL::Digest.new('sha512')
135
- Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
139
+ Extension::Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
140
+ end
141
+
142
+ def rsa_sha256(key)
143
+ digest = ::OpenSSL::Digest.new('sha256')
144
+ private_key = ::OpenSSL::PKey::RSA.new(key)
145
+ Workato::Extension::Binary.new(private_key.sign(digest, self))
136
146
  end
137
147
 
138
148
  def md5_hexdigest
@@ -140,17 +150,17 @@ module Workato
140
150
  end
141
151
 
142
152
  def sha1
143
- Binary.new(::Digest::SHA1.digest(self))
153
+ Extension::Binary.new(::Digest::SHA1.digest(self))
144
154
  end
145
155
 
146
156
  def hmac_sha1(key)
147
157
  digest = ::OpenSSL::Digest.new('sha1')
148
- Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
158
+ Extension::Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
149
159
  end
150
160
 
151
161
  def hmac_md5(key)
152
162
  digest = ::OpenSSL::Digest.new('md5')
153
- Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
163
+ Extension::Binary.new(::OpenSSL::HMAC.digest(digest, key, self))
154
164
  end
155
165
 
156
166
  def from_xml
@@ -228,7 +238,7 @@ module Workato
228
238
  end
229
239
 
230
240
  def as_string(encoding)
231
- String.new(self, encoding: encoding).encode(encoding, invalid: :replace, undef: :replace)
241
+ ::String.new(self, encoding: encoding).encode(encoding, invalid: :replace, undef: :replace)
232
242
  end
233
243
 
234
244
  def as_utf8
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Workato
4
+ module Web
5
+ class App
6
+ CODE_PATH = '/code'
7
+ CALLBACK_PATH = '/oauth/callback'
8
+
9
+ def call(env)
10
+ req = Rack::Request.new(env)
11
+ case req.path_info
12
+ when /#{CODE_PATH}/
13
+ [200, { 'Content-Type' => 'text/plain' }, [@code.to_s]]
14
+ when /#{CALLBACK_PATH}/
15
+ @code = req.params['code']
16
+ [200, { 'Content-Type' => 'text/plain' }, ['We stored response code. Now you can close the browser window']]
17
+ else
18
+ [404, { 'Content-Type' => 'text/plain' }, ['404: Not Found']]
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
5
5
  gem 'byebug'
6
6
  gem 'rspec'
7
7
  gem 'timecop'
8
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
8
9
  gem 'vcr'
9
10
  gem 'webmock'
10
11
  gem 'workato-connector-sdk'
@@ -5,13 +5,19 @@ RSpec.describe 'actions/<%= name %>', :vcr do
5
5
  # Spec describes the most commons blocks of an action. Remove describes that you don't need.
6
6
  # Learn more: https://docs.workato.com/developing-connectors/sdk/cli/reference/rspec-commands.html
7
7
 
8
+ subject(:output) { connector.actions.<%= name %>(input) }
9
+
8
10
  let(:connector) { Workato::Connector::Sdk::Connector.from_file('connector.rb', settings) }
9
11
  let(:settings) { Workato::Connector::Sdk::Settings.from_default_file }
12
+ let(:input) { {} }
13
+
14
+ pending 'add some examples for action output'
10
15
 
16
+ # Or add more fine grained tests for each action definition block
11
17
  let(:action) { connector.actions.<%= name %> }
12
18
 
13
19
  describe 'execute' do
14
- subject(:output) { action.execute(settings, input, extended_input_schema, extended_output_schema) }
20
+ subject(:output) { action.execute(settings, input, extended_input_schema, extended_output_schema, continue) }
15
21
 
16
22
  pending 'add some examples'
17
23
  end
@@ -6,9 +6,15 @@ RSpec.describe 'triggers/<%= name %>', :vcr do
6
6
  # Depending on the type of your trigger remove describes that you don't need.
7
7
  # Learn more: https://docs.workato.com/developing-connectors/sdk/cli/reference/rspec-commands.html
8
8
 
9
+ subject(:output) { connector.triggers.<%= name %>(input) }
10
+
9
11
  let(:connector) { Workato::Connector::Sdk::Connector.from_file('connector.rb', settings) }
10
12
  let(:settings) { Workato::Connector::Sdk::Settings.from_default_file }
13
+ let(:input) { {} }
14
+
15
+ pending 'add some examples for trigger output'
11
16
 
17
+ # Or add more fine grained tests for each trigger definition block
12
18
  let(:trigger) { connector.triggers.<%= name %> }
13
19
 
14
20
  describe 'webhook_subscribe' do