Class: Notiffany::Notifier::GNTP

Inherits:
Base
  • Object
show all
Defined in:
lib/notiffany/notifier/gntp.rb

Overview

System notifications using the [ruby_gntp](github.com/snaka/ruby_gntp) gem.

This gem is available for OS X, Linux and Windows and sends system notifications to the following system notification frameworks through the

[Growl Network Transport Protocol](www.growlforwindows.com/gfw/help/gntp.aspx):

Constant Summary collapse

DEFAULTS =
{
  sticky: false
}
CLIENT_DEFAULTS =

Default options for the ruby gtnp client.

{
  host:     "127.0.0.1",
  password: "",
  port:     23_053
}

Constants inherited from Base

Base::ERROR_ADD_GEM_AND_RUN_BUNDLE, Base::HOSTS

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#_image_path, #initialize, #name, #notify, #title

Constructor Details

This class inherits a constructor from Notiffany::Notifier::Base

Instance Method Details

#_check_available(_opts) ⇒ Object



39
40
# File 'lib/notiffany/notifier/gntp.rb', line 39

def _check_available(_opts)
end

#_gem_nameObject



35
36
37
# File 'lib/notiffany/notifier/gntp.rb', line 35

def _gem_name
  "ruby_gntp"
end

#_perform_notify(message, opts = {}) ⇒ Object

Shows a system notification.

Parameters:

  • message (String)

    the notification message body

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

    additional notification library options

Options Hash (opts):

  • type (String)

    the notification type. Either ‘success’, ‘pending’, ‘failed’ or ‘notify’

  • title (String)

    the notification title

  • image (String)

    the path to the notification image

  • host (String)

    the hostname or IP address to which to send a remote notification

  • password (String)

    the password used for remote notifications

  • port (Integer)

    the port to send a remote notification

  • sticky (Boolean)

    make the notification sticky



57
58
59
60
61
62
63
64
65
# File 'lib/notiffany/notifier/gntp.rb', line 57

def _perform_notify(message, opts = {})
  opts = {
    name: opts[:type].to_s,
    text: message,
    icon: opts[:image]
  }.merge(opts)

  _gntp_client(opts).notify(opts)
end

#_supported_hostsObject



30
31
32
33
# File 'lib/notiffany/notifier/gntp.rb', line 30

def _supported_hosts
  %w(darwin linux linux-gnu freebsd openbsd sunos solaris mswin mingw
     cygwin)
end