Class: DynamicPDFApi::PdfSecurityInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_client/PdfSecurityInfo.rb

Overview

Represents the PDF security info endpoint.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ PdfSecurityInfo

Returns a new instance of PdfSecurityInfo.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 6

def initialize(data = {})
  @encryption_type_string       = data["encryptionType"]
  @allow_edit                   = data["allowEdit"]
  @allow_print                  = data["allowPrint"]
  @allow_update_annots_and_fields = data["allowUpdateAnnotsAndFields"]
  @allow_copy                   = data["allowCopy"]
  @allow_high_resolution_printing = data["allowHighResolutionPrinting"]
  @allow_document_assembly      = data["allowDocumentAssembly"]
  @allow_form_filling           = data["allowFormFilling"]
  @allow_accessibility          = data["allowAccessibility"]
  @encrypt_all_except_metadata  = data["encryptAllExceptMetadata"]
  @encrypt_only_file_attachments = data["encryptOnlyFileAttachments"]
  @has_owner_password           = data["hasOwnerPassword"]
  @has_user_password            = data["hasUserPassword"]
  @encryption_type = encryption_type()
end

Instance Attribute Details

#allow_accessibilityObject

Gets or sets if accessibility programs should be able to read the documents text and images for the user.



61
62
63
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 61

def allow_accessibility
  @allow_accessibility
end

#allow_copyObject

Gets or sets if text and images can be copied to the clipboard by the user.



41
42
43
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 41

def allow_copy
  @allow_copy
end

#allow_document_assemblyObject

Gets or sets if the document can be assembled and manipulated by the user.



51
52
53
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 51

def allow_document_assembly
  @allow_document_assembly
end

#allow_editObject

Gets or sets if the document can be edited by the user.



26
27
28
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 26

def allow_edit
  @allow_edit
end

#allow_form_fillingObject

Gets or sets if form filling should be allowed by the user.



56
57
58
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 56

def allow_form_filling
  @allow_form_filling
end

#allow_high_resolution_printingObject

Gets or sets if the document can be printed at a high resolution by the user.



46
47
48
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 46

def allow_high_resolution_printing
  @allow_high_resolution_printing
end

#allow_printObject

Gets or sets if the document can be printed by the user.



31
32
33
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 31

def allow_print
  @allow_print
end

#allow_update_annots_and_fieldsObject

Gets or sets if annotations and form fields can be added, edited and modified by the user.



36
37
38
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 36

def allow_update_annots_and_fields
  @allow_update_annots_and_fields
end

#encrypt_all_except_metadataObject

Gets or sets a value indicating whether all data should be encrypted except for metadata.



66
67
68
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 66

def 
  @encrypt_all_except_metadata
end

#encrypt_only_file_attachmentsObject

Gets or sets a value indicating whether only file attachments should be encrypted.



71
72
73
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 71

def encrypt_only_file_attachments
  @encrypt_only_file_attachments
end

#encryption_type_stringObject

Gets or sets the encryption type.



85
86
87
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 85

def encryption_type_string
  @encryption_type_string
end

#has_owner_passwordObject

Gets or sets a value indicating whether the PDF document has an owner password set.



76
77
78
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 76

def has_owner_password
  @has_owner_password
end

#has_user_passwordObject

Gets or sets a value indicating whether the PDF document has an user password set.



81
82
83
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 81

def has_user_password
  @has_user_password
end

Instance Method Details

#encryption_typeObject



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/ruby_client/PdfSecurityInfo.rb', line 87

def encryption_type
  case (@encryption_type_string).downcase
  when "rc4-40"
    EncryptionType::RC440
  when "rc4-128"
    EncryptionType::RC4128
  when "aes-128-cbc"
    EncryptionType::AES128CBC
  when "aes-256-cbc"
    EncryptionType::AES256CBC
  else
    EncryptionType::NONE
  end
end