Sha256: d4684a9478a3bfdbec8a1834e8e5e7f52a01d7a1303c6fb28c127b7be2da374b
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require "weeblycloud/cloudresource" require "weeblycloud/saveable" require "weeblycloud/user" require "weeblycloud/plan" module Weeblycloud # Represents an Account resource. # https://cloud-developer.weebly.com/account.html class Account < CloudResource include Saveable def initialize @endpoint = "account" super() end # Make an API call to get the resource def get response = @client.get(@endpoint) @properties = response.json["account"] end # Creates a `User`. Requires the user's **email**, and optionally accepts # a hash of additional properties. Returns a `User` resource. # on success. 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 a user with a given ID def get_user(user_id) return User.new(user_id) end # Returns a iterable of all Plan resources. def list_plans result = @client.get("plan") return result.map { |plan| Plan.new(plan["plan_id"]) } end # Return the Plan with the given ID. def get_plan(plan_id) return Plan.new(plan_id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weeblycloud-1.0.0 | lib/weeblycloud/account.rb |