Sha256: db435da7f8bd0529e00efbb77a9145dbd788fb3f0b00c639ef6f1144459b9c51

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

module Squall
  # OnApp UserGroup
  class UserGroup < Base

    # Return a list of all user groups
    def list
      response = request(:get, "/user_groups.json")
      response.collect { |user_group| user_group['user_group'] }
    end

    # Create a user group
    #
    # ==== Params
    #
    # * +options+ - Params for creating the user groups
    #
    # ==== Options
    #
    # * +label*+ - Label for the user group
    #
    # ==== Example
    #
    #   create :label => "My new user group"
    def create(options={})
      params.required(:label).validate!(options)
      request(:post, "/user_groups.json", default_params(options))
    end

    # Edit a user group
    #
    # ==== Params
    #
    # * +id*+ - ID of the user group
    # * +options+ - Params for creating the user groups
    #
    # ==== Options
    #
    # See #create
    #
    # * +options+ - Params for editing the user group.
    def edit(id, options={})
      params.accepts(:label).validate!(options)
      request(:put, "/user_groups/#{id}.json", default_params(options))
    end

    # Delete a user group
    #
    # ==== Params
    #
    # * +id*+ - ID of the user group
    def delete(id)
      request(:delete, "/user_groups/#{id}.json")
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
squall-1.3.0 lib/squall/user_group.rb
squall-1.2.1beta1 lib/squall/user_group.rb
squall-1.2.0beta1 lib/squall/user_group.rb
squall-1.1.0 lib/squall/user_group.rb