callrail 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -15
- data/.rspec +3 -3
- data/.travis.yml +5 -5
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +6 -6
- data/LICENSE.txt +21 -21
- data/README.md +268 -272
- data/Rakefile +6 -6
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/callrail.gemspec +39 -39
- data/lib/callrail/version.rb +3 -3
- data/lib/callrail.rb +266 -266
- metadata +13 -14
data/README.md
CHANGED
@@ -1,272 +1,268 @@
|
|
1
|
-
# Callrail
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
$
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
```
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
######
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
###### Get
|
59
|
-
|
60
|
-
```testcon.get_companies() ```
|
61
|
-
|
62
|
-
######
|
63
|
-
```
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
```
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
opts =
|
78
|
-
opts[:
|
79
|
-
opts[:
|
80
|
-
# opts[:
|
81
|
-
# opts[:
|
82
|
-
# opts[:
|
83
|
-
# opts[:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
```
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
user_opts =
|
115
|
-
user_opts[:
|
116
|
-
user_opts[:
|
117
|
-
user_opts
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
```
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
```
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
tracker_options = {}
|
161
|
-
tracker_options[:
|
162
|
-
tracker_options[:
|
163
|
-
tracker_options[:
|
164
|
-
tracker_options[:
|
165
|
-
tracker_options
|
166
|
-
|
167
|
-
|
168
|
-
tracker_options
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
```
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
```
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
summary_options =
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
```
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
```
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
```
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
int_opts
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
int_opts
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
```
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
##
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
##
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
## Code of Conduct
|
271
|
-
|
272
|
-
Everyone interacting in the Callrail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/callrail/blob/master/CODE_OF_CONDUCT.md).
|
1
|
+
# Callrail
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'callrail'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install callrail
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
###### Time options
|
21
|
+
Callrail defaults to last_30_days if a date range isn't specified.
|
22
|
+
opts[:date_range] - Values: recent, today, yesterday, last_7_days, last_30_days, this_month, last_month, all_time
|
23
|
+
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
|
24
|
+
opts[:end_date] - ex: “2015-10-05” for all calls before and including October 9, 2
|
25
|
+
|
26
|
+
* *Examples of what is currently enabled
|
27
|
+
|
28
|
+
###### Setting Connection
|
29
|
+
```ruby
|
30
|
+
opts = {}
|
31
|
+
opts[:key] = "<Your Callrail API Key>"
|
32
|
+
opts[:account_id] = <your_account_id>
|
33
|
+
opts[:api_version] = "v3"
|
34
|
+
```
|
35
|
+
* * Account ID is optional for the initial connection. You can set the account id later if you need to retrieve it first.
|
36
|
+
* * API version is optional. v3 will be used by default.
|
37
|
+
|
38
|
+
``` testcon = Callrail::Api.new(:key => opts[:key]) ```
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
###### Get Accounts
|
43
|
+
``` testcon.get_accounts ```
|
44
|
+
|
45
|
+
|
46
|
+
###### Set Specific Account
|
47
|
+
|
48
|
+
```
|
49
|
+
opts[:account_id] = <your_account_id>
|
50
|
+
testcon.set_account_id(:account_id => opts[:account_id])
|
51
|
+
```
|
52
|
+
** Account ID must be set for everything but Get Accounts
|
53
|
+
|
54
|
+
###### Get Companies
|
55
|
+
|
56
|
+
```testcon.get_companies() ```
|
57
|
+
|
58
|
+
###### Get a specific Company
|
59
|
+
``` opts[:company_id] = <company_id> ```
|
60
|
+
``` testcon.get_companies(:company_id => opts[:company_id]) ```
|
61
|
+
|
62
|
+
###### Create a Company
|
63
|
+
```
|
64
|
+
opts = {}
|
65
|
+
opts[:name] = "XXX - Test Company 1"
|
66
|
+
opts[:time_zone] = "America/Los_Angeles" #
|
67
|
+
testcon.create_company(:name => opts[:name])
|
68
|
+
```
|
69
|
+
|
70
|
+
|
71
|
+
###### Update a Company
|
72
|
+
```
|
73
|
+
opts = {}
|
74
|
+
opts[:name] = "XXX - Test Company 2"
|
75
|
+
opts[:company_id] = <company_id>
|
76
|
+
# opts[:time_zone] = "America/Phoenix"
|
77
|
+
# opts[:callscore_enabled] = false
|
78
|
+
# opts[:keyword_spotting_enabled] = false
|
79
|
+
# opts[:callscribe_enabled] = false
|
80
|
+
# opts[:swap_exclude_jquery] = true
|
81
|
+
# opts[:swap_ppc_override] = false
|
82
|
+
# opts[:swap_landing_override] = nil
|
83
|
+
# opts[:swap_cookie_duration] = 90
|
84
|
+
testcon.update_company(:company_id => opts[:company_id], :time_zone => opts[:time_zone] )
|
85
|
+
```
|
86
|
+
|
87
|
+
###### Disable a Company
|
88
|
+
```
|
89
|
+
opts = {}
|
90
|
+
opts[:company_id] = <company_id>
|
91
|
+
testcon.disable_company(opts)
|
92
|
+
```
|
93
|
+
###### Get Users
|
94
|
+
``` testcon.get_users ```
|
95
|
+
|
96
|
+
###### Get Users For a specific company
|
97
|
+
```
|
98
|
+
user_opts = {:company_id => <company_id>}
|
99
|
+
puts testcon.get_users(user_opts)
|
100
|
+
```
|
101
|
+
|
102
|
+
###### Get Specific User
|
103
|
+
```
|
104
|
+
opts[:user_id] = <user_id>
|
105
|
+
testcon.get_users(:user_id => opts[:user_id] )
|
106
|
+
```
|
107
|
+
|
108
|
+
###### Create User
|
109
|
+
```
|
110
|
+
user_opts ={}
|
111
|
+
user_opts[:first_name] = "User"
|
112
|
+
user_opts[:last_name] = "Test"
|
113
|
+
user_opts[:email] = "test@test.com"
|
114
|
+
user_opts[:role] = "reporting"
|
115
|
+
user_opts[:password] = '<password>'
|
116
|
+
user_opts[:companies] = [<company_id>, <company_id2>, <company_id3>]
|
117
|
+
testcon.create_user(user_opts)
|
118
|
+
```
|
119
|
+
|
120
|
+
###### Update a user
|
121
|
+
```
|
122
|
+
user_opts[:user_id] = <user_id>
|
123
|
+
user_opts[:last_name] = "Test2"
|
124
|
+
testcon.update_user(user_opts)
|
125
|
+
```
|
126
|
+
|
127
|
+
###### Get Trackers
|
128
|
+
```
|
129
|
+
tracker_options = {}
|
130
|
+
testcon.get_trackers(tracker_options)
|
131
|
+
```
|
132
|
+
|
133
|
+
###### Get Trackers for a Company
|
134
|
+
```
|
135
|
+
tracker_options[:company_id] = <company_id>
|
136
|
+
testcon.get_trackers(tracker_options)
|
137
|
+
```
|
138
|
+
|
139
|
+
###### Get a specific tracker
|
140
|
+
```
|
141
|
+
tracker_options = {}
|
142
|
+
tracker_options[:tracker_id] = <tracker_id>
|
143
|
+
testcon.get_trackers(tracker_options)
|
144
|
+
```
|
145
|
+
|
146
|
+
###### Tracker Filtering
|
147
|
+
```
|
148
|
+
tracker_options = {}
|
149
|
+
tracker_options[:filtering] = [{:field => "type", :value => "source"},{:field => "status", :value => "active"}]
|
150
|
+
puts "Filters: 1. #{tracker_options[:filtering][0][:field]} = #{tracker_options[:filtering][0][:value]} 2. #{tracker_options[:filtering][1][:field]} = #{tracker_options[:filtering][1][:value]} "
|
151
|
+
testcon.get_trackers(tracker_options)
|
152
|
+
```
|
153
|
+
|
154
|
+
###### Create a Source Tracker
|
155
|
+
```
|
156
|
+
tracker_options = {}
|
157
|
+
tracker_options[:name] = "Test Source tracker"
|
158
|
+
tracker_options[:type] = "source"
|
159
|
+
tracker_options[:company_id] = <company_id>
|
160
|
+
tracker_options[:call_flow] = {:type => "basic", :recording_enabled => true, :destination_number => "+15555555555", :greeting_text => nil, :greeting_recording_url => nil}
|
161
|
+
tracker_options[:tracking_number] = {:area_code => "555", :local => "+15555555555"}
|
162
|
+
tracker_options[:source] = {:type => "all"}
|
163
|
+
tracker_options[:sms_enabled] = true
|
164
|
+
tracker_options[:whisper_message] = "This is a test number call"
|
165
|
+
testcon.create_tracker(tracker_options)
|
166
|
+
```
|
167
|
+
###### Update a Source Tracker
|
168
|
+
tracker_options = {}
|
169
|
+
tracker_options[:source] = {:type => "search", :search_engine => "all", :search_type => "paid"}
|
170
|
+
tracker_options[:tracker_id] = <tracker_id>
|
171
|
+
puts testcon.update_tracker(tracker_options)
|
172
|
+
|
173
|
+
###### Get Calls
|
174
|
+
Sorting: customer_name, customer_phone_number, duration, start_time, source
|
175
|
+
Filtering: date_range, answer_status, device, direction, lead_status
|
176
|
+
Searching: caller_name, note, source, dialed_number, caller_number, outgoing_number
|
177
|
+
|
178
|
+
```
|
179
|
+
call_options = {}
|
180
|
+
testcon.get_calls(call_options)
|
181
|
+
```
|
182
|
+
|
183
|
+
###### Get a specific call
|
184
|
+
```
|
185
|
+
call_options = {call_id: <call_id>}
|
186
|
+
testcon.get_calls(call_options)
|
187
|
+
```
|
188
|
+
|
189
|
+
###### Update a specific call
|
190
|
+
```
|
191
|
+
call_options = {call_id: <call_id>}
|
192
|
+
call_options[:note] = "Test"
|
193
|
+
testcon.update_call(call_options)
|
194
|
+
```
|
195
|
+
###### Get Calls summary
|
196
|
+
Summary Grouping: source, keywords, campaign, referrer, landing_page, or company
|
197
|
+
Summary Fields: total_calls, missed_calls, answered_calls, first_time_callers, average_duration, formatted_average_duration, leads. Defaults to total_calls
|
198
|
+
```
|
199
|
+
summary_options = {group_by: "campaign"}
|
200
|
+
testcon.get_calls_summary(summary_options)
|
201
|
+
```
|
202
|
+
|
203
|
+
For a time series (grouped by date), set summary_options[:time_series] = true
|
204
|
+
|
205
|
+
|
206
|
+
###### Getting Call recording URL
|
207
|
+
```
|
208
|
+
call_options = {}
|
209
|
+
call_options[:call_id] = >call_id>
|
210
|
+
puts testcon.get_call_recording(call_options)
|
211
|
+
```
|
212
|
+
|
213
|
+
###### Getting Integrations for a company
|
214
|
+
```
|
215
|
+
int_opts = {}
|
216
|
+
int_opts[:company_id] = <company_id>
|
217
|
+
testcon.get_integrations(int_opts)
|
218
|
+
```
|
219
|
+
|
220
|
+
###### Getting a specific Integrations
|
221
|
+
```
|
222
|
+
int_opts = {}
|
223
|
+
int_opts[:integration_id] = <integration_id>
|
224
|
+
testcon.get_integrations(int_opts)
|
225
|
+
```
|
226
|
+
###### Creating a Webhook Integration
|
227
|
+
```
|
228
|
+
int_opts = {}
|
229
|
+
int_opts[:company_id] = <company_id>
|
230
|
+
int_opts[:type] = "Webhooks"
|
231
|
+
int_opts[:config] = {:post_call_webhook => ["https://requestb.in"]}
|
232
|
+
testcon.create_integration(int_opts)
|
233
|
+
```
|
234
|
+
|
235
|
+
###### Updating a Webhook Integration
|
236
|
+
```
|
237
|
+
int_opts = {}
|
238
|
+
int_opts[:integration_id] = <integration_id>
|
239
|
+
int_opts[:state] = 'active'
|
240
|
+
int_opts[:config] = {:post_call_webhook => ["https://requestb.in?test=12345"]}
|
241
|
+
testcon.update_integration(int_opts)
|
242
|
+
```
|
243
|
+
|
244
|
+
###### Disabling an Integration
|
245
|
+
```
|
246
|
+
int_opts = {}
|
247
|
+
int_opts[:integration_id] = <integration_id>
|
248
|
+
testcon.disable_integration(int_opts)
|
249
|
+
```
|
250
|
+
|
251
|
+
|
252
|
+
## Development
|
253
|
+
|
254
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
255
|
+
|
256
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
257
|
+
|
258
|
+
## Contributing
|
259
|
+
|
260
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mhoskiso/callrail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
261
|
+
|
262
|
+
## License
|
263
|
+
|
264
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
265
|
+
|
266
|
+
## Code of Conduct
|
267
|
+
|
268
|
+
Everyone interacting in the Callrail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/callrail/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "callrail"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "callrail"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|