Skip to content

Commit

Permalink
Implement project post end-points
Browse files Browse the repository at this point in the history
- Cancel, restore and complete methods
  • Loading branch information
İsmail Akbudak committed Mar 12, 2018
1 parent 6b1a713 commit 644959b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@
files_model: [{ externalId: 'test1' }, { externalId: 'test2' }],
files: %w[files/Test.txt files/Test-2.txt]
)

# Post project cancel
puts project.cancel(PROJECT_ID)

# Post project restore
puts project.restore(PROJECT_ID)

# Post project complete
puts project.complete(PROJECT_ID)
12 changes: 12 additions & 0 deletions lib/smartcat_sdk/rest/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ def add_document(project_id, files: [], files_model: [])
headers: SmartcatSDK::Util::Project.model_headers
)
end

def cancel(project_id)
prepare_request(:post, "#{@resource}/cancel?projectId=#{project_id}")
end

def restore(project_id)
prepare_request(:post, "#{@resource}/restore?projectId=#{project_id}")
end

def complete(project_id)
prepare_request(:post, "#{@resource}/complete?projectId=#{project_id}")
end
end
end
end

0 comments on commit 644959b

Please sign in to comment.