Module: Pushover
- Defined in:
- lib/pushover.rb,
lib/pushover/message.rb,
lib/pushover/receipt.rb,
lib/pushover/version.rb,
lib/pushover/response.rb
Overview
pushover interface for ruby
Defined Under Namespace
Classes: Message, Receipt, Response
Constant Summary collapse
- HEADERS =
headers to include in every request.
{ 'Content-Type' => 'application/json', 'User-Agent' => "pushover (ruby gem) v#{VERSION}" }
- Excon =
excon connection to use for every request.
Excon.new('https://api.pushover.net', headers: HEADERS)
- VERSION =
The current version of Pushover.
"3.0.3".freeze
Instance Attribute Summary collapse
-
#callback ⇒ String
Callback url.
-
#device ⇒ String
Device to transmit too.
-
#expire ⇒ Numeric
Expire time until message expires.
-
#message ⇒ String
Message to transmit.
-
#priority ⇒ Numeric
Numeric value for priority.
-
#retry ⇒ Numeric
How long to retry for, in seconds.
-
#sound ⇒ String
Sound to play.
-
#timestamp ⇒ Numeric
Timestamp to expire, in epoch.
-
#title ⇒ String
Title of the message.
-
#token ⇒ String
Application token.
-
#url ⇒ String
Supplementary url.
-
#url_title ⇒ String
Title of the supplementary url.
-
#user ⇒ String
User key.
Instance Attribute Details
#callback ⇒ String
Returns callback url.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#device ⇒ String
Returns device to transmit too.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#expire ⇒ Numeric
Returns expire time until message expires.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#message ⇒ String
Returns message to transmit.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#priority ⇒ Numeric
Returns numeric value for priority.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#retry ⇒ Numeric
Returns how long to retry for, in seconds.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#sound ⇒ String
Returns sound to play.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#timestamp ⇒ Numeric
Returns timestamp to expire, in epoch.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#title ⇒ String
Returns title of the message.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#token ⇒ String
Returns application token.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#url ⇒ String
Returns supplementary url.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#url_title ⇒ String
Returns title of the supplementary url.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |
#user ⇒ String
Returns user key.
29 30 31 32 33 34 35 36 37 |
# File 'lib/pushover/message.rb', line 29 Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do # push the configured message to pushover. # @return [Response] response for the receipt request def push i[token user ].each { |param| raise "#{param} must be supplied" unless send param } Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h) end end |