Class: Hivehook::Resources::StreamService
- Inherits:
-
BaseService
- Object
- BaseService
- Hivehook::Resources::StreamService
- Defined in:
- lib/hivehook/resources/stream_service.rb
Constant Summary collapse
- FRAGMENT =
"id applicationId name status retentionDays createdAt"
Instance Method Summary collapse
- #create(input) ⇒ Object
- #delete(id) ⇒ Object
- #get(id) ⇒ Object
- #list(options = {}) ⇒ Object
- #update(id, input) ⇒ Object
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Hivehook::Resources::BaseService
Instance Method Details
#create(input) ⇒ Object
23 24 25 26 |
# File 'lib/hivehook/resources/stream_service.rb', line 23 def create(input) query = "mutation($input: CreateStreamInput!) { createStream(input: $input) { #{FRAGMENT} } }" @transport.execute(query, { "input" => input })["createStream"] end |
#delete(id) ⇒ Object
33 34 35 36 |
# File 'lib/hivehook/resources/stream_service.rb', line 33 def delete(id) query = "mutation($id: UUID!) { deleteStream(id: $id) }" @transport.execute(query, { "id" => id })["deleteStream"] end |
#get(id) ⇒ Object
18 19 20 21 |
# File 'lib/hivehook/resources/stream_service.rb', line 18 def get(id) query = "query($id: UUID!) { stream(id: $id) { #{FRAGMENT} } }" @transport.execute(query, { "id" => id })["stream"] end |
#list(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/hivehook/resources/stream_service.rb', line 8 def list( = {}) query = "query($applicationId: UUID, $status: StreamStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) { streams(applicationId: $applicationId, 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 status search limit offset after first]))["streams"] end |
#update(id, input) ⇒ Object
28 29 30 31 |
# File 'lib/hivehook/resources/stream_service.rb', line 28 def update(id, input) query = "mutation($id: UUID!, $input: UpdateStreamInput!) { updateStream(id: $id, input: $input) { #{FRAGMENT} } }" @transport.execute(query, { "id" => id, "input" => input })["updateStream"] end |