callrail 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +53 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/callrail.gemspec +39 -0
- data/lib/callrail.rb +208 -0
- data/lib/callrail/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd73d225bdbb90aa0d860e9d9ba37f941e64c462
|
4
|
+
data.tar.gz: 839626a6a127edd4fefc5120aab59d712cd9dd83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7ffeeb5932ddf2bbd4ba02481a09296d65370e00f5a9c922f09412821fa2052564e67016d360bfcfb6925fe4d0ef9ce0b05b467c2e1105418524519ab8aaeaf
|
7
|
+
data.tar.gz: 63b7abc2bac27d3ab965455e53aee3c17e449c3e91fd24a707a654ec0da335e8941ea75d8d0d2093f2e8bf6fd801b3177693b8b5b698b4c9d905901cba61fbb0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mhoskison@etnainteractive.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
callrail (0.1.0)
|
5
|
+
json (~> 2.1.0)
|
6
|
+
rest-client (~> 2.0.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.3)
|
12
|
+
domain_name (0.5.20170404)
|
13
|
+
unf (>= 0.0.5, < 1.0.0)
|
14
|
+
http-cookie (1.0.3)
|
15
|
+
domain_name (~> 0.5)
|
16
|
+
json (2.1.0)
|
17
|
+
mime-types (3.1)
|
18
|
+
mime-types-data (~> 3.2015)
|
19
|
+
mime-types-data (3.2016.0521)
|
20
|
+
netrc (0.11.0)
|
21
|
+
rake (10.5.0)
|
22
|
+
rest-client (2.0.2)
|
23
|
+
http-cookie (>= 1.0.2, < 2.0)
|
24
|
+
mime-types (>= 1.16, < 4.0)
|
25
|
+
netrc (~> 0.8)
|
26
|
+
rspec (3.7.0)
|
27
|
+
rspec-core (~> 3.7.0)
|
28
|
+
rspec-expectations (~> 3.7.0)
|
29
|
+
rspec-mocks (~> 3.7.0)
|
30
|
+
rspec-core (3.7.0)
|
31
|
+
rspec-support (~> 3.7.0)
|
32
|
+
rspec-expectations (3.7.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.7.0)
|
35
|
+
rspec-mocks (3.7.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-support (3.7.0)
|
39
|
+
unf (0.1.4)
|
40
|
+
unf_ext
|
41
|
+
unf_ext (0.0.7.4)
|
42
|
+
|
43
|
+
PLATFORMS
|
44
|
+
ruby
|
45
|
+
|
46
|
+
DEPENDENCIES
|
47
|
+
bundler (~> 1.16)
|
48
|
+
callrail!
|
49
|
+
rake (~> 10.0)
|
50
|
+
rspec (~> 3.0)
|
51
|
+
|
52
|
+
BUNDLED WITH
|
53
|
+
1.16.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Michael Hoskison
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
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
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
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.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
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
ADDED
data/bin/console
ADDED
@@ -0,0 +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__)
|
data/bin/setup
ADDED
data/callrail.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "callrail/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "callrail"
|
8
|
+
spec.version = Callrail::VERSION
|
9
|
+
spec.authors = ["Michael Hoskison"]
|
10
|
+
spec.email = ["mhoskison@etnainteractive.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Used to access the CallRail api}
|
13
|
+
spec.description = %q{CallRail API}
|
14
|
+
spec.homepage = "https://github.com/mhoskiso/callrail.git"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
|
37
|
+
spec.add_dependency "rest-client", "~> 2.0.2"
|
38
|
+
spec.add_dependency "json", "~> 2.1.0"
|
39
|
+
end
|
data/lib/callrail.rb
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require "callrail/version"
|
3
|
+
require 'json'
|
4
|
+
require 'ostruct'
|
5
|
+
require 'rest-client'
|
6
|
+
|
7
|
+
module Callrail
|
8
|
+
class Api
|
9
|
+
|
10
|
+
MAX_PAGE_SIZE = '250'
|
11
|
+
|
12
|
+
def initialize(opts = {})
|
13
|
+
@url = 'https://api.callrail.com/v2/a'
|
14
|
+
@auth = "Token token=" + opts[:key]
|
15
|
+
@account_id = opts[:account_id].to_s if opts[:account_id]
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_account_id(opts = {})
|
19
|
+
@account_id = opts[:account_id].to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_json(response)
|
23
|
+
body = JSON.parse(response.to_str) if response.code == 200
|
24
|
+
OpenStruct.new(code: response.code, body: body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_params(opts = {})
|
28
|
+
params = {}
|
29
|
+
#Result params
|
30
|
+
params[:date_range] = opts[:date_range] if opts[:date_range]
|
31
|
+
# Values: recent, today, yesterday, last_7_days, last_30_days, this_month, last_month, all_time
|
32
|
+
params[:start_date] = opts[:start_date] if opts[:start_date]
|
33
|
+
# 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
|
34
|
+
params[:end_date] = opts[:end_date] if opts[:end_date]
|
35
|
+
# ex: “2015-10-05” for all calls before and including October 9, 2015 - “2015-09-05T10:00” for all calls before 10 AM September 5, 2015
|
36
|
+
params[:sort] = opts[:sort] if opts[:sort]
|
37
|
+
# ex: /users.json?sort=email Will return a list of user objects for the target account, sorted by email address in alphabetical order.
|
38
|
+
params[:search] = opts[:search] if opts[:search]
|
39
|
+
# ex: users.json?search=belcher Will return a list of user objects in the target account that match the name given.
|
40
|
+
params[:fields] = opts[:fields] if opts[:fields]
|
41
|
+
# ex: calls/444941612.json?fields=company_id,company_name Will return the additional user requested fields for the target call.
|
42
|
+
params[:page] = opts[:page] || 1
|
43
|
+
params[:per_page] = opts[:per_page] || MAX_PAGE_SIZE
|
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
|
+
#Filters
|
48
|
+
if opts[:filtering]
|
49
|
+
opts[:filtering].each do |filter|
|
50
|
+
params[filter[:field].to_sym] = filter[:value]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
#Shared Params
|
54
|
+
params[:name] = opts[:name] if opts[:name]
|
55
|
+
#Account Params
|
56
|
+
# Sorting: id, name
|
57
|
+
#Company Params
|
58
|
+
# Sorting: id, name
|
59
|
+
# Filtering: status
|
60
|
+
# Searching: name
|
61
|
+
params[:callscore_enabled] = opts[:callscore_enabled] if opts[:callscore_enabled]
|
62
|
+
params[:keyword_spotting_enabled] = opts[:keyword_spotting_enabled] if opts[:keyword_spotting_enabled]
|
63
|
+
params[:callscribe_enabled] = opts[:callscribe_enabled] if opts[:callscribe_enabled]
|
64
|
+
params[:time_zone] = opts[:time_zone] if opts[:time_zone]
|
65
|
+
# USA Values: America/New_York (Eastern Time Zone), America/Indiana/Indianapolis (Indiana Time Zone), America/Chicago (Central Time Zone),
|
66
|
+
# America/Denver (Mountain Time Zone), America/Phoenix (Arizona Time Zone), America/Los_Angeles (Pacific Time Zone)
|
67
|
+
# Full List: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
68
|
+
params[:swap_exclude_jquery] = opts[:swap_exclude_jquery] if opts[:swap_exclude_jquery]
|
69
|
+
params[:swap_ppc_override] = opts[:swap_ppc_override] if opts[:swap_ppc_override]
|
70
|
+
params[:swap_landing_override] = opts[:swap_landing_override] if opts[:swap_landing_override]
|
71
|
+
params[:swap_cookie_duration] = opts[:swap_cookie_duration] if opts[:swap_cookie_duration]
|
72
|
+
#User Params
|
73
|
+
# Sorting: id, email, created_at
|
74
|
+
# Searching: first_name, last_name, email
|
75
|
+
params[:first_name] = opts[:first_name] if opts[:first_name]
|
76
|
+
params[:last_name] = opts[:last_name] if opts[:last_name]
|
77
|
+
params[:email] = opts[:email] if opts[:email]
|
78
|
+
params[:role] = opts[:role] if opts[:role]
|
79
|
+
params[:password] = opts[:password] if opts[:password]
|
80
|
+
params[:companies] = opts[:companies] if opts[:companies]
|
81
|
+
#Tracker Params
|
82
|
+
# Filtering: type, status
|
83
|
+
params[:type] = opts[:type] if opts[:type]
|
84
|
+
params[:company_id] = opts[:company_id] if opts[:company_id]
|
85
|
+
params[:call_flow] = opts[:call_flow] if opts[:call_flow]
|
86
|
+
params[:pool_size] = opts[:pool_size] if opts[:pool_size]
|
87
|
+
params[:pool_numbers] = opts[:pool_numbers] if opts[:pool_numbers]
|
88
|
+
params[:source] = opts[:source] if opts[:source]
|
89
|
+
params[:swap_targets] = opts[:swap_targets] if opts[:swap_targets]
|
90
|
+
params[:whisper_message] = opts[:whisper_message] if opts[:whisper_message]
|
91
|
+
params[:sms_enabled] = opts[:sms_enabled] if opts[:sms_enabled]
|
92
|
+
params[:tracking_number] = opts[:tracking_number] if opts[:tracking_number]
|
93
|
+
|
94
|
+
#Call Params
|
95
|
+
# Sorting: customer_name, customer_phone_number, duration, start_time, source
|
96
|
+
# Filtering: date_range, answer_status, device, direction, lead_status
|
97
|
+
# Searching: caller_name, note, source, dialed_number, caller_number, outgoing_number
|
98
|
+
#Text Message Params
|
99
|
+
# Filtering: date_range
|
100
|
+
# Searching: customer_phone_number, customer_name
|
101
|
+
|
102
|
+
return params
|
103
|
+
end
|
104
|
+
|
105
|
+
def get_total_records(params)
|
106
|
+
total_records = parse_json(RestClient.get(@url+params[:path], params: params, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth)).body['total_records'] || 1
|
107
|
+
return total_records
|
108
|
+
end
|
109
|
+
|
110
|
+
def get_total_pages(params)
|
111
|
+
total_pages = parse_json(RestClient.get(@url+params[:path], params: params, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth)).body['total_pages'] || 1
|
112
|
+
return total_pages
|
113
|
+
end
|
114
|
+
|
115
|
+
def get_responses(opts = {})
|
116
|
+
responses = []
|
117
|
+
params = set_params(opts)
|
118
|
+
while params[:total_pages] > 0
|
119
|
+
response = parse_json(RestClient.get(@url+params[:path], params: params,:Authorization => @auth)).body
|
120
|
+
response = (opts[:data]) ? response[opts[:data]] : response
|
121
|
+
responses.push(response)
|
122
|
+
params[:page] += 1 unless opts[:page]
|
123
|
+
params[:total_pages] -= 1
|
124
|
+
end
|
125
|
+
return responses
|
126
|
+
end
|
127
|
+
# Account Calls
|
128
|
+
def get_accounts(opts = {})
|
129
|
+
opts[:path] = (opts[:account_id]) ? "/" + opts[:account_id].to_s + ".json" : ".json"
|
130
|
+
opts[:data] = "accounts" unless opts[:account_id]
|
131
|
+
results = get_responses(opts)
|
132
|
+
return results
|
133
|
+
end
|
134
|
+
|
135
|
+
# Company Calls
|
136
|
+
def get_companies(opts = {})
|
137
|
+
opts[:path] = (opts[:company_id]) ? "/" + @account_id + "/companies/" + opts[:company_id].to_s + ".json" : "/" + @account_id + "/companies.json"
|
138
|
+
opts[:data] = "companies" unless opts[:company_id]
|
139
|
+
results = get_responses(opts)
|
140
|
+
return results
|
141
|
+
end
|
142
|
+
|
143
|
+
def create_company(opts = {}) # http://apidocs.callrail.com/#time-zones
|
144
|
+
params = set_params(opts)
|
145
|
+
path = "/" + @account_id + "/companies.json"
|
146
|
+
response = parse_json(RestClient.post(@url+path, params ,:Authorization => @auth))
|
147
|
+
return response.code
|
148
|
+
end
|
149
|
+
|
150
|
+
def update_company(opts = {})
|
151
|
+
params = set_params(opts)
|
152
|
+
path = "/" + @account_id + "/companies/" + opts[:company_id].to_s
|
153
|
+
response = parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
|
154
|
+
end
|
155
|
+
|
156
|
+
def disable_company( opts = {})
|
157
|
+
path = "/" + @account_id + "/companies/" + opts[:company_id].to_s
|
158
|
+
response = parse_json(RestClient.delete(@url+path, :Authorization => @auth))
|
159
|
+
end
|
160
|
+
|
161
|
+
# User Calls
|
162
|
+
def get_users( opts={} )
|
163
|
+
opts[:path] = (opts[:user_id]) ? "/" + @account_id + "/users/" + opts[:user_id].to_s + ".json" : "/" + @account_id + "/users.json"
|
164
|
+
opts[:data] = "users" unless opts[:user_id]
|
165
|
+
results = get_responses(opts)
|
166
|
+
return results
|
167
|
+
end
|
168
|
+
|
169
|
+
def create_user( opts = {})
|
170
|
+
params = set_params(opts)
|
171
|
+
path = "/" + @account_id + "/users.json"
|
172
|
+
response = parse_json(RestClient.post(@url+path, params ,:Authorization => @auth))
|
173
|
+
return response.code
|
174
|
+
end
|
175
|
+
|
176
|
+
def update_user(opts = {})
|
177
|
+
params = set_params(opts)
|
178
|
+
path = "/" + @account_id + "/users/" + opts[:user_id].to_s + ".json"
|
179
|
+
response = parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
|
180
|
+
end
|
181
|
+
|
182
|
+
# Tracker Calls
|
183
|
+
def get_trackers(opts={})
|
184
|
+
opts[:path] = (opts[:tracker_id]) ? "/" + @account_id + "/trackers/" + opts[:tracker_id].to_s + ".json" : "/" + @account_id + "/trackers.json"
|
185
|
+
opts[:data] = "trackers" unless opts[:tracker_id]
|
186
|
+
results = get_responses(opts)
|
187
|
+
end
|
188
|
+
|
189
|
+
def create_tracker(opts={})
|
190
|
+
opts[:path] = "/" + @account_id + "/trackers.json"
|
191
|
+
params = set_params(opts)
|
192
|
+
response = parse_json(RestClient.post(@url+opts[:path], params ,:Authorization => @auth))
|
193
|
+
return response.code
|
194
|
+
end
|
195
|
+
|
196
|
+
def update_tracker(opts={})
|
197
|
+
opts[:path] = "/" + @account_id + "/trackers/" + opts[:tracker_id] + ".json"
|
198
|
+
params = set_params(opts)
|
199
|
+
response = parse_json(RestClient.put(@url+path, params, :Authorization => @auth))
|
200
|
+
end
|
201
|
+
|
202
|
+
def disable_tracker(opts={})
|
203
|
+
path = "/" + @account_id + "/trackers/" + opts[:tracker_id] + ".json"
|
204
|
+
response = parse_json(RestClient.delete(@url+path, :Authorization => @auth))
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: callrail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Hoskison
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.0
|
83
|
+
description: CallRail API
|
84
|
+
email:
|
85
|
+
- mhoskison@etnainteractive.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- callrail.gemspec
|
102
|
+
- lib/callrail.rb
|
103
|
+
- lib/callrail/version.rb
|
104
|
+
homepage: https://github.com/mhoskiso/callrail.git
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata:
|
108
|
+
allowed_push_host: https://rubygems.org
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.6.8
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Used to access the CallRail api
|
129
|
+
test_files: []
|