docspring 4.7.0 → 4.8.0

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +18 -1
  4. data/lib/docspring/api/client.rb +1354 -123
  5. data/lib/docspring/api_client.rb +1 -1
  6. data/lib/docspring/models/add_page_numbers_request.rb +279 -0
  7. data/lib/docspring/models/ask_support_help_request.rb +1 -1
  8. data/lib/docspring/models/base64_job_source.rb +222 -0
  9. data/lib/docspring/models/combined_pdf_job_source.rb +222 -0
  10. data/lib/docspring/models/compress_pdf_request.rb +207 -0
  11. data/lib/docspring/models/create_template_request.rb +22 -2
  12. data/lib/docspring/models/custom_file_job_source.rb +222 -0
  13. data/lib/docspring/models/decrypt_pdf_request.rb +217 -0
  14. data/lib/docspring/models/encrypt_pdf_request.rb +237 -0
  15. data/lib/docspring/models/error_info.rb +15 -5
  16. data/lib/docspring/models/extract_pages_request.rb +234 -0
  17. data/lib/docspring/models/field.rb +1 -1
  18. data/lib/docspring/models/field_input.rb +1 -1
  19. data/lib/docspring/models/flatten_pdf_request.rb +207 -0
  20. data/lib/docspring/models/html_engine_options.rb +1 -1
  21. data/lib/docspring/models/html_engine_options_input.rb +1 -1
  22. data/lib/docspring/models/htmlto_pdf_request.rb +322 -0
  23. data/lib/docspring/models/image_format.rb +41 -0
  24. data/lib/docspring/models/images_to_pdf_request.rb +241 -0
  25. data/lib/docspring/models/job.rb +508 -0
  26. data/lib/docspring/models/job_file.rb +308 -0
  27. data/lib/docspring/models/job_file_job_source.rb +232 -0
  28. data/lib/docspring/models/job_html_engine.rb +41 -0
  29. data/lib/docspring/models/job_list.rb +200 -0
  30. data/lib/docspring/models/job_operation.rb +53 -0
  31. data/lib/docspring/models/job_operation_filter.rb +53 -0
  32. data/lib/docspring/models/job_options.rb +392 -0
  33. data/lib/docspring/models/job_page_margin.rb +198 -0
  34. data/lib/docspring/models/job_page_size.rb +51 -0
  35. data/lib/docspring/models/job_source.rb +267 -0
  36. data/lib/docspring/models/job_source_input.rb +66 -0
  37. data/lib/docspring/models/job_source_type.rb +46 -0
  38. data/lib/docspring/models/job_state.rb +42 -0
  39. data/lib/docspring/models/markdown_to_pdf_request.rb +312 -0
  40. data/lib/docspring/models/page_image.rb +3 -3
  41. data/lib/docspring/models/page_number_position.rb +45 -0
  42. data/lib/docspring/models/page_size.rb +45 -0
  43. data/lib/docspring/models/pdf_permissions.rb +198 -0
  44. data/lib/docspring/models/pdf_permissions_input.rb +198 -0
  45. data/lib/docspring/models/pdfto_images_request.rb +269 -0
  46. data/lib/docspring/models/pdfto_text_request.rb +217 -0
  47. data/lib/docspring/models/rotate_pages_request.rb +244 -0
  48. data/lib/docspring/models/split_pdf_request.rb +229 -0
  49. data/lib/docspring/models/submission_job_source.rb +222 -0
  50. data/lib/docspring/models/template.rb +41 -2
  51. data/lib/docspring/models/template_blank_page.rb +212 -0
  52. data/lib/docspring/models/template_blank_page_input.rb +212 -0
  53. data/lib/docspring/models/template_document.rb +1 -1
  54. data/lib/docspring/models/template_html_engine.rb +41 -0
  55. data/lib/docspring/models/template_page_images.rb +3 -3
  56. data/lib/docspring/models/template_page_list.rb +243 -0
  57. data/lib/docspring/models/template_page_list_input.rb +243 -0
  58. data/lib/docspring/models/template_page_processing_status.rb +28 -1
  59. data/lib/docspring/models/update_template_request.rb +33 -2
  60. data/lib/docspring/models/upload_job_source.rb +222 -0
  61. data/lib/docspring/models/url_job_source.rb +222 -0
  62. data/lib/docspring/models/watermark_layer.rb +41 -0
  63. data/lib/docspring/models/watermark_pdf_request.rb +316 -0
  64. data/lib/docspring/models/webhook_event_type.rb +4 -1
  65. data/lib/docspring/request_schemas.json +1997 -45
  66. data/lib/docspring/version.rb +1 -1
  67. data/lib/docspring.rb +45 -0
  68. metadata +46 -1
@@ -0,0 +1,312 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ # Markdown to convert to PDF, as `markdown` or as a file in `input` (one of them), with the page's settings. GitHub Flavored Markdown: tables, task lists, strikethrough and raw HTML. DocSpring's stylesheet for Markdown styles it, and your `css` is added after it.
18
+ class MarkdownToPdfRequest < ApiModelBase
19
+ # The file the job reads. The job shows it as `inputs[0]`.
20
+ attr_accessor :input
21
+
22
+ # Your own data about the job, such as an ID from your app. Up to 50 keys.
23
+ attr_accessor :metadata
24
+
25
+ # Seconds after the job finishes until its files are deleted, up to 10 years (315360000), sooner or later than the account's expiry setting. Defaults to the account's expiry setting for the PDF tools, which keeps them until you delete the job when it's off. A job that fails is kept for at least 48 hours.
26
+ attr_accessor :expires_in
27
+
28
+ # HTML printed in each page's top margin. An element with the class `pageNumber`, `totalPages` or `date` gets the page's number, the number of pages or today's date. Give its text a `font-size`.
29
+ attr_accessor :header_html
30
+
31
+ # HTML printed in each page's bottom margin, with the same classes as `header_html`.
32
+ attr_accessor :footer_html
33
+
34
+ # The paper size. Default `Letter`. Don't send it with `width` and `height`.
35
+ attr_accessor :page_size
36
+
37
+ # A custom page's width, such as `8.5in` or `210mm`. Send it with `height`.
38
+ attr_accessor :width
39
+
40
+ # A custom page's height, such as `11in` or `297mm`. Send it with `width`.
41
+ attr_accessor :height
42
+
43
+ # Turn the page on its side. Default false.
44
+ attr_accessor :landscape
45
+
46
+ # The page's margins. Each side's default is `1in`.
47
+ attr_accessor :margin
48
+
49
+ # Print the page's own background (what `html` or `body` sets). Default false.
50
+ attr_accessor :print_background
51
+
52
+ # The Markdown. Up to 10 MB. The request body as a whole is limited to 10 MB too, so send a large document as a file in `input` (also up to 10 MB).
53
+ attr_accessor :markdown
54
+
55
+ # CSS added after DocSpring's stylesheet for Markdown, so its rules win: `h1 { font-family: Georgia, serif; }` changes the headings' font.
56
+ attr_accessor :css
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'input' => :'input',
84
+ :'metadata' => :'metadata',
85
+ :'expires_in' => :'expires_in',
86
+ :'header_html' => :'header_html',
87
+ :'footer_html' => :'footer_html',
88
+ :'page_size' => :'page_size',
89
+ :'width' => :'width',
90
+ :'height' => :'height',
91
+ :'landscape' => :'landscape',
92
+ :'margin' => :'margin',
93
+ :'print_background' => :'print_background',
94
+ :'markdown' => :'markdown',
95
+ :'css' => :'css'
96
+ }
97
+ end
98
+
99
+ # Returns attribute mapping this model knows about
100
+ def self.acceptable_attribute_map
101
+ attribute_map
102
+ end
103
+
104
+ # Returns all the JSON keys this model knows about
105
+ def self.acceptable_attributes
106
+ acceptable_attribute_map.values
107
+ end
108
+
109
+ # Attribute type mapping.
110
+ def self.openapi_types
111
+ {
112
+ :'input' => :'JobSourceInput',
113
+ :'metadata' => :'Hash<String, Object>',
114
+ :'expires_in' => :'Integer',
115
+ :'header_html' => :'String',
116
+ :'footer_html' => :'String',
117
+ :'page_size' => :'JobPageSize',
118
+ :'width' => :'String',
119
+ :'height' => :'String',
120
+ :'landscape' => :'Boolean',
121
+ :'margin' => :'JobPageMargin',
122
+ :'print_background' => :'Boolean',
123
+ :'markdown' => :'String',
124
+ :'css' => :'String'
125
+ }
126
+ end
127
+
128
+ # List of attributes with nullable: true
129
+ def self.openapi_nullable
130
+ Set.new([
131
+ ])
132
+ end
133
+
134
+ # Returns attribute type mapping
135
+ def self.acceptable_openapi_types
136
+ openapi_types
137
+ end
138
+
139
+ # Returns the nullable attributes
140
+ def self.acceptable_openapi_nullable
141
+ openapi_nullable
142
+ end
143
+
144
+ # Initializes the object
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ def initialize(attributes = {})
147
+ if (!attributes.is_a?(Hash))
148
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::MarkdownToPdfRequest` initialize method"
149
+ end
150
+
151
+ # check to see if the attribute exists and convert string to symbol for hash key
152
+ acceptable_attribute_map = self.class.acceptable_attribute_map
153
+ attributes = attributes.each_with_object({}) { |(k, v), h|
154
+ if (!acceptable_attribute_map.key?(k.to_sym))
155
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::MarkdownToPdfRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
156
+ end
157
+ h[k.to_sym] = v
158
+ }
159
+
160
+ if attributes.key?(:'input')
161
+ self.input = attributes[:'input']
162
+ end
163
+
164
+ if attributes.key?(:'metadata')
165
+ if (value = attributes[:'metadata']).is_a?(Hash)
166
+ self.metadata = value
167
+ end
168
+ end
169
+
170
+ if attributes.key?(:'expires_in')
171
+ self.expires_in = attributes[:'expires_in']
172
+ end
173
+
174
+ if attributes.key?(:'header_html')
175
+ self.header_html = attributes[:'header_html']
176
+ end
177
+
178
+ if attributes.key?(:'footer_html')
179
+ self.footer_html = attributes[:'footer_html']
180
+ end
181
+
182
+ if attributes.key?(:'page_size')
183
+ self.page_size = attributes[:'page_size']
184
+ end
185
+
186
+ if attributes.key?(:'width')
187
+ self.width = attributes[:'width']
188
+ end
189
+
190
+ if attributes.key?(:'height')
191
+ self.height = attributes[:'height']
192
+ end
193
+
194
+ if attributes.key?(:'landscape')
195
+ self.landscape = attributes[:'landscape']
196
+ end
197
+
198
+ if attributes.key?(:'margin')
199
+ self.margin = attributes[:'margin']
200
+ end
201
+
202
+ if attributes.key?(:'print_background')
203
+ self.print_background = attributes[:'print_background']
204
+ end
205
+
206
+ if attributes.key?(:'markdown')
207
+ self.markdown = attributes[:'markdown']
208
+ end
209
+
210
+ if attributes.key?(:'css')
211
+ self.css = attributes[:'css']
212
+ end
213
+ end
214
+
215
+ # Show invalid properties with the reasons. Usually used together with valid?
216
+ # @return Array for valid properties with the reasons
217
+ def list_invalid_properties
218
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
219
+ invalid_properties = Array.new
220
+ invalid_properties
221
+ end
222
+
223
+ # Check to see if the all the properties in the model are valid
224
+ # @return true if the model is valid
225
+ def valid?
226
+ warn '[DEPRECATED] the `valid?` method is obsolete'
227
+ true
228
+ end
229
+
230
+ # Checks equality by comparing each attribute.
231
+ # @param [Object] Object to be compared
232
+ def ==(o)
233
+ return true if self.equal?(o)
234
+ self.class == o.class &&
235
+ input == o.input &&
236
+ metadata == o.metadata &&
237
+ expires_in == o.expires_in &&
238
+ header_html == o.header_html &&
239
+ footer_html == o.footer_html &&
240
+ page_size == o.page_size &&
241
+ width == o.width &&
242
+ height == o.height &&
243
+ landscape == o.landscape &&
244
+ margin == o.margin &&
245
+ print_background == o.print_background &&
246
+ markdown == o.markdown &&
247
+ css == o.css
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Integer] Hash code
258
+ def hash
259
+ [input, metadata, expires_in, header_html, footer_html, page_size, width, height, landscape, margin, print_background, markdown, css].hash
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def self.build_from_hash(attributes)
266
+ return nil unless attributes.is_a?(Hash)
267
+ attributes = attributes.transform_keys(&:to_sym)
268
+ # include attributes inherited from allOf parents (the nearest declaration wins)
269
+ map = acceptable_attribute_map
270
+ transformed_hash = {}
271
+ acceptable_openapi_types.each_pair do |key, type|
272
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
273
+ transformed_hash["#{key}"] = nil
274
+ elsif type =~ /\AArray<(.*)>/i
275
+ # check to ensure the input is an array given that the attribute
276
+ # is documented as an array but the input is not
277
+ if attributes[map[key]].is_a?(Array)
278
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
279
+ end
280
+ elsif !attributes[map[key]].nil?
281
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
282
+ end
283
+ end
284
+ # Responses can include enum values added after this client was released, so the enum setters
285
+ # accept any value while the model is built from a response
286
+ allocate.tap do |model|
287
+ model.instance_variable_set(:@_skip_enum_validation, true)
288
+ model.send(:initialize, transformed_hash)
289
+ model.remove_instance_variable(:@_skip_enum_validation)
290
+ end
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ # include attributes inherited from allOf parents (the nearest declaration wins)
298
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ if value.nil?
301
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ end
311
+
312
+ end
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module DocSpring
17
- # An image of one page of a PDF, a PNG of a submission's page or a JPEG of a template's.
17
+ # An image of one page of a PDF, a PNG of a submission's page or a JPEG of a template's. A blank page that was added to a template (its `page_list`) has no image file: it's a white page of this `width` and `height`.
18
18
  class PageImage < ApiModelBase
19
19
  # The page number, from 1.
20
20
  attr_accessor :page
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # The image's height in pixels.
26
26
  attr_accessor :height
27
27
 
28
- # A temporary link to download the image. A submission's is null when your account turns off download links for submissions.
28
+ # A temporary link to download the image. A submission's is null when your account turns off download links for submissions, and so is a template's blank page's, which has no image file.
29
29
  attr_accessor :download_url
30
30
 
31
31
  # A link to download a submission's image that doesn't expire: it redirects to a new temporary link. It needs your API token or a signed-in session, except for a submission of a template that makes its submissions public. Null for a template's page images.
@@ -37,7 +37,7 @@ module DocSpring
37
37
  # The image's media type, `image/png` for a submission's pages or `image/jpeg` for a template's.
38
38
  attr_accessor :content_type
39
39
 
40
- # The image's size in bytes.
40
+ # The image's size in bytes. 0 for a template's blank page.
41
41
  attr_accessor :size
42
42
 
43
43
  # The SHA-256 hash of the image. Null for a template's page images.
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ class PageNumberPosition
18
+ BOTTOM_CENTER = "bottom_center".freeze
19
+ BOTTOM_LEFT = "bottom_left".freeze
20
+ BOTTOM_RIGHT = "bottom_right".freeze
21
+ TOP_CENTER = "top_center".freeze
22
+ TOP_LEFT = "top_left".freeze
23
+ TOP_RIGHT = "top_right".freeze
24
+
25
+ def self.all_vars
26
+ @all_vars ||= [BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER, TOP_LEFT, TOP_RIGHT].freeze
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def self.build_from_hash(value)
33
+ new.build_from_hash(value)
34
+ end
35
+
36
+ # Builds the enum from string
37
+ # @param [String] The enum value in the form of the string
38
+ # @return [String] The enum value
39
+ def build_from_hash(value)
40
+ # Only responses are built from hashes, and a value added to the API after this client was released is kept as it
41
+ # is: the constants are the values this client knows
42
+ value
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ class PageSize
18
+ FIT = "fit".freeze
19
+ LETTER = "letter".freeze
20
+ LEGAL = "legal".freeze
21
+ A3 = "a3".freeze
22
+ A4 = "a4".freeze
23
+ A5 = "a5".freeze
24
+
25
+ def self.all_vars
26
+ @all_vars ||= [FIT, LETTER, LEGAL, A3, A4, A5].freeze
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def self.build_from_hash(value)
33
+ new.build_from_hash(value)
34
+ end
35
+
36
+ # Builds the enum from string
37
+ # @param [String] The enum value in the form of the string
38
+ # @return [String] The enum value
39
+ def build_from_hash(value)
40
+ # Only responses are built from hashes, and a value added to the API after this client was released is kept as it
41
+ # is: the constants are the values this client knows
42
+ value
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,198 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ # What someone who opens a PDF without its owner password can do. Everything is allowed by default.
18
+ class PdfPermissions < ApiModelBase
19
+ # Print the PDF.
20
+ attr_accessor :print
21
+
22
+ # Copy its text and images.
23
+ attr_accessor :copy
24
+
25
+ # Change it, fill its forms and assemble its pages.
26
+ attr_accessor :modify
27
+
28
+ # Add comments and annotations.
29
+ attr_accessor :annotate
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'print' => :'print',
35
+ :'copy' => :'copy',
36
+ :'modify' => :'modify',
37
+ :'annotate' => :'annotate'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'print' => :'Boolean',
55
+ :'copy' => :'Boolean',
56
+ :'modify' => :'Boolean',
57
+ :'annotate' => :'Boolean'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Returns attribute type mapping
68
+ def self.acceptable_openapi_types
69
+ openapi_types
70
+ end
71
+
72
+ # Returns the nullable attributes
73
+ def self.acceptable_openapi_nullable
74
+ openapi_nullable
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::PdfPermissions` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::PdfPermissions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'print')
94
+ self.print = attributes[:'print']
95
+ end
96
+
97
+ if attributes.key?(:'copy')
98
+ self.copy = attributes[:'copy']
99
+ end
100
+
101
+ if attributes.key?(:'modify')
102
+ self.modify = attributes[:'modify']
103
+ end
104
+
105
+ if attributes.key?(:'annotate')
106
+ self.annotate = attributes[:'annotate']
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ print == o.print &&
131
+ copy == o.copy &&
132
+ modify == o.modify &&
133
+ annotate == o.annotate
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [print, copy, modify, annotate].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ # include attributes inherited from allOf parents (the nearest declaration wins)
155
+ map = acceptable_attribute_map
156
+ transformed_hash = {}
157
+ acceptable_openapi_types.each_pair do |key, type|
158
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
165
+ end
166
+ elsif !attributes[map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
168
+ end
169
+ end
170
+ # Responses can include enum values added after this client was released, so the enum setters
171
+ # accept any value while the model is built from a response
172
+ allocate.tap do |model|
173
+ model.instance_variable_set(:@_skip_enum_validation, true)
174
+ model.send(:initialize, transformed_hash)
175
+ model.remove_instance_variable(:@_skip_enum_validation)
176
+ end
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ # include attributes inherited from allOf parents (the nearest declaration wins)
184
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ end
197
+
198
+ end