dynamicpdf_api 1.0.0.pre.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ruby_client/Action.rb +15 -0
  3. data/lib/ruby_client/AdditionalResource.rb +113 -0
  4. data/lib/ruby_client/AdditionalResourceType.rb +27 -0
  5. data/lib/ruby_client/Aes128Security.rb +70 -0
  6. data/lib/ruby_client/Aes256Security.rb +70 -0
  7. data/lib/ruby_client/Align.rb +21 -0
  8. data/lib/ruby_client/ButtonFieldInformation.rb +48 -0
  9. data/lib/ruby_client/ButtonFieldType.rb +16 -0
  10. data/lib/ruby_client/ChoiceFieldInformation.rb +52 -0
  11. data/lib/ruby_client/ChoiceFieldType.rb +16 -0
  12. data/lib/ruby_client/CmykColor.rb +47 -0
  13. data/lib/ruby_client/Color.rb +12 -0
  14. data/lib/ruby_client/ColorSpaceType.rb +36 -0
  15. data/lib/ruby_client/ConverterInput.rb +100 -0
  16. data/lib/ruby_client/DlexInput.rb +61 -0
  17. data/lib/ruby_client/DlexLayout.rb +135 -0
  18. data/lib/ruby_client/DlexResource.rb +40 -0
  19. data/lib/ruby_client/Elements/AztecBarcodeElement.rb +113 -0
  20. data/lib/ruby_client/Elements/AztecSymbolSize.rb +206 -0
  21. data/lib/ruby_client/Elements/BarcodeElement.rb +37 -0
  22. data/lib/ruby_client/Elements/Code11BarcodeElement.rb +77 -0
  23. data/lib/ruby_client/Elements/Code128BarcodeElement.rb +105 -0
  24. data/lib/ruby_client/Elements/Code25BarcodeElement.rb +75 -0
  25. data/lib/ruby_client/Elements/Code39BarcodeElement.rb +75 -0
  26. data/lib/ruby_client/Elements/Code93BarcodeElement.rb +75 -0
  27. data/lib/ruby_client/Elements/Compaction.rb +26 -0
  28. data/lib/ruby_client/Elements/DataMatrixBarcodeElement.rb +95 -0
  29. data/lib/ruby_client/Elements/DataMatrixEncodingType.rb +56 -0
  30. data/lib/ruby_client/Elements/DataMatrixFunctionCharacter.rb +31 -0
  31. data/lib/ruby_client/Elements/DataMatrixSymbolSize.rb +161 -0
  32. data/lib/ruby_client/Elements/Dim2BarcodeElement.rb +28 -0
  33. data/lib/ruby_client/Elements/Element.rb +46 -0
  34. data/lib/ruby_client/Elements/ElementPlacement.rb +36 -0
  35. data/lib/ruby_client/Elements/ElementType.rb +96 -0
  36. data/lib/ruby_client/Elements/ErrorCorrection.rb +56 -0
  37. data/lib/ruby_client/Elements/Gs1DataBarBarcodeElement.rb +76 -0
  38. data/lib/ruby_client/Elements/Gs1DataBarType.rb +22 -0
  39. data/lib/ruby_client/Elements/Iata25BarcodeElement.rb +83 -0
  40. data/lib/ruby_client/Elements/ImageElement.rb +108 -0
  41. data/lib/ruby_client/Elements/LineElement.rb +92 -0
  42. data/lib/ruby_client/Elements/MsiBarcodeCheckDigitMode.rb +31 -0
  43. data/lib/ruby_client/Elements/MsiBarcodeElement.rb +79 -0
  44. data/lib/ruby_client/Elements/PageNumberingElement.rb +91 -0
  45. data/lib/ruby_client/Elements/Pdf417BarcodeElement.rb +112 -0
  46. data/lib/ruby_client/Elements/QrCodeElement.rb +77 -0
  47. data/lib/ruby_client/Elements/QrCodeFnc1.rb +22 -0
  48. data/lib/ruby_client/Elements/RectangleElement.rb +109 -0
  49. data/lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb +90 -0
  50. data/lib/ruby_client/Elements/StackedGs1DataBarType.rb +23 -0
  51. data/lib/ruby_client/Elements/TextBarcodeElement.rb +48 -0
  52. data/lib/ruby_client/Elements/TextElement.rb +83 -0
  53. data/lib/ruby_client/Elements/ValueType.rb +16 -0
  54. data/lib/ruby_client/EncryptDocumentComponents.rb +16 -0
  55. data/lib/ruby_client/EndPointException.rb +7 -0
  56. data/lib/ruby_client/Endpoint.rb +38 -0
  57. data/lib/ruby_client/EndpointResource.rb +7 -0
  58. data/lib/ruby_client/ExcelInput.rb +49 -0
  59. data/lib/ruby_client/ExcelResource.rb +79 -0
  60. data/lib/ruby_client/Font.rb +276 -0
  61. data/lib/ruby_client/FontInformation.rb +9 -0
  62. data/lib/ruby_client/FontResource.rb +35 -0
  63. data/lib/ruby_client/FormField.rb +62 -0
  64. data/lib/ruby_client/FormFieldInformation.rb +45 -0
  65. data/lib/ruby_client/GoToAction.rb +53 -0
  66. data/lib/ruby_client/Grayscale.rb +41 -0
  67. data/lib/ruby_client/HtmlInput.rb +60 -0
  68. data/lib/ruby_client/HtmlResource.rb +34 -0
  69. data/lib/ruby_client/ImageInfo.rb +69 -0
  70. data/lib/ruby_client/ImageInformation.rb +57 -0
  71. data/lib/ruby_client/ImageInput.rb +150 -0
  72. data/lib/ruby_client/ImageResource.rb +89 -0
  73. data/lib/ruby_client/ImageResponse.rb +24 -0
  74. data/lib/ruby_client/Input.rb +53 -0
  75. data/lib/ruby_client/InputType.rb +41 -0
  76. data/lib/ruby_client/JsonResponse.rb +18 -0
  77. data/lib/ruby_client/LayoutDataResource.rb +48 -0
  78. data/lib/ruby_client/LineStyle.rb +79 -0
  79. data/lib/ruby_client/MergeOptions.rb +135 -0
  80. data/lib/ruby_client/MultiSelectListBoxInformation.rb +45 -0
  81. data/lib/ruby_client/Outline.rb +113 -0
  82. data/lib/ruby_client/OutlineList.rb +57 -0
  83. data/lib/ruby_client/OutlineStyle.rb +28 -0
  84. data/lib/ruby_client/OutputSize.rb +10 -0
  85. data/lib/ruby_client/PageInformation.rb +27 -0
  86. data/lib/ruby_client/PageInput.rb +152 -0
  87. data/lib/ruby_client/PageOrientation.rb +17 -0
  88. data/lib/ruby_client/PageSize.rb +127 -0
  89. data/lib/ruby_client/PageZoom.rb +33 -0
  90. data/lib/ruby_client/Pdf.rb +417 -0
  91. data/lib/ruby_client/PdfContent.rb +21 -0
  92. data/lib/ruby_client/PdfInfo.rb +68 -0
  93. data/lib/ruby_client/PdfInfoResponse.rb +27 -0
  94. data/lib/ruby_client/PdfInformation.rb +81 -0
  95. data/lib/ruby_client/PdfInput.rb +66 -0
  96. data/lib/ruby_client/PdfInstructions.rb +97 -0
  97. data/lib/ruby_client/PdfResource.rb +36 -0
  98. data/lib/ruby_client/PdfResponse.rb +23 -0
  99. data/lib/ruby_client/PdfText.rb +85 -0
  100. data/lib/ruby_client/PdfTextResponse.rb +27 -0
  101. data/lib/ruby_client/PdfXmp.rb +67 -0
  102. data/lib/ruby_client/PushButtonInformation.rb +21 -0
  103. data/lib/ruby_client/RC4128Security.rb +62 -0
  104. data/lib/ruby_client/Resource.rb +51 -0
  105. data/lib/ruby_client/ResourceType.rb +48 -0
  106. data/lib/ruby_client/Response.rb +39 -0
  107. data/lib/ruby_client/RgbColor.rb +1048 -0
  108. data/lib/ruby_client/Security.rb +73 -0
  109. data/lib/ruby_client/SecurityType.rb +23 -0
  110. data/lib/ruby_client/SignatureFieldInformation.rb +21 -0
  111. data/lib/ruby_client/Template.rb +46 -0
  112. data/lib/ruby_client/TextFieldInformation.rb +27 -0
  113. data/lib/ruby_client/TextReplace.rb +43 -0
  114. data/lib/ruby_client/UnitConverter.rb +111 -0
  115. data/lib/ruby_client/UrlAction.rb +31 -0
  116. data/lib/ruby_client/VAlign.rb +21 -0
  117. data/lib/ruby_client/WebColor.rb +18 -0
  118. data/lib/ruby_client/WordInput.rb +65 -0
  119. data/lib/ruby_client/WordResource.rb +82 -0
  120. data/lib/ruby_client/XmlResponse.rb +23 -0
  121. data/lib/ruby_client/version.rb +5 -0
  122. data/lib/ruby_client.rb +123 -0
  123. metadata +169 -0
@@ -0,0 +1,73 @@
1
+ module DynamicPDFApi
2
+ require_relative 'SecurityType'
3
+
4
+ #
5
+ # Base class from which all security classes are derived.
6
+ #
7
+ class Security
8
+ def initialize(user_pwd = nil, owner_pwd = nil)
9
+ @_user_password = user_pwd
10
+ @_owner_password = owner_pwd
11
+ @_allow_copy = nil
12
+ @_allow_edit = nil
13
+ @_allow_print = nil
14
+ @_allow_update_annots_and_fields = nil
15
+
16
+ @_allow_accessibility = nil
17
+ @_allow_form_filling = nil
18
+ @_allow_high_resolution_printing = nil
19
+ @_allow_document_assembly = nil
20
+ @_type = nil
21
+ end
22
+
23
+ #
24
+ # Gets or sets if text and images can be copied to the clipboard by the user.
25
+ #
26
+ attr_accessor :allow_copy
27
+
28
+ #
29
+ # Gets or sets if the document can be edited by the user.
30
+ #
31
+ attr_accessor :allow_edit
32
+
33
+ #
34
+ # Gets or sets if the document can be printed by the user.
35
+ #
36
+ attr_accessor :allow_print
37
+
38
+ #
39
+ # Gets or sets if annotations and form fields can be added, edited and modified by the user.
40
+ #
41
+ attr_accessor :allow_update_annots_and_fields
42
+
43
+ #
44
+ # Gets or sets the owner password.
45
+ #
46
+ attr_accessor :owner_password
47
+
48
+ #
49
+ # Gets or sets the user password.
50
+ #
51
+ attr_accessor :user_password
52
+
53
+ #
54
+ # Gets or sets if accessibility programs should be able to read the documents text and images for the user.
55
+ #
56
+ attr_accessor :allow_accessibility
57
+
58
+ #
59
+ # Gets or sets if form filling should be allowed by the user.
60
+ #
61
+ attr_accessor :allow_form_filling
62
+
63
+ #
64
+ # Gets or sets if the document can be printed at a high resolution by the user.
65
+ #
66
+ attr_accessor :allow_high_resolution_printing
67
+
68
+ #
69
+ # Gets or sets if the document can be assembled and manipulated by the user.
70
+ #
71
+ attr_accessor :allow_document_assembly
72
+ end
73
+ end
@@ -0,0 +1,23 @@
1
+ module DynamicPDFApi
2
+ #
3
+ #
4
+ # Represents different types of the security.
5
+ #
6
+ #
7
+ class SecurityType
8
+ #
9
+ # AES 128 bit security.
10
+ #
11
+ AES_128 = 'aes128'.freeze
12
+
13
+ #
14
+ # AES 256 bit security.
15
+ #
16
+ AES_256 = 'aes256'.freeze
17
+
18
+ #
19
+ # RC4 128 bit security.
20
+ #
21
+ RC_4128 = 'aC4128'.freeze
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents information of a signature field.
4
+ #
5
+ class SignatureFieldInformation
6
+ def initialize
7
+ @name = nil
8
+ @signed = nil
9
+ end
10
+
11
+ #
12
+ # Gets or Sets the name of a signature field.
13
+ #
14
+ attr_accessor :name
15
+
16
+ #
17
+ # Gets or Sets the boolean, indicating the field signed or not.
18
+ #
19
+ attr_accessor :signed
20
+ end
21
+ end
@@ -0,0 +1,46 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents a document template.
4
+ #
5
+ class Template
6
+ #
7
+ # Initializes a new instance of the Template class.
8
+ #
9
+ # @param id [String] The id string representing id for the template.
10
+ #
11
+ def initialize(id)
12
+ @id = if id.nil?
13
+ SecureRandom.uuid
14
+ else
15
+ id
16
+ end
17
+ @elements = []
18
+ end
19
+
20
+ #
21
+ # Gets or sets the id for the template.
22
+ #
23
+ attr_accessor :id
24
+
25
+ #
26
+ # Gets or sets the elements for the template.
27
+ #
28
+ attr_accessor :elements
29
+
30
+ def to_json(_options = {})
31
+ elements = []
32
+ @elements.each do |element|
33
+ str = element unless element.nil?
34
+
35
+ elements << str unless str.nil?
36
+ end
37
+
38
+ json_array = {}
39
+
40
+ json_array['id'] = @id
41
+ json_array['elements'] = @elements
42
+
43
+ JSON.pretty_generate(json_array)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,27 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents information of a text field.
4
+ #
5
+ class TextFieldInformation
6
+ def initialize
7
+ @name = nil
8
+ @value = nil
9
+ @default_value = nil
10
+ end
11
+
12
+ #
13
+ # Gets or Sets the name of the Text field.
14
+ #
15
+ attr_accessor :name
16
+
17
+ #
18
+ # Gets or Sets the value of the Text field.
19
+ #
20
+ attr_accessor :value
21
+
22
+ #
23
+ # Gets or Sets the default value of the Text field.
24
+ #
25
+ attr_accessor :default_value
26
+ end
27
+ end
@@ -0,0 +1,43 @@
1
+ module DynamicPDFApi
2
+ class TextReplace
3
+
4
+ #
5
+ # Represents the find and replace values and its options.
6
+ #
7
+ # @param name="text">Text to find.
8
+ # @param name="replaceText">Text to replace.
9
+ # @param name="matchCase">True value will make the search operation case sensitive.
10
+ def initialize(text, replaceText, matchCase = false)
11
+ @text = text
12
+ @replace_text = replaceText
13
+ @match_case = matchCase
14
+ end
15
+
16
+ #
17
+ # Gets or sets the Find Text value. This string will be replaced with ReplaceText during conversion.
18
+ #
19
+ attr_accessor :text
20
+
21
+ #
22
+ # Gets or sets ReplaceText value.This string will replace the Text during conversion.
23
+ #
24
+ attr_accessor :replace_text
25
+
26
+ #
27
+ # If True, the search operation will be case sensitive.
28
+ #
29
+ attr_accessor :match_case
30
+
31
+ def to_json(_options = {})
32
+ json_array = {}
33
+
34
+ json_array["text"] = @text
35
+
36
+ json_array["replaceText"] = @replace_text unless @replace_text.nil?
37
+
38
+ json_array["matchCase"] = @match_case unless @match_case.nil?
39
+
40
+ JSON.pretty_generate(json_array)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,111 @@
1
+ require_relative "PageSize"
2
+
3
+ module DynamicPDFApi
4
+ #
5
+ # Represents a html input.
6
+ #
7
+ class UnitConverter
8
+ def initialize
9
+ end
10
+
11
+ #
12
+ # Method to convert inches to points.
13
+ #
14
+ # @param name="size">Size in inches.
15
+ # @returns Size in points.
16
+ def self.inches_to_points(size)
17
+ size * 72.0
18
+ end
19
+
20
+ #
21
+ # Method to convert millimeters to points.
22
+ #
23
+ # @param name="size">Size in millimeters.
24
+ # @returns Size in points.
25
+ def self.millimeters_to_points(size)
26
+ size * 2.8346456692913385826771653543307
27
+ end
28
+
29
+ def self.get_paper_size(size)
30
+ case size
31
+
32
+ when PageSize::LETTER
33
+ @smaller = inches_to_points(8.5)
34
+ @larger = inches_to_points(11)
35
+ when PageSize::LEGAL
36
+ @smaller = inches_to_points(8.5)
37
+ @larger = inches_to_points(14)
38
+ when PageSize::EXECUTIVE
39
+ @smaller = inches_to_points(7.25)
40
+ @larger = inches_to_points(10.5)
41
+ when PageSize::TABLOID
42
+ @smaller = inches_to_points(11)
43
+ @larger = inches_to_points(17)
44
+ when PageSize::ENVELOPE10
45
+ @smaller = inches_to_points(4.125)
46
+ @larger = inches_to_points(9.5)
47
+ when PageSize::ENVELOPEMONARCH
48
+ @smaller = inches_to_points(3.875)
49
+ @larger = inches_to_points(7.5)
50
+ when PageSize::FOLIO
51
+ @smaller = inches_to_points(8.5)
52
+ @larger = inches_to_points(13)
53
+ when PageSize::STATEMENT
54
+ @smaller = inches_to_points(5.5)
55
+ @larger = inches_to_points(8.5)
56
+ when PageSize::A4
57
+ @smaller = millimeters_to_points(210)
58
+ @larger = millimeters_to_points(297)
59
+ when PageSize::A5
60
+ @smaller = millimeters_to_points(148)
61
+ @larger = millimeters_to_points(210)
62
+ when PageSize::B4
63
+ @smaller = millimeters_to_points(250)
64
+ @larger = millimeters_to_points(353)
65
+ when PageSize::B5
66
+ @smaller = millimeters_to_points(176)
67
+ @larger = millimeters_to_points(250)
68
+ when PageSize::A3
69
+ @smaller = millimeters_to_points(297)
70
+ @larger = millimeters_to_points(420)
71
+ when PageSize::B3
72
+ @smaller = millimeters_to_points(353)
73
+ @larger = millimeters_to_points(500)
74
+ when PageSize::A6
75
+ @smaller = millimeters_to_points(105)
76
+ @larger = millimeters_to_points(148)
77
+ when PageSize::B5JIS
78
+ @smaller = millimeters_to_points(182)
79
+ @larger = millimeters_to_points(257)
80
+ when PageSize::ENVELOPEDL
81
+ @smaller = millimeters_to_points(110)
82
+ @larger = millimeters_to_points(220)
83
+ when PageSize::ENVELOPEC5
84
+ @smaller = millimeters_to_points(162)
85
+ @larger = millimeters_to_points(229)
86
+ when PageSize::ENVELOPEB5
87
+ @smaller = millimeters_to_points(176)
88
+ @larger = millimeters_to_points(250)
89
+ when PageSize::PRC16K
90
+ @smaller = millimeters_to_points(146)
91
+ @larger = millimeters_to_points(215)
92
+ when PageSize::PRC32K
93
+ @smaller = millimeters_to_points(97)
94
+ @larger = millimeters_to_points(151)
95
+ when PageSize::QUATRO
96
+ @smaller = millimeters_to_points(215)
97
+ @larger = millimeters_to_points(275)
98
+ when PageSize::DOUBLEPOSTCARD
99
+ @smaller = millimeters_to_points(148.0)
100
+ @larger = millimeters_to_points(200.0)
101
+ when PageSize::POSTCARD
102
+ @smaller = inches_to_points(3.94)
103
+ @larger = inches_to_points(5.83)
104
+ else
105
+ @smaller = inches_to_points(8.5)
106
+ @larger = inches_to_points(11)
107
+ end
108
+ OutputSize.new(@larger, @smaller)
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Action'
3
+
4
+ #
5
+ # Represents an action linking to an external URL.
6
+ #
7
+ class UrlAction < Action
8
+ #
9
+ # Initializes a new instance of the UrlAction class.
10
+ #
11
+ # @param url [String] URL the action launches.
12
+ #
13
+ def initialize(url)
14
+ super()
15
+ @url = url
16
+ end
17
+
18
+ #
19
+ # Gets or sets the URL launched by the action.
20
+ #
21
+ attr_accessor :url
22
+
23
+ def to_json(_options = {})
24
+ json_array = {}
25
+
26
+ json_array['url'] = @url unless @url.nil?
27
+
28
+ JSON.pretty_generate(json_array)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies vertical alignment.
4
+ #
5
+ class VAlign
6
+ #
7
+ # Align top.
8
+ #
9
+ TOP = 'top'.freeze
10
+
11
+ #
12
+ # Align center. This is default.
13
+ #
14
+ CENTER = 'center'.freeze
15
+
16
+ #
17
+ # Align bottom.
18
+ #
19
+ BOTTOM = 'bottom'.freeze
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module DynamicPDFApi
2
+ require_relative "RgbColor"
3
+
4
+ #
5
+ # Represents an RGB color created using the web hexadecimal convention.
6
+ #
7
+ class WebColor < RgbColor
8
+ #
9
+ # Initializes a new instance of the WebColor class.
10
+ #
11
+ # @param web_hex_string [String] The hexadecimal string representing the color.
12
+ #
13
+ def initialize(web_hex_string)
14
+ super()
15
+ @_color_string = web_hex_string
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,65 @@
1
+ module DynamicPDFApi
2
+ require_relative "PageSize"
3
+ require_relative "PageOrientation"
4
+ require_relative "InputType"
5
+ #
6
+ # Represents a Word input.
7
+ #
8
+ class WordInput < ConverterInput
9
+
10
+ #
11
+ # Initializes a new instance of the WordInput"/> class.
12
+ #
13
+ # @param name="resource">The resource of type WordResource.
14
+ # @param name="size">The page size of the output PDF.
15
+ # @param name="orientation">The page orientation of the output PDF.
16
+ # @param name="margins">The page margins of the output PDF.
17
+ def initialize(resource, size = PageSize::LETTER, orientation = PageOrientation::PORTRAIT, margins = nil)
18
+ super(resource, size, orientation, margins)
19
+ @_type = InputType::WORD
20
+
21
+ @text_replace = Array.new
22
+ end
23
+
24
+ def GetTextReplace
25
+ if ((@text_replace != nil && @text_replace.Count > 0))
26
+ @text_replace
27
+ else
28
+ nil
29
+ end
30
+ end
31
+
32
+ #
33
+ # Gets or sets the TextReplace object List.
34
+ #
35
+ attr_accessor :text_replace
36
+
37
+ def to_json(_options = {})
38
+ json_array = {}
39
+
40
+ json_array["type"] = "word"
41
+
42
+ json_array["topMargin"] = @top_margin unless @top_margin.nil?
43
+
44
+ json_array["leftMargin"] = @left_margin unless @left_margin.nil?
45
+
46
+ json_array["bottomMargin"] = @bottom_margin unless @bottom_margin.nil?
47
+
48
+ json_array["rightMargin"] = @right_margin unless @right_margin.nil?
49
+
50
+ json_array["pageWidth"] = @page_width unless @page_width.nil?
51
+
52
+ json_array["pageHeight"] = @page_height unless @page_height.nil?
53
+
54
+ json_array["textReplace"] = @text_replace unless @text_replace.nil?
55
+ #---------------------------------------------------
56
+ json_array["templateId"] = @_template_id unless @_template_id.nil?
57
+
58
+ json_array["resourceName"] = @resource_name unless @resource_name.nil?
59
+
60
+ json_array["id"] = @id unless @id.nil?
61
+
62
+ JSON.pretty_generate(json_array)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,82 @@
1
+ module DynamicPDFApi
2
+ require_relative "ResourceType"
3
+ #
4
+ # Represents a Word resource.
5
+ #
6
+ class WordResource < Resource
7
+
8
+ #
9
+ # Initializes a new instance of the WordResource class.
10
+ #
11
+ # @param name="filePath">The Word file path.
12
+ # @param name="resourceName">The The resource name with file extension.
13
+ def initialize(file, resourceName = nil)
14
+ @resource_name = nil
15
+ @file_extension = nil
16
+ super(file, resourceName)
17
+
18
+ @_type = ResourceType::WORD
19
+ @_mime_type = nil
20
+ super(file, resource_name)
21
+ end
22
+
23
+ #
24
+ # Sets the resource name.
25
+ #
26
+ # @remarks The resource name should be specified with a file extension.
27
+ def resource_name=(value)
28
+ @resource_name = value
29
+ if (value == nil || File.extname(value) == nil)
30
+ raise "Invalid resource name."
31
+ end
32
+ end
33
+
34
+ attr_accessor :mime_type
35
+
36
+ def file_extension=(value)
37
+ @file_extension = value
38
+ inputFileExtension = ""
39
+ if (@resource_name != nil)
40
+ if (File.extname(value) != nil)
41
+ inputFileExtension = File.extname(value).ToLower
42
+ else
43
+ raise "Invalid resource name."
44
+ end
45
+ elsif (FilePath != nil)
46
+ if (File.extname(FilePath) != nil)
47
+ inputFileExtension = File.extname(FilePath).ToLower
48
+ else
49
+ raise "Invalid file path specified."
50
+ end
51
+ else
52
+ raise "Invalid file path or resource name."
53
+ end
54
+
55
+ if (inputFileExtension == ".doc")
56
+ @mime_type = "application/msword"
57
+ ".doc"
58
+ elsif (inputFileExtension == ".docx" && @data[0] == 0x50 && @data[1] == 0x4b)
59
+ @mime_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
60
+ ".docx"
61
+ elsif (inputFileExtension == ".odt" && @data[0] == 0x50 && @data[1] == 0x4b)
62
+ @mime_type = "application/vnd.oasis.opendocument.text"
63
+ ".odt"
64
+ else
65
+ raise "Unsupported file type or invalid file extension."
66
+ end
67
+ end
68
+
69
+ def SetMimeType()
70
+
71
+ # _ = FileExtension
72
+ end
73
+
74
+ def to_json(_options = {})
75
+ json_array = {}
76
+ json_array["type"] = "word"
77
+
78
+ json_array["resourceName"] = @resource_name
79
+ JSON.pretty_generate(json_array)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,23 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Response'
3
+
4
+ #
5
+ # Represents the xml response.
6
+ #
7
+ class XmlResponse < Response
8
+ #
9
+ # Initializes a new instance of the XmlResponse class.
10
+ #
11
+ # @param xml_content [String] The xml content of the response.
12
+ #
13
+ def initialize(xml_content = nil)
14
+ super()
15
+ @content = xml_content
16
+ end
17
+
18
+ #
19
+ # Gets the xml content.
20
+ #
21
+ attr_accessor :content
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyClient
4
+ VERSION = "1.0.0-beta"
5
+ end