Class: OneDriveForBusiness::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/onedrive_for_business/item.rb

Direct Known Subclasses

File, Folder

Constant Summary collapse

FIELDS =
[:id, :name, :e_tag, :created_by, :last_modified_by,
:date_time_created, :date_time_last_modified,
:size, :parent_reference, :web_url, :type]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drive, fields) ⇒ Item

Returns a new instance of Item.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/onedrive_for_business/item.rb', line 3

def initialize(drive, fields)
  @drive = drive
  @id = fields['id']
  @name = fields['name']
  @e_tag = fields['eTag']
  @created_by = IdentitySet.new(fields['createdBy']) if fields['createdBy']
  @last_modified_by = IdentitySet.new(fields['lastModifiedBy']) if fields['lastModifiedBy']
  @date_time_created = fields['dateTimeCreated']
  @date_time_last_modified = fields['dateTimeLastModified']
  @size = fields['size']
  @parent_reference = ItemReference.new(fields['parentReference']) if fields['parentReference']
  @web_url = fields['webUrl']
  @type = fields['type']
end

Instance Attribute Details

#driveObject (readonly)

Returns the value of attribute drive.



23
24
25
# File 'lib/onedrive_for_business/item.rb', line 23

def drive
  @drive
end