lib/siteleaf/site.rb in siteleaf-0.9.12 vs lib/siteleaf/site.rb in siteleaf-0.9.13

- old
+ new

@@ -3,11 +3,24 @@ attr_accessor :title, :domain, :timezone attr_reader :id, :user_id, :created_at, :updated_at def self.find_by_domain(domain) - result = Client.get "sites", {"domain" => domain} + result = Client.get self.endpoint, {"domain" => domain} self.new(result.first) if result and result.size >= 1 + end + + def theme + @theme ||= if result = Client.get("sites/#{self.id}/theme") + theme = Theme.new(result) + theme.site_id = self.id + theme + end + end + + def assets + result = Client.get "sites/#{self.id}/assets" + result.map { |r| Asset.new(r) } if result end def pages result = Client.get "sites/#{self.id}/pages" result.map { |r| Page.new(r) } if result \ No newline at end of file