Sha256: e682740d0420abbc1a9cbf8569de9b342b1137d7c6e5a570b2bdf08a15c43128

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

module Siteleaf
  class Collection < Entity

    attr_accessor :title, :path, :permalink, :output, :site_id, :metadata
    attr_reader :id, :directory, :created_at, :updated_at
    
    def create_endpoint
      "sites/#{self.site_id}/collections"
    end
    
    def site
      Site.find(self.site_id)
    end
    
    def documents
      result = Client.get "collections/#{self.id}/documents"
      result.map { |r| Document.new(r) } if result.is_a? Array
    end
    
    def output?
      output == true
    end
    
    def filename
      path
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
siteleaf-2.0.0.pre.beta7 lib/siteleaf/collection.rb