Class: Retab::WorkflowReviewVersions
- Inherits:
-
Object
- Object
- Retab::WorkflowReviewVersions
- Defined in:
- lib/retab/workflow_review_versions.rb
Instance Method Summary collapse
-
#create(review_id:, parent_id:, snapshot:, note: nil, request_options: {}) ⇒ Retab::ReviewVersion
Create Review Version Route.
-
#get(version_id:, request_options: {}) ⇒ Retab::ReviewVersion
Get Review Version Route.
-
#initialize(client) ⇒ WorkflowReviewVersions
constructor
A new instance of WorkflowReviewVersions.
-
#list(review_id:, before: nil, after: nil, limit: 50, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::ReviewVersion>
List Review Versions Route.
Constructor Details
#initialize(client) ⇒ WorkflowReviewVersions
Returns a new instance of WorkflowReviewVersions.
9 10 11 |
# File 'lib/retab/workflow_review_versions.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create(review_id:, parent_id:, snapshot:, note: nil, request_options: {}) ⇒ Retab::ReviewVersion
Create Review Version Route
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/retab/workflow_review_versions.rb', line 64 def create( review_id:, parent_id:, snapshot:, note: nil, request_options: {} ) body = { 'review_id' => review_id, 'parent_id' => parent_id, 'snapshot' => snapshot, 'note' => note }.compact response = @client.request( method: :post, path: '/v1/workflows/reviews/versions', auth: true, body: body, request_options: ) result = Retab::ReviewVersion.new(response.body) result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#get(version_id:, request_options: {}) ⇒ Retab::ReviewVersion
Get Review Version Route
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/retab/workflow_review_versions.rb', line 93 def get( version_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/reviews/versions/#{Retab::Util.encode_path(version_id)}", auth: true, request_options: ) result = Retab::ReviewVersion.new(response.body) result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#list(review_id:, before: nil, after: nil, limit: 50, request_options: {}) ⇒ Retab::Types::ListStruct<Retab::ReviewVersion>
List Review Versions Route
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/retab/workflow_review_versions.rb', line 20 def list( review_id:, before: nil, after: nil, limit: 50, request_options: {} ) params = { 'review_id' => review_id, 'before' => before, 'after' => after, 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/workflows/reviews/versions', auth: true, params: params, request_options: ) fetch_next = ->(cursor) { list( review_id: review_id, before: before, after: cursor, limit: limit, request_options: ) } Retab::Types::ListStruct.from_response( response, model: Retab::ReviewVersion, filters: { review_id: review_id, before: before, limit: limit }, fetch_next: fetch_next ) end |