Class: ImageKitIo::ApiService::Bulk
- Inherits:
-
Object
- Object
- ImageKitIo::ApiService::Bulk
- Includes:
- Constantable
- Defined in:
- lib/imagekitio/api_service/bulk.rb
Instance Method Summary collapse
- #add_tags(file_ids: [], tags: []) ⇒ Object
-
#initialize(req_obj) ⇒ Bulk
constructor
A new instance of Bulk.
- #job_status(job_id: nil) ⇒ Object
- #remove_ai_tags(file_ids: [], ai_tags: []) ⇒ Object
- #remove_files(file_ids: []) ⇒ Object
- #remove_tags(file_ids: [], tags: []) ⇒ Object
Methods included from Constantable
Constructor Details
#initialize(req_obj) ⇒ Bulk
Returns a new instance of Bulk.
8 9 10 |
# File 'lib/imagekitio/api_service/bulk.rb', line 8 def initialize(req_obj) @req_obj = req_obj end |
Instance Method Details
#add_tags(file_ids: [], tags: []) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/imagekitio/api_service/bulk.rb', line 21 def (file_ids: [], tags: []) if file_ids.empty? || .empty? raise ArgumentError, 'Parameters are required' end url = "#{constants.BASE_URL}/addTags" payload = { 'fileIds': file_ids, 'tags': }.to_json @req_obj.request('post', url, @req_obj.create_headers, payload) end |
#job_status(job_id: nil) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/imagekitio/api_service/bulk.rb', line 12 def job_status(job_id: nil) if job_id == '' || job_id.nil? raise ArgumentError, 'job_id is required' end url = "#{constants.BULK_BASE_URL}/#{job_id}" payload = { 'jobId': job_id } @req_obj.request('get', url, @req_obj.create_headers, payload) end |
#remove_ai_tags(file_ids: [], ai_tags: []) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/imagekitio/api_service/bulk.rb', line 39 def (file_ids: [], ai_tags: []) if file_ids.empty? || .empty? raise ArgumentError, 'Parameters are required' end url = "#{constants.BASE_URL}/removeAITags" payload = { 'fileIds': file_ids, 'AITags': }.to_json @req_obj.request('post', url, @req_obj.create_headers, payload) end |
#remove_files(file_ids: []) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/imagekitio/api_service/bulk.rb', line 48 def remove_files(file_ids: []) if file_ids.empty? raise ArgumentError, 'File ids are required' end url = "#{constants.BASE_URL}#{constants.BULK_FILE_DELETE}" payload = {'fileIds': file_ids}.to_json @req_obj.request("post", url, @req_obj.create_headers, payload) end |
#remove_tags(file_ids: [], tags: []) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/imagekitio/api_service/bulk.rb', line 30 def (file_ids: [], tags: []) if file_ids.empty? || .empty? raise ArgumentError, 'Parameters are required' end url = "#{constants.BASE_URL}/removeTags" payload = { 'fileIds': file_ids, 'tags': }.to_json @req_obj.request('post', url, @req_obj.create_headers, payload) end |