Class: Prowly::BasicNotification
- Inherits:
-
Object
- Object
- Prowly::BasicNotification
- Defined in:
- lib/prowly/notification.rb
Direct Known Subclasses
Defined Under Namespace
Classes: DuplicatedAssignmentOfApiKey, NoAPIKeyGiven, NoApplicationNameGiven, NoDescriptionGiven
Instance Attribute Summary collapse
- #apikey ⇒ Object (also: #apikeys)
-
#application ⇒ Object
Returns the value of attribute application.
-
#description ⇒ Object
Returns the value of attribute description.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ BasicNotification
constructor
A new instance of BasicNotification.
- #to_params ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ BasicNotification
Returns a new instance of BasicNotification.
27 28 29 30 31 32 33 |
# File 'lib/prowly/notification.rb', line 27 def initialize(params = {}) if params[:apikeys] and params[:apikey] raise DuplicatedAssignmentOfApiKey, "Use apikey or apikeys, not both" else @apikey = params[:apikeys] || params[:apikey] end end |
Instance Attribute Details
#apikey ⇒ Object Also known as: apikeys
18 19 20 21 22 23 24 |
# File 'lib/prowly/notification.rb', line 18 def apikey if @apikey.is_a? Array @apikey.join(',') else @apikey end end |
#application ⇒ Object
Returns the value of attribute application.
13 14 15 |
# File 'lib/prowly/notification.rb', line 13 def application @application end |
#description ⇒ Object
Returns the value of attribute description.
13 14 15 |
# File 'lib/prowly/notification.rb', line 13 def description @description end |
Instance Method Details
#to_params ⇒ Object
35 36 37 38 39 40 |
# File 'lib/prowly/notification.rb', line 35 def to_params raise NoAPIKeyGiven if apikey.nil? raise NoApplicationNameGiven if @application.nil? raise NoDescriptionGiven if @description.nil? params.join('&') end |