groupdocs_annotation_cloud 18.7 → 19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_annotation_cloud.rb +23 -39
  3. data/lib/groupdocs_annotation_cloud/api/annotate_api.rb +664 -0
  4. data/lib/groupdocs_annotation_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_annotation_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_annotation_cloud/api/{pdf_file_api.rb → info_api.rb} +101 -105
  7. data/lib/groupdocs_annotation_cloud/api/preview_api.rb +380 -0
  8. data/lib/groupdocs_annotation_cloud/api/storage_api.rb +541 -0
  9. data/lib/groupdocs_annotation_cloud/api_client.rb +7 -17
  10. data/lib/groupdocs_annotation_cloud/api_error.rb +5 -3
  11. data/lib/groupdocs_annotation_cloud/configuration.rb +3 -3
  12. data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +24 -16
  13. data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +97 -82
  14. data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +31 -23
  15. data/lib/groupdocs_annotation_cloud/models/disc_usage.rb +234 -0
  16. data/lib/groupdocs_annotation_cloud/models/document_info.rb +44 -22
  17. data/lib/groupdocs_annotation_cloud/models/error.rb +244 -0
  18. data/lib/groupdocs_annotation_cloud/models/error_details.rb +229 -0
  19. data/lib/groupdocs_annotation_cloud/models/file_version.rb +289 -0
  20. data/lib/groupdocs_annotation_cloud/models/{value_type.rb → file_versions.rb} +33 -13
  21. data/lib/groupdocs_annotation_cloud/models/files_list.rb +216 -0
  22. data/lib/groupdocs_annotation_cloud/models/files_upload_result.rb +228 -0
  23. data/lib/groupdocs_annotation_cloud/models/format.rb +224 -0
  24. data/lib/groupdocs_annotation_cloud/models/formats_result.rb +216 -0
  25. data/lib/groupdocs_annotation_cloud/models/link.rb +24 -16
  26. data/lib/groupdocs_annotation_cloud/models/link_element.rb +18 -10
  27. data/lib/groupdocs_annotation_cloud/models/object_exist.rb +234 -0
  28. data/lib/groupdocs_annotation_cloud/models/{image_page.rb → page_image.rb} +28 -13
  29. data/lib/groupdocs_annotation_cloud/models/{image_pages.rb → page_images.rb} +26 -14
  30. data/lib/groupdocs_annotation_cloud/models/page_info.rb +41 -23
  31. data/lib/groupdocs_annotation_cloud/models/point.rb +31 -13
  32. data/lib/groupdocs_annotation_cloud/models/rectangle.rb +45 -17
  33. data/lib/groupdocs_annotation_cloud/models/row_info.rb +38 -16
  34. data/lib/groupdocs_annotation_cloud/models/storage_exist.rb +219 -0
  35. data/lib/groupdocs_annotation_cloud/models/storage_file.rb +264 -0
  36. data/lib/groupdocs_annotation_cloud/version.rb +2 -2
  37. metadata +22 -39
  38. data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +0 -344
  39. data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +0 -218
  40. data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +0 -395
  41. data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +0 -53
  42. data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +0 -49
  43. data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +0 -53
  44. data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +0 -53
  45. data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +0 -53
  46. data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +0 -49
  47. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +0 -53
  48. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +0 -53
  49. data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +0 -53
  50. data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +0 -57
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_client.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -51,7 +51,7 @@ module GroupDocsAnnotationCloud
51
51
  def initialize(config)
52
52
  @config = config
53
53
  @default_headers = {
54
- 'Content-Type' => "application/json",
54
+ 'Content-Type' => config.api_version == '' ? "application/x-www-form-urlencoded" : "application/json",
55
55
  'x-groupdocs-client' => "ruby sdk",
56
56
  'x-groupdocs-version' => GroupDocsAnnotationCloud::VERSION.to_s
57
57
  }
@@ -69,18 +69,8 @@ module GroupDocsAnnotationCloud
69
69
  end
70
70
 
71
71
  unless response.success?
72
- if response.status == 0
73
- # Errors from libcurl will be made visible here
74
- raise ApiError.new(:code => 0,
75
- :message => response.reason_phrase)
76
- else
77
- raise ApiError.new(:code => response.status,
78
- :response_headers => response.headers,
79
- :response_body => response.body),
80
- response.reason_phrase
81
- end
72
+ raise ApiError.new(:code => response.status, :response_body => response.body)
82
73
  end
83
-
84
74
 
85
75
  data = deserialize(response, opts[:return_type]) if opts[:return_type]
86
76
  [data, response.status, response.headers]
@@ -250,7 +240,7 @@ module GroupDocsAnnotationCloud
250
240
  encoding = response.body.encoding
251
241
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
252
242
  @tempfile = tempfile
253
- IO.binwrite(tempfile, response.body)
243
+ tempfile.write(response.body)
254
244
  response.on_complete do |resp|
255
245
  tempfile.close
256
246
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
@@ -283,7 +273,9 @@ module GroupDocsAnnotationCloud
283
273
  # @return [String] HTTP body data in the form of string
284
274
  def build_request_body(header_params, form_params, body)
285
275
  # http form
286
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
276
+ if body
277
+ data = body.is_a?(String) ? body : body.to_json
278
+ elsif header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
287
279
  header_params['Content-Type'] == 'multipart/form-data'
288
280
  data = {}
289
281
  form_params.each do |key, value|
@@ -296,8 +288,6 @@ module GroupDocsAnnotationCloud
296
288
  data[key] = value.to_s
297
289
  end
298
290
  end
299
- elsif body
300
- data = body.is_a?(String) ? body : body.to_json
301
291
  else
302
292
  data = nil
303
293
  end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_error.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,12 +40,14 @@ module GroupDocsAnnotationCloud
40
40
  if arg.key?(:response_body) then
41
41
  data = JSON.parse(arg[:response_body], :symbolize_names => true)
42
42
  if !data.nil? && !data[:error].nil? then
43
- @message = data[:error][:message]
43
+ @message = data[:error]
44
+ elsif !data.nil? && !data[:Error].nil? && !data[:Error][:Message].nil? then
45
+ @message = data[:Error][:Message]
44
46
  end
45
47
  end
46
48
 
47
49
  if arg.key?(:arg) then
48
- @code = arg[:code]
50
+ @code = arg[:Code]
49
51
  end
50
52
 
51
53
  else
@@ -1,6 +1,6 @@
1
1
  # ------------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="configuration.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -34,7 +34,7 @@ module GroupDocsAnnotationCloud
34
34
  # @return [String] Api base url
35
35
  attr_accessor :api_base_url
36
36
 
37
- # Api version, default is '/v1'
37
+ # Api version, default is '/v2.0'
38
38
  #
39
39
  # @return [String] Api version
40
40
  attr_accessor :api_version
@@ -81,7 +81,7 @@ module GroupDocsAnnotationCloud
81
81
  # @return [Configuration] New instance of Configuration
82
82
  def initialize(app_sid, app_key)
83
83
  @api_base_url = "https://api.groupdocs.cloud"
84
- @api_version = '/v1'
84
+ @api_version = '/v2.0'
85
85
  @app_sid = app_sid
86
86
  @app_key = app_key
87
87
  @client_side_validation = true
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="annotation_api_link.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -28,28 +28,28 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsAnnotationCloud
31
- # Provides information for the words api resource link.
31
+ # Provides information for the words api resource link
32
32
  class AnnotationApiLink
33
33
 
34
34
  # The \"href\" attribute contains the link's IRI. atom:link elements MUST have an href attribute, whose value MUST be a IRI reference
35
35
  attr_accessor :href
36
36
 
37
- # atom:link elements MAY have a \"rel\" attribute that indicates the link relation type. If the \"rel\" attribute is not present, the link element MUST be interpreted as if the link relation type is \"alternate\".
37
+ # atom:link elements MAY have a \"rel\" attribute that indicates the link relation type. If the \"rel\" attribute is not present, the link element MUST be interpreted as if the link relation type is \"alternate\"
38
38
  attr_accessor :rel
39
39
 
40
- # On the link element, the \"type\" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note that the type attribute does not override the actual media type returned with the representation.
40
+ # On the link element, the \"type\" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note that the type attribute does not override the actual media type returned with the representation
41
41
  attr_accessor :type
42
42
 
43
- # The \"title\" attribute conveys human-readable information about the link. The content of the \"title\" attribute is Language-Sensitive.
43
+ # The \"title\" attribute conveys human-readable information about the link. The content of the \"title\" attribute is Language-Sensitive
44
44
  attr_accessor :title
45
45
 
46
46
  # Attribute mapping from ruby-style variable name to JSON key.
47
47
  def self.attribute_map
48
48
  {
49
- :'href' => :'href',
50
- :'rel' => :'rel',
51
- :'type' => :'type',
52
- :'title' => :'title'
49
+ :'href' => :'Href',
50
+ :'rel' => :'Rel',
51
+ :'type' => :'Type',
52
+ :'title' => :'Title'
53
53
  }
54
54
  end
55
55
 
@@ -125,20 +125,28 @@ module GroupDocsAnnotationCloud
125
125
  [href, rel, type, title].hash
126
126
  end
127
127
 
128
+ # Downcases first letter.
129
+ # @return downcased string
130
+ def uncap(str)
131
+ str[0, 1].downcase + str[1..-1]
132
+ end
133
+
128
134
  # Builds the object from hash
129
135
  # @param [Hash] attributes Model attributes in the form of hash
130
136
  # @return [Object] Returns the model itself
131
137
  def build_from_hash(attributes)
132
138
  return nil unless attributes.is_a?(Hash)
133
139
  self.class.swagger_types.each_pair do |key, type|
140
+ pname = uncap(self.class.attribute_map[key]).intern
141
+ value = attributes[pname]
134
142
  if type =~ /\AArray<(.*)>/i
135
143
  # check to ensure the input is an array given that the the attribute
136
- # is documented as an array but the input is not
137
- if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ # is documented as an array but the input is not
145
+ if value.is_a?(Array)
146
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
139
147
  end
140
- elsif !attributes[self.class.attribute_map[key]].nil?
141
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ elsif !value.nil?
149
+ self.send("#{key}=", _deserialize(type, value))
142
150
  end
143
151
  # or else data not found in attributes(hash), not an issue as the data can be optional
144
152
  end
@@ -153,9 +161,9 @@ module GroupDocsAnnotationCloud
153
161
  def _deserialize(type, value)
154
162
  case type.to_sym
155
163
  when :DateTime
156
- Time.at(/\d/.match(value)[0].to_f).to_datetime
164
+ Date.parse value
157
165
  when :Date
158
- Time.at(/\d/.match(value)[0].to_f).to_date
166
+ Date.parse value
159
167
  when :String
160
168
  value.to_s
161
169
  when :Integer
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="annotation_info.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -28,74 +28,80 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsAnnotationCloud
31
-
31
+ # Describes annotation properties
32
32
  class AnnotationInfo
33
33
 
34
- # Gets or sets the unique identifier.
34
+ # Gets or sets the unique identifier
35
35
  attr_accessor :guid
36
36
 
37
- # Gets or sets the document unique identifier.
37
+ # Gets or sets the document unique identifier
38
38
  attr_accessor :document_guid
39
39
 
40
- # Gets or sets the text.
40
+ # Gets or sets the annotation text
41
41
  attr_accessor :text
42
42
 
43
- # Gets or sets the creator unique identifier.
43
+ # Gets or sets the creator unique identifier
44
44
  attr_accessor :creator_guid
45
45
 
46
- # Gets or sets the name of the creator.
46
+ # Gets or sets the name of the creator
47
47
  attr_accessor :creator_name
48
48
 
49
- # Gets or sets the creator email.
49
+ # Gets or sets the creator's email
50
50
  attr_accessor :creator_email
51
51
 
52
- # Gets or sets the box.
52
+ # Gets or sets the box where annotation will be placed
53
53
  attr_accessor :box
54
54
 
55
- # Gets or sets the page number.
55
+ # Gets or sets the number of page where annotation will be placed
56
56
  attr_accessor :page_number
57
57
 
58
- # Gets or sets the annotation position.
58
+ # Gets or sets the annotation position
59
59
  attr_accessor :annotation_position
60
60
 
61
- # Gets or sets the SVG path.
61
+ # Gets or sets the annotation SVG path
62
62
  attr_accessor :svg_path
63
63
 
64
- # Gets or sets the type.
64
+ # Gets or sets the annotation type
65
65
  attr_accessor :type
66
66
 
67
- # Gets or sets the access.
67
+ # Gets or sets the annotation access
68
68
  attr_accessor :access
69
69
 
70
- # Gets or sets the replies.
70
+ # Gets or sets the array of annotation replies
71
71
  attr_accessor :replies
72
72
 
73
- # Gets or sets the created on.
73
+ # Gets or sets the annotation created on date
74
74
  attr_accessor :created_on
75
75
 
76
- # Gets or sets the color of the font.
76
+ # Gets or sets the annotation's font color
77
77
  attr_accessor :font_color
78
78
 
79
- # Gets or sets the color of the pen.
79
+ # Gets or sets the annotation's pen color
80
80
  attr_accessor :pen_color
81
81
 
82
- # Gets or sets the width of the pen.
82
+ # Gets or sets the annotation's pen width
83
83
  attr_accessor :pen_width
84
84
 
85
- # Gets or sets the pen style.
85
+ # Gets or sets the annotation's pen style
86
86
  attr_accessor :pen_style
87
87
 
88
- # Gets or sets the color of the background.
88
+ # Gets or sets the annotation's background color
89
89
  attr_accessor :background_color
90
90
 
91
- # Gets or sets the field text.
91
+ # Gets or sets the annotation's field text
92
92
  attr_accessor :field_text
93
93
 
94
- # Gets or sets the font family.
94
+ # Gets or sets the annotation's font family
95
95
  attr_accessor :font_family
96
96
 
97
- # Gets or sets the size of the font.
97
+ # Gets or sets the annotation's font size
98
98
  attr_accessor :font_size
99
+
100
+ # Gets or sets the annotation's opacity
101
+ attr_accessor :opacity
102
+
103
+ # Gets or sets the watermark annotation's rotation angle
104
+ attr_accessor :angle
99
105
  class EnumAttributeValidator
100
106
  attr_reader :datatype
101
107
  attr_reader :allowable_values
@@ -121,28 +127,30 @@ module GroupDocsAnnotationCloud
121
127
  # Attribute mapping from ruby-style variable name to JSON key.
122
128
  def self.attribute_map
123
129
  {
124
- :'guid' => :'guid',
125
- :'document_guid' => :'documentGuid',
126
- :'text' => :'text',
127
- :'creator_guid' => :'creatorGuid',
128
- :'creator_name' => :'creatorName',
129
- :'creator_email' => :'creatorEmail',
130
- :'box' => :'box',
131
- :'page_number' => :'pageNumber',
132
- :'annotation_position' => :'annotationPosition',
133
- :'svg_path' => :'svgPath',
134
- :'type' => :'type',
135
- :'access' => :'access',
136
- :'replies' => :'replies',
137
- :'created_on' => :'createdOn',
138
- :'font_color' => :'fontColor',
139
- :'pen_color' => :'penColor',
140
- :'pen_width' => :'penWidth',
141
- :'pen_style' => :'penStyle',
142
- :'background_color' => :'backgroundColor',
143
- :'field_text' => :'fieldText',
144
- :'font_family' => :'fontFamily',
145
- :'font_size' => :'fontSize'
130
+ :'guid' => :'Guid',
131
+ :'document_guid' => :'DocumentGuid',
132
+ :'text' => :'Text',
133
+ :'creator_guid' => :'CreatorGuid',
134
+ :'creator_name' => :'CreatorName',
135
+ :'creator_email' => :'CreatorEmail',
136
+ :'box' => :'Box',
137
+ :'page_number' => :'PageNumber',
138
+ :'annotation_position' => :'AnnotationPosition',
139
+ :'svg_path' => :'SvgPath',
140
+ :'type' => :'Type',
141
+ :'access' => :'Access',
142
+ :'replies' => :'Replies',
143
+ :'created_on' => :'CreatedOn',
144
+ :'font_color' => :'FontColor',
145
+ :'pen_color' => :'PenColor',
146
+ :'pen_width' => :'PenWidth',
147
+ :'pen_style' => :'PenStyle',
148
+ :'background_color' => :'BackgroundColor',
149
+ :'field_text' => :'FieldText',
150
+ :'font_family' => :'FontFamily',
151
+ :'font_size' => :'FontSize',
152
+ :'opacity' => :'Opacity',
153
+ :'angle' => :'Angle'
146
154
  }
147
155
  end
148
156
 
@@ -170,7 +178,9 @@ module GroupDocsAnnotationCloud
170
178
  :'background_color' => :'Integer',
171
179
  :'field_text' => :'String',
172
180
  :'font_family' => :'String',
173
- :'font_size' => :'Float'
181
+ :'font_size' => :'Float',
182
+ :'opacity' => :'Float',
183
+ :'angle' => :'Float'
174
184
  }
175
185
  end
176
186
 
@@ -272,6 +282,14 @@ module GroupDocsAnnotationCloud
272
282
  self.font_size = attributes[:'FontSize']
273
283
  end
274
284
 
285
+ if attributes.key?(:'Opacity')
286
+ self.opacity = attributes[:'Opacity']
287
+ end
288
+
289
+ if attributes.key?(:'Angle')
290
+ self.angle = attributes[:'Angle']
291
+ end
292
+
275
293
  end
276
294
 
277
295
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -294,10 +312,6 @@ module GroupDocsAnnotationCloud
294
312
  invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
295
313
  end
296
314
 
297
- if @font_color.nil?
298
- invalid_properties.push("invalid value for 'font_color', font_color cannot be nil.")
299
- end
300
-
301
315
  return invalid_properties
302
316
  end
303
317
 
@@ -307,25 +321,25 @@ module GroupDocsAnnotationCloud
307
321
  return false if @document_guid.nil?
308
322
  return false if @box.nil?
309
323
  return false if @type.nil?
310
- type_validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
324
+ type_validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance", "Ellipse"])
311
325
  return false unless type_validator.valid?(@type)
312
326
  access_validator = EnumAttributeValidator.new('String', ["Public", "Private"])
313
327
  return false unless access_validator.valid?(@access)
314
328
  return false if @created_on.nil?
315
- return false if @font_color.nil?
316
329
  return true
317
330
  end
318
331
 
319
332
  # Custom attribute writer method checking allowed values (enum).
320
333
  # @param [Object] type Object to be assigned
321
334
  def type=(type)
322
- validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
323
- if validator.valid?(type)
335
+ validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance", "Ellipse"])
336
+ if type.to_i == 0
337
+ unless validator.valid?(type)
338
+ raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
339
+ end
324
340
  @type = type
325
- elsif type.to_i >= 0 && type.to_i < validator.allowable_values.count
326
- @type = validator.allowable_values[type.to_i]
327
341
  else
328
- raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
342
+ @type = validator.allowable_values[type.to_i]
329
343
  end
330
344
  end
331
345
 
@@ -333,12 +347,13 @@ module GroupDocsAnnotationCloud
333
347
  # @param [Object] access Object to be assigned
334
348
  def access=(access)
335
349
  validator = EnumAttributeValidator.new('String', ["Public", "Private"])
336
- if validator.valid?(access)
350
+ if access.to_i == 0
351
+ unless validator.valid?(access)
352
+ raise ArgumentError, "invalid value for 'access', must be one of #{validator.allowable_values}."
353
+ end
337
354
  @access = access
338
- elsif access.to_i >= 0 && access.to_i < validator.allowable_values.count
339
- @access = validator.allowable_values[access.to_i]
340
355
  else
341
- raise ArgumentError, "invalid value for 'access', must be one of #{validator.allowable_values}."
356
+ @access = validator.allowable_values[access.to_i]
342
357
  end
343
358
  end
344
359
 
@@ -368,7 +383,9 @@ module GroupDocsAnnotationCloud
368
383
  background_color == other.background_color &&
369
384
  field_text == other.field_text &&
370
385
  font_family == other.font_family &&
371
- font_size == other.font_size
386
+ font_size == other.font_size &&
387
+ opacity == other.opacity &&
388
+ angle == other.angle
372
389
  end
373
390
 
374
391
  # @see the `==` method
@@ -380,7 +397,13 @@ module GroupDocsAnnotationCloud
380
397
  # Calculates hash code according to all attributes.
381
398
  # @return [Fixnum] Hash code
382
399
  def hash
383
- [guid, document_guid, text, creator_guid, creator_name, creator_email, box, page_number, annotation_position, svg_path, type, access, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, field_text, font_family, font_size].hash
400
+ [guid, document_guid, text, creator_guid, creator_name, creator_email, box, page_number, annotation_position, svg_path, type, access, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, field_text, font_family, font_size, opacity, angle].hash
401
+ end
402
+
403
+ # Downcases first letter.
404
+ # @return downcased string
405
+ def uncap(str)
406
+ str[0, 1].downcase + str[1..-1]
384
407
  end
385
408
 
386
409
  # Builds the object from hash
@@ -389,14 +412,16 @@ module GroupDocsAnnotationCloud
389
412
  def build_from_hash(attributes)
390
413
  return nil unless attributes.is_a?(Hash)
391
414
  self.class.swagger_types.each_pair do |key, type|
415
+ pname = uncap(self.class.attribute_map[key]).intern
416
+ value = attributes[pname]
392
417
  if type =~ /\AArray<(.*)>/i
393
418
  # check to ensure the input is an array given that the the attribute
394
- # is documented as an array but the input is not
395
- if attributes[self.class.attribute_map[key]].is_a?(Array)
396
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
419
+ # is documented as an array but the input is not
420
+ if value.is_a?(Array)
421
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
397
422
  end
398
- elsif !attributes[self.class.attribute_map[key]].nil?
399
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
423
+ elsif !value.nil?
424
+ self.send("#{key}=", _deserialize(type, value))
400
425
  end
401
426
  # or else data not found in attributes(hash), not an issue as the data can be optional
402
427
  end
@@ -411,9 +436,9 @@ module GroupDocsAnnotationCloud
411
436
  def _deserialize(type, value)
412
437
  case type.to_sym
413
438
  when :DateTime
414
- Time.at(/\d/.match(value)[0].to_f).to_datetime
439
+ Date.parse value
415
440
  when :Date
416
- Time.at(/\d/.match(value)[0].to_f).to_date
441
+ Date.parse value
417
442
  when :String
418
443
  value.to_s
419
444
  when :Integer
@@ -466,17 +491,7 @@ module GroupDocsAnnotationCloud
466
491
  self.class.attribute_map.each_pair do |attr, param|
467
492
  value = self.send(attr)
468
493
  next if value.nil?
469
- if attr == :type
470
- validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
471
- value = validator.allowable_values.index(value)
472
- hash[param] = _to_hash(value)
473
- elsif attr == :access
474
- validator = EnumAttributeValidator.new('String', ["Public", "Private"])
475
- value = validator.allowable_values.index(value)
476
- hash[param] = _to_hash(value)
477
- else
478
- hash[param] = _to_hash(value)
479
- end
494
+ hash[param] = _to_hash(value)
480
495
  end
481
496
  hash
482
497
  end