Class: Lithic::Resources::AuthRules::V2

Inherits:
Object
  • Object
show all
Defined in:
lib/lithic/resources/auth_rules/v2.rb,
lib/lithic/resources/auth_rules/v2/backtests.rb

Defined Under Namespace

Classes: Backtests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ V2

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of V2.

Parameters:



326
327
328
329
# File 'lib/lithic/resources/auth_rules/v2.rb', line 326

def initialize(client:)
  @client = client
  @backtests = Lithic::Resources::AuthRules::V2::Backtests.new(client: client)
end

Instance Attribute Details

#backtestsLithic::Resources::AuthRules::V2::Backtests (readonly)



8
9
10
# File 'lib/lithic/resources/auth_rules/v2.rb', line 8

def backtests
  @backtests
end

Instance Method Details

#create(body:, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

Creates a new V2 Auth rule in draft mode



20
21
22
23
24
25
26
27
28
29
# File 'lib/lithic/resources/auth_rules/v2.rb', line 20

def create(params)
  parsed, options = Lithic::AuthRules::V2CreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v2/auth_rules",
    body: parsed[:body],
    model: Lithic::AuthRules::AuthRule,
    options: options
  )
end

#delete(auth_rule_token, request_options: {}) ⇒ nil

Deletes a V2 Auth rule

Parameters:

Returns:

  • (nil)

See Also:



129
130
131
132
133
134
135
136
# File 'lib/lithic/resources/auth_rules/v2.rb', line 129

def delete(auth_rule_token, params = {})
  @client.request(
    method: :delete,
    path: ["v2/auth_rules/%1$s", auth_rule_token],
    model: NilClass,
    options: params[:request_options]
  )
end

#draft(auth_rule_token, parameters: nil, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

Creates a new draft version of a rule that will be ran in shadow mode.

This can also be utilized to reset the draft parameters, causing a draft version to no longer be ran in shadow mode.



154
155
156
157
158
159
160
161
162
163
# File 'lib/lithic/resources/auth_rules/v2.rb', line 154

def draft(auth_rule_token, params = {})
  parsed, options = Lithic::AuthRules::V2DraftParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v2/auth_rules/%1$s/draft", auth_rule_token],
    body: parsed,
    model: Lithic::AuthRules::AuthRule,
    options: options
  )
end

#list(account_token: nil, business_account_token: nil, card_token: nil, ending_before: nil, event_stream: nil, event_streams: nil, page_size: nil, scope: nil, starting_after: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::AuthRules::AuthRule>

Some parameter documentations has been truncated, see Models::AuthRules::V2ListParams for more details.

Lists V2 Auth rules

Parameters:

  • account_token (String)

    Only return Auth Rules that are bound to the provided account token.

  • business_account_token (String)

    Only return Auth Rules that are bound to the provided business account token.

  • card_token (String)

    Only return Auth Rules that are bound to the provided card token.

  • ending_before (String)

    A cursor representing an item’s token before which a page of results should end.

  • event_stream (Symbol, Lithic::Models::AuthRules::EventStream)

    Deprecated: Use event_streams instead. Only return Auth rules that are executed

  • event_streams (Array<Symbol, Lithic::Models::AuthRules::EventStream>)

    Only return Auth rules that are executed during any of the provided event stream

  • page_size (Integer)

    Page size (for pagination).

  • scope (Symbol, Lithic::Models::AuthRules::V2ListParams::Scope)

    Only return Auth Rules that are bound to the provided scope.

  • starting_after (String)

    A cursor representing an item’s token after which a page of results should begin

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/lithic/resources/auth_rules/v2.rb', line 106

def list(params = {})
  parsed, options = Lithic::AuthRules::V2ListParams.dump_request(params)
  query = Lithic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v2/auth_rules",
    query: query,
    page: Lithic::Internal::CursorPage,
    model: Lithic::AuthRules::AuthRule,
    options: options
  )
end

#list_results(auth_rule_token: nil, begin_: nil, end_: nil, ending_before: nil, event_token: nil, has_actions: nil, page_size: nil, starting_after: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::AuthRules::V2ListResultsResponse::AuthorizationResult, Lithic::Models::AuthRules::V2ListResultsResponse::Authentication3DSResult, Lithic::Models::AuthRules::V2ListResultsResponse::TokenizationResult, Lithic::Models::AuthRules::V2ListResultsResponse::ACHResult>

Some parameter documentations has been truncated, see Models::AuthRules::V2ListResultsParams for more details.

Lists Auth Rule evaluation results.

Limitations:

  • Results are available for the past 3 months only

  • At least one filter (‘event_token` or `auth_rule_token`) must be provided

  • When filtering by ‘event_token`, pagination is not supported

Parameters:

  • auth_rule_token (String)

    Filter by Auth Rule token

  • begin_ (Time)

    Date string in RFC 3339 format. Only events evaluated after the specified time w

  • end_ (Time)

    Date string in RFC 3339 format. Only events evaluated before the specified time

  • ending_before (String)

    A cursor representing an item’s token before which a page of results should end.

  • event_token (String)

    Filter by event token

  • has_actions (Boolean)

    Filter by whether the rule evaluation produced any actions. When not provided, a

  • page_size (Integer)

    Page size (for pagination).

  • starting_after (String)

    A cursor representing an item’s token after which a page of results should begin

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/lithic/resources/auth_rules/v2.rb', line 199

def list_results(params = {})
  parsed, options = Lithic::AuthRules::V2ListResultsParams.dump_request(params)
  query = Lithic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v2/auth_rules/results",
    query: query.transform_keys(begin_: "begin", end_: "end"),
    page: Lithic::Internal::CursorPage,
    model: Lithic::Models::AuthRules::V2ListResultsResponse,
    options: options
  )
end

#list_versions(auth_rule_token, request_options: {}) ⇒ Lithic::Models::AuthRules::V2ListVersionsResponse

Returns all versions of an auth rule, sorted by version number descending (newest first).

Parameters:

Returns:

See Also:



223
224
225
226
227
228
229
230
# File 'lib/lithic/resources/auth_rules/v2.rb', line 223

def list_versions(auth_rule_token, params = {})
  @client.request(
    method: :get,
    path: ["v2/auth_rules/%1$s/versions", auth_rule_token],
    model: Lithic::Models::AuthRules::V2ListVersionsResponse,
    options: params[:request_options]
  )
end

#promote(auth_rule_token, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

Promotes the draft version of an Auth rule to the currently active version such that it is enforced in the respective stream.

Parameters:

Returns:

See Also:



243
244
245
246
247
248
249
250
# File 'lib/lithic/resources/auth_rules/v2.rb', line 243

def promote(auth_rule_token, params = {})
  @client.request(
    method: :post,
    path: ["v2/auth_rules/%1$s/promote", auth_rule_token],
    model: Lithic::AuthRules::AuthRule,
    options: params[:request_options]
  )
end

#retrieve(auth_rule_token, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

Fetches a V2 Auth rule by its token

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
# File 'lib/lithic/resources/auth_rules/v2.rb', line 41

def retrieve(auth_rule_token, params = {})
  @client.request(
    method: :get,
    path: ["v2/auth_rules/%1$s", auth_rule_token],
    model: Lithic::AuthRules::AuthRule,
    options: params[:request_options]
  )
end

#retrieve_features(auth_rule_token, account_token: nil, card_token: nil, request_options: {}) ⇒ Lithic::Models::AuthRules::V2RetrieveFeaturesResponse

Fetches the current calculated Feature values for the given Auth Rule

This only calculates the features for the active version.

  • VelocityLimit Rules calculates the current Velocity Feature data. This requires a ‘card_token` or `account_token` matching what the rule is Scoped to.

  • ConditionalBlock Rules calculates the CARD*TRANSACTION_COUNT** attributes on the rule. This requires a ‘card_token`

Parameters:

  • auth_rule_token (String)
  • account_token (String)
  • card_token (String)
  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



272
273
274
275
276
277
278
279
280
281
282
# File 'lib/lithic/resources/auth_rules/v2.rb', line 272

def retrieve_features(auth_rule_token, params = {})
  parsed, options = Lithic::AuthRules::V2RetrieveFeaturesParams.dump_request(params)
  query = Lithic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v2/auth_rules/%1$s/features", auth_rule_token],
    query: query,
    model: Lithic::Models::AuthRules::V2RetrieveFeaturesResponse,
    options: options
  )
end

#retrieve_report(auth_rule_token, begin_:, end_:, request_options: {}) ⇒ Lithic::Models::AuthRules::V2RetrieveReportResponse

Retrieves a performance report for an Auth rule containing daily statistics and evaluation outcomes.

**Time Range Limitations:**

  • Reports are supported for the past 3 months only

  • Maximum interval length is 1 month

  • Report data is available only through the previous day in UTC (current day data is not available)

The report provides daily statistics for both current and draft versions of the Auth rule, including approval, decline, and challenge counts along with sample events.

Parameters:

  • auth_rule_token (String)
  • begin_ (Date)

    Start date for the report

  • end_ (Date)

    End date for the report

  • request_options (Lithic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



311
312
313
314
315
316
317
318
319
320
321
# File 'lib/lithic/resources/auth_rules/v2.rb', line 311

def retrieve_report(auth_rule_token, params)
  parsed, options = Lithic::AuthRules::V2RetrieveReportParams.dump_request(params)
  query = Lithic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v2/auth_rules/%1$s/report", auth_rule_token],
    query: query.transform_keys(begin_: "begin", end_: "end"),
    model: Lithic::Models::AuthRules::V2RetrieveReportResponse,
    options: options
  )
end

#update(auth_rule_token, body:, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

Updates a V2 Auth rule’s properties

If ‘account_tokens`, `card_tokens`, `program_level`, `excluded_card_tokens`, `excluded_account_tokens`, or `excluded_business_account_tokens` is provided, this will replace existing associations with the provided list of entities.



65
66
67
68
69
70
71
72
73
74
# File 'lib/lithic/resources/auth_rules/v2.rb', line 65

def update(auth_rule_token, params)
  parsed, options = Lithic::AuthRules::V2UpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v2/auth_rules/%1$s", auth_rule_token],
    body: parsed[:body],
    model: Lithic::AuthRules::AuthRule,
    options: options
  )
end