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

Instance Attribute Details

#callbackString

Returns callback url.

Returns:

  • (String)

    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 message].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

#deviceString

Returns device to transmit too.

Returns:

  • (String)

    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 message].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

#expireNumeric

Returns expire time until message expires.

Returns:

  • (Numeric)

    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 message].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

#messageString

Returns message to transmit.

Returns:

  • (String)

    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 message].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

#priorityNumeric

Returns numeric value for priority.

Returns:

  • (Numeric)

    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 message].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

#retryNumeric

Returns how long to retry for, in seconds.

Returns:

  • (Numeric)

    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 message].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

#soundString

Returns sound to play.

Returns:

  • (String)

    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 message].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

#timestampNumeric

Returns timestamp to expire, in epoch.

Returns:

  • (Numeric)

    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 message].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

#titleString

Returns title of the message.

Returns:

  • (String)

    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 message].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

#tokenString

Returns application token.

Returns:

  • (String)

    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 message].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

#urlString

Returns supplementary url.

Returns:

  • (String)

    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 message].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_titleString

Returns title of the supplementary url.

Returns:

  • (String)

    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 message].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

#userString

Returns user key.

Returns:

  • (String)

    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 message].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