Module: GroupMe::Bots
- Included in:
- Client
- Defined in:
- lib/groupme/bots.rb
Instance Method Summary collapse
-
#bot_post(id, text, options = {}) ⇒ Boolean
Post a message from a bot.
-
#bots ⇒ Array<Hashie::Mash>
(also: #list_bots)
List the authenticated user’s bots.
-
#create_bot(name, group_id, options = {}) ⇒ Hashie::Mash
Create a new bot.
-
#destroy_bot(id) ⇒ Boolean
Remove a bot.
Instance Method Details
#bot_post(id, text, options = {}) ⇒ Boolean
Post a message from a bot.
22 23 24 25 26 27 28 29 |
# File 'lib/groupme/bots.rb', line 22 def bot_post(id, text, = {}) data = { :bot_id => id, :text => text } data[:options] = if .any? post('/bots/post', data).status == 202 end |
#bots ⇒ Array<Hashie::Mash> Also known as: list_bots
List the authenticated user’s bots.
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.
39 40 41 42 43 44 |
# File 'lib/groupme/bots.rb', line 39 def create_bot(name, group_id, = {}) data = { :bot => .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 |