callrail 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c9cd2fba229327d4939c9bd9f2589ea5726d723
4
- data.tar.gz: 27e3c89b69a800d909ce2599ea46560426c8f6c2
3
+ metadata.gz: 32be84e443677aff60e60bb350c56f70ef2de42d
4
+ data.tar.gz: bd8e1ee25df3c9fb056966f267acf3dc1e354f9b
5
5
  SHA512:
6
- metadata.gz: d1b76a79bf2c890de8ef7d2a83ac89835b10af5147170fe78b39a576c02666897a889d1150a86ea81416e6de214494e844e7205e78c31f87923bea2e140a7adf
7
- data.tar.gz: a7e93903741442bbf01cd0ee18cf64106ea84db7925dc45ab67f389ad3650b10076afa58474f55e0fdf21b239ba0b1de0661d4fe812ec966b15a4e02e3960434
6
+ metadata.gz: e98b518e973b0e1cb095c2c5ca4e0623fa1ccaa7087352efe97831bb550432b58e8137f539cef4552fc7ecb86cfa7f45323087329859b9e9ac79240eef493b3a
7
+ data.tar.gz: 94e67d4af52dd4e1dc15ca96f8a519ab6562afbb16c474c772c34ea893d0ca13503b92716223e1560f2520eef659f6eece0fbfd29039f9b20cf3d732cec3a09f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- callrail (0.1.0)
4
+ callrail (0.2.0)
5
5
  json (~> 2.1.0)
6
6
  rest-client (~> 2.0.2)
7
7
 
data/README.md CHANGED
@@ -85,7 +85,7 @@ testcon.update_company(:company_id => opts[:company_id], :time_zone => opts[:tim
85
85
  ```
86
86
  opts = {}
87
87
  opts[:company_id] = <company_id>
88
- testcon.disable_company(:company_id => opts[:company_id] = <company_id>)
88
+ testcon.disable_company(opts)
89
89
  ```
90
90
  ###### Get Users
91
91
  ``` testcon.get_users ```
@@ -156,6 +156,44 @@ tracker_options[:whisper_message] = "This is a test number call"
156
156
  testcon.create_tracker(tracker_options)
157
157
  ```
158
158
 
159
+ ###### Getting Integrations for a company
160
+ ```
161
+ int_opts = {}
162
+ int_opts[:company_id] = <company_id>
163
+ testcon.get_integrations(int_opts)
164
+ ```
165
+
166
+ ###### Getting a specific Integrations
167
+ ```
168
+ int_opts = {}
169
+ int_opts[:integration_id] = <integration_id>
170
+ testcon.get_integrations(int_opts)
171
+ ```
172
+ ###### Creating a Webhook Integration
173
+ ```
174
+ int_opts = {}
175
+ int_opts[:company_id] = <company_id>
176
+ int_opts[:type] = "Webhooks"
177
+ int_opts[:config] = {:post_call_webhook => ["https://requestb.in"]}
178
+ testcon.create_integration(int_opts)
179
+ ```
180
+
181
+ ###### Updating a Webhook Integration
182
+ ```
183
+ int_opts = {}
184
+ int_opts[:integration_id] = <integration_id>
185
+ int_opts[:state] = 'active'
186
+ int_opts[:config] = {:post_call_webhook => ["https://requestb.in?test=12345"]}
187
+ testcon.update_integration(int_opts)
188
+ ```
189
+
190
+ ###### Disabling an Integration
191
+ ```
192
+ int_opts = {}
193
+ int_opts[:integration_id] = <integration_id>
194
+ testcon.disable_integration(int_opts)
195
+ ```
196
+
159
197
 
160
198
  ## Development
161
199
 
data/lib/callrail.rb CHANGED
@@ -42,8 +42,6 @@ module Callrail
42
42
  params[:page] = opts[:page] || 1
43
43
  params[:per_page] = opts[:per_page] || MAX_PAGE_SIZE
44
44
  params[:path] = opts[:path] if opts[:path]
45
- params[:total_records] = get_total_records(params) if opts[:path]
46
- params[:total_pages] = get_total_pages(params) if opts[:path]
47
45
  #Filters
48
46
  if opts[:filtering]
49
47
  opts[:filtering].each do |filter|
@@ -90,6 +88,9 @@ module Callrail
90
88
  params[:whisper_message] = opts[:whisper_message] if opts[:whisper_message]
91
89
  params[:sms_enabled] = opts[:sms_enabled] if opts[:sms_enabled]
92
90
  params[:tracking_number] = opts[:tracking_number] if opts[:tracking_number]
91
+ #Integration Params
92
+ params[:config] = opts[:config] if opts[:config]
93
+ params[:state] = opts[:state] if opts[:state]
93
94
 
94
95
  #Call Params
95
96
  # Sorting: customer_name, customer_phone_number, duration, start_time, source
@@ -98,6 +99,9 @@ module Callrail
98
99
  #Text Message Params
99
100
  # Filtering: date_range
100
101
  # Searching: customer_phone_number, customer_name
102
+ #pagination
103
+ params[:total_records] = get_total_records(params) if opts[:path]
104
+ params[:total_pages] = get_total_pages(params) if opts[:path]
101
105
 
102
106
  return params
103
107
  end
@@ -149,7 +153,7 @@ module Callrail
149
153
 
150
154
  def update_company(opts = {})
151
155
  params = set_params(opts)
152
- path = "/" + @account_id + "/companies/" + opts[:company_id].to_s
156
+ path = "/" + @account_id + "/companies/" + opts[:company_id].to_s + ".json"
153
157
  response = parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
154
158
  end
155
159
 
@@ -203,6 +207,32 @@ module Callrail
203
207
  path = "/" + @account_id + "/trackers/" + opts[:tracker_id] + ".json"
204
208
  response = parse_json(RestClient.delete(@url+path, :Authorization => @auth))
205
209
  end
210
+
211
+ # Integrations
212
+ def get_integrations(opts ={})
213
+ opts[:path] = (opts[:integration_id]) ? "/" + @account_id + "/integrations/" + opts[:integration_id].to_s + ".json" : "/" + @account_id + "/integrations.json"
214
+ opts[:data] = "integrations" unless opts[:integration_id]
215
+ results = get_responses(opts)
216
+ return results
217
+ end
218
+
219
+ def create_integration(opts ={})
220
+ opts[:path] = "/" + @account_id + "/integrations.json"
221
+ params = set_params(opts)
222
+ response = parse_json(RestClient.post(@url+opts[:path], params ,:Authorization => @auth))
223
+ return response
224
+ end
225
+
226
+ def update_integration(opts = {})
227
+ params = set_params(opts)
228
+ path = "/" + @account_id + "/integrations/" + opts[:integration_id].to_s + ".json"
229
+ response = parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
230
+ end
231
+
232
+ def disable_integration(opts={})
233
+ path = "/" + @account_id + "/integrations/" + opts[:integration_id].to_s + ".json"
234
+ response = parse_json(RestClient.delete(@url+path, :Authorization => @auth))
235
+ end
206
236
 
207
237
  end
208
238
  end
@@ -1,3 +1,3 @@
1
1
  module Callrail
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoskison