Module: BitrixWebhook::CRM::DEAL

Defined in:
lib/bitrix_webhook/CRM/deal.rb

Class Method Summary collapse

Class Method Details

.base_url(method) ⇒ Object



5
6
7
# File 'lib/bitrix_webhook/CRM/deal.rb', line 5

def self.base_url(method)
  "https://#{BitrixWebhook.bitrix24_url}/rest/#{BitrixWebhook.webhook_user}/#{ BitrixWebhook.hook}/crm.deal.#{method}?"
end

.get(id) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bitrix_webhook/CRM/deal.rb', line 9

def self.get(id)
  query_params = {
      id: id
  }.to_query
  get_url = base_url('get').to_s + query_params
  begin
    JSON.parse(HTTP.get(get_url).body)
  rescue => e
    {error:e}.to_json
  end
end