Class: Plaid::BeaconUser::Client
- Inherits:
-
Object
- Object
- Plaid::BeaconUser::Client
- Defined in:
- lib/plaid/beacon_user/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserCreateResponse
Create and scan a Beacon User against your Beacon Program, according to your program's settings.
-
#get(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserGetResponse
Fetch a Beacon User.
-
#get_account_insights(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserAccountInsightsGetResponse
Get Account Insights for all Accounts linked to this Beacon User.
- #initialize(client:) ⇒ void constructor
-
#list_history(request_options: {}, **params) ⇒ Plaid::Internal::CursorItemIterator
List all changes to the Beacon User in reverse-chronological order.
-
#review(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserGetResponse
Update the status of a Beacon User.
-
#update(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserUpdateResponse
Update the identity data for a Beacon User in your Beacon Program or add new accounts to the Beacon User.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/plaid/beacon_user/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserCreateResponse
Create and scan a Beacon User against your Beacon Program, according to your program's settings.
When you submit a new user to /beacon/user/create, several checks are performed immediately:
-
The user's PII (provided within the
userobject) is searched against all other users within the Beacon Program you specified. If a match is found that violates your program's "Duplicate Information Filtering" settings, the user will be returned with a status ofpending_review. -
The user's PII is also searched against all fraud reports created by your organization across all of your Beacon Programs. If the user's data matches a fraud report that your team created, the user will be returned with a status of
rejected. -
Finally, the user's PII is searched against all fraud reports shared with the Beacon Network by other companies. If a matching fraud report is found, the user will be returned with a
pending_reviewstatus if your program has enabled automatic flagging based on network fraud.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/plaid/beacon_user/client.rb', line 50 def create(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/create", body: Plaid::BeaconUser::Types::BeaconUserCreateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserCreateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#get(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserGetResponse
Fetch a Beacon User.
The Beacon User is returned with all of their associated information and a status based on the Beacon Network
duplicate record and fraud checks.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/plaid/beacon_user/client.rb', line 103 def get(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/get", body: Plaid::BeaconUser::Types::BeaconUserGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#get_account_insights(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserAccountInsightsGetResponse
Get Account Insights for all Accounts linked to this Beacon User. The insights for each account are computed based on the information that was last retrieved from the financial institution.
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/plaid/beacon_user/client.rb', line 358 def get_account_insights(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/account_insights/get", body: Plaid::BeaconUser::Types::BeaconUserAccountInsightsGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserAccountInsightsGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#list_history(request_options: {}, **params) ⇒ Plaid::Internal::CursorItemIterator
List all changes to the Beacon User in reverse-chronological order.
Returns a Plaid::Internal::CursorItemIterator that yields each Plaid::Types::BeaconUser in the
beacon_users field of every page, requesting pages as they are needed. Call pages on it to get each page as
a Plaid::Types::BeaconUserHistoryListResponse, including its other fields.
No request is sent by this call. The first page is requested when you start iterating (or call
load_first_page), so an API error is raised by the loop (or by load_first_page), not by this call.
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/plaid/beacon_user/client.rb', line 296 def list_history(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) Plaid::Internal::CursorItemIterator.new( cursor_field: :next_cursor, item_field: :beacon_users, initial_cursor: params[:cursor] ) do |next_cursor| params[:cursor] = next_cursor request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/history/list", body: Plaid::BeaconUser::Types::BeaconUserHistoryListRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin parsed_response = (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserHistoryListResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end [parsed_response, response] else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end end |
#review(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserGetResponse
Update the status of a Beacon User.
When updating a Beacon User's status via this endpoint, Plaid validates that the status change is consistent with the related state for this Beacon User. Specifically, we will check:
- Whether there are any associated Beacon Reports connected to the Beacon User, and
- Whether there are any confirmed Beacon Report Syndications connected to the Beacon User.
When updating a Beacon User's status to rejected, we enforce that either a Beacon Report has been created for
the Beacon User or a Beacon Report Syndication has been confirmed.
When updating a Beacon User's status to cleared, we enforce that there are no active Beacon Reports or
confirmed Beacon Report Syndications associated with the user. If you previously created a Beacon Report for
this user, you must delete it before updating the Beacon User's status to cleared.
There are no restrictions on updating a Beacon User's status to pending_review.
If these conditions are not met, the request will be rejected with an error explaining the issue.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/plaid/beacon_user/client.rb', line 171 def review(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/review", body: Plaid::BeaconUser::Types::BeaconUserReviewRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#update(request_options: {}, **params) ⇒ Plaid::Types::BeaconUserUpdateResponse
Update the identity data for a Beacon User in your Beacon Program or add new accounts to the Beacon User.
Similar to /beacon/user/create, several checks are performed immediately when you submit an identity data
change to /beacon/user/update:
-
The user's updated PII is searched against all other users within the Beacon Program you specified. If a match is found that violates your program's "Duplicate Information Filtering" settings, the user will be returned with a status of
pending_review. -
The user's updated PII is also searched against all fraud reports created by your organization across all of your Beacon Programs. If the user's data matches a fraud report that your team created, the user will be returned with a status of
rejected. -
Finally, the user's PII is searched against all fraud reports shared with the Beacon Network by other companies. If a matching fraud report is found, the user will be returned with a
pending_reviewstatus if your program has enabled automatic flagging based on network fraud.
Plaid maintains a version history for each Beacon User, so the Beacon User's identity data before and after the update is retained as separate versions.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/plaid/beacon_user/client.rb', line 239 def update(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "beacon/user/update", body: Plaid::BeaconUser::Types::BeaconUserUpdateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::BeaconUserUpdateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |