Class: Pushover::Receipt
- Inherits:
-
Object
- Object
- Pushover::Receipt
- Defined in:
- lib/pushover/receipt.rb
Overview
Deprecated compatibility interface for retrieving receipts.
Instance Method Summary collapse
-
#get ⇒ Response
Retrieve the configured receipt through the shared client.
-
#initialize(attributes = {}, **keywords) ⇒ Receipt
constructor
A new instance of Receipt.
Constructor Details
#initialize(attributes = {}, **keywords) ⇒ Receipt
Returns a new instance of Receipt.
9 10 11 12 13 14 15 16 17 |
# File 'lib/pushover/receipt.rb', line 9 def initialize(attributes = {}, **keywords) raise ArgumentError, 'attributes must be supplied as a Hash' unless attributes.is_a?(Hash) values = attributes.merge(keywords).transform_keys(&:to_sym) unknown = values.keys - ATTRIBUTES raise ArgumentError, "unknown keywords: #{unknown.join(', ')}" unless unknown.empty? values.each { |attribute, value| public_send("#{attribute}=", value) } end |
Instance Method Details
#get ⇒ Response
Retrieve the configured receipt through the shared client.
21 22 23 24 25 26 27 |
# File 'lib/pushover/receipt.rb', line 21 def get require 'pushover' unless defined?(Pushover::Excon) warn 'Pushover::Receipt#get is deprecated; use Pushover::Client.new(token: ...).receipts.get(receipt: ...)', uplevel: 1 %i[receipt token].each { |param| raise "#{param} must be supplied" unless public_send(param) } Client.new(token: token).receipts.get(receipt: receipt) end |