Sha256: 8e6e9ebdad5654cbc2a1bacff3adb9ef9d0d2cb59bd5f2280f5b12bdc33f2a50

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

# 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_encoder_ids: nil, acs_system_ids: nil, limit: nil)
        @client.post("/acs/encoders/list", {acs_encoder_ids: acs_encoder_ids, acs_system_ids: acs_system_ids, limit: limit}.compact)

        nil
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seam-2.2.0 lib/seam/routes/clients/acs_encoders.rb
seam-2.1.0 lib/seam/routes/clients/acs_encoders.rb