Class: Noti::Notification

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#imageObject

Returns the value of attribute image.



4
5
6
# File 'lib/noti/notification.rb', line 4

def image
  @image
end

#soundObject

Returns the value of attribute sound.



4
5
6
# File 'lib/noti/notification.rb', line 4

def sound
  @sound
end

#textObject

Returns the value of attribute text.



4
5
6
# File 'lib/noti/notification.rb', line 4

def text
  @text
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/noti/notification.rb', line 4

def title
  @title
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/noti/notification.rb', line 4

def url
  @url
end

Instance Method Details

#deliver_to(user) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/noti/notification.rb', line 6

def deliver_to(user)
  data = {
    :app => Noti.app,
    :user => user,
    :notification => {
      :title => self.title,
      :text => self.text,
      :url => self.url,
      :sound => self.sound,
      :image => self.image
    }
  }
  Noti::Request.request('add', data) && true
end