Module: LibNio

Defined in:
lib/ruby-libnio.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#iconObject

Returns the value of attribute icon.



6
7
8
# File 'lib/ruby-libnio.rb', line 6

def icon
  @icon
end

Returns the value of attribute link.



6
7
8
# File 'lib/ruby-libnio.rb', line 6

def link
  @link
end

#stickyObject

Returns the value of attribute sticky.



6
7
8
# File 'lib/ruby-libnio.rb', line 6

def sticky
  @sticky
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/ruby-libnio.rb', line 6

def title
  @title
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/ruby-libnio.rb', line 8

def self.included(base)
  base.send(:include, HTTParty)
  base.send(:base_uri, 'api.notify.io')
  base.extend ClassMethods
end

Instance Method Details

#notify(userhash, opts = {}) ⇒ Object



25
26
27
# File 'lib/ruby-libnio.rb', line 25

def notify(userhash, opts = {})
  self.class.post("/v1/notify/#{userhash}?api_key=#{api_key}", :body => opts)
end

#notify_all(userhashes, opts = {}) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/ruby-libnio.rb', line 29

def notify_all(userhashes, opts = {})
  responses = []
  userhashes.each do |user|
    responses << self.class.post("/v1/notify/#{user}?api_key=#{api_key}", :body => opts)
  end
  responses
end