class Remind101::Command::Messages

send messages

Public Instance Methods

create() click to toggle source
messages:create [MESSAGE]

send a new message

-c, --code CODE # the group code to send the message to

Examples

$ remind101 send "Don't forget to study!" -c math101
# File lib/remind101/command/messages.rb, line 17
def create
  body = shift_argument
  validate_arguments!

  group = remind101.groups.find { |g| g.name == options[:code] }
  error("Unable to find a group with that code") if group.nil?

  attributes = { body: body, group_ids: [ group.id ] }

  action "Sending message: #{body}" do
    remind101.create_message! attributes
  end
end