Class: Seam::Clients::AcsEncoders

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/acs_encoders.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ AcsEncoders

Returns a new instance of AcsEncoders.



8
9
10
11
# File 'lib/seam/routes/acs_encoders.rb', line 8

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#encode_credential(acs_encoder_id:, access_method_id: nil, acs_credential_id: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Encodes an existing credential onto a plastic card placed on the specified encoder. Either provide an acs_credential_id or an access_method_id

Parameters:

  • acs_encoder_id

    ID of the acs_encoder to use to encode the acs_credential.

  • access_method_id (defaults to: nil)

    ID of the access_method to encode onto a card.

  • acs_credential_id (defaults to: nil)

    ID of the acs_credential to encode onto a card.

Returns:



22
23
24
25
26
27
28
# File 'lib/seam/routes/acs_encoders.rb', line 22

def encode_credential(acs_encoder_id:, access_method_id: nil, acs_credential_id: nil, wait_for_action_attempt: nil)
  res = @client.post("/acs/encoders/encode_credential", {acs_encoder_id: acs_encoder_id, access_method_id: access_method_id, acs_credential_id: acs_credential_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

#get(acs_encoder_id:) ⇒ Seam::Resources::AcsEncoder

Returns a specified encoder.

Parameters:

  • acs_encoder_id

    ID of the encoder that you want to get.

Returns:



33
34
35
36
37
# File 'lib/seam/routes/acs_encoders.rb', line 33

def get(acs_encoder_id:)
  res = @client.post("/acs/encoders/get", {acs_encoder_id: acs_encoder_id}.compact)

  Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoder"])
end

#list(acs_system_id: nil, acs_system_ids: nil, acs_encoder_ids: nil, limit: nil, page_cursor: nil) ⇒ Seam::Resources::AcsEncoder

Returns a list of all encoders.

Parameters:

  • acs_system_id (defaults to: nil)

    ID of the access system for which you want to retrieve all encoders.

  • acs_system_ids (defaults to: nil)

    IDs of the access systems for which you want to retrieve all encoders.

  • acs_encoder_ids (defaults to: nil)

    IDs of the encoders that you want to retrieve.

  • limit (defaults to: nil)

    Number of encoders to return.

  • page_cursor (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

Returns:



46
47
48
49
50
# File 'lib/seam/routes/acs_encoders.rb', line 46

def list(acs_system_id: nil, acs_system_ids: nil, acs_encoder_ids: nil, limit: nil, page_cursor: nil)
  res = @client.post("/acs/encoders/list", {acs_system_id: acs_system_id, acs_system_ids: acs_system_ids, acs_encoder_ids: acs_encoder_ids, limit: limit, page_cursor: page_cursor}.compact)

  Seam::Resources::AcsEncoder.load_from_response(res.body["acs_encoders"])
end

#scan_credential(acs_encoder_id:, salto_ks_metadata: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Scans an encoded acs_credential from a plastic card placed on the specified encoder.

Parameters:

  • acs_encoder_id

    ID of the encoder to use for the scan.

  • salto_ks_metadata (defaults to: nil)

    Salto KS-specific metadata for the scan action.

Returns:



56
57
58
59
60
61
62
# File 'lib/seam/routes/acs_encoders.rb', line 56

def scan_credential(acs_encoder_id:, salto_ks_metadata: nil, wait_for_action_attempt: nil)
  res = @client.post("/acs/encoders/scan_credential", {acs_encoder_id: acs_encoder_id, salto_ks_metadata: }.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

#scan_to_assign_credential(acs_encoder_id:, acs_user_id: nil, salto_ks_metadata: nil, user_identity_id: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Scans a physical card placed on the specified encoder and assigns the scanned credential to an ACS user. Provide either an acs_user_id or a user_identity_id.

Parameters:

  • acs_encoder_id

    ID of the acs_encoder to use to scan the credential.

  • acs_user_id (defaults to: nil)

    ID of the acs_user to assign the scanned credential to.

  • salto_ks_metadata (defaults to: nil)

    Salto KS-specific metadata for the scan action.

  • user_identity_id (defaults to: nil)

    ID of the user_identity to assign the scanned credential to. If the ACS system contains an ACS user linked to this user identity, it is used. Otherwise, one is created.

Returns:



70
71
72
73
74
75
76
# File 'lib/seam/routes/acs_encoders.rb', line 70

def scan_to_assign_credential(acs_encoder_id:, acs_user_id: nil, salto_ks_metadata: nil, user_identity_id: nil, wait_for_action_attempt: nil)
  res = @client.post("/acs/encoders/scan_to_assign_credential", {acs_encoder_id: acs_encoder_id, acs_user_id: acs_user_id, salto_ks_metadata: , user_identity_id: user_identity_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

#simulateObject



13
14
15
# File 'lib/seam/routes/acs_encoders.rb', line 13

def simulate
  @simulate ||= Seam::Clients::AcsEncodersSimulate.new(client: @client, defaults: @defaults)
end