Class: Prowly::BasicNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/prowly/notification.rb

Direct Known Subclasses

Notification

Defined Under Namespace

Classes: DuplicatedAssignmentOfApiKey, NoAPIKeyGiven, NoApplicationNameGiven, NoDescriptionGiven

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#apikeyObject 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

#applicationObject

Returns the value of attribute application.



13
14
15
# File 'lib/prowly/notification.rb', line 13

def application
  @application
end

#descriptionObject

Returns the value of attribute description.



13
14
15
# File 'lib/prowly/notification.rb', line 13

def description
  @description
end

Instance Method Details

#to_paramsObject

Raises:



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