callrail 0.1.0 → 0.2.0

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: dd73d225bdbb90aa0d860e9d9ba37f941e64c462
4
- data.tar.gz: 839626a6a127edd4fefc5120aab59d712cd9dd83
3
+ metadata.gz: 5c9cd2fba229327d4939c9bd9f2589ea5726d723
4
+ data.tar.gz: 27e3c89b69a800d909ce2599ea46560426c8f6c2
5
5
  SHA512:
6
- metadata.gz: e7ffeeb5932ddf2bbd4ba02481a09296d65370e00f5a9c922f09412821fa2052564e67016d360bfcfb6925fe4d0ef9ce0b05b467c2e1105418524519ab8aaeaf
7
- data.tar.gz: 63b7abc2bac27d3ab965455e53aee3c17e449c3e91fd24a707a654ec0da335e8941ea75d8d0d2093f2e8bf6fd801b3177693b8b5b698b4c9d905901cba61fbb0
6
+ metadata.gz: d1b76a79bf2c890de8ef7d2a83ac89835b10af5147170fe78b39a576c02666897a889d1150a86ea81416e6de214494e844e7205e78c31f87923bea2e140a7adf
7
+ data.tar.gz: a7e93903741442bbf01cd0ee18cf64106ea84db7925dc45ab67f389ad3650b10076afa58474f55e0fdf21b239ba0b1de0661d4fe812ec966b15a4e02e3960434
data/.gitignore CHANGED
@@ -10,4 +10,5 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
 
13
- test.rb
13
+ test.rb
14
+ *.gem
data/README.md CHANGED
@@ -22,7 +22,140 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
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
 
@@ -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.code
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.code
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.code
193
+ return response
194
194
  end
195
195
 
196
196
  def update_tracker(opts={})
@@ -1,3 +1,3 @@
1
1
  module Callrail
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler