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.



293
294
295
296
# File 'lib/lithic/resources/auth_rules/v2.rb', line 293

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(parameters:, type:, card_tokens:, program_level:, account_tokens: nil, business_account_tokens: nil, event_stream: nil, name: nil, excluded_card_tokens: nil, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

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

Creates a new V2 Auth rule in draft mode



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

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

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

Deletes a V2 Auth rule



165
166
167
168
169
170
171
172
# File 'lib/lithic/resources/auth_rules/v2.rb', line 165

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.



190
191
192
193
194
195
196
197
198
199
# File 'lib/lithic/resources/auth_rules/v2.rb', line 190

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



143
144
145
146
147
148
149
150
151
152
153
# File 'lib/lithic/resources/auth_rules/v2.rb', line 143

def list(params = {})
  parsed, options = Lithic::AuthRules::V2ListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v2/auth_rules",
    query: parsed,
    page: Lithic::Internal::CursorPage,
    model: Lithic::AuthRules::AuthRule,
    options: 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.



212
213
214
215
216
217
218
219
# File 'lib/lithic/resources/auth_rules/v2.rb', line 212

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



61
62
63
64
65
66
67
68
# File 'lib/lithic/resources/auth_rules/v2.rb', line 61

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`



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

def retrieve_features(auth_rule_token, params = {})
  parsed, options = Lithic::AuthRules::V2RetrieveFeaturesParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v2/auth_rules/%1$s/features", auth_rule_token],
    query: parsed,
    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.



279
280
281
282
283
284
285
286
287
288
# File 'lib/lithic/resources/auth_rules/v2.rb', line 279

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

#update(auth_rule_token, account_tokens: nil, business_account_tokens: nil, name: nil, state: nil, card_tokens: nil, excluded_card_tokens: nil, program_level: nil, request_options: {}) ⇒ Lithic::Models::AuthRules::AuthRule

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

Updates a V2 Auth rule’s properties

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



102
103
104
105
106
107
108
109
110
111
# File 'lib/lithic/resources/auth_rules/v2.rb', line 102

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,
    model: Lithic::AuthRules::AuthRule,
    options: options
  )
end