Class: Boppers::Notifier::Pushover

Inherits:
Object
  • Object
show all
Defined in:
lib/boppers/notifier/pushover.rb

Constant Summary collapse

ENDPOINT =
"https://api.pushover.net/1/messages.json"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_token:, user_token:, subscribe: nil) ⇒ Pushover

Returns a new instance of Pushover.



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

def initialize(app_token:, user_token:, subscribe: nil)
  @app_token = app_token
  @user_token = user_token
  @subscribe = subscribe
end

Instance Attribute Details

#app_tokenObject (readonly)

Returns the value of attribute app_token.



8
9
10
# File 'lib/boppers/notifier/pushover.rb', line 8

def app_token
  @app_token
end

#subscribeObject (readonly)

Returns the value of attribute subscribe.



8
9
10
# File 'lib/boppers/notifier/pushover.rb', line 8

def subscribe
  @subscribe
end

#user_tokenObject (readonly)

Returns the value of attribute user_token.



8
9
10
# File 'lib/boppers/notifier/pushover.rb', line 8

def user_token
  @user_token
end

Instance Method Details

#call(title, message, _options) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/boppers/notifier/pushover.rb', line 16

def call(title, message, _options)
  HttpClient.post(
    ENDPOINT,
    token: app_token,
    user: user_token,
    title: title,
    message: message
  )
end