noresponse 3.0.8 → 4.0.1
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/lib/no_response/models/shared/webhookdeliveryattempt.rb +4 -10
- data/lib/no_response/models/shared/webhookreplay.rb +4 -10
- data/lib/no_response/models/shared.rb +0 -1
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/no_response/webhooks.rb +28 -2
- metadata +1 -3
- data/lib/no_response/models/shared/eventtype.rb +0 -18
- data/lib/no_response/models/shared/eventtype.rbi +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa139d0d85091fddabfe4d07a2c8694222f9ed5c5be76cc716f8ca7f1ed7e0f3
|
|
4
|
+
data.tar.gz: 3164ac403c8fcd1f7a54658ea6e8a86c66a620c66b3c20f789349d07d006790d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4413543c0d01ac1eb9a9e72f32dfff5390d9f0992a76c3e865c331ab5039585ced60f1128c99421ec2c514e495183ad931317b14d07d31616c535c217a600590
|
|
7
|
+
data.tar.gz: 4421d7d84256867b1420d72c10e1bb29a7dfbbb63169f12b3ce38344de8c1e61fe185d13cf6e1b2a82a8caf9fcad02ea1849ed218803e2bbbacbca0bb0f9d7ff
|
|
@@ -15,17 +15,11 @@ module NoResponse
|
|
|
15
15
|
::String,
|
|
16
16
|
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("event_id"), required: true}}
|
|
17
17
|
)
|
|
18
|
-
|
|
18
|
+
# The event's type, as its body's type: assessment.updated, account.deleted or account.risk_changed.
|
|
19
19
|
field(
|
|
20
20
|
:event_type,
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
'format_json': {
|
|
24
|
-
'letter_case': ::NoResponse::Utils.field_name("event_type"),
|
|
25
|
-
required: true,
|
|
26
|
-
'decoder': ::NoResponse::Utils.open_enum_from_string(Models::Shared::EventType, false)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
21
|
+
::String,
|
|
22
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("event_type"), required: true}}
|
|
29
23
|
)
|
|
30
24
|
# Which attempt of this delivery this was: 1 for the first send, up to 9 with retries. A replay counts its own attempts from 1.
|
|
31
25
|
field(
|
|
@@ -84,7 +78,7 @@ module NoResponse
|
|
|
84
78
|
sig {
|
|
85
79
|
params(
|
|
86
80
|
event_id: ::String,
|
|
87
|
-
event_type:
|
|
81
|
+
event_type: ::String,
|
|
88
82
|
attempt: ::Integer,
|
|
89
83
|
replay: T::Boolean,
|
|
90
84
|
status: Models::Shared::WebhookDeliveryAttemptStatus,
|
|
@@ -21,20 +21,14 @@ module NoResponse
|
|
|
21
21
|
::String,
|
|
22
22
|
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("event_id"), required: true}}
|
|
23
23
|
)
|
|
24
|
-
|
|
24
|
+
# The event's type, as its body's type: assessment.updated, account.deleted or account.risk_changed.
|
|
25
25
|
field(
|
|
26
26
|
:event_type,
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
'format_json': {
|
|
30
|
-
'letter_case': ::NoResponse::Utils.field_name("event_type"),
|
|
31
|
-
required: true,
|
|
32
|
-
'decoder': ::NoResponse::Utils.open_enum_from_string(Models::Shared::EventType, false)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
27
|
+
::String,
|
|
28
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("event_type"), required: true}}
|
|
35
29
|
)
|
|
36
30
|
|
|
37
|
-
sig { params(endpoint_id: ::String, event_id: ::String, event_type:
|
|
31
|
+
sig { params(endpoint_id: ::String, event_id: ::String, event_type: ::String).void }
|
|
38
32
|
def initialize(endpoint_id:, event_id:, event_type:)
|
|
39
33
|
@endpoint_id = endpoint_id
|
|
40
34
|
@event_id = event_id
|
|
@@ -42,7 +42,6 @@ module NoResponse
|
|
|
42
42
|
autoload :ConsistencyValue, "no_response/models/shared/consistencyvalue.rb"
|
|
43
43
|
autoload :Country, "no_response/models/shared/country.rb"
|
|
44
44
|
autoload :Depth, "no_response/models/shared/depth.rb"
|
|
45
|
-
autoload :EventType, "no_response/models/shared/eventtype.rb"
|
|
46
45
|
autoload :Failure, "no_response/models/shared/failure.rb"
|
|
47
46
|
autoload :FailureReason, "no_response/models/shared/failurereason.rb"
|
|
48
47
|
autoload :Flow, "no_response/models/shared/flow.rb"
|
|
@@ -95,9 +95,9 @@ module NoResponse
|
|
|
95
95
|
|
|
96
96
|
@language = "ruby"
|
|
97
97
|
@openapi_doc_version = "1"
|
|
98
|
-
@sdk_version = "
|
|
98
|
+
@sdk_version = "4.0.1"
|
|
99
99
|
@gen_version = "internal"
|
|
100
|
-
@user_agent = "noresponse-sdk/ruby
|
|
100
|
+
@user_agent = "noresponse-sdk/ruby 4.0.1 internal 1 noresponse"
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
sig { returns([String, T::Hash[Symbol, String]]) }
|
data/lib/no_response/webhooks.rb
CHANGED
|
@@ -60,12 +60,21 @@ module NoResponse
|
|
|
60
60
|
# until it is verified again.
|
|
61
61
|
EndpointDisabled = Struct.new(:endpoint_id, :failing_since, :disabled_at, keyword_init: true)
|
|
62
62
|
|
|
63
|
+
# The account's decision for at least one flow changed. account is a
|
|
64
|
+
# Models::Shared::Account exactly as accounts.get returns it, with its new
|
|
65
|
+
# risk and decisions; previous_decisions_by_flow is a
|
|
66
|
+
# Models::Shared::AccountDecisionsByFlow holding the decisions it replaced.
|
|
67
|
+
# It is not sent when the score moves within the same decision, nor for an
|
|
68
|
+
# account's first risk.
|
|
69
|
+
AccountRiskChanged = Struct.new(:account, :previous_decisions_by_flow, keyword_init: true)
|
|
70
|
+
|
|
63
71
|
# A verified delivery. data is a Models::Shared::Assessment (exactly as
|
|
64
72
|
# assessments.get returns it) or an AssessmentExpired for type
|
|
65
73
|
# "assessment.updated", an EndpointVerification for
|
|
66
74
|
# "endpoint.verification", an AccountDeleted for "account.deleted", a
|
|
67
|
-
# TenantDeleted for "tenant.deleted"
|
|
68
|
-
# "webhook_endpoint.disabled"
|
|
75
|
+
# TenantDeleted for "tenant.deleted", an EndpointDisabled for
|
|
76
|
+
# "webhook_endpoint.disabled" and an AccountRiskChanged for
|
|
77
|
+
# "account.risk_changed". Deliveries are at least once and unordered:
|
|
69
78
|
# deduplicate on id and keep the highest detail.assessment_version.
|
|
70
79
|
Event = Struct.new(:id, :type, :created_at, :data, :test, keyword_init: true) do
|
|
71
80
|
# True for the terminal expiry event: delete what you hold and fetch nothing.
|
|
@@ -178,6 +187,8 @@ module NoResponse
|
|
|
178
187
|
tenant_deleted(data)
|
|
179
188
|
when 'webhook_endpoint.disabled'
|
|
180
189
|
endpoint_disabled(data)
|
|
190
|
+
when 'account.risk_changed'
|
|
191
|
+
account_risk_changed(data)
|
|
181
192
|
else
|
|
182
193
|
raise VerificationError.new(:invalid_payload, 'Unknown webhook event type')
|
|
183
194
|
end
|
|
@@ -227,6 +238,21 @@ module NoResponse
|
|
|
227
238
|
disabled_at: data['disabled_at'])
|
|
228
239
|
end
|
|
229
240
|
|
|
241
|
+
def account_risk_changed(data)
|
|
242
|
+
account = data['account']
|
|
243
|
+
previous = data['previous_decisions_by_flow']
|
|
244
|
+
unless account.is_a?(Hash) && previous.is_a?(Hash) && account['id'].is_a?(String) && ACCOUNT_ID.match?(account['id'])
|
|
245
|
+
raise VerificationError.new(:invalid_payload, 'Account risk changed event is malformed')
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
begin
|
|
249
|
+
AccountRiskChanged.new(account: Crystalline.unmarshal_json(account, Models::Shared::Account),
|
|
250
|
+
previous_decisions_by_flow: Crystalline.unmarshal_json(previous, Models::Shared::AccountDecisionsByFlow))
|
|
251
|
+
rescue KeyError, TypeError, ArgumentError, NoMethodError
|
|
252
|
+
raise VerificationError.new(:invalid_payload, 'Account risk changed event is malformed')
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
230
256
|
def valid_datetime?(value)
|
|
231
257
|
Time.iso8601(value)
|
|
232
258
|
true
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: noresponse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- NoResponse
|
|
@@ -434,8 +434,6 @@ files:
|
|
|
434
434
|
- lib/no_response/models/shared/email.rbi
|
|
435
435
|
- lib/no_response/models/shared/email_union.rb
|
|
436
436
|
- lib/no_response/models/shared/email_union.rbi
|
|
437
|
-
- lib/no_response/models/shared/eventtype.rb
|
|
438
|
-
- lib/no_response/models/shared/eventtype.rbi
|
|
439
437
|
- lib/no_response/models/shared/failure.rb
|
|
440
438
|
- lib/no_response/models/shared/failure.rbi
|
|
441
439
|
- lib/no_response/models/shared/failurereason.rb
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
module NoResponse
|
|
5
|
-
module Models
|
|
6
|
-
module Shared
|
|
7
|
-
|
|
8
|
-
class EventType
|
|
9
|
-
include ::Crystalline::Enum
|
|
10
|
-
enums do
|
|
11
|
-
ASSESSMENT_UPDATED = new("assessment.updated")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
open!
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|