Module: BitrixWebhook::TASK::ITEM
- Defined in:
- lib/bitrix_webhook/task/item.rb
Class Method Summary collapse
Class Method Details
.add(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bitrix_webhook/task/item.rb', line 15 def self.add( = {}) = config.merge() query_params = { fields: { TITLE: [:title], RESPONSIBLE_ID: [:responsible_id], DEADLINE: (DateTime.now + 1.day).strftime("%FT%T%:z"), UF_CRM_TASK: ["D_#{[:crm_user_id]}"] }, }.to_query post_url = base_url('add').to_s + query_params begin JSON.parse(HTTP.post(post_url).body) rescue => e {error:e}.to_json end end |
.base_url(method) ⇒ Object
11 12 13 |
# File 'lib/bitrix_webhook/task/item.rb', line 11 def self.base_url(method) "https://#{BitrixWebhook.bitrix24_url}/rest/#{BitrixWebhook.webhook_user}/#{ BitrixWebhook.hook}/task.item.#{method}?" end |
.config ⇒ Object
5 6 7 8 9 |
# File 'lib/bitrix_webhook/task/item.rb', line 5 def self.config { responsible_id: BitrixWebhook.webhook_user } end |
.getdata(task_id) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bitrix_webhook/task/item.rb', line 35 def self.getdata(task_id) query_params = { TASKID: task_id }.to_query post_url = base_url('getdata').to_s + query_params begin JSON.parse(HTTP.post(post_url).body) rescue => e {error:e}.to_json end end |