Class: CalltouchClient
- Inherits:
-
Object
- Object
- CalltouchClient
- Defined in:
- lib/calltouch_client.rb
Defined Under Namespace
Classes: ApiError
Constant Summary collapse
- VERSION =
'0.0.1'
Instance Method Summary collapse
-
#approved(id, options = {}) ⇒ Object
Approve order.
-
#calls(site_id, options = {}) ⇒ Object
clientApiId - required dateFrom - required dateTo - required clientId source.value source.filterMode medium.value medium.filterMode utmSource.value utmSource.filterMode utmMedium.value utmMedium.filterMode utmTerm.value utmTerm.filterMode utmContent.value utmContent.filterMode utmCampaign.value utmCampaign.filterMode keyword.value keyword.filterMode ani.value ani.filterMode phoneNumber.value phoneNumber.filterMode uniqueOnly callId withMapVisits.
-
#calls_by_date(site_id, options = {}) ⇒ Object
Total calls count by date access_token - required dateFrom dateTo.
-
#calls_count(site_id, options = {}) ⇒ Object
Total calls count access_token - required dateFrom dateTo.
-
#canceled(id, options = {}) ⇒ Object
Cancel order.
-
#completed(id, options = {}) ⇒ Object
Complete order.
-
#get_order(id, options = {}) ⇒ Object
Get order.
-
#get_request(id, options = {}) ⇒ Object
Get request.
-
#initialize(client_api_id) ⇒ CalltouchClient
constructor
A new instance of CalltouchClient.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Pass post, get, delete, put and patch to the request method.
-
#rejected(id, options = {}) ⇒ Object
Reject order.
-
#search(options = {}) ⇒ Object
Search.
-
#set_order(options = {}) ⇒ Object
Order by calling.
-
#set_request(options = {}) ⇒ Object
Request.
Constructor Details
#initialize(client_api_id) ⇒ CalltouchClient
Returns a new instance of CalltouchClient.
11 12 13 14 15 16 |
# File 'lib/calltouch_client.rb', line 11 def initialize(client_api_id) @client_api_id = client_api_id @session_id = nil @api_url = 'http://api.calltouch.ru/calls-service/RestAPI' @options = { clientApiId: client_api_id } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Pass post, get, delete, put and patch to the request method
123 124 125 126 127 128 129 |
# File 'lib/calltouch_client.rb', line 123 def method_missing(method_name, *arguments, &block) if method_name.to_s =~ /(post|get|put|patch|delete)/ request($1.to_sym, *arguments, &block) else super end end |
Instance Method Details
#approved(id, options = {}) ⇒ Object
Approve order
46 47 48 |
# File 'lib/calltouch_client.rb', line 46 def approved id, = {} get "requests/orders/#{id}/approve", .merge!(@options) end |
#calls(site_id, options = {}) ⇒ Object
clientApiId - required dateFrom - required dateTo - required clientId source.value source.filterMode medium.value medium.filterMode utmSource.value utmSource.filterMode utmMedium.value utmMedium.filterMode utmTerm.value utmTerm.filterMode utmContent.value utmContent.filterMode utmCampaign.value utmCampaign.filterMode keyword.value keyword.filterMode ani.value ani.filterMode phoneNumber.value phoneNumber.filterMode uniqueOnly callId withMapVisits
97 98 99 |
# File 'lib/calltouch_client.rb', line 97 def calls site_id, = {} get "#{site_id}/calls-diary/calls", .merge!(@options) end |
#calls_by_date(site_id, options = {}) ⇒ Object
Total calls count by date access_token - required dateFrom dateTo
115 116 117 |
# File 'lib/calltouch_client.rb', line 115 def calls_by_date site_id, = {} get "statistics/#{site_id}/calls/count-by-date", .merge!({ access_token: @client_api_id }) end |
#calls_count(site_id, options = {}) ⇒ Object
Total calls count access_token - required dateFrom dateTo
106 107 108 |
# File 'lib/calltouch_client.rb', line 106 def calls_count site_id, = {} get "statistics/#{site_id}/calls/total-count", .merge!({ access_token: @client_api_id }) end |
#canceled(id, options = {}) ⇒ Object
Cancel order
51 52 53 |
# File 'lib/calltouch_client.rb', line 51 def canceled id, = {} get "requests/orders/#{id}/cancel", .merge!(@options) end |
#completed(id, options = {}) ⇒ Object
Complete order
61 62 63 |
# File 'lib/calltouch_client.rb', line 61 def completed id, = {} get "requests/orders/#{id}/complete", .merge!(@options) end |
#get_order(id, options = {}) ⇒ Object
Get order
41 42 43 |
# File 'lib/calltouch_client.rb', line 41 def get_order id, = {} get "requests/orders/#{id}", .merge!(@options) end |
#get_request(id, options = {}) ⇒ Object
Get request
36 37 38 |
# File 'lib/calltouch_client.rb', line 36 def get_request id, = {} get "requests/#{id}", .merge!(@options) end |
#rejected(id, options = {}) ⇒ Object
Reject order
56 57 58 |
# File 'lib/calltouch_client.rb', line 56 def rejected id, = {} get "requests/orders/#{id}/reject", .merge!(@options) end |
#search(options = {}) ⇒ Object
Search
31 32 33 |
# File 'lib/calltouch_client.rb', line 31 def search = {} get 'requests', .merge!(@options) end |
#set_order(options = {}) ⇒ Object
Order by calling
26 27 28 |
# File 'lib/calltouch_client.rb', line 26 def set_order = {} get 'orders/register', .merge!(@options) end |
#set_request(options = {}) ⇒ Object
Request
21 22 23 |
# File 'lib/calltouch_client.rb', line 21 def set_request = {} get 'requests/orders/register', .merge!(@options) end |