Class: Pushover::Receipts
- Inherits:
-
Object
- Object
- Pushover::Receipts
- Defined in:
- lib/pushover/receipts.rb
Overview
Receipts provides operations for the Receipt API.
Constant Summary collapse
- RECEIPT_PATTERN =
/\A[A-Za-z0-9]{30}\z/
Instance Method Summary collapse
-
#cancel(receipt:) ⇒ Response
Cancel future retries for an emergency message receipt.
-
#cancel_by_tag(tag:) ⇒ Response
Cancel future retries for all emergency messages with a tag.
-
#get(receipt:) ⇒ Response
Retrieve the current status of an emergency message receipt.
-
#initialize(client) ⇒ Receipts
constructor
A new instance of Receipts.
Constructor Details
#initialize(client) ⇒ Receipts
Returns a new instance of Receipts.
8 9 10 |
# File 'lib/pushover/receipts.rb', line 8 def initialize(client) @client = client end |
Instance Method Details
#cancel(receipt:) ⇒ Response
Cancel future retries for an emergency message receipt.
26 27 28 29 30 31 32 33 34 |
# File 'lib/pushover/receipts.rb', line 26 def cancel(receipt:) validate_receipt!(receipt) response = @client.connection.post( path: "/1/receipts/#{receipt}/cancel.json", body: Oj.dump('token' => @client.token) ) Response.create_from_excon_response(response) end |
#cancel_by_tag(tag:) ⇒ Response
Cancel future retries for all emergency messages with a tag.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pushover/receipts.rb', line 38 def cancel_by_tag(tag:) validate_tag!(tag) encoded_tag = URI.encode_uri_component(tag) response = @client.connection.post( path: "/1/receipts/cancel_by_tag/#{encoded_tag}.json", body: Oj.dump('token' => @client.token) ) Response.create_from_excon_response(response) end |
#get(receipt:) ⇒ Response
Retrieve the current status of an emergency message receipt.
14 15 16 17 18 19 20 21 22 |
# File 'lib/pushover/receipts.rb', line 14 def get(receipt:) validate_receipt!(receipt) response = @client.connection.get( path: "/1/receipts/#{receipt}.json", query: { token: @client.token } ) Response.create_from_excon_response(response) end |