Class: Bitrix24CloudApi::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bitrix24_cloud_api/base.rb

Class Method Summary collapse

Class Method Details

.resource_path(exact_name = nil) ⇒ Object



21
22
23
# File 'lib/bitrix24_cloud_api/base.rb', line 21

def resource_path(exact_name = nil)
  exact_name || name.gsub("Bitrix24CloudApi::", "").gsub("::", ".").downcase
end

.resource_url(client, action) ⇒ Object



15
16
17
18
19
# File 'lib/bitrix24_cloud_api/base.rb', line 15

def resource_url(client, action)
  path = client.api_endpoint
  path << "#{resource_path}." unless resource_path.empty?
  path << "#{action}.#{client.extension}"
end

.to_query(params) ⇒ Object



11
12
13
# File 'lib/bitrix24_cloud_api/base.rb', line 11

def to_query(params)
  params.to_a.map { |x| "#{CGI.escape(x[0].to_s)}=#{CGI.escape(x[1].to_s)}" }.join("&")
end