groupdocs_signature_cloud 20.7 → 22.6

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_signature_cloud/api/file_api.rb +6 -6
  3. data/lib/groupdocs_signature_cloud/api/folder_api.rb +6 -6
  4. data/lib/groupdocs_signature_cloud/api/info_api.rb +2 -2
  5. data/lib/groupdocs_signature_cloud/api/license_api.rb +169 -0
  6. data/lib/groupdocs_signature_cloud/api/preview_api.rb +217 -0
  7. data/lib/groupdocs_signature_cloud/api/sign_api.rb +6 -6
  8. data/lib/groupdocs_signature_cloud/api/storage_api.rb +5 -5
  9. data/lib/groupdocs_signature_cloud/api_client.rb +1 -1
  10. data/lib/groupdocs_signature_cloud/api_error.rb +18 -5
  11. data/lib/groupdocs_signature_cloud/configuration.rb +1 -1
  12. data/lib/groupdocs_signature_cloud/models/barcode_signature.rb +21 -3
  13. data/lib/groupdocs_signature_cloud/models/barcode_type.rb +19 -1
  14. data/lib/groupdocs_signature_cloud/models/barcodes_result.rb +19 -1
  15. data/lib/groupdocs_signature_cloud/models/base_settings.rb +19 -1
  16. data/lib/groupdocs_signature_cloud/models/border_line.rb +19 -1
  17. data/lib/groupdocs_signature_cloud/models/brush.rb +19 -1
  18. data/lib/groupdocs_signature_cloud/models/checkbox_form_field_signature.rb +460 -0
  19. data/lib/groupdocs_signature_cloud/models/color.rb +38 -5
  20. data/lib/groupdocs_signature_cloud/models/combobox_form_field_signature.rb +467 -0
  21. data/lib/groupdocs_signature_cloud/models/consumption_result.rb +257 -0
  22. data/lib/groupdocs_signature_cloud/models/delete_options.rb +21 -3
  23. data/lib/groupdocs_signature_cloud/models/delete_result.rb +20 -2
  24. data/lib/groupdocs_signature_cloud/models/delete_settings.rb +19 -1
  25. data/lib/groupdocs_signature_cloud/models/digital_form_field_signature.rb +460 -0
  26. data/lib/groupdocs_signature_cloud/models/digital_signature.rb +35 -7
  27. data/lib/groupdocs_signature_cloud/models/digital_signature_appearance.rb +309 -0
  28. data/lib/groupdocs_signature_cloud/models/disc_usage.rb +19 -1
  29. data/lib/groupdocs_signature_cloud/models/error.rb +19 -1
  30. data/lib/groupdocs_signature_cloud/models/error_details.rb +19 -1
  31. data/lib/groupdocs_signature_cloud/models/file_info.rb +19 -1
  32. data/lib/groupdocs_signature_cloud/models/file_version.rb +19 -1
  33. data/lib/groupdocs_signature_cloud/models/file_versions.rb +19 -1
  34. data/lib/groupdocs_signature_cloud/models/files_list.rb +19 -1
  35. data/lib/groupdocs_signature_cloud/models/files_upload_result.rb +19 -1
  36. data/lib/groupdocs_signature_cloud/models/form_field_signature.rb +445 -0
  37. data/lib/groupdocs_signature_cloud/models/format.rb +19 -1
  38. data/lib/groupdocs_signature_cloud/models/formats_result.rb +19 -1
  39. data/lib/groupdocs_signature_cloud/models/image_appearance.rb +339 -0
  40. data/lib/groupdocs_signature_cloud/models/image_signature.rb +21 -3
  41. data/lib/groupdocs_signature_cloud/models/info_result.rb +36 -6
  42. data/lib/groupdocs_signature_cloud/models/info_settings.rb +38 -5
  43. data/lib/groupdocs_signature_cloud/models/linear_gradient_brush.rb +19 -1
  44. data/lib/groupdocs_signature_cloud/models/object_exist.rb +19 -1
  45. data/lib/groupdocs_signature_cloud/models/options_base.rb +21 -3
  46. data/lib/groupdocs_signature_cloud/models/padding.rb +19 -1
  47. data/lib/groupdocs_signature_cloud/models/page_info.rb +19 -1
  48. data/lib/groupdocs_signature_cloud/models/pages_setup.rb +19 -1
  49. data/lib/groupdocs_signature_cloud/models/pdf_digital_signature.rb +339 -0
  50. data/lib/groupdocs_signature_cloud/models/pdf_digital_signature_appearance.rb +359 -0
  51. data/lib/groupdocs_signature_cloud/models/pdf_text_annotation_appearance.rb +395 -0
  52. data/lib/groupdocs_signature_cloud/models/pdf_text_sticker_appearance.rb +355 -0
  53. data/lib/groupdocs_signature_cloud/models/preview_page.rb +277 -0
  54. data/lib/groupdocs_signature_cloud/models/preview_result.rb +279 -0
  55. data/lib/groupdocs_signature_cloud/models/preview_settings.rb +356 -0
  56. data/lib/groupdocs_signature_cloud/models/qr_code_signature.rb +21 -3
  57. data/lib/groupdocs_signature_cloud/models/qr_code_type.rb +19 -1
  58. data/lib/groupdocs_signature_cloud/models/qr_codes_result.rb +19 -1
  59. data/lib/groupdocs_signature_cloud/models/radial_gradient_brush.rb +19 -1
  60. data/lib/groupdocs_signature_cloud/models/radio_button_form_field_signature.rb +467 -0
  61. data/lib/groupdocs_signature_cloud/models/save_options.rb +19 -1
  62. data/lib/groupdocs_signature_cloud/models/search_barcode_options.rb +21 -3
  63. data/lib/groupdocs_signature_cloud/models/search_digital_options.rb +21 -3
  64. data/lib/groupdocs_signature_cloud/models/search_options.rb +21 -3
  65. data/lib/groupdocs_signature_cloud/models/search_qr_code_options.rb +21 -3
  66. data/lib/groupdocs_signature_cloud/models/search_result.rb +19 -1
  67. data/lib/groupdocs_signature_cloud/models/search_settings.rb +19 -1
  68. data/lib/groupdocs_signature_cloud/models/sign_barcode_options.rb +47 -4
  69. data/lib/groupdocs_signature_cloud/models/sign_digital_options.rb +32 -4
  70. data/lib/groupdocs_signature_cloud/models/sign_image_options.rb +32 -4
  71. data/lib/groupdocs_signature_cloud/models/sign_options.rb +35 -7
  72. data/lib/groupdocs_signature_cloud/models/sign_qr_code_options.rb +47 -4
  73. data/lib/groupdocs_signature_cloud/models/sign_result.rb +20 -2
  74. data/lib/groupdocs_signature_cloud/models/sign_settings.rb +19 -1
  75. data/lib/groupdocs_signature_cloud/models/sign_stamp_options.rb +32 -4
  76. data/lib/groupdocs_signature_cloud/models/sign_text_options.rb +50 -7
  77. data/lib/groupdocs_signature_cloud/models/signature.rb +21 -3
  78. data/lib/groupdocs_signature_cloud/models/signature_appearance.rb +279 -0
  79. data/lib/groupdocs_signature_cloud/models/signature_font.rb +19 -1
  80. data/lib/groupdocs_signature_cloud/models/solid_brush.rb +19 -1
  81. data/lib/groupdocs_signature_cloud/models/stamp_line.rb +19 -1
  82. data/lib/groupdocs_signature_cloud/models/storage_exist.rb +19 -1
  83. data/lib/groupdocs_signature_cloud/models/storage_file.rb +19 -1
  84. data/lib/groupdocs_signature_cloud/models/text_form_field_signature.rb +455 -0
  85. data/lib/groupdocs_signature_cloud/models/text_signature.rb +21 -3
  86. data/lib/groupdocs_signature_cloud/models/texture_brush.rb +19 -1
  87. data/lib/groupdocs_signature_cloud/models/time_stamp.rb +257 -0
  88. data/lib/groupdocs_signature_cloud/models/update_options.rb +21 -3
  89. data/lib/groupdocs_signature_cloud/models/update_result.rb +20 -2
  90. data/lib/groupdocs_signature_cloud/models/update_settings.rb +19 -1
  91. data/lib/groupdocs_signature_cloud/models/verify_barcode_options.rb +21 -3
  92. data/lib/groupdocs_signature_cloud/models/verify_digital_options.rb +21 -3
  93. data/lib/groupdocs_signature_cloud/models/verify_options.rb +21 -3
  94. data/lib/groupdocs_signature_cloud/models/verify_qr_code_options.rb +21 -3
  95. data/lib/groupdocs_signature_cloud/models/verify_result.rb +20 -2
  96. data/lib/groupdocs_signature_cloud/models/verify_settings.rb +19 -1
  97. data/lib/groupdocs_signature_cloud/models/verify_text_options.rb +21 -3
  98. data/lib/groupdocs_signature_cloud/version.rb +2 -2
  99. data/lib/groupdocs_signature_cloud.rb +21 -1
  100. metadata +26 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fa984d6ace26ca0b73e9c3be93031929594d219
4
- data.tar.gz: d990275e8c301d779c59571859caf8023836f7a1
3
+ metadata.gz: e416e30dc865a5ccdc6ef6191d6c171b7dc80de7
4
+ data.tar.gz: 67ce14e9a7d4d1b549d00a10869f75bf157f82e1
5
5
  SHA512:
6
- metadata.gz: 22c1e3b614286e022dfe2420e73561c00fe771d0754ffad4fc619e2448533dc94cdecef85facc52cf05f070d2beeabc25f8b5250c3953ce226be779cd78f9dd5
7
- data.tar.gz: ea0bae5816f4246b5c5aa96cc8fb7b38647aedb4996948f035c860320b731ff8a39fbf6631f3c73715eb975361bcbb926a374d6257b7b751cc487803b3d25958
6
+ metadata.gz: ac814bd08a08460d5d8499c915903b7853d33a3c14b204148f662975acc9738e22f07f07093791d861dda355578d97eebfe072d07e92a41f8dfa7bed3dc703a6
7
+ data.tar.gz: 995ff8bae48a52f8be1eb2c161e3f875b49db9b856e1bac9111a1dc24d231bcf143d0b33fe8bf542b7e54aa6e9eda59c4788cd744fdce27650d245123c58df0e
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="file.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -454,7 +454,7 @@ end
454
454
  #
455
455
  # --------------------------------------------------------------------------------------------------------------------
456
456
  # <copyright company="Aspose Pty Ltd" file="copy_file_request.rb">
457
- # Copyright (c) 2003-2020 Aspose Pty Ltd
457
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
458
458
  # </copyright>
459
459
  # <summary>
460
460
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -515,7 +515,7 @@ end
515
515
  #
516
516
  # --------------------------------------------------------------------------------------------------------------------
517
517
  # <copyright company="Aspose Pty Ltd" file="delete_file_request.rb">
518
- # Copyright (c) 2003-2020 Aspose Pty Ltd
518
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
519
519
  # </copyright>
520
520
  # <summary>
521
521
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -568,7 +568,7 @@ end
568
568
  #
569
569
  # --------------------------------------------------------------------------------------------------------------------
570
570
  # <copyright company="Aspose Pty Ltd" file="download_file_request.rb">
571
- # Copyright (c) 2003-2020 Aspose Pty Ltd
571
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
572
572
  # </copyright>
573
573
  # <summary>
574
574
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -621,7 +621,7 @@ end
621
621
  #
622
622
  # --------------------------------------------------------------------------------------------------------------------
623
623
  # <copyright company="Aspose Pty Ltd" file="move_file_request.rb">
624
- # Copyright (c) 2003-2020 Aspose Pty Ltd
624
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
625
625
  # </copyright>
626
626
  # <summary>
627
627
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -682,7 +682,7 @@ end
682
682
  #
683
683
  # --------------------------------------------------------------------------------------------------------------------
684
684
  # <copyright company="Aspose Pty Ltd" file="upload_file_request.rb">
685
- # Copyright (c) 2003-2020 Aspose Pty Ltd
685
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
686
686
  # </copyright>
687
687
  # <summary>
688
688
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="folder.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -435,7 +435,7 @@ end
435
435
  #
436
436
  # --------------------------------------------------------------------------------------------------------------------
437
437
  # <copyright company="Aspose Pty Ltd" file="copy_folder_request.rb">
438
- # Copyright (c) 2003-2020 Aspose Pty Ltd
438
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
439
439
  # </copyright>
440
440
  # <summary>
441
441
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -492,7 +492,7 @@ end
492
492
  #
493
493
  # --------------------------------------------------------------------------------------------------------------------
494
494
  # <copyright company="Aspose Pty Ltd" file="create_folder_request.rb">
495
- # Copyright (c) 2003-2020 Aspose Pty Ltd
495
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
496
496
  # </copyright>
497
497
  # <summary>
498
498
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -541,7 +541,7 @@ end
541
541
  #
542
542
  # --------------------------------------------------------------------------------------------------------------------
543
543
  # <copyright company="Aspose Pty Ltd" file="delete_folder_request.rb">
544
- # Copyright (c) 2003-2020 Aspose Pty Ltd
544
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
545
545
  # </copyright>
546
546
  # <summary>
547
547
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -594,7 +594,7 @@ end
594
594
  #
595
595
  # --------------------------------------------------------------------------------------------------------------------
596
596
  # <copyright company="Aspose Pty Ltd" file="get_files_list_request.rb">
597
- # Copyright (c) 2003-2020 Aspose Pty Ltd
597
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
598
598
  # </copyright>
599
599
  # <summary>
600
600
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -643,7 +643,7 @@ end
643
643
  #
644
644
  # --------------------------------------------------------------------------------------------------------------------
645
645
  # <copyright company="Aspose Pty Ltd" file="move_folder_request.rb">
646
- # Copyright (c) 2003-2020 Aspose Pty Ltd
646
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
647
647
  # </copyright>
648
648
  # <summary>
649
649
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="info.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -320,7 +320,7 @@ end
320
320
  #
321
321
  # --------------------------------------------------------------------------------------------------------------------
322
322
  # <copyright company="Aspose Pty Ltd" file="get_info_request.rb">
323
- # Copyright (c) 2003-2020 Aspose Pty Ltd
323
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
324
324
  # </copyright>
325
325
  # <summary>
326
326
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,169 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="license.rb">
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ # </summary>
24
+ # -----------------------------------------------------------------------------------
25
+
26
+ require 'uri'
27
+ require 'date'
28
+
29
+ module GroupDocsSignatureCloud
30
+ #
31
+ # GroupDocs.Signature Cloud API
32
+ #
33
+ class LicenseApi
34
+ attr_accessor :config
35
+
36
+ #make LicenseApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of LicenseApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [LicenseApi] New instance of LicenseApi
43
+ def initialize(config)
44
+ @config = config
45
+ @api_client = ApiClient.new(config)
46
+ @access_token = nil
47
+ end
48
+
49
+ # Initializes new instance of LicenseApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [LicenseApi] New instance of LicenseApi
54
+ def self.from_keys(app_sid, app_key)
55
+ config = Configuration.new(app_sid, app_key)
56
+ return new(config)
57
+ end
58
+
59
+ # Initializes new instance of LicenseApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [LicenseApi] New instance of LicenseApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Get license consumption
68
+ #
69
+ # @return [ConsumptionResult]
70
+ def get_consumption_credit()
71
+ data, _status_code, _headers = get_consumption_credit_with_http_info()
72
+ data
73
+ end
74
+
75
+ # Get license consumption
76
+ #
77
+
78
+ # @return [Array<(ConsumptionResult, Fixnum, Hash)>]
79
+ # ConsumptionResult data, response status code and response headers
80
+ def get_consumption_credit_with_http_info()
81
+
82
+
83
+ @api_client.config.logger.debug 'Calling API: LicenseApi.get_consumption_credit ...' if @api_client.config.debugging
84
+ # resource path
85
+ local_var_path = '/signature/consumption'
86
+
87
+ # query parameters
88
+ query_params = {}
89
+
90
+ # header parameters
91
+ header_params = {}
92
+ # HTTP header 'Accept' (if needed)
93
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
94
+ # HTTP header 'Content-Type'
95
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
96
+
97
+ # form parameters
98
+ form_params = {}
99
+
100
+ # http body (model)
101
+ post_body = nil
102
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
103
+ header_params: header_params,
104
+ query_params: query_params,
105
+ form_params: form_params,
106
+ body: post_body,
107
+ access_token: get_access_token,
108
+ return_type: 'ConsumptionResult')
109
+ if @api_client.config.debugging
110
+ @api_client.config.logger.debug "API called:
111
+ LicenseApi#get_consumption_credit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
112
+ end
113
+ [data, status_code, headers]
114
+ end
115
+
116
+ #
117
+ # Helper method to convert first letter to downcase
118
+ #
119
+ private def downcase_first_letter(str)
120
+ value = str[0].downcase + str[1..-1]
121
+ value
122
+ end
123
+
124
+ #
125
+ # Retrieves access token
126
+ #
127
+ private def get_access_token
128
+ if @access_token.nil? then
129
+ request_access_token
130
+ end
131
+
132
+ @access_token
133
+ end
134
+
135
+ #
136
+ # Gets a access token from server
137
+ #
138
+ private def request_access_token
139
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
140
+ auth_config.api_base_url = @config.api_base_url
141
+ auth_config.debugging = @config.debugging
142
+ auth_config.logger = @config.logger
143
+ auth_config.temp_folder_path = @config.temp_folder_path
144
+ auth_config.client_side_validation = @config.client_side_validation
145
+ auth_config.api_version = ''
146
+
147
+ auth_api_client = ApiClient.new(auth_config)
148
+
149
+ request_url = "/connect/token"
150
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
151
+
152
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
153
+
154
+ @access_token = data[:access_token]
155
+
156
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
157
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
158
+ @access_token_expires_at = DateTime.now + expires_in_days
159
+ end
160
+
161
+ # requires all files inside a directory from current dir
162
+ # @param _dir can be relative path like '/lib' or "../lib"
163
+ private def require_all(_dir)
164
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
165
+ require file
166
+ end
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,217 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="preview.rb">
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ # </summary>
24
+ # -----------------------------------------------------------------------------------
25
+
26
+ require 'uri'
27
+ require 'date'
28
+
29
+ module GroupDocsSignatureCloud
30
+ #
31
+ # GroupDocs.Signature Cloud API
32
+ #
33
+ class PreviewApi
34
+ attr_accessor :config
35
+
36
+ #make PreviewApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of PreviewApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [PreviewApi] New instance of PreviewApi
43
+ def initialize(config)
44
+ @config = config
45
+ @api_client = ApiClient.new(config)
46
+ @access_token = nil
47
+ end
48
+
49
+ # Initializes new instance of PreviewApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [PreviewApi] New instance of PreviewApi
54
+ def self.from_keys(app_sid, app_key)
55
+ config = Configuration.new(app_sid, app_key)
56
+ return new(config)
57
+ end
58
+
59
+ # Initializes new instance of PreviewApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [PreviewApi] New instance of PreviewApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Creates document preview images
68
+ #
69
+ # @param request preview_document_request
70
+ # @return [PreviewResult]
71
+ def preview_document(request)
72
+ data, _status_code, _headers = preview_document_with_http_info(request)
73
+ data
74
+ end
75
+
76
+ # Creates document preview images
77
+ #
78
+ # @param request preview_document_request
79
+ # @return [Array<(PreviewResult, Fixnum, Hash)>]
80
+ # PreviewResult data, response status code and response headers
81
+ def preview_document_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? PreviewDocumentRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: PreviewApi.preview_document ...' if @api_client.config.debugging
85
+ # verify the required parameter 'preview_settings' is set
86
+ raise ArgumentError, 'Missing the required parameter preview_settings when calling PreviewApi.preview_document' if @api_client.config.client_side_validation && request.preview_settings.nil?
87
+ # resource path
88
+ local_var_path = '/signature/preview'
89
+
90
+ # query parameters
91
+ query_params = {}
92
+
93
+ # header parameters
94
+ header_params = {}
95
+ # HTTP header 'Accept' (if needed)
96
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
97
+ # HTTP header 'Content-Type'
98
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
99
+
100
+ # form parameters
101
+ form_params = {}
102
+
103
+ # http body (model)
104
+ post_body = @api_client.object_to_http_body(request.preview_settings)
105
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
106
+ header_params: header_params,
107
+ query_params: query_params,
108
+ form_params: form_params,
109
+ body: post_body,
110
+ access_token: get_access_token,
111
+ return_type: 'PreviewResult')
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "API called:
114
+ PreviewApi#preview_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ [data, status_code, headers]
117
+ end
118
+
119
+ #
120
+ # Helper method to convert first letter to downcase
121
+ #
122
+ private def downcase_first_letter(str)
123
+ value = str[0].downcase + str[1..-1]
124
+ value
125
+ end
126
+
127
+ #
128
+ # Retrieves access token
129
+ #
130
+ private def get_access_token
131
+ if @access_token.nil? then
132
+ request_access_token
133
+ end
134
+
135
+ @access_token
136
+ end
137
+
138
+ #
139
+ # Gets a access token from server
140
+ #
141
+ private def request_access_token
142
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
143
+ auth_config.api_base_url = @config.api_base_url
144
+ auth_config.debugging = @config.debugging
145
+ auth_config.logger = @config.logger
146
+ auth_config.temp_folder_path = @config.temp_folder_path
147
+ auth_config.client_side_validation = @config.client_side_validation
148
+ auth_config.api_version = ''
149
+
150
+ auth_api_client = ApiClient.new(auth_config)
151
+
152
+ request_url = "/connect/token"
153
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
154
+
155
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
156
+
157
+ @access_token = data[:access_token]
158
+
159
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
160
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
161
+ @access_token_expires_at = DateTime.now + expires_in_days
162
+ end
163
+
164
+ # requires all files inside a directory from current dir
165
+ # @param _dir can be relative path like '/lib' or "../lib"
166
+ private def require_all(_dir)
167
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
168
+ require file
169
+ end
170
+ end
171
+ end
172
+ end
173
+ #
174
+ # --------------------------------------------------------------------------------------------------------------------
175
+ # <copyright company="Aspose Pty Ltd" file="preview_document_request.rb">
176
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
177
+ # </copyright>
178
+ # <summary>
179
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
180
+ # of this software and associated documentation files (the "Software"), to deal
181
+ # in the Software without restriction, including without limitation the rights
182
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
183
+ # copies of the Software, and to permit persons to whom the Software is
184
+ # furnished to do so, subject to the following conditions:
185
+ #
186
+ # The above copyright notice and this permission notice shall be included in all
187
+ # copies or substantial portions of the Software.
188
+ #
189
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
190
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
191
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
192
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
193
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
194
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
195
+ # SOFTWARE.
196
+ # </summary>
197
+ # --------------------------------------------------------------------------------------------------------------------
198
+ #
199
+
200
+ module GroupDocsSignatureCloud
201
+
202
+ #
203
+ # Request model for preview_document operation.
204
+ #
205
+ class PreviewDocumentRequest
206
+
207
+ # Document preview settings
208
+ attr_accessor :preview_settings
209
+
210
+ #
211
+ # Initializes a new instance.
212
+ # @param preview_settings Document preview settings
213
+ def initialize(preview_settings)
214
+ self.preview_settings = preview_settings
215
+ end
216
+ end
217
+ end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="sign.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -381,7 +381,7 @@ end
381
381
  #
382
382
  # --------------------------------------------------------------------------------------------------------------------
383
383
  # <copyright company="Aspose Pty Ltd" file="create_signatures_request.rb">
384
- # Copyright (c) 2003-2020 Aspose Pty Ltd
384
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
385
385
  # </copyright>
386
386
  # <summary>
387
387
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -426,7 +426,7 @@ end
426
426
  #
427
427
  # --------------------------------------------------------------------------------------------------------------------
428
428
  # <copyright company="Aspose Pty Ltd" file="delete_signatures_request.rb">
429
- # Copyright (c) 2003-2020 Aspose Pty Ltd
429
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
430
430
  # </copyright>
431
431
  # <summary>
432
432
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -471,7 +471,7 @@ end
471
471
  #
472
472
  # --------------------------------------------------------------------------------------------------------------------
473
473
  # <copyright company="Aspose Pty Ltd" file="search_signatures_request.rb">
474
- # Copyright (c) 2003-2020 Aspose Pty Ltd
474
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
475
475
  # </copyright>
476
476
  # <summary>
477
477
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -516,7 +516,7 @@ end
516
516
  #
517
517
  # --------------------------------------------------------------------------------------------------------------------
518
518
  # <copyright company="Aspose Pty Ltd" file="update_signatures_request.rb">
519
- # Copyright (c) 2003-2020 Aspose Pty Ltd
519
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
520
520
  # </copyright>
521
521
  # <summary>
522
522
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -561,7 +561,7 @@ end
561
561
  #
562
562
  # --------------------------------------------------------------------------------------------------------------------
563
563
  # <copyright company="Aspose Pty Ltd" file="verify_signatures_request.rb">
564
- # Copyright (c) 2003-2020 Aspose Pty Ltd
564
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
565
565
  # </copyright>
566
566
  # <summary>
567
567
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="storage.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -353,7 +353,7 @@ end
353
353
  #
354
354
  # --------------------------------------------------------------------------------------------------------------------
355
355
  # <copyright company="Aspose Pty Ltd" file="get_disc_usage_request.rb">
356
- # Copyright (c) 2003-2020 Aspose Pty Ltd
356
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
357
357
  # </copyright>
358
358
  # <summary>
359
359
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -398,7 +398,7 @@ end
398
398
  #
399
399
  # --------------------------------------------------------------------------------------------------------------------
400
400
  # <copyright company="Aspose Pty Ltd" file="get_file_versions_request.rb">
401
- # Copyright (c) 2003-2020 Aspose Pty Ltd
401
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
402
402
  # </copyright>
403
403
  # <summary>
404
404
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -447,7 +447,7 @@ end
447
447
  #
448
448
  # --------------------------------------------------------------------------------------------------------------------
449
449
  # <copyright company="Aspose Pty Ltd" file="object_exists_request.rb">
450
- # Copyright (c) 2003-2020 Aspose Pty Ltd
450
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
451
451
  # </copyright>
452
452
  # <summary>
453
453
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -500,7 +500,7 @@ end
500
500
  #
501
501
  # --------------------------------------------------------------------------------------------------------------------
502
502
  # <copyright company="Aspose Pty Ltd" file="storage_exists_request.rb">
503
- # Copyright (c) 2003-2020 Aspose Pty Ltd
503
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
504
504
  # </copyright>
505
505
  # <summary>
506
506
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_client.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_error.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -39,10 +39,23 @@ module GroupDocsSignatureCloud
39
39
 
40
40
  if arg.key?(:response_body) then
41
41
  data = JSON.parse(arg[:response_body], :symbolize_names => true)
42
- if !data.nil? && !data[:error].nil? then
43
- @message = data[:error]
44
- elsif !data.nil? && !data[:Error].nil? && !data[:Error][:Message].nil? then
45
- @message = data[:Error][:Message]
42
+ if !data.nil? then
43
+ if !data[:error].nil? then
44
+ error = data[:error]
45
+ if error.kind_of?(String) then
46
+ @message = error
47
+ else
48
+ @message = error[:message]
49
+ end
50
+ else
51
+ message = data[:message]
52
+ if !message.nil? && message.kind_of?(String) then
53
+ @message = message
54
+ @code = data[:code]
55
+ else
56
+ @message = data
57
+ end
58
+ end
46
59
  end
47
60
  end
48
61
 
@@ -1,6 +1,6 @@
1
1
  # ------------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="configuration.rb">
3
- # Copyright (c) 2003-2020 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2022 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy