lib/siteleaf/asset.rb in siteleaf-1.0.6 vs lib/siteleaf/asset.rb in siteleaf-1.0.7
- old
+ new
@@ -1,11 +1,11 @@
module Siteleaf
class Asset < Entity
- attr_accessor :file, :filename, :replace, :site_id, :page_id, :post_id, :theme_id
+ attr_accessor :file, :filename, :replace, :site_id, :page_id, :post_id, :theme_id, :meta
attr_reader :id, :url, :content_type, :filesize, :checksum, :created_at, :updated_at
-
+
def create_endpoint
if !self.post_id.nil?
"posts/#{self.post_id}/assets"
elsif !self.page_id.nil?
"pages/#{self.page_id}/assets"
@@ -13,24 +13,24 @@
"sites/#{self.site_id}/theme/assets"
else
"sites/#{self.site_id}/assets"
end
end
-
+
def post
Post.find(self.post_id) if self.post_id
end
-
+
def page
Page.find(self.page_id) if self.page_id
end
-
+
def theme
Theme.find(self.theme_id) if self.theme_id
end
-
+
def site
Site.find(self.site_id) if self.site_id
end
-
+
end
end
\ No newline at end of file