Class: CommandTower::Messaging::Pushover::Adapters::HttpAdapter

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/messaging/pushover/adapters/http_adapter.rb

Overview

Real Pushover HTTP client for credential validation, test notifications, and production delivery. Never returns or logs secrets / raw provider payloads.

Instance Method Summary collapse

Instance Method Details

#send_message!(user_key:, application_token:, title:, message:) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'app/services/command_tower/messaging/pushover/adapters/http_adapter.rb', line 36

def send_message!(user_key:, application_token:, title:, message:)
  post_form(
    path: "messages.json",
    form: {
      "token" => application_token.to_s,
      "user" => user_key.to_s,
      "title" => title.to_s,
      "message" => message.to_s,
    },
  )
end

#send_test_notification!(user_key:, application_token:, title:, message:) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'app/services/command_tower/messaging/pushover/adapters/http_adapter.rb', line 24

def send_test_notification!(user_key:, application_token:, title:, message:)
  post_form(
    path: "messages.json",
    form: {
      "token" => application_token.to_s,
      "user" => user_key.to_s,
      "title" => title.to_s,
      "message" => message.to_s,
    },
  )
end

#validate_user!(user_key:, application_token:) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'app/services/command_tower/messaging/pushover/adapters/http_adapter.rb', line 14

def validate_user!(user_key:, application_token:)
  post_form(
    path: "users/validate.json",
    form: {
      "token" => application_token.to_s,
      "user" => user_key.to_s,
    },
  )
end