class Esignatur::Pades

esignature PAdES document representation. More info: api.esignatur.dk/Documentation/Pades

Attributes

api[R]
attributes[R]
order[R]

Public Class Methods

new(order:, attributes: {}, api:) click to toggle source
# File lib/esignatur/pades.rb, line 13
def initialize(order:, attributes: {}, api:)
  @attributes = attributes
  @order = order
  @api = api
end

Public Instance Methods

document_data() click to toggle source
# File lib/esignatur/pades.rb, line 19
def document_data
  fetch unless attributes.key?('DocumentData')
  Base64.decode64(attributes.fetch('DocumentData'))
end
document_id() click to toggle source
# File lib/esignatur/pades.rb, line 34
def document_id
  fetch unless attributes.key?('DocumentId')
  attributes['DocumentId']
end
fetch() click to toggle source
# File lib/esignatur/pades.rb, line 39
def fetch
  response = api_post('Pades/Download', 'Id' => order.id, 'AgreementId' => attributes['AgreementId'])
  @attributes = response.json_body if errors.empty?
  self
end
filename() click to toggle source
# File lib/esignatur/pades.rb, line 29
def filename
  fetch unless attributes.key?('Filename')
  attributes['Filename']
end
title() click to toggle source
# File lib/esignatur/pades.rb, line 24
def title
  fetch unless attributes.key?('Title')
  attributes['Title']
end