callrail 0.2.7 → 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,270 +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
- ```
38
- * * Account ID is optional for the initial connection. You can set the account id later if you need to retrieve it first.
39
-
40
- ``` testcon = Callrail::Api.new(:key => opts[:key]) ```
41
-
42
-
43
-
44
- ###### Get Accounts
45
- ``` testcon.get_accounts ```
46
-
47
-
48
- ###### Set Specific Account
49
-
50
- ```
51
- opts[:account_id] = <your_account_id>
52
- testcon.set_account_id(:account_id => opts[:account_id])
53
- ```
54
- ** Account ID must be set for everything but Get Accounts
55
-
56
- ###### Get Companies
57
-
58
- ```testcon.get_companies() ```
59
-
60
- ###### Get a specific Company
61
- ``` opts[:company_id] = <company_id> ```
62
- ``` testcon.get_companies(:company_id => opts[:company_id]) ```
63
-
64
- ###### Create a Company
65
- ```
66
- opts = {}
67
- opts[:name] = "XXX - Test Company 1"
68
- opts[:time_zone] = "America/Los_Angeles" #
69
- testcon.create_company(:name => opts[:name])
70
- ```
71
-
72
-
73
- ###### Update a Company
74
- ```
75
- opts = {}
76
- opts[:name] = "XXX - Test Company 2"
77
- opts[:company_id] = <company_id>
78
- # opts[:time_zone] = "America/Phoenix"
79
- # opts[:callscore_enabled] = false
80
- # opts[:keyword_spotting_enabled] = false
81
- # opts[:callscribe_enabled] = false
82
- # opts[:swap_exclude_jquery] = true
83
- # opts[:swap_ppc_override] = false
84
- # opts[:swap_landing_override] = nil
85
- # opts[:swap_cookie_duration] = 90
86
- testcon.update_company(:company_id => opts[:company_id], :time_zone => opts[:time_zone] )
87
- ```
88
-
89
- ###### Disable a Company
90
- ```
91
- opts = {}
92
- opts[:company_id] = <company_id>
93
- testcon.disable_company(opts)
94
- ```
95
- ###### Get Users
96
- ``` testcon.get_users ```
97
-
98
- ###### Get Users For a specific company
99
- ```
100
- user_opts = {:company_id => <company_id>}
101
- puts testcon.get_users(user_opts)
102
- ```
103
-
104
- ###### Get Specific User
105
- ```
106
- opts[:user_id] = <user_id>
107
- testcon.get_users(:user_id => opts[:user_id] )
108
- ```
109
-
110
- ###### Create User
111
- ```
112
- user_opts ={}
113
- user_opts[:first_name] = "User"
114
- user_opts[:last_name] = "Test"
115
- user_opts[:email] = "test@test.com"
116
- user_opts[:role] = "reporting"
117
- user_opts[:password] = '<password>'
118
- user_opts[:companies] = [<company_id>, <company_id2>, <company_id3>]
119
- testcon.create_user(user_opts)
120
- ```
121
-
122
- ###### Update a user
123
- ```
124
- user_opts[:user_id] = <user_id>
125
- user_opts[:last_name] = "Test2"
126
- testcon.update_user(user_opts)
127
- ```
128
-
129
- ###### Get Trackers
130
- ```
131
- tracker_options = {}
132
- testcon.get_trackers(tracker_options)
133
- ```
134
-
135
- ###### Get Trackers for a Company
136
- ```
137
- tracker_options[:company_id] = <company_id>
138
- testcon.get_trackers(tracker_options)
139
- ```
140
-
141
- ###### Get a specific tracker
142
- ```
143
- tracker_options = {}
144
- tracker_options[:tracker_id] = <tracker_id>
145
- testcon.get_trackers(tracker_options)
146
- ```
147
-
148
- ###### Tracker Filtering
149
- ```
150
- tracker_options = {}
151
- tracker_options[:filtering] = [{:field => "type", :value => "source"},{:field => "status", :value => "active"}]
152
- puts "Filters: 1. #{tracker_options[:filtering][0][:field]} = #{tracker_options[:filtering][0][:value]} 2. #{tracker_options[:filtering][1][:field]} = #{tracker_options[:filtering][1][:value]} "
153
- testcon.get_trackers(tracker_options)
154
- ```
155
-
156
- ###### Create a Source Tracker
157
- ```
158
- tracker_options = {}
159
- tracker_options[:name] = "Test Source tracker"
160
- tracker_options[:type] = "source"
161
- tracker_options[:company_id] = <company_id>
162
- tracker_options[:call_flow] = {:type => "basic", :recording_enabled => true, :destination_number => "+15555555555", :greeting_text => nil, :greeting_recording_url => nil}
163
- tracker_options[:tracking_number] = {:area_code => "555", :local => "+15555555555"}
164
- tracker_options[:source] = {:type => "all"}
165
- tracker_options[:sms_enabled] = true
166
- tracker_options[:whisper_message] = "This is a test number call"
167
- testcon.create_tracker(tracker_options)
168
- ```
169
- ###### Update a Source Tracker
170
- tracker_options = {}
171
- tracker_options[:source] = {:type => "search", :search_engine => "all", :search_type => "paid"}
172
- tracker_options[:tracker_id] = <tracker_id>
173
- puts testcon.update_tracker(tracker_options)
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
-
215
- ###### Getting Integrations for a company
216
- ```
217
- int_opts = {}
218
- int_opts[:company_id] = <company_id>
219
- testcon.get_integrations(int_opts)
220
- ```
221
-
222
- ###### Getting a specific Integrations
223
- ```
224
- int_opts = {}
225
- int_opts[:integration_id] = <integration_id>
226
- testcon.get_integrations(int_opts)
227
- ```
228
- ###### Creating a Webhook Integration
229
- ```
230
- int_opts = {}
231
- int_opts[:company_id] = <company_id>
232
- int_opts[:type] = "Webhooks"
233
- int_opts[:config] = {:post_call_webhook => ["https://requestb.in"]}
234
- testcon.create_integration(int_opts)
235
- ```
236
-
237
- ###### Updating a Webhook Integration
238
- ```
239
- int_opts = {}
240
- int_opts[:integration_id] = <integration_id>
241
- int_opts[:state] = 'active'
242
- int_opts[:config] = {:post_call_webhook => ["https://requestb.in?test=12345"]}
243
- testcon.update_integration(int_opts)
244
- ```
245
-
246
- ###### Disabling an Integration
247
- ```
248
- int_opts = {}
249
- int_opts[:integration_id] = <integration_id>
250
- testcon.disable_integration(int_opts)
251
- ```
252
-
253
-
254
- ## Development
255
-
256
- 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.
257
-
258
- 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).
259
-
260
- ## Contributing
261
-
262
- 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.
263
-
264
- ## License
265
-
266
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
267
-
268
- ## Code of Conduct
269
-
270
- 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