Class: Dropbox::FileMetadata

Inherits:
Metadata show all
Defined in:
lib/dropbox/metadata.rb

Overview

Contains the metadata (but not contents) of a file.

Instance Attribute Summary collapse

Attributes inherited from Metadata

#name, #path_display, #path_lower

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ FileMetadata

Returns a new instance of FileMetadata.


19
20
21
22
23
24
25
26
27
28
# File 'lib/dropbox/metadata.rb', line 19

def initialize(attrs={})
  @id = attrs.delete('id')
  if cm = attrs.delete('client_modified')
    @client_modified = Time.parse(cm)
  end
  @server_modified = Time.parse(attrs.delete('server_modified'))
  @rev = attrs.delete('rev')
  @size = attrs.delete('size')
  super(attrs)
end

Instance Attribute Details

#client_modifiedObject (readonly)

Returns the value of attribute client_modified


17
18
19
# File 'lib/dropbox/metadata.rb', line 17

def client_modified
  @client_modified
end

#idObject (readonly)

Returns the value of attribute id


17
18
19
# File 'lib/dropbox/metadata.rb', line 17

def id
  @id
end

#revObject (readonly)

Returns the value of attribute rev


17
18
19
# File 'lib/dropbox/metadata.rb', line 17

def rev
  @rev
end

#server_modifiedObject (readonly)

Returns the value of attribute server_modified


17
18
19
# File 'lib/dropbox/metadata.rb', line 17

def server_modified
  @server_modified
end

#sizeObject (readonly)

Returns the value of attribute size


17
18
19
# File 'lib/dropbox/metadata.rb', line 17

def size
  @size
end

Instance Method Details

#==(cmp) ⇒ Object


30
31
32
# File 'lib/dropbox/metadata.rb', line 30

def ==(cmp)
  cmp.is_a?(self.class) && self.id == cmp.id
end