Module: GroupMe::Groups

Included in:
Client
Defined in:
lib/groupme/groups.rb

Instance Method Summary collapse

Instance Method Details

#create_group(name, options = {}) ⇒ Hashie::Mash

Create a new group.

Parameters:

  • name (String)

    Name for the new group

  • options (Hash) (defaults to: {})

    Group information

Options Hash (options):

  • :description (String)

    Description of the group

  • :image_url (String)

    GroupMe Image Service URL

  • :share (Boolean)

    If you pass a true value, a share URL will be generated

Returns:

  • (Hashie::Mash)

    Hash representing the group

See Also:



48
49
50
51
# File 'lib/groupme/groups.rb', line 48

def create_group(name, options = {})
  options[:name] = name
  post '/groups', options
end

#destroy_group(group_id) ⇒ Boolean

Disband a group

Returns:

  • (Boolean)

    Success/Failure

See Also:



71
72
73
# File 'lib/groupme/groups.rb', line 71

def destroy_group(group_id)
  post("/groups/#{group_id}/destroy").status == 200
end

#former_groupsArray<Hashie::Mash> Also known as: list_former_groups

List the authenticated user’s former groups.

Examples:

client = GroupMe::Client.new
client.former_groups

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing groups.

See Also:



34
35
36
# File 'lib/groupme/groups.rb', line 34

def former_groups
  get '/groups/former'
end

#group(id) ⇒ Hashie::Mash

Load a specific group.

Examples:

client = GroupMe::Client.new
client.group(32)

Parameters:

  • id (String, Integer)

    The ID of the group

Returns:

  • (Hashie::Mash)

    Hash representing the group.

See Also:



23
24
25
# File 'lib/groupme/groups.rb', line 23

def group(id)
  get "/groups/#{id}"
end

#groupsArray<Hashie::Mash> Also known as: list_groups

List the authenticated user’s active groups.

Examples:

client = GroupMe::Client.new
client.groups

Returns:

  • (Array<Hashie::Mash>)

    Array of hashes representing groups.

See Also:



10
11
12
# File 'lib/groupme/groups.rb', line 10

def groups
  get '/groups'
end

#join_group(group_id, share_token) ⇒ Boolean

Join a shared group

Returns:

  • (Boolean)

    Success/Failure

See Also:



79
80
81
# File 'lib/groupme/groups.rb', line 79

def join_group(group_id, share_token)
  post("/groups/#{group_id}/join/#{share_token}").status == 200
end

#update_group(group_id, data) ⇒ Hashie::Mash

Update a group after creation

Parameters:

  • name (Integer)

    Group ID

  • data (Hash)

    Group information

  • options (Hash)

    a customizable set of options

Options Hash (data):

  • :name (String)

    Name of the group

  • :description (String)

    Description of the group

  • :image_url (String)

    GroupMe Image Service URL

Returns:

  • (Hashie::Mash)

    Hash representing the group

See Also:



63
64
65
# File 'lib/groupme/groups.rb', line 63

def update_group(group_id, data)
  post "/groups/#{group_id}/update", data
end