Class: GroupDocsConversionCloud::DocumentMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_conversion_cloud/models/document_metadata.rb

Overview

Contains a document metadata

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DocumentMetadata

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 118

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'FileType')
    self.file_type = attributes[:'FileType']
  end

  if attributes.key?(:'PageCount')
    self.page_count = attributes[:'PageCount']
  end

  if attributes.key?(:'Size')
    self.size = attributes[:'Size']
  end

  if attributes.key?(:'Width')
    self.width = attributes[:'Width']
  end

  if attributes.key?(:'Height')
    self.height = attributes[:'Height']
  end

  if attributes.key?(:'HorizontalResolution')
    self.horizontal_resolution = attributes[:'HorizontalResolution']
  end

  if attributes.key?(:'VerticalResolution')
    self.vertical_resolution = attributes[:'VerticalResolution']
  end

  if attributes.key?(:'BitsPerPixel')
    self.bits_per_pixel = attributes[:'BitsPerPixel']
  end

  if attributes.key?(:'Title')
    self.title = attributes[:'Title']
  end

  if attributes.key?(:'Author')
    self.author = attributes[:'Author']
  end

  if attributes.key?(:'CreatedDate')
    self.created_date = attributes[:'CreatedDate']
  end

  if attributes.key?(:'ModifiedDate')
    self.modified_date = attributes[:'ModifiedDate']
  end

  if attributes.key?(:'Layers')
    if (value = attributes[:'Layers']).is_a?(Array)
      self.layers = value
    end
  end

  if attributes.key?(:'IsPasswordProtected')
    self.is_password_protected = attributes[:'IsPasswordProtected']
  end

end

Instance Attribute Details

#authorObject

Returns detected document author if applicable to the current document format



62
63
64
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 62

def author
  @author
end

#bits_per_pixelObject

Returns detected bits per pixel if applicable to the current document format



56
57
58
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 56

def bits_per_pixel
  @bits_per_pixel
end

#created_dateObject

Returns detected document creation date if it’s applicable to the current document format



65
66
67
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 65

def created_date
  @created_date
end

#file_typeObject

Document file type



35
36
37
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 35

def file_type
  @file_type
end

#heightObject

Returns detected height if applicable to the current document format



47
48
49
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 47

def height
  @height
end

#horizontal_resolutionObject

Returns detected horizontal resolution if applicable to the current document format



50
51
52
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 50

def horizontal_resolution
  @horizontal_resolution
end

#is_password_protectedObject

Is document password protected



74
75
76
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 74

def is_password_protected
  @is_password_protected
end

#layersObject

Returns list of layer names if applicable to the current document format



71
72
73
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 71

def layers
  @layers
end

#modified_dateObject

Returns detected document modification date if applicable to the current document format



68
69
70
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 68

def modified_date
  @modified_date
end

#page_countObject

Gets pages count if applicable to the current document format



38
39
40
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 38

def page_count
  @page_count
end

#sizeObject

Document bytes size



41
42
43
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 41

def size
  @size
end

#titleObject

Returns document title width if applicable to the current document format



59
60
61
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 59

def title
  @title
end

#vertical_resolutionObject

Returns detected vertical resolution if applicable to the current document format



53
54
55
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 53

def vertical_resolution
  @vertical_resolution
end

#widthObject

Returns detected width if applicable to the current document format



44
45
46
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 44

def width
  @width
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 77

def self.attribute_map
  {
    :'file_type' => :'FileType',
    :'page_count' => :'PageCount',
    :'size' => :'Size',
    :'width' => :'Width',
    :'height' => :'Height',
    :'horizontal_resolution' => :'HorizontalResolution',
    :'vertical_resolution' => :'VerticalResolution',
    :'bits_per_pixel' => :'BitsPerPixel',
    :'title' => :'Title',
    :'author' => :'Author',
    :'created_date' => :'CreatedDate',
    :'modified_date' => :'ModifiedDate',
    :'layers' => :'Layers',
    :'is_password_protected' => :'IsPasswordProtected'
  }
end

.swagger_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 97

def self.swagger_types
  {
    :'file_type' => :'String',
    :'page_count' => :'Integer',
    :'size' => :'Integer',
    :'width' => :'Integer',
    :'height' => :'Integer',
    :'horizontal_resolution' => :'Integer',
    :'vertical_resolution' => :'Integer',
    :'bits_per_pixel' => :'Integer',
    :'title' => :'String',
    :'author' => :'String',
    :'created_date' => :'DateTime',
    :'modified_date' => :'DateTime',
    :'layers' => :'Array<String>',
    :'is_password_protected' => :'BOOLEAN'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 249

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      file_type == other.file_type &&
      page_count == other.page_count &&
      size == other.size &&
      width == other.width &&
      height == other.height &&
      horizontal_resolution == other.horizontal_resolution &&
      vertical_resolution == other.vertical_resolution &&
      bits_per_pixel == other.bits_per_pixel &&
      title == other.title &&
      author == other.author &&
      created_date == other.created_date &&
      modified_date == other.modified_date &&
      layers == other.layers &&
      is_password_protected == other.is_password_protected
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 313

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Date.parse value
  when :Date
    Date.parse value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else
  # model
    temp_model = GroupDocsConversionCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 380

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 289

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    pname = uncap(self.class.attribute_map[key]).intern
    value = attributes[pname]
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not                    
      if value.is_a?(Array)
        self.send("#{key}=", value.map { |v| _deserialize($1, v) })
      end
    elsif !value.nil?
      self.send("#{key}=", _deserialize(type, value))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


270
271
272
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 270

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



276
277
278
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 276

def hash
  [file_type, page_count, size, width, height, horizontal_resolution, vertical_resolution, bits_per_pixel, title, author, created_date, modified_date, layers, is_password_protected].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 186

def list_invalid_properties
  invalid_properties = []
  if @page_count.nil?
    invalid_properties.push("invalid value for 'page_count', page_count cannot be nil.")
  end

  if @size.nil?
    invalid_properties.push("invalid value for 'size', size cannot be nil.")
  end

  if @width.nil?
    invalid_properties.push("invalid value for 'width', width cannot be nil.")
  end

  if @height.nil?
    invalid_properties.push("invalid value for 'height', height cannot be nil.")
  end

  if @horizontal_resolution.nil?
    invalid_properties.push("invalid value for 'horizontal_resolution', horizontal_resolution cannot be nil.")
  end

  if @vertical_resolution.nil?
    invalid_properties.push("invalid value for 'vertical_resolution', vertical_resolution cannot be nil.")
  end

  if @bits_per_pixel.nil?
    invalid_properties.push("invalid value for 'bits_per_pixel', bits_per_pixel cannot be nil.")
  end

  if @created_date.nil?
    invalid_properties.push("invalid value for 'created_date', created_date cannot be nil.")
  end

  if @modified_date.nil?
    invalid_properties.push("invalid value for 'modified_date', modified_date cannot be nil.")
  end

  if @is_password_protected.nil?
    invalid_properties.push("invalid value for 'is_password_protected', is_password_protected cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



360
361
362
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 360

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



366
367
368
369
370
371
372
373
374
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 366

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



354
355
356
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 354

def to_s
  to_hash.to_s
end

#uncap(str) ⇒ Object

Downcases first letter.

Returns:

  • downcased string



282
283
284
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 282

def uncap(str)
  str[0, 1].downcase + str[1..-1]
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/groupdocs_conversion_cloud/models/document_metadata.rb', line 233

def valid?
  return false if @page_count.nil?
  return false if @size.nil?
  return false if @width.nil?
  return false if @height.nil?
  return false if @horizontal_resolution.nil?
  return false if @vertical_resolution.nil?
  return false if @bits_per_pixel.nil?
  return false if @created_date.nil?
  return false if @modified_date.nil?
  return false if @is_password_protected.nil?
  return true
end