Module: GroupMe::Bots

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

Instance Method Summary collapse

Instance Method Details

#bot_post(id, text, options = {}) ⇒ Boolean

Post a message from a bot.

Options Hash (options):

  • :picture_url (String)

    Picture URL from image service

See Also:



22
23
24
25
26
27
28
29
# File 'lib/groupme/bots.rb', line 22

def bot_post(id, text, options = {})
  data = {
    :bot_id => id,
    :text => text
  }
  data[:options] = options if options.any?
  post('/bots/post', data).status == 202
end

#botsArray<Hashie::Mash> Also known as: list_bots

List the authenticated user's bots.

Examples:

client = GroupMe::Client.new
client.bots

See Also:



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

def bots
  get('/bots')
end

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

Create a new bot.

Options Hash (options):

  • :avatar_url (String)

    Avatar image URL for the bot

  • :callback_url (String)

    Callback URL for the bot

See Also:



39
40
41
42
43
44
# File 'lib/groupme/bots.rb', line 39

def create_bot(name, group_id, options = {})
  data = {
    :bot => options.merge(:name => name, :group_id => group_id)
  }
  post('/bots', data)
end

#destroy_bot(id) ⇒ Boolean

Remove a bot.



51
52
53
54
55
56
# File 'lib/groupme/bots.rb', line 51

def destroy_bot(id)
  data = {
    :bot_id => id
  }
  post('/bots/destroy', data).status == 200
end