Class: Helo::Sending

Inherits:
API
  • Object
show all
Defined in:
lib/helo/apis/sending.rb

Instance Method Summary collapse

Instance Method Details

#broadcast(request_data, channel_id: nil, idempotency_key: nil) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/helo/apis/sending.rb', line 23

def broadcast(request_data, channel_id: nil, idempotency_key: nil)
  request = SendBroadcastRequest.new(request_data)
  headers = {}
  headers["X-Helo-Channel-Id"] = channel_id unless channel_id.nil?
  headers["X-Helo-Idempotency-Key"] = idempotency_key unless idempotency_key.nil?
  response = @client.request(:post, "/send/broadcast", body: request.to_params, headers: headers)
  SendBroadcastResponse.from_hash(response.body)
end

#broadcast_message(request_data, channel_id: nil, idempotency_key: nil) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/helo/apis/sending.rb', line 32

def broadcast_message(request_data, channel_id: nil, idempotency_key: nil)
  request = SendMessageRequest.new(request_data)
  headers = {}
  headers["X-Helo-Channel-Id"] = channel_id unless channel_id.nil?
  headers["X-Helo-Idempotency-Key"] = idempotency_key unless idempotency_key.nil?
  response = @client.request(:post, "/send/broadcast/message", body: request.to_params, headers: headers)
  SendMessageAcceptedResponse.from_hash(response.body)
end

#transactional(request_data, channel_id: nil, idempotency_key: nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/helo/apis/sending.rb', line 5

def transactional(request_data, channel_id: nil, idempotency_key: nil)
  request = SendMessageRequest.new(request_data)
  headers = {}
  headers["X-Helo-Channel-Id"] = channel_id unless channel_id.nil?
  headers["X-Helo-Idempotency-Key"] = idempotency_key unless idempotency_key.nil?
  response = @client.request(:post, "/send/transactional", body: request.to_params, headers: headers)
  SendMessageAcceptedResponse.from_hash(response.body)
end

#transactional_batch(request_data, channel_id: nil, idempotency_key: nil) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/helo/apis/sending.rb', line 14

def transactional_batch(request_data, channel_id: nil, idempotency_key: nil)
  request = SendMessageBatchRequest.new(request_data)
  headers = {}
  headers["X-Helo-Channel-Id"] = channel_id unless channel_id.nil?
  headers["X-Helo-Idempotency-Key"] = idempotency_key unless idempotency_key.nil?
  response = @client.request(:post, "/send/transactional/batch", body: request.to_params, headers: headers)
  SendMessageBatchResponse.from_hash(response.body)
end