Class: CommandTower::Messaging::Execution::Adapters::Expo::HttpClient
- Inherits:
-
Object
- Object
- CommandTower::Messaging::Execution::Adapters::Expo::HttpClient
- Defined in:
- app/services/command_tower/messaging/execution/adapters/expo/http_client.rb
Overview
Narrow Expo Push HTTP client for Messaging notification push. Never logs tokens, Authorization headers, or raw bodies that may contain tokens.
Instance Method Summary collapse
-
#get_receipts(ids) ⇒ Object
ids: Array of ticket id strings.
-
#initialize(configuration: nil) ⇒ HttpClient
constructor
A new instance of HttpClient.
-
#send_messages(messages) ⇒ Object
messages: Array of Expo message hashes (to/title/body/data).
Constructor Details
#initialize(configuration: nil) ⇒ HttpClient
Returns a new instance of HttpClient.
15 16 17 |
# File 'app/services/command_tower/messaging/execution/adapters/expo/http_client.rb', line 15 def initialize(configuration: nil) @configuration = configuration || Configuration.new end |
Instance Method Details
#get_receipts(ids) ⇒ Object
ids: Array of ticket id strings. Returns { ok:, status_code:, receipts: { id => { status:, message:, error: } } }
30 31 32 33 |
# File 'app/services/command_tower/messaging/execution/adapters/expo/http_client.rb', line 30 def get_receipts(ids) response = post_json("#{api_base_url}/getReceipts", { "ids" => Array(ids) }) parse_receipts_response(response) end |
#send_messages(messages) ⇒ Object
messages: Array of Expo message hashes (to/title/body/data). Returns { ok:, status_code:, tickets: [...] } where each ticket is { status:, id:, message:, error: } (error is Expo details.error when present).
22 23 24 25 26 |
# File 'app/services/command_tower/messaging/execution/adapters/expo/http_client.rb', line 22 def () # Expo Push /send accepts a JSON array of messages. response = post_json("#{api_base_url}/send", Array()) parse_send_response(response) end |