Sha256: b215ad748a8f65face9e0abfb06f481aeffc31b482f81f1b4818d3eb5d039b19

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Universign
  module Service
    module Document
      # Retrieve documents signed
      #
      # @return [Array<Universign::Document>]
      def documents
        @client = Universign::Client.new

        @documents ||= safeguard do
          result = @client.call('requester.getDocuments', @transaction_id)
          result.map do |document|
            Universign::Document.from_data(document)
          end
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        attr_reader :documents
      end

      # def signed_with_transaction_id(transaction_id)
      #   @client = Universign::Client.new.client
      #
      #   safeguard(-> { return false }) do
      #     result = @client.call('requester.getTransactionInfo', transaction_id)
      #     !result['signerInfos'].any? { |s| s['status'] != 'signed' }
      #   end
      # end
      #
      # def signed_with_custom_id(custom_id)
      #   @client = Universign::Client.new.client
      #
      #   safeguard(-> { return false }) do
      #     result = @client.call('requester.getTransactionInfoByCustomId', custom_id)
      #     !result['signerInfos'].any? { |s| s['status'] != 'signed' }
      #   end
      # end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_universign-1.6.0 lib/universign/service/document.rb
ruby_universign-1.5.1 lib/universign/service/document.rb