class Weeblycloud::User
Represents a User
resource. cloud-developer.weebly.com/user.html
Public Class Methods
new(user_id, data = nil)
click to toggle source
Calls superclass method
Weeblycloud::CloudResource::new
# File lib/weeblycloud/user.rb, line 14 def initialize(user_id, data = nil) @user_id = user_id.to_i @endpoint = "user/#{@user_id}" super(data) end
Public Instance Methods
create_site(domain, properties={})
click to toggle source
# File lib/weeblycloud/user.rb, line 60 def create_site(domain, properties={}) properties.merge!({"domain"=>domain}) response = @client.post(@endpoint + "/site", :content=>properties) return Site.new(@user_id, response.json["site"]["site_id"]) end
create_theme(name, zip_url)
click to toggle source
# File lib/weeblycloud/user.rb, line 54 def create_theme(name, zip_url) data = {"theme_name" => name, "theme_zip" => zip_url} response = @client.post(@endpoint + "/theme", :content=>data) return Theme.new(@user_id, response.json["theme_id"]) end
disable()
click to toggle source
# File lib/weeblycloud/user.rb, line 34 def disable result = @client.post(@endpoint + "/disable") return result.json["success"] end
enable()
click to toggle source
# File lib/weeblycloud/user.rb, line 29 def enable result = @client.post(@endpoint + "/enable") return result.json["success"] end
get()
click to toggle source
# File lib/weeblycloud/user.rb, line 24 def get response = @client.get(@endpoint) @properties = response.json["user"] end
get_site(site_id)
click to toggle source
# File lib/weeblycloud/user.rb, line 66 def get_site(site_id) return Site.new(@user_id, site_id) end
id()
click to toggle source
# File lib/weeblycloud/user.rb, line 20 def id @user_id end
list_sites(filters={})
click to toggle source
# File lib/weeblycloud/user.rb, line 49 def list_sites(filters={}) result = @client.get(@endpoint + "/site", :params=>filters) return result.map {|i| Site.new(@user_id, i["site_id"], i)} end
list_themes(filters={})
click to toggle source
# File lib/weeblycloud/user.rb, line 44 def list_themes(filters={}) result = @client.get(@endpoint + "/theme", :params=>filters) return result.map {|i| Theme.new(@user_id, i["theme_id"], i)} end
login_link()
click to toggle source
# File lib/weeblycloud/user.rb, line 39 def login_link result = @client.post(@endpoint + "/loginLink") return result.json["link"] end