Class: Siteleaf::File
Instance Attribute Summary collapse
-
#basename ⇒ Object
readonly
Returns the value of attribute basename.
-
#collection_path ⇒ Object
Returns the value of attribute collection_path.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#download_url ⇒ Object
readonly
Returns the value of attribute download_url.
-
#file ⇒ Object
Returns the value of attribute file.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#filesize ⇒ Object
readonly
Returns the value of attribute filesize.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#path ⇒ Object
Returns the value of attribute path.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#site_id ⇒ Object
Returns the value of attribute site_id.
-
#thumbnail_url ⇒ Object
readonly
Returns the value of attribute thumbnail_url.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Attributes inherited from Entity
Instance Method Summary collapse
- #collection ⇒ Object
- #collection_identifier ⇒ Object
- #create_endpoint ⇒ Object
- #site ⇒ Object
- #to_file ⇒ Object
Methods inherited from Entity
all, #attributes, #attributes=, class_name, create, delete, #delete, endpoint, #entity_endpoint, find, #identifier, #initialize, #save
Constructor Details
This class inherits a constructor from Siteleaf::Entity
Instance Attribute Details
#basename ⇒ Object (readonly)
Returns the value of attribute basename.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def basename @basename end |
#collection_path ⇒ Object
Returns the value of attribute collection_path.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def collection_path @collection_path end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def content_type @content_type end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def created_at @created_at end |
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def directory @directory end |
#download_url ⇒ Object (readonly)
Returns the value of attribute download_url.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def download_url @download_url end |
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def file @file end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def filename @filename end |
#filesize ⇒ Object (readonly)
Returns the value of attribute filesize.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def filesize @filesize end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def id @id end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def path @path end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def sha @sha end |
#site_id ⇒ Object
Returns the value of attribute site_id.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def site_id @site_id end |
#thumbnail_url ⇒ Object (readonly)
Returns the value of attribute thumbnail_url.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def thumbnail_url @thumbnail_url end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def updated_at @updated_at end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/siteleaf/file.rb', line 5 def url @url end |
#user_id ⇒ Object
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/siteleaf/file.rb', line 4 def user_id @user_id end |
Instance Method Details
#collection ⇒ Object
15 16 17 |
# File 'lib/siteleaf/file.rb', line 15 def collection Collection.find(collection_identifier) end |
#collection_identifier ⇒ Object
19 20 21 |
# File 'lib/siteleaf/file.rb', line 19 def collection_identifier collection_path || (directory && directory.match(/_(.*)/).try(:last)) end |
#create_endpoint ⇒ Object
7 8 9 |
# File 'lib/siteleaf/file.rb', line 7 def create_endpoint ::File.join("sites", site_id, "collections", collection_identifier, "files") end |
#site ⇒ Object
11 12 13 |
# File 'lib/siteleaf/file.rb', line 11 def site Site.find(site_id) if site_id end |
#to_file ⇒ Object
23 24 25 |
# File 'lib/siteleaf/file.rb', line 23 def to_file SourceFile.new(site_id: site_id, name: filename).to_file end |