callrail 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,272 +1,268 @@
1
- # Callrail
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/callrail`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'callrail'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install callrail
22
-
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
29
-
30
- * *Examples of what is currently enabled
31
-
32
- ###### Setting Connection
33
- ```ruby
34
- opts = {}
35
- opts[:key] = "<Your Callrail API Key>"
36
- opts[:account_id] = <your_account_id>
37
- opts[:api_version] = "v2"
38
- ```
39
- * * Account ID is optional for the initial connection. You can set the account id later if you need to retrieve it first.
40
- * * API version is optional. v2 will be used by default. v3 is untested, use at your own risk! Callrail IDs are different in v3, keep in mind if changing versions.
41
-
42
- ``` testcon = Callrail::Api.new(:key => opts[:key]) ```
43
-
44
-
45
-
46
- ###### Get Accounts
47
- ``` testcon.get_accounts ```
48
-
49
-
50
- ###### Set Specific Account
51
-
52
- ```
53
- opts[:account_id] = <your_account_id>
54
- testcon.set_account_id(:account_id => opts[:account_id])
55
- ```
56
- ** Account ID must be set for everything but Get Accounts
57
-
58
- ###### Get Companies
59
-
60
- ```testcon.get_companies() ```
61
-
62
- ###### Get a specific Company
63
- ``` opts[:company_id] = <company_id> ```
64
- ``` testcon.get_companies(:company_id => opts[:company_id]) ```
65
-
66
- ###### Create a Company
67
- ```
68
- opts = {}
69
- opts[:name] = "XXX - Test Company 1"
70
- opts[:time_zone] = "America/Los_Angeles" #
71
- testcon.create_company(:name => opts[:name])
72
- ```
73
-
74
-
75
- ###### Update a Company
76
- ```
77
- opts = {}
78
- opts[:name] = "XXX - Test Company 2"
79
- opts[:company_id] = <company_id>
80
- # opts[:time_zone] = "America/Phoenix"
81
- # opts[:callscore_enabled] = false
82
- # opts[:keyword_spotting_enabled] = false
83
- # opts[:callscribe_enabled] = false
84
- # opts[:swap_exclude_jquery] = true
85
- # opts[:swap_ppc_override] = false
86
- # opts[:swap_landing_override] = nil
87
- # opts[:swap_cookie_duration] = 90
88
- testcon.update_company(:company_id => opts[:company_id], :time_zone => opts[:time_zone] )
89
- ```
90
-
91
- ###### Disable a Company
92
- ```
93
- opts = {}
94
- opts[:company_id] = <company_id>
95
- testcon.disable_company(opts)
96
- ```
97
- ###### Get Users
98
- ``` testcon.get_users ```
99
-
100
- ###### Get Users For a specific company
101
- ```
102
- user_opts = {:company_id => <company_id>}
103
- puts testcon.get_users(user_opts)
104
- ```
105
-
106
- ###### Get Specific User
107
- ```
108
- opts[:user_id] = <user_id>
109
- testcon.get_users(:user_id => opts[:user_id] )
110
- ```
111
-
112
- ###### Create User
113
- ```
114
- user_opts ={}
115
- user_opts[:first_name] = "User"
116
- user_opts[:last_name] = "Test"
117
- user_opts[:email] = "test@test.com"
118
- user_opts[:role] = "reporting"
119
- user_opts[:password] = '<password>'
120
- user_opts[:companies] = [<company_id>, <company_id2>, <company_id3>]
121
- testcon.create_user(user_opts)
122
- ```
123
-
124
- ###### Update a user
125
- ```
126
- user_opts[:user_id] = <user_id>
127
- user_opts[:last_name] = "Test2"
128
- testcon.update_user(user_opts)
129
- ```
130
-
131
- ###### Get Trackers
132
- ```
133
- tracker_options = {}
134
- testcon.get_trackers(tracker_options)
135
- ```
136
-
137
- ###### Get Trackers for a Company
138
- ```
139
- tracker_options[:company_id] = <company_id>
140
- testcon.get_trackers(tracker_options)
141
- ```
142
-
143
- ###### Get a specific tracker
144
- ```
145
- tracker_options = {}
146
- tracker_options[:tracker_id] = <tracker_id>
147
- testcon.get_trackers(tracker_options)
148
- ```
149
-
150
- ###### Tracker Filtering
151
- ```
152
- tracker_options = {}
153
- tracker_options[:filtering] = [{:field => "type", :value => "source"},{:field => "status", :value => "active"}]
154
- puts "Filters: 1. #{tracker_options[:filtering][0][:field]} = #{tracker_options[:filtering][0][:value]} 2. #{tracker_options[:filtering][1][:field]} = #{tracker_options[:filtering][1][:value]} "
155
- testcon.get_trackers(tracker_options)
156
- ```
157
-
158
- ###### Create a Source Tracker
159
- ```
160
- tracker_options = {}
161
- tracker_options[:name] = "Test Source tracker"
162
- tracker_options[:type] = "source"
163
- tracker_options[:company_id] = <company_id>
164
- tracker_options[:call_flow] = {:type => "basic", :recording_enabled => true, :destination_number => "+15555555555", :greeting_text => nil, :greeting_recording_url => nil}
165
- tracker_options[:tracking_number] = {:area_code => "555", :local => "+15555555555"}
166
- tracker_options[:source] = {:type => "all"}
167
- tracker_options[:sms_enabled] = true
168
- tracker_options[:whisper_message] = "This is a test number call"
169
- testcon.create_tracker(tracker_options)
170
- ```
171
- ###### Update a Source Tracker
172
- tracker_options = {}
173
- tracker_options[:source] = {:type => "search", :search_engine => "all", :search_type => "paid"}
174
- tracker_options[:tracker_id] = <tracker_id>
175
- puts testcon.update_tracker(tracker_options)
176
-
177
- ###### Get Calls
178
- Sorting: customer_name, customer_phone_number, duration, start_time, source
179
- Filtering: date_range, answer_status, device, direction, lead_status
180
- Searching: caller_name, note, source, dialed_number, caller_number, outgoing_number
181
-
182
- ```
183
- call_options = {}
184
- testcon.get_calls(call_options)
185
- ```
186
-
187
- ###### Get a specific call
188
- ```
189
- call_options = {call_id: <call_id>}
190
- testcon.get_calls(call_options)
191
- ```
192
-
193
- ###### Update a specific call
194
- ```
195
- call_options = {call_id: <call_id>}
196
- call_options[:note] = "Test"
197
- testcon.update_call(call_options)
198
- ```
199
- ###### Get Calls summary
200
- Summary Grouping: source, keywords, campaign, referrer, landing_page, or company
201
- Summary Fields: total_calls, missed_calls, answered_calls, first_time_callers, average_duration, formatted_average_duration, leads. Defaults to total_calls
202
- ```
203
- summary_options = {group_by: "campaign"}
204
- testcon.get_calls_summary(summary_options)
205
- ```
206
-
207
- For a time series (grouped by date), set summary_options[:time_series] = true
208
-
209
-
210
- ###### Getting Call recording URL
211
- ```
212
- call_options = {}
213
- call_options[:call_id] = >call_id>
214
- puts testcon.get_call_recording(call_options)
215
- ```
216
-
217
- ###### Getting Integrations for a company
218
- ```
219
- int_opts = {}
220
- int_opts[:company_id] = <company_id>
221
- testcon.get_integrations(int_opts)
222
- ```
223
-
224
- ###### Getting a specific Integrations
225
- ```
226
- int_opts = {}
227
- int_opts[:integration_id] = <integration_id>
228
- testcon.get_integrations(int_opts)
229
- ```
230
- ###### Creating a Webhook Integration
231
- ```
232
- int_opts = {}
233
- int_opts[:company_id] = <company_id>
234
- int_opts[:type] = "Webhooks"
235
- int_opts[:config] = {:post_call_webhook => ["https://requestb.in"]}
236
- testcon.create_integration(int_opts)
237
- ```
238
-
239
- ###### Updating a Webhook Integration
240
- ```
241
- int_opts = {}
242
- int_opts[:integration_id] = <integration_id>
243
- int_opts[:state] = 'active'
244
- int_opts[:config] = {:post_call_webhook => ["https://requestb.in?test=12345"]}
245
- testcon.update_integration(int_opts)
246
- ```
247
-
248
- ###### Disabling an Integration
249
- ```
250
- int_opts = {}
251
- int_opts[:integration_id] = <integration_id>
252
- testcon.disable_integration(int_opts)
253
- ```
254
-
255
-
256
- ## Development
257
-
258
- 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.
259
-
260
- 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).
261
-
262
- ## Contributing
263
-
264
- 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.
265
-
266
- ## License
267
-
268
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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