callrail 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbbaf506ead787ca52dc63840bb542d453d49a34
4
- data.tar.gz: c612a2e8c8fb78bf487947a8a13736bd5bb407df
3
+ metadata.gz: 711be4fe1640adfe3c857a8b4014467fa17d1200
4
+ data.tar.gz: 0acb033d592e81ce66985dd42476d066822d92c2
5
5
  SHA512:
6
- metadata.gz: 81cad40eb9c1b41226ecfa9d89779a76ff9866ffbd41e4537b07f372b1d62187dd927122178f5ac6bce60f9341bc89a6451cbec46f83b13a9ff08ef67cfde441
7
- data.tar.gz: 962ea32852ee2427319273b5a8b01de3aa7a905c039b34b61aa455ade32fa676df8a4a7be2fd0a0437e5072f3628ac48cd156c93573a5bb7985bc5dc377bd7ae
6
+ metadata.gz: 1d59d1537dbfe8d723c09a69fccf7fa081749a023b3afe10162b54db789d0c122d4da07778d2c9df1e4e5eeb82ffc2b6e1753a379e0666802e7b4ddd71337f59
7
+ data.tar.gz: 727f635520ccb319e942ecabff2eb9208d2a29bb84bbc1644f01a1f3e5dc2b040543597a4755d324187c1573181d4a3fcc5a8653422c4d6833ff7385a1729db4
data/README.md CHANGED
@@ -21,6 +21,11 @@ Or install it yourself as:
21
21
  $ gem install callrail
22
22
 
23
23
  ## Usage
24
+ ###### Time options
25
+ Callrail defaults to last_30_days if a date range isn't specified.
26
+ opts[:date_range] - Values: recent, today, yesterday, last_7_days, last_30_days, this_month, last_month, all_time
27
+ opts[:start_date] - ex: “2015-09-05” for all calls after and including September 9, 2015 - “2015-09-05T10:00” for all calls after 10 AM September 5, 2015
28
+ opts[:end_date] - ex: “2015-10-05” for all calls before and including October 9, 2
24
29
 
25
30
  * *Examples of what is currently enabled
26
31
 
@@ -167,6 +172,46 @@ tracker_options[:source] = {:type => "search", :search_engine => "all", :search_
167
172
  tracker_options[:tracker_id] = <tracker_id>
168
173
  puts testcon.update_tracker(tracker_options)
169
174
 
175
+ ###### Get Calls
176
+ Sorting: customer_name, customer_phone_number, duration, start_time, source
177
+ Filtering: date_range, answer_status, device, direction, lead_status
178
+ Searching: caller_name, note, source, dialed_number, caller_number, outgoing_number
179
+
180
+ ```
181
+ call_options = {}
182
+ testcon.get_calls(call_options)
183
+ ```
184
+
185
+ ###### Get a specific call
186
+ ```
187
+ call_options = {call_id: <call_id>}
188
+ testcon.get_calls(call_options)
189
+ ```
190
+
191
+ ###### Update a specific call
192
+ ```
193
+ call_options = {call_id: <call_id>}
194
+ call_options[:note] = "Test"
195
+ testcon.update_call(call_options)
196
+ ```
197
+ ###### Get Calls summary
198
+ Summary Grouping: source, keywords, campaign, referrer, landing_page, or company
199
+ Summary Fields: total_calls, missed_calls, answered_calls, first_time_callers, average_duration, formatted_average_duration, leads. Defaults to total_calls
200
+ ```
201
+ summary_options = {group_by: "campaign"}
202
+ testcon.get_calls_summary(summary_options)
203
+ ```
204
+
205
+ For a time series (grouped by date), set summary_options[:time_series] = true
206
+
207
+
208
+ ###### Getting Call recording URL
209
+ ```
210
+ call_options = {}
211
+ call_options[:call_id] = >call_id>
212
+ puts testcon.get_call_recording(call_options)
213
+ ```
214
+
170
215
  ###### Getting Integrations for a company
171
216
  ```
172
217
  int_opts = {}
@@ -91,12 +91,26 @@ module Callrail
91
91
  params[:tracking_number] = opts[:tracking_number] if opts[:tracking_number]
92
92
  #Integration Params
93
93
  params[:config] = opts[:config] if opts[:config]
94
- params[:state] = opts[:state] if opts[:state]
95
-
94
+ params[:state] = opts[:state] if opts[:state]
96
95
  #Call Params
97
96
  # Sorting: customer_name, customer_phone_number, duration, start_time, source
98
97
  # Filtering: date_range, answer_status, device, direction, lead_status
99
98
  # Searching: caller_name, note, source, dialed_number, caller_number, outgoing_number
99
+ # Summary Grouping: source, keywords, campaign, referrer, landing_page, or company
100
+ # Summary Fields: total_calls, missed_calls, answered_calls, first_time_callers, average_duration, formatted_average_duration, leads. Defaults to total_calls
101
+ params[:tags] = opts[:tags] if opts[:tags]
102
+ params[:note] = opts[:note] if opts[:note]
103
+ params[:value] = opts[:value] if opts[:value]
104
+ params[:lead_status] = opts[:lead_status] if opts[:lead_status]
105
+ params[:group_by] = opts[:group_by] if opts[:group_by]
106
+ params[:device] = opts[:device] if opts[:device]
107
+ params[:min_duration] = opts[:min_duration] if opts[:min_duration]
108
+ params[:max_duration] = opts[:max_duration] if opts[:max_duration]
109
+ params[:tracker_ids] = opts[:tracker_ids] if opts[:tracker_ids]
110
+ params[:direction] = opts[:direction] if opts[:direction]
111
+ params[:answer_status] = opts[:answer_status] if opts[:answer_status]
112
+ params[:first_time_callers] = opts[:first_time_callers] if opts[:first_time_callers]
113
+ params[:agent] = opts[:agent] if opts[:agent]
100
114
  #Text Message Params
101
115
  # Filtering: date_range
102
116
  # Searching: customer_phone_number, customer_name
@@ -122,14 +136,14 @@ module Callrail
122
136
  return responses.flatten! || responses
123
137
  end
124
138
 
125
- # Account Calls
139
+ # Account
126
140
  def get_accounts(opts = {})
127
141
  opts[:path] = (opts[:account_id]) ? "/" + opts[:account_id].to_s + ".json" : ".json"
128
142
  opts[:data] = "accounts" unless opts[:account_id]
129
143
  return get_responses(opts)
130
144
  end
131
145
 
132
- # Company Calls
146
+ # Company
133
147
  def get_companies(opts = {})
134
148
  opts[:path] = (opts[:company_id]) ? "/" + @account_id + "/companies/" + opts[:company_id].to_s + ".json" : "/" + @account_id + "/companies.json"
135
149
  opts[:data] = "companies" unless opts[:company_id]
@@ -154,7 +168,7 @@ module Callrail
154
168
  return parse_json(RestClient.delete(@url+path, :Authorization => @auth))
155
169
  end
156
170
 
157
- # User Calls
171
+ # User
158
172
  def get_users( opts={} )
159
173
  opts[:path] = (opts[:user_id]) ? "/" + @account_id + "/users/" + opts[:user_id].to_s + ".json" : "/" + @account_id + "/users.json"
160
174
  opts[:data] = "users" unless opts[:user_id]
@@ -173,7 +187,33 @@ module Callrail
173
187
  return parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
174
188
  end
175
189
 
176
- # Tracker Calls
190
+ # Calls
191
+ def get_calls( opts={} )
192
+ opts[:path] = (opts[:call_id]) ? "/" + @account_id + "/calls/" + opts[:call_id].to_s + ".json" : "/" + @account_id + "/calls.json"
193
+ opts[:data] = "calls" unless opts[:call_id]
194
+ return get_responses(opts)
195
+ end
196
+
197
+ def get_calls_summary( opts={} )
198
+ opts[:path] = (opts[:time_series] == true) ? "/" + @account_id + "/calls/timeseries.json" : "/" + @account_id + "/calls/summary.json"
199
+ return get_responses(opts)
200
+ end
201
+
202
+ def update_call(opts = {})
203
+ params = set_params(opts)
204
+ path = "/" + @account_id + "/calls/" + opts[:call_id].to_s + ".json"
205
+ return parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
206
+ end
207
+
208
+ def get_call_recording( opts={} )
209
+ opts[:path] = "/" + @account_id + "/calls/" + opts[:call_id].to_s + "/recording.json"
210
+ opts[:data] = "url"
211
+ return get_responses(opts).first
212
+ end
213
+
214
+
215
+
216
+ # Tracker
177
217
  def get_trackers(opts={})
178
218
  opts[:path] = (opts[:tracker_id]) ? "/" + @account_id + "/trackers/" + opts[:tracker_id].to_s + ".json" : "/" + @account_id + "/trackers.json"
179
219
  opts[:data] = "trackers" unless opts[:tracker_id]
@@ -1,3 +1,3 @@
1
1
  module Callrail
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoskison
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler