Class: NMA::Notification
- Inherits:
-
Object
- Object
- NMA::Notification
- Defined in:
- lib/ruby-notify-my-android/notification.rb
Defined Under Namespace
Classes: NoAPIKeyGiven, NoApplicationNameGiven, NoDescriptionGiven
Instance Attribute Summary collapse
- #apikey ⇒ Object
-
#application ⇒ Object
Returns the value of attribute application.
-
#description ⇒ Object
Returns the value of attribute description.
-
#event ⇒ Object
Returns the value of attribute event.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#providerkey ⇒ Object
Returns the value of attribute providerkey.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Notification
constructor
A new instance of Notification.
- #to_params ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Notification
Returns a new instance of Notification.
24 25 26 27 28 29 30 |
# File 'lib/ruby-notify-my-android/notification.rb', line 24 def initialize(params = {}) @apikey = params[:apikey] @application = params[:application] || "NMA" @event = params[:event] || "NMA is working!!" @description = params[:description] || "This is the default description" @priority = params[:priority] || Priority::NORMAL end |
Instance Attribute Details
#apikey ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ruby-notify-my-android/notification.rb', line 16 def apikey if @apikey.is_a? Array @apikey.join(',') else @apikey end end |
#application ⇒ Object
Returns the value of attribute application.
12 13 14 |
# File 'lib/ruby-notify-my-android/notification.rb', line 12 def application @application end |
#description ⇒ Object
Returns the value of attribute description.
12 13 14 |
# File 'lib/ruby-notify-my-android/notification.rb', line 12 def description @description end |
#event ⇒ Object
Returns the value of attribute event.
13 14 15 |
# File 'lib/ruby-notify-my-android/notification.rb', line 13 def event @event end |
#priority ⇒ Object
Returns the value of attribute priority.
13 14 15 |
# File 'lib/ruby-notify-my-android/notification.rb', line 13 def priority @priority end |
#providerkey ⇒ Object
Returns the value of attribute providerkey.
13 14 15 |
# File 'lib/ruby-notify-my-android/notification.rb', line 13 def providerkey @providerkey end |
Instance Method Details
#to_params ⇒ Object
32 33 34 35 36 37 |
# File 'lib/ruby-notify-my-android/notification.rb', line 32 def to_params raise NoAPIKeyGiven if apikey.nil? raise NoApplicationNameGiven if @application.nil? raise NoDescriptionGiven if @description.nil? params.join('&') end |