Module: NMA
- Extended by:
- NMA
- Included in:
- NMA
- Defined in:
- lib/ruby-notify-my-android.rb,
lib/ruby-notify-my-android/request.rb,
lib/ruby-notify-my-android/response.rb,
lib/ruby-notify-my-android/notification.rb
Overview
This is the main Notify My Andoid module
Defined Under Namespace
Classes: Notification, Priority, Request, Response
Constant Summary
collapse
- VERSION =
self.version
Instance Method Summary
collapse
Instance Method Details
#notify(notification = Notification.new) {|notification| ... } ⇒ Object
11
12
13
14
|
# File 'lib/ruby-notify-my-android.rb', line 11
def notify(notification = Notification.new)
yield notification if block_given?
Request.instance.call Request::Command::NOTIFY, notification.to_params
end
|
#remaining_calls(key) ⇒ Object
25
26
27
28
29
|
# File 'lib/ruby-notify-my-android.rb', line 25
def remaining_calls(key)
result = verify(key)
return result.response["remaining"].to_i if result.succeeded?
result.response["content"]
end
|
#valid_key?(key) ⇒ Boolean
20
21
22
23
|
# File 'lib/ruby-notify-my-android.rb', line 20
def valid_key?(key)
result = verify(key)
result.succeeded?
end
|
#verify(apikey) ⇒ Object
16
17
18
|
# File 'lib/ruby-notify-my-android.rb', line 16
def verify(apikey)
Request.instance.call Request::Command::VERIFY, "apikey=#{apikey}"
end
|
#version ⇒ Object
31
32
33
|
# File 'lib/ruby-notify-my-android.rb', line 31
def version
File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION]))
end
|