callrail 0.1.0 → 0.2.0
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 +4 -4
- data/.gitignore +2 -1
- data/README.md +134 -1
- data/lib/callrail.rb +4 -4
- data/lib/callrail/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9cd2fba229327d4939c9bd9f2589ea5726d723
|
4
|
+
data.tar.gz: 27e3c89b69a800d909ce2599ea46560426c8f6c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1b76a79bf2c890de8ef7d2a83ac89835b10af5147170fe78b39a576c02666897a889d1150a86ea81416e6de214494e844e7205e78c31f87923bea2e140a7adf
|
7
|
+
data.tar.gz: a7e93903741442bbf01cd0ee18cf64106ea84db7925dc45ab67f389ad3650b10076afa58474f55e0fdf21b239ba0b1de0661d4fe812ec966b15a4e02e3960434
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,140 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
* *Examples of what is currently enabled
|
26
|
+
|
27
|
+
###### Setting Connection
|
28
|
+
```ruby
|
29
|
+
opts = {}
|
30
|
+
opts[:key] = "<Your Callrail API Key>"
|
31
|
+
opts[:account_id] = <your_account_id>
|
32
|
+
```
|
33
|
+
* * Account ID is optional for the initial connection. You can set the account id later if you need to retrieve it first.
|
34
|
+
|
35
|
+
``` testcon = Callrail::Api.new(:key => opts[:key]) ```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
###### Get Accounts
|
40
|
+
``` testcon.get_accounts ```
|
41
|
+
|
42
|
+
|
43
|
+
###### Set Specific Account
|
44
|
+
|
45
|
+
```
|
46
|
+
opts[:account_id] = <your_account_id>
|
47
|
+
testcon.set_account_id(:account_id => opts[:account_id])
|
48
|
+
```
|
49
|
+
** Account ID must be set for everything but Get Accounts
|
50
|
+
|
51
|
+
###### Get Companies
|
52
|
+
|
53
|
+
```testcon.get_companies() ```
|
54
|
+
|
55
|
+
###### Get a specific Company
|
56
|
+
``` opts[:company_id] = <company_id> ```
|
57
|
+
``` testcon.get_companies(:company_id => opts[:company_id]) ```
|
58
|
+
|
59
|
+
###### Create a Company
|
60
|
+
```
|
61
|
+
opts = {}
|
62
|
+
opts[:name] = "XXX - Test Company 1"
|
63
|
+
opts[:time_zone] = "America/Los_Angeles" #
|
64
|
+
testcon.create_company(:name => opts[:name])
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
###### Update a Company
|
69
|
+
```
|
70
|
+
opts = {}
|
71
|
+
opts[:name] = "XXX - Test Company 2"
|
72
|
+
opts[:company_id] = <company_id>
|
73
|
+
# opts[:time_zone] = "America/Phoenix"
|
74
|
+
# opts[:callscore_enabled] = false
|
75
|
+
# opts[:keyword_spotting_enabled] = false
|
76
|
+
# opts[:callscribe_enabled] = false
|
77
|
+
# opts[:swap_exclude_jquery] = true
|
78
|
+
# opts[:swap_ppc_override] = false
|
79
|
+
# opts[:swap_landing_override] = nil
|
80
|
+
# opts[:swap_cookie_duration] = 90
|
81
|
+
testcon.update_company(:company_id => opts[:company_id], :time_zone => opts[:time_zone] )
|
82
|
+
```
|
83
|
+
|
84
|
+
###### Disable a Company
|
85
|
+
```
|
86
|
+
opts = {}
|
87
|
+
opts[:company_id] = <company_id>
|
88
|
+
testcon.disable_company(:company_id => opts[:company_id] = <company_id>)
|
89
|
+
```
|
90
|
+
###### Get Users
|
91
|
+
``` testcon.get_users ```
|
92
|
+
|
93
|
+
###### Get Specific User
|
94
|
+
```
|
95
|
+
opts[:user_id] = <user_id>
|
96
|
+
testcon.get_users(:user_id => opts[:user_id] )
|
97
|
+
```
|
98
|
+
|
99
|
+
###### Create User
|
100
|
+
```
|
101
|
+
user_opts ={}
|
102
|
+
user_opts[:first_name] = "User"
|
103
|
+
user_opts[:last_name] = "Test"
|
104
|
+
user_opts[:email] = "test@test.com"
|
105
|
+
user_opts[:role] = "reporting"
|
106
|
+
user_opts[:password] = '<password>'
|
107
|
+
user_opts[:companies] = [<company_id>, <company_id2>, <company_id3>]
|
108
|
+
testcon.create_user(user_opts)
|
109
|
+
```
|
110
|
+
|
111
|
+
###### Update a user
|
112
|
+
```
|
113
|
+
user_opts[:user_id] = <user_id>
|
114
|
+
user_opts[:last_name] = "Test2"
|
115
|
+
testcon.update_user(user_opts)
|
116
|
+
```
|
117
|
+
|
118
|
+
###### Get Trackers
|
119
|
+
```
|
120
|
+
tracker_options = {}
|
121
|
+
testcon.get_trackers(tracker_options)
|
122
|
+
```
|
123
|
+
|
124
|
+
###### Get Trackers for a Company
|
125
|
+
```
|
126
|
+
tracker_options[:company_id] = <company_id>
|
127
|
+
testcon.get_trackers(tracker_options)
|
128
|
+
```
|
129
|
+
|
130
|
+
###### Get a specific tracker
|
131
|
+
```
|
132
|
+
tracker_options = {}
|
133
|
+
tracker_options[:tracker_id] = <tracker_id>
|
134
|
+
testcon.get_trackers(tracker_options)
|
135
|
+
```
|
136
|
+
|
137
|
+
###### Tracker Filtering
|
138
|
+
```
|
139
|
+
tracker_options = {}
|
140
|
+
tracker_options[:filtering] = [{:field => "type", :value => "source"},{:field => "status", :value => "active"}]
|
141
|
+
puts "Filters: 1. #{tracker_options[:filtering][0][:field]} = #{tracker_options[:filtering][0][:value]} 2. #{tracker_options[:filtering][1][:field]} = #{tracker_options[:filtering][1][:value]} "
|
142
|
+
testcon.get_trackers(tracker_options)
|
143
|
+
```
|
144
|
+
|
145
|
+
###### Create a Source Tracker
|
146
|
+
```
|
147
|
+
tracker_options = {}
|
148
|
+
tracker_options[:name] = "Test Source tracker"
|
149
|
+
tracker_options[:type] = "source"
|
150
|
+
tracker_options[:company_id] = <company_id>
|
151
|
+
tracker_options[:call_flow] = {:type => "basic", :recording_enabled => true, :destination_number => "+15555555555", :greeting_text => nil, :greeting_recording_url => nil}
|
152
|
+
tracker_options[:tracking_number] = {:area_code => "555", :local => "+15555555555"}
|
153
|
+
tracker_options[:source] = {:type => "all"}
|
154
|
+
tracker_options[:sms_enabled] = true
|
155
|
+
tracker_options[:whisper_message] = "This is a test number call"
|
156
|
+
testcon.create_tracker(tracker_options)
|
157
|
+
```
|
158
|
+
|
26
159
|
|
27
160
|
## Development
|
28
161
|
|
data/lib/callrail.rb
CHANGED
@@ -20,7 +20,7 @@ module Callrail
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_json(response)
|
23
|
-
body = JSON.parse(response.to_str) if response.code == 200
|
23
|
+
body = JSON.parse(response.to_str) if response.code == 200 || response.code == 201
|
24
24
|
OpenStruct.new(code: response.code, body: body)
|
25
25
|
end
|
26
26
|
|
@@ -144,7 +144,7 @@ module Callrail
|
|
144
144
|
params = set_params(opts)
|
145
145
|
path = "/" + @account_id + "/companies.json"
|
146
146
|
response = parse_json(RestClient.post(@url+path, params ,:Authorization => @auth))
|
147
|
-
return response
|
147
|
+
return response
|
148
148
|
end
|
149
149
|
|
150
150
|
def update_company(opts = {})
|
@@ -170,7 +170,7 @@ module Callrail
|
|
170
170
|
params = set_params(opts)
|
171
171
|
path = "/" + @account_id + "/users.json"
|
172
172
|
response = parse_json(RestClient.post(@url+path, params ,:Authorization => @auth))
|
173
|
-
return response
|
173
|
+
return response
|
174
174
|
end
|
175
175
|
|
176
176
|
def update_user(opts = {})
|
@@ -190,7 +190,7 @@ module Callrail
|
|
190
190
|
opts[:path] = "/" + @account_id + "/trackers.json"
|
191
191
|
params = set_params(opts)
|
192
192
|
response = parse_json(RestClient.post(@url+opts[:path], params ,:Authorization => @auth))
|
193
|
-
return response
|
193
|
+
return response
|
194
194
|
end
|
195
195
|
|
196
196
|
def update_tracker(opts={})
|
data/lib/callrail/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hoskison
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|