Skip to content

Commit

Permalink
Implement document delete end-point
Browse files Browse the repository at this point in the history
  • Loading branch information
İsmail Akbudak committed Mar 12, 2018
1 parent 644959b commit fce3015
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
ACCOUNT_ID = 'ACCOUNT_ID'.freeze
API_KEY = 'API_KEY'.freeze

# -------------------------------------------------------------
# -------------------------------------------------------------
# Project API end-point
# -------------------------------------------------------------
# -------------------------------------------------------------
project = SmartcatSDK::REST::Project.new(ACCOUNT_ID, API_KEY)
# Get project details
PROJECT_ID = 'EXAMPLE_PROJECT_ID'.freeze
Expand Down Expand Up @@ -62,3 +65,13 @@

# Post project complete
puts project.complete(PROJECT_ID)

# -------------------------------------------------------------
# -------------------------------------------------------------
# Document API end-point
# -------------------------------------------------------------
# -------------------------------------------------------------
document = SmartcatSDK::REST::Document.new(ACCOUNT_ID, API_KEY)
# Delete documents
DOCUMENT_IDS = %w[2048153_9 2048153_7].freeze
puts document.delete(DOCUMENT_IDS)
1 change: 1 addition & 0 deletions lib/smartcat_sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
require 'smartcat_sdk/util/request'
require 'smartcat_sdk/rest/errors'
require 'smartcat_sdk/rest/project'
require 'smartcat_sdk/rest/document'

module SmartcatSDK
# Your code goes here...
Expand Down
16 changes: 16 additions & 0 deletions lib/smartcat_sdk/rest/document.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'smartcat_sdk/rest/base_request'

module SmartcatSDK
module REST
class Document < BaseRequest
def initialize(*args)
super(*args)
@resource = 'document'
end

def delete(document_ids = [])
prepare_request(:delete, @resource, params: { documentIds: document_ids })
end
end
end
end

0 comments on commit fce3015

Please sign in to comment.