module GrowlCar::GrowlNotification

Public Instance Methods

send_growl_notification(from, message) click to toggle source

Sends a notification to the boxcar.io growl provider

@param from [String] name of the sender of the message @param message [String] message to be sent to boxcar @raise [GrowlCar::Error::UnauthorizedError] if username or password is incorrect @raise [GrowlCar::Error::HttpError] if http response is not 200 or 401 @return [Boolean] on successful notification

# File lib/growl_car/growl_notification.rb, line 11
def send_growl_notification(from, message)
  boxcar_post_fields = {
    "notification[from_screen_name]" => from,
    "notification[message]" => message,
    "notification[from_remote_service_id]" => random_growl_number
  }

  post_notification(boxcar_post_fields)
end

Private Instance Methods

random_growl_number() click to toggle source
# File lib/growl_car/growl_notification.rb, line 23
def random_growl_number
  Random.rand(9999999999)
end