Class: BaseFile

Inherits:
Object
  • Object
show all
Defined in:
lib/dynalist/base_file.rb

Direct Known Subclasses

Document, Folder

Constant Summary collapse

PERMISSION =
{
  0 => :no_access,
  1 => :read_only,
  2 => :edit_rights,
  3 => :manage,
  4 => :owner
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, title: nil, type: nil, permission: nil) ⇒ BaseFile

Returns a new instance of BaseFile.



14
15
16
17
18
19
# File 'lib/dynalist/base_file.rb', line 14

def initialize(id: nil, title: nil, type: nil, permission: nil)
  @id = id
  @title = title
  @type = type
  @permission_number = permission
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/dynalist/base_file.rb', line 12

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/dynalist/base_file.rb', line 12

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/dynalist/base_file.rb', line 12

def type
  @type
end

Instance Method Details

#include(**query) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/dynalist/base_file.rb', line 25

def include(**query)
  query.each do |key, value|
    next if instance_variable_get("@#{key}") == value
    return false
  end

  return true
end

#permissionObject



21
22
23
# File 'lib/dynalist/base_file.rb', line 21

def permission
  PERMISSION[@permission_number]
end