class Siteleaf::Collection

Attributes

created_at[R]
directory[R]
id[R]
metadata[RW]
output[RW]
path[RW]
site_id[RW]
title[RW]
updated_at[R]
user_id[RW]

Public Instance Methods

create_endpoint() click to toggle source
# File lib/siteleaf/collection.rb, line 7
def create_endpoint
  ::File.join("sites", site_id, "collections")
end
documents() click to toggle source
# File lib/siteleaf/collection.rb, line 23
def documents
  result = Client.get "#{entity_endpoint}/documents"
  result.map { |r| Document.new(r) } if result.is_a? Array
end
entity_endpoint() click to toggle source
# File lib/siteleaf/collection.rb, line 11
def entity_endpoint
  ::File.join(create_endpoint, identifier)
end
filename() click to toggle source
# File lib/siteleaf/collection.rb, line 37
def filename
  path
end
files() click to toggle source
# File lib/siteleaf/collection.rb, line 28
def files
  result = Client.get "#{entity_endpoint}/files"
  result.map { |r| File.new(r) } if result.is_a? Array
end
identifier() click to toggle source
# File lib/siteleaf/collection.rb, line 15
def identifier
  path
end
output?() click to toggle source
# File lib/siteleaf/collection.rb, line 33
def output?
  output == true
end
site() click to toggle source
# File lib/siteleaf/collection.rb, line 19
def site
  Site.find(site_id)
end