Class: Pushover::Receipt

Inherits:
Struct
  • Object
show all
Defined in:
lib/pushover/receipt.rb

Overview

Receipt is a struct to interface with the receipt endpoint.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#receiptString

Returns id of the receipt to request.

Returns:

  • (String)

    id of the receipt to request



7
8
9
10
11
12
13
14
15
# File 'lib/pushover/receipt.rb', line 7

Receipt = Struct.new(:receipt, :token, keyword_init: true) do
  # Call pushover and return a response.
  # @return [Response] response for the receipt request
  def get
    %i[receipt token].each { |param| raise "#{param} must be supplied" unless send param }

    Response.create_from_excon_response Excon.get(path: "1/receipts/#{receipt}.json", query: { token: token })
  end
end

#tokenString

Returns application token to check for a receipt.

Returns:

  • (String)

    application token to check for a receipt



7
8
9
10
11
12
13
14
15
# File 'lib/pushover/receipt.rb', line 7

Receipt = Struct.new(:receipt, :token, keyword_init: true) do
  # Call pushover and return a response.
  # @return [Response] response for the receipt request
  def get
    %i[receipt token].each { |param| raise "#{param} must be supplied" unless send param }

    Response.create_from_excon_response Excon.get(path: "1/receipts/#{receipt}.json", query: { token: token })
  end
end

Instance Method Details

#getResponse

Call pushover and return a response.

Returns:

  • (Response)

    response for the receipt request



10
11
12
13
14
# File 'lib/pushover/receipt.rb', line 10

def get
  %i[receipt token].each { |param| raise "#{param} must be supplied" unless send param }

  Response.create_from_excon_response Excon.get(path: "1/receipts/#{receipt}.json", query: { token: token })
end