noresponse 2.1.8 → 2.1.10
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/assessmentflow.rb +17 -0
- data/lib/no_response/models/shared/assessmentflow.rbi +9 -0
- data/lib/no_response/models/shared/assessmentrequest.rb +30 -0
- data/lib/no_response/models/shared/assessmentrequest.rbi +12 -0
- data/lib/no_response/models/shared/assessmentrequestpolicycontext.rb +1 -1
- data/lib/no_response/models/shared/depth.rb +16 -0
- data/lib/no_response/models/shared/depth.rbi +9 -0
- data/lib/no_response/models/shared/flow.rb +1 -1
- data/lib/no_response/models/shared.rb +2 -0
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/no_response/wait.rb +25 -6
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa850a7e8b70f2991de9e114685af4f2a6820888e1f4fe805cdad030902e13c1
|
|
4
|
+
data.tar.gz: 94f598e386f9e942ef67b3dfd2e83ae104dc4dd2345785c48587f28c081c54ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc83f0343b1474ad7d2264e02c6c95668dbf33d243f551d76df5d3bc439bc25705646771d49dafcec908d3b10162b224188ca6982c9e3ba97c7a7d88b9ad2746
|
|
7
|
+
data.tar.gz: c230e855babf8e941034ae409130a8a8942551a92f9c1595a7a49e4b5ddc8cdc6c08a0ca51831e808e78e6f3884defc28bf76ee486cfa6f85be9fb29229c3309
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
# AssessmentFlow - The customer event an assessment is made for: signup (a new account), login (a returning sign-in) or purchase (a payment or credit grant). The account's risk is reported with the decision for this flow.
|
|
8
|
+
class AssessmentFlow < T::Enum
|
|
9
|
+
enums do
|
|
10
|
+
SIGNUP = new("signup")
|
|
11
|
+
LOGIN = new("login")
|
|
12
|
+
PURCHASE = new("purchase")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -21,6 +21,28 @@ module NoResponse
|
|
|
21
21
|
Models::Shared::AssessmentRequestIdentifiers,
|
|
22
22
|
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("identifiers"), required: true}}
|
|
23
23
|
)
|
|
24
|
+
# The customer event an assessment is made for: signup (a new account), login (a returning sign-in) or purchase (a payment or credit grant). The account's risk is reported with the decision for this flow.
|
|
25
|
+
field(
|
|
26
|
+
:flow,
|
|
27
|
+
Crystalline::Nilable.new(Models::Shared::AssessmentFlow),
|
|
28
|
+
{
|
|
29
|
+
'format_json': {
|
|
30
|
+
'letter_case': ::NoResponse::Utils.field_name("flow"),
|
|
31
|
+
'decoder': ::NoResponse::Utils.enum_from_string(Models::Shared::AssessmentFlow, true)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
# How long the synchronous answer waits for sources. quick waits only for the fast sources, those that answer within 500 ms of ingress (or deadline_ms when lower); full waits for the whole budget, up to 3000 ms. Sources still running at the cut continue asynchronously and update the assessment either way.
|
|
36
|
+
field(
|
|
37
|
+
:depth,
|
|
38
|
+
Crystalline::Nilable.new(Models::Shared::Depth),
|
|
39
|
+
{
|
|
40
|
+
'format_json': {
|
|
41
|
+
'letter_case': ::NoResponse::Utils.field_name("depth"),
|
|
42
|
+
'decoder': ::NoResponse::Utils.enum_from_string(Models::Shared::Depth, true)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
)
|
|
24
46
|
|
|
25
47
|
field(
|
|
26
48
|
:policy_context,
|
|
@@ -73,6 +95,8 @@ module NoResponse
|
|
|
73
95
|
params(
|
|
74
96
|
account_id: ::String,
|
|
75
97
|
identifiers: Models::Shared::AssessmentRequestIdentifiers,
|
|
98
|
+
flow: T.nilable(Models::Shared::AssessmentFlow),
|
|
99
|
+
depth: T.nilable(Models::Shared::Depth),
|
|
76
100
|
policy_context: T.nilable(Models::Shared::AssessmentRequestPolicyContext),
|
|
77
101
|
request_id: T.nilable(::String),
|
|
78
102
|
deadline_ms: T.nilable(::Integer),
|
|
@@ -86,6 +110,8 @@ module NoResponse
|
|
|
86
110
|
def initialize(
|
|
87
111
|
account_id:,
|
|
88
112
|
identifiers:,
|
|
113
|
+
flow: nil,
|
|
114
|
+
depth: nil,
|
|
89
115
|
policy_context: nil,
|
|
90
116
|
request_id: nil,
|
|
91
117
|
deadline_ms: nil,
|
|
@@ -96,6 +122,8 @@ module NoResponse
|
|
|
96
122
|
)
|
|
97
123
|
@account_id = account_id
|
|
98
124
|
@identifiers = identifiers
|
|
125
|
+
@flow = flow
|
|
126
|
+
@depth = depth
|
|
99
127
|
@policy_context = policy_context
|
|
100
128
|
@request_id = request_id
|
|
101
129
|
@deadline_ms = deadline_ms
|
|
@@ -110,6 +138,8 @@ module NoResponse
|
|
|
110
138
|
return false unless other.is_a?(self.class)
|
|
111
139
|
return false unless @account_id == other.account_id
|
|
112
140
|
return false unless @identifiers == other.identifiers
|
|
141
|
+
return false unless @flow == other.flow
|
|
142
|
+
return false unless @depth == other.depth
|
|
113
143
|
return false unless @policy_context == other.policy_context
|
|
114
144
|
return false unless @request_id == other.request_id
|
|
115
145
|
return false unless @deadline_ms == other.deadline_ms
|
|
@@ -9,7 +9,7 @@ module NoResponse
|
|
|
9
9
|
extend T::Sig
|
|
10
10
|
include Crystalline::MetadataFields
|
|
11
11
|
|
|
12
|
-
# The provider flow the assessment gates. Absent means signup.
|
|
12
|
+
# The provider flow the assessment gates. Use the top-level flow instead; this member is ignored when the top-level flow is present. Absent means signup.
|
|
13
13
|
field(
|
|
14
14
|
:flow,
|
|
15
15
|
Crystalline::Nilable.new(Models::Shared::Flow),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
# Depth - How long the synchronous answer waits for sources. quick waits only for the fast sources, those that answer within 500 ms of ingress (or deadline_ms when lower); full waits for the whole budget, up to 3000 ms. Sources still running at the cut continue asynchronously and update the assessment either way.
|
|
8
|
+
class Depth < T::Enum
|
|
9
|
+
enums do
|
|
10
|
+
QUICK = new("quick")
|
|
11
|
+
FULL = new("full")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
module NoResponse
|
|
5
5
|
module Models
|
|
6
6
|
module Shared
|
|
7
|
-
# Flow - The provider flow the assessment gates. Absent means signup.
|
|
7
|
+
# Flow - The provider flow the assessment gates. Use the top-level flow instead; this member is ignored when the top-level flow is present. Absent means signup.
|
|
8
8
|
class Flow < T::Enum
|
|
9
9
|
enums do
|
|
10
10
|
SIGNUP = new("signup")
|
|
@@ -11,6 +11,7 @@ module NoResponse
|
|
|
11
11
|
autoload :AccountRiskReason, "no_response/models/shared/accountriskreason.rb"
|
|
12
12
|
autoload :Assessment, "no_response/models/shared/assessment.rb"
|
|
13
13
|
autoload :AssessmentAuthContext, "no_response/models/shared/assessmentauthcontext.rb"
|
|
14
|
+
autoload :AssessmentFlow, "no_response/models/shared/assessmentflow.rb"
|
|
14
15
|
autoload :AssessmentList, "no_response/models/shared/assessmentlist.rb"
|
|
15
16
|
autoload :AssessmentOutcome, "no_response/models/shared/assessmentoutcome.rb"
|
|
16
17
|
autoload :AssessmentOutcomeRequest, "no_response/models/shared/assessmentoutcomerequest.rb"
|
|
@@ -37,6 +38,7 @@ module NoResponse
|
|
|
37
38
|
autoload :Consistency, "no_response/models/shared/consistency.rb"
|
|
38
39
|
autoload :ConsistencyValue, "no_response/models/shared/consistencyvalue.rb"
|
|
39
40
|
autoload :Country, "no_response/models/shared/country.rb"
|
|
41
|
+
autoload :Depth, "no_response/models/shared/depth.rb"
|
|
40
42
|
autoload :EventType, "no_response/models/shared/eventtype.rb"
|
|
41
43
|
autoload :Failure, "no_response/models/shared/failure.rb"
|
|
42
44
|
autoload :FailureReason, "no_response/models/shared/failurereason.rb"
|
|
@@ -95,9 +95,9 @@ module NoResponse
|
|
|
95
95
|
|
|
96
96
|
@language = "ruby"
|
|
97
97
|
@openapi_doc_version = "1"
|
|
98
|
-
@sdk_version = "2.1.
|
|
98
|
+
@sdk_version = "2.1.10"
|
|
99
99
|
@gen_version = "internal"
|
|
100
|
-
@user_agent = "noresponse-sdk/ruby 2.1.
|
|
100
|
+
@user_agent = "noresponse-sdk/ruby 2.1.10 internal 1 noresponse"
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
sig { returns([String, T::Hash[Symbol, String]]) }
|
data/lib/no_response/wait.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# typed: true
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
# Wait for
|
|
4
|
+
# Wait for an assessment to complete. Hand-written beside the generated client.
|
|
5
5
|
|
|
6
6
|
module NoResponse
|
|
7
7
|
# The assessment was still pending when the wait ran out. last is the
|
|
@@ -22,9 +22,12 @@ module NoResponse
|
|
|
22
22
|
|
|
23
23
|
class << self
|
|
24
24
|
|
|
25
|
-
# Poll client.assessments.get until the assessment is
|
|
25
|
+
# Poll client.assessments.get until the assessment's status is complete,
|
|
26
26
|
# sleeping for the Retry-After the API sends (at least 1 s) between
|
|
27
|
-
# polls.
|
|
27
|
+
# polls. Once timeout seconds have passed it returns a partial answer as
|
|
28
|
+
# it stands, its status still PARTIAL, and raises WaitTimeoutError if the
|
|
29
|
+
# assessment is still pending. A poll cut off by the deadline also
|
|
30
|
+
# returns the last partial answer instead of losing it.
|
|
28
31
|
def wait(client, assessment_id, **options)
|
|
29
32
|
poll(client.assessments, assessment_id, **options)
|
|
30
33
|
end
|
|
@@ -34,13 +37,29 @@ module NoResponse
|
|
|
34
37
|
raise ArgumentError, 'timeout must be positive' unless timeout.positive?
|
|
35
38
|
|
|
36
39
|
deadline = clock.call + timeout
|
|
40
|
+
last = T.let(nil, T.untyped)
|
|
37
41
|
loop do
|
|
38
42
|
remaining_ms = [((deadline - clock.call) * 1000).ceil, 1].max
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
begin
|
|
44
|
+
response = assessments.get(assessment_id: assessment_id, timeout_ms: remaining_ms)
|
|
45
|
+
rescue Faraday::TimeoutError
|
|
46
|
+
# Each poll is bounded by the time left, so a request timeout here
|
|
47
|
+
# is the wait running out: a partial answer from an earlier poll
|
|
48
|
+
# stands. Anything else, or a timeout before the deadline, raises.
|
|
49
|
+
raise unless clock.call >= deadline && last&.status == Models::Shared::Status::PARTIAL
|
|
50
|
+
|
|
51
|
+
return last
|
|
52
|
+
end
|
|
53
|
+
last = response.result
|
|
54
|
+
status = response.result.status
|
|
55
|
+
return response.result if status == Models::Shared::Status::COMPLETE
|
|
41
56
|
|
|
42
57
|
delay = retry_after(response.headers)
|
|
43
|
-
|
|
58
|
+
if clock.call + delay > deadline
|
|
59
|
+
return response.result if status == Models::Shared::Status::PARTIAL
|
|
60
|
+
|
|
61
|
+
raise WaitTimeoutError.new(assessment_id, response.result)
|
|
62
|
+
end
|
|
44
63
|
|
|
45
64
|
sleeper.call(delay)
|
|
46
65
|
end
|
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: 2.1.
|
|
4
|
+
version: 2.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- NoResponse
|
|
@@ -355,6 +355,8 @@ files:
|
|
|
355
355
|
- lib/no_response/models/shared/assessment.rbi
|
|
356
356
|
- lib/no_response/models/shared/assessmentauthcontext.rb
|
|
357
357
|
- lib/no_response/models/shared/assessmentauthcontext.rbi
|
|
358
|
+
- lib/no_response/models/shared/assessmentflow.rb
|
|
359
|
+
- lib/no_response/models/shared/assessmentflow.rbi
|
|
358
360
|
- lib/no_response/models/shared/assessmentlist.rb
|
|
359
361
|
- lib/no_response/models/shared/assessmentlist.rbi
|
|
360
362
|
- lib/no_response/models/shared/assessmentoutcome.rb
|
|
@@ -407,6 +409,8 @@ files:
|
|
|
407
409
|
- lib/no_response/models/shared/consistencyvalue.rbi
|
|
408
410
|
- lib/no_response/models/shared/country.rb
|
|
409
411
|
- lib/no_response/models/shared/country.rbi
|
|
412
|
+
- lib/no_response/models/shared/depth.rb
|
|
413
|
+
- lib/no_response/models/shared/depth.rbi
|
|
410
414
|
- lib/no_response/models/shared/email.rb
|
|
411
415
|
- lib/no_response/models/shared/email.rbi
|
|
412
416
|
- lib/no_response/models/shared/email_union.rb
|