Class: Notifo
Instance Method Summary collapse
-
#initialize(username, apisecret) ⇒ Notifo
constructor
Required Parameters username - notifo service username apikey - notifo service apisecret.
-
#post(username, msg, title = nil, uri = nil) ⇒ Object
Required Parameters to - notifo username of recipient msg - message being sent; must be url encoded Optional Parameters title - name of “notification event” uri - the uri that will be loaded when the notification is opened; if specified, must be urlencoded; if a web address, must start with http:// or https://.
-
#subscribe_user(username) ⇒ Object
Required Parameters username - notifo username to subscribe to your service.
Constructor Details
#initialize(username, apisecret) ⇒ Notifo
Required Parameters username - notifo service username apikey - notifo service apisecret
10 11 12 |
# File 'lib/notifo.rb', line 10 def initialize(username, apisecret) @auth = {:username => username, :password => apisecret} end |
Instance Method Details
#post(username, msg, title = nil, uri = nil) ⇒ Object
Required Parameters to - notifo username of recipient msg - message being sent; must be url encoded Optional Parameters title - name of “notification event” uri - the uri that will be loaded when the notification is opened; if specified, must be urlencoded; if a web address, must start with http:// or https://
27 28 29 30 |
# File 'lib/notifo.rb', line 27 def post(username, msg, title=nil, uri=nil) = { :body => {:to => username, :msg => msg, :title=>uri, :uri=>uri}, :basic_auth => @auth } self.class.post('/send_notification', ) end |
#subscribe_user(username) ⇒ Object
Required Parameters username - notifo username to subscribe to your service
16 17 18 19 |
# File 'lib/notifo.rb', line 16 def subscribe_user(username) = { :body => {:username => username}, :basic_auth => @auth } self.class.post("/subscribe_user", ) end |