Skip to content

Commit d7f731f

Browse files
Merge pull request #7 from sendinblue/feature_updated_swagger_sync
swagger sync: for webhook updates
2 parents ce1be98 + f16b701 commit d7f731f

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

lib/sib-api-v3-sdk/models/update_webhook.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ class UpdateWebhook
2424
# Events triggering the webhook. Possible values for Transactional type webhook – request, delivered, hardBounce, softBounce, blocked, spam, invalid, deferred, click, opened, uniqueOpened and unsubscribed and possible values for Marketing type webhook – spam, opened, click, hardBounce, softBounce, unsubscribed, listAddition and delivered
2525
attr_accessor :events
2626

27+
class EnumAttributeValidator
28+
attr_reader :datatype
29+
attr_reader :allowable_values
30+
31+
def initialize(datatype, allowable_values)
32+
@allowable_values = allowable_values.map do |value|
33+
case datatype.to_s
34+
when /Integer/i
35+
value.to_i
36+
when /Float/i
37+
value.to_f
38+
else
39+
value
40+
end
41+
end
42+
end
43+
44+
def valid?(value)
45+
!value || allowable_values.include?(value)
46+
end
47+
end
2748

2849
# Attribute mapping from ruby-style variable name to JSON key.
2950
def self.attribute_map

lib/sib-api-v3-sdk/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
=end
1212

1313
module SibApiV3Sdk
14-
VERSION = "2.1.0"
14+
VERSION = "2.1.1"
1515
end

spec/models/create_webhook_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
describe 'test attribute "events"' do
4848
it 'should work' do
4949
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["hardBounce", "softBounce", "blocked", "spam", "delivered", "request", "click", "invalid", "deferred", "opened", "uniqueOpened", "unsubscribed", "listAddition"])
51+
#validator.allowable_values.each do |value|
52+
# expect { @instance.events = value }.not_to raise_error
53+
#end
5054
end
5155
end
5256

spec/models/update_webhook_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
describe 'test attribute "events"' do
4848
it 'should work' do
4949
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["hardBounce", "softBounce", "blocked", "spam", "delivered", "request", "click", "invalid", "deferred", "opened", "uniqueOpened", "unsubscribed", "listAddition"])
51+
#validator.allowable_values.each do |value|
52+
# expect { @instance.events = value }.not_to raise_error
53+
#end
5054
end
5155
end
5256

0 commit comments

Comments
 (0)