class Weeblycloud::Account

Represents an Account resource. cloud-developer.weebly.com/account.html

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/weeblycloud/account.rb, line 14
def initialize
  @endpoint = "account"
  super()
end

Public Instance Methods

create_user(email, properties={}) click to toggle source

Creates a `User`. Requires the user's email, and optionally accepts a hash of additional properties. Returns a `User` resource. on success.

# File lib/weeblycloud/account.rb, line 28
def create_user(email, properties={})
  properties.merge!({"email"=>email})
  response = @client.post("user", :content=>properties)
  return User.new(response.json["user"]["user_id"])
end
get() click to toggle source

Make an API call to get the resource

# File lib/weeblycloud/account.rb, line 20
def get
  response = @client.get(@endpoint)
  @properties = response.json["account"]
end
get_plan(plan_id) click to toggle source

Return the Plan with the given ID.

# File lib/weeblycloud/account.rb, line 46
def get_plan(plan_id)
  return Plan.new(plan_id)
end
get_user(user_id) click to toggle source

Get a user with a given ID

# File lib/weeblycloud/account.rb, line 35
def get_user(user_id)
  return User.new(user_id)
end
list_plans() click to toggle source

Returns a iterable of all Plan resources.

# File lib/weeblycloud/account.rb, line 40
def list_plans
  result = @client.get("plan")
  return result.map { |plan| Plan.new(plan["plan_id"]) }
end