Class: LayerVault::File

Inherits:
Model
  • Object
show all
Defined in:
lib/layervault/file.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

build_associations, #set_context

Class Method Details

.for(organization, project, folder_path, file_name) ⇒ Object



4
5
6
7
8
# File 'lib/layervault/file.rb', line 4

def for(organization, project, folder_path, file_name)
  resp = MultiJson.decode(LayerVault.client.file(organization, project, folder_path, file_name))
  instance = build_associations(resp, :revisions)
  instance.set_context(organization: organization, project: project, folder_path: folder_path, file_name: file_name )
end

Instance Method Details

#previews(width, height) ⇒ Object



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

def previews(width, height)
  LayerVault.client.previews(context.organization, context.project, context.folder_path, context.file_name, w: width, h: height)
end

#revisions(options = {}) ⇒ Object



15
16
17
# File 'lib/layervault/file.rb', line 15

def revisions(options={})
  LayerVault.client.revisions(context.organization, context.project, context.folder_path, context.file_name, first_seen: options[:first_seen], last_seen: options[:last_seen])
end