lib/siteleaf/site.rb in siteleaf-0.9.22 vs lib/siteleaf/site.rb in siteleaf-0.9.23

- old
+ new

@@ -1,9 +1,9 @@ module Siteleaf class Site < Entity - attr_accessor :title, :domain, :timezone + attr_accessor :title, :domain, :timezone, :meta attr_reader :id, :user_id, :created_at, :updated_at def self.find_by_domain(domain) result = Client.get self.endpoint, {"domain" => domain} self.new(result.first) if result and result.size >= 1 @@ -31,9 +31,14 @@ Client.get "sites/#{self.id}/resolve", {"url" => url} end def preview(url = '/', template = nil) Client.post "sites/#{self.id}/preview", {"url" => url, "template" => template} + end + + def publish + result = Client.post "sites/#{self.id}/publish", {} + Job.new(id: result.parsed_response["job_id"]) if result end end end \ No newline at end of file