Class: Hivehook::Resources::MessageService
- Inherits:
-
BaseService
- Object
- BaseService
- Hivehook::Resources::MessageService
- Defined in:
- lib/hivehook/resources/message_service.rb
Constant Summary collapse
- FRAGMENT =
"id applicationId eventType payload idempotencyKey status createdAt"
Instance Method Summary collapse
- #broadcast(input) ⇒ Object
- #get(id) ⇒ Object
- #list(options = {}) ⇒ Object
- #send(input) ⇒ Object
- #send_dynamic(input) ⇒ Object
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Hivehook::Resources::BaseService
Instance Method Details
#broadcast(input) ⇒ Object
28 29 30 31 |
# File 'lib/hivehook/resources/message_service.rb', line 28 def broadcast(input) query = "mutation($input: BroadcastMessageInput!) { broadcastMessage(input: $input) { #{FRAGMENT} } }" @transport.execute(query, { "input" => input })["broadcastMessage"] end |
#get(id) ⇒ Object
18 19 20 21 |
# File 'lib/hivehook/resources/message_service.rb', line 18 def get(id) query = "query($id: UUID!) { message(id: $id) { #{FRAGMENT} } }" @transport.execute(query, { "id" => id })["message"] end |
#list(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/hivehook/resources/message_service.rb', line 8 def list( = {}) query = "query($applicationId: UUID, $eventType: String, $status: MessageStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) { messages(applicationId: $applicationId, eventType: $eventType, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) { nodes { #{FRAGMENT} } pageInfo { total limit offset endCursor hasNextPage } } }" @transport.execute(query, build_variables(, %w[applicationId eventType status search limit offset after first]))["messages"] end |
#send(input) ⇒ Object
23 24 25 26 |
# File 'lib/hivehook/resources/message_service.rb', line 23 def send(input) query = "mutation($input: SendMessageInput!) { sendMessage(input: $input) { #{FRAGMENT} } }" @transport.execute(query, { "input" => input })["sendMessage"] end |
#send_dynamic(input) ⇒ Object
33 34 35 36 |
# File 'lib/hivehook/resources/message_service.rb', line 33 def send_dynamic(input) query = "mutation($input: SendDynamicMessageInput!) { sendDynamicMessage(input: $input) { #{FRAGMENT} } }" @transport.execute(query, { "input" => input })["sendDynamicMessage"] end |