lib/siteleaf/collection.rb in siteleaf-2.0.0 vs lib/siteleaf/collection.rb in siteleaf-2.0.1
- old
+ new
@@ -1,42 +1,42 @@
module Siteleaf
class Collection < Entity
attr_accessor :title, :path, :permalink, :output, :site_id, :user_id, :metadata
attr_reader :id, :directory, :created_at, :updated_at
-
+
def create_endpoint
::File.join("sites", site_id, "collections")
end
-
+
def entity_endpoint
::File.join(create_endpoint, identifier)
end
-
+
def identifier
path
end
-
+
def site
Site.find(site_id)
end
-
+
def documents
result = Client.get "#{entity_endpoint}/documents"
- result.map { |r| Document.new(r) } if result.is_a? Array
+ result.map { |r| Document.new(r) } if result.parsed_response.is_a? Array
end
-
+
def files
result = Client.get "#{entity_endpoint}/files"
- result.map { |r| File.new(r) } if result.is_a? Array
+ result.map { |r| File.new(r) } if result.parsed_response.is_a? Array
end
-
+
def output?
output == true
end
-
+
def filename
path
end
-
+
end
end
\ No newline at end of file