Class: Copy::File

Inherits:
Base
  • Object
show all
Includes:
Operations::Activity, Operations::Create, Operations::Delete, Operations::Show
Defined in:
lib/copy/file.rb

Constant Summary collapse

TYPES =
[ :file, :dir, :root, :copy, :inbox ]

Instance Attribute Summary collapse

Attributes inherited from Base

#created_time

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Operations::Create

included

Methods included from Operations::Activity

included

Methods included from Operations::Delete

included

Methods included from Operations::Show

included

Methods inherited from Base

#errors, #parse_timestamps, #set_attributes, #valid?

Methods included from Operations::Base

included

Constructor Details

#initialize(attributes = {}) ⇒ File

Returns a new instance of File.



18
19
20
21
22
23
# File 'lib/copy/file.rb', line 18

def initialize(attributes = {})
  super(attributes)
  parse_children
  parse_revisions
  parse_links
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



11
12
13
# File 'lib/copy/file.rb', line 11

def children
  @children
end

#children_countObject

Returns the value of attribute children_count.



11
12
13
# File 'lib/copy/file.rb', line 11

def children_count
  @children_count
end

#countsObject

Returns the value of attribute counts.



11
12
13
# File 'lib/copy/file.rb', line 11

def counts
  @counts
end

#creator_idObject

Returns the value of attribute creator_id.



11
12
13
# File 'lib/copy/file.rb', line 11

def creator_id
  @creator_id
end

#date_last_syncedObject

Returns the value of attribute date_last_synced.



11
12
13
# File 'lib/copy/file.rb', line 11

def date_last_synced
  @date_last_synced
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/copy/file.rb', line 11

def id
  @id
end

#inbox_notificationsObject

Returns the value of attribute inbox_notifications.



11
12
13
# File 'lib/copy/file.rb', line 11

def inbox_notifications
  @inbox_notifications
end

Returns the value of attribute link_name.



11
12
13
# File 'lib/copy/file.rb', line 11

def link_name
  @link_name
end

Returns the value of attribute links.



11
12
13
# File 'lib/copy/file.rb', line 11

def links
  @links
end

#mime_typeObject

Returns the value of attribute mime_type.



11
12
13
# File 'lib/copy/file.rb', line 11

def mime_type
  @mime_type
end

#modified_timeObject

Returns the value of attribute modified_time.



11
12
13
# File 'lib/copy/file.rb', line 11

def modified_time
  @modified_time
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/copy/file.rb', line 11

def name
  @name
end

#object_availableObject

Returns the value of attribute object_available.



11
12
13
# File 'lib/copy/file.rb', line 11

def object_available
  @object_available
end

#pathObject

Returns the value of attribute path.



11
12
13
# File 'lib/copy/file.rb', line 11

def path
  @path
end

#permissionsObject

Returns the value of attribute permissions.



11
12
13
# File 'lib/copy/file.rb', line 11

def permissions
  @permissions
end

#publicObject

Returns the value of attribute public.



11
12
13
# File 'lib/copy/file.rb', line 11

def public
  @public
end

#recipient_confirmedObject

Returns the value of attribute recipient_confirmed.



11
12
13
# File 'lib/copy/file.rb', line 11

def recipient_confirmed
  @recipient_confirmed
end

#revision_idObject

Returns the value of attribute revision_id.



11
12
13
# File 'lib/copy/file.rb', line 11

def revision_id
  @revision_id
end

#revisionsObject

Returns the value of attribute revisions.



11
12
13
# File 'lib/copy/file.rb', line 11

def revisions
  @revisions
end

#shareObject

Returns the value of attribute share.



11
12
13
# File 'lib/copy/file.rb', line 11

def share
  @share
end

#sizeObject

Returns the value of attribute size.



11
12
13
# File 'lib/copy/file.rb', line 11

def size
  @size
end

#stubObject

Returns the value of attribute stub.



11
12
13
# File 'lib/copy/file.rb', line 11

def stub
  @stub
end

#syncingObject

Returns the value of attribute syncing.



11
12
13
# File 'lib/copy/file.rb', line 11

def syncing
  @syncing
end

#thumbObject

Returns the value of attribute thumb.



11
12
13
# File 'lib/copy/file.rb', line 11

def thumb
  @thumb
end

#tokenObject

Returns the value of attribute token.



11
12
13
# File 'lib/copy/file.rb', line 11

def token
  @token
end

#typeObject

Returns the value of attribute type.



11
12
13
# File 'lib/copy/file.rb', line 11

def type
  @type
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/copy/file.rb', line 11

def url
  @url
end

Class Method Details

.create(attrs) ⇒ Object

Create operation overwrite to parse file first



65
66
67
# File 'lib/copy/file.rb', line 65

def create(attrs)
  super(parse_file(attrs))
end

Instance Method Details

#is_dir?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/copy/file.rb', line 25

def is_dir?
  type != 'file'
end


53
54
55
56
57
58
59
60
# File 'lib/copy/file.rb', line 53

def parse_links
  return unless links
  results = []
  links.each do |obj|
    results << Copy::Link.new(obj)
  end
  @links = results
end

#stubbed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/copy/file.rb', line 29

def stubbed?
  stub
end