-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacs_encoders.rb
36 lines (26 loc) · 1.49 KB
/
acs_encoders.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
require "seam/helpers/action_attempt"
module Seam
module Clients
class AcsEncoders
def initialize(client:, defaults:)
@client = client
@defaults = defaults
end
def encode_credential(acs_credential_id:, acs_encoder_id:, wait_for_action_attempt: nil)
res = @client.post("/acs/encoders/encode_credential", {acs_credential_id: acs_credential_id, acs_encoder_id: acs_encoder_id}.compact)
wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end
def list(acs_system_id: nil, limit: nil, acs_system_ids: nil, acs_encoder_ids: nil)
@client.post("/acs/encoders/list", {acs_system_id: acs_system_id, limit: limit, acs_system_ids: acs_system_ids, acs_encoder_ids: acs_encoder_ids}.compact)
nil
end
def scan_credential(acs_encoder_id:, wait_for_action_attempt: nil)
res = @client.post("/acs/encoders/scan_credential", {acs_encoder_id: acs_encoder_id}.compact)
wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt
Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end
end
end
end