call_action 2.0 → 2.2
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 +20 -0
- data/LICENSE +19 -0
- data/README.md +101 -0
- data/lib/call_action/activity.rb +13 -0
- data/lib/call_action/api.rb +83 -0
- data/lib/call_action/channel.rb +13 -0
- data/lib/call_action/contact.rb +19 -0
- data/lib/call_action/source.rb +13 -0
- data/lib/call_action.rb +16 -0
- data/lib/generators/call_action/install_generator.rb +9 -0
- data/lib/generators/call_action/templates/initializer.rb +4 -0
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee16af4875879cb89a7bf5b3fa8a73555f9c0d38
|
4
|
+
data.tar.gz: 300493398810fce7b24eb912537b5de93108e13b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9320358066876a147a79543867b8d19c0b321f5a5d3d13e5926811ab3432642aa7b033907fd3a585e0dcde7254896c2c282acb5ba4ec6d26878f5b03a61c8ac3
|
7
|
+
data.tar.gz: e851938d8c347dd5fd1a93e9f8c4052f58a4be2eb77650dae98e48d5d70e19e6d377a20d3a42e8f469ff8de54c491aee98cf4c833c28b03abfaebf39322f72b6
|
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) <2017> <Shahzad Tariq>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# CallAction
|
2
|
+
|
3
|
+
CallAction is a mobile web application to automate the tracking and engagement of inbound calls across all marketing channels.
|
4
|
+
|
5
|
+
This gem is ruby wrapper for [CallAction](https://callaction.co/) API. It is open source and developed independently to help rails developers CallAction api integration.
|
6
|
+
|
7
|
+
- Track Every Inbound Call
|
8
|
+
- Build Your Lead Database
|
9
|
+
- Answer Every Call
|
10
|
+
|
11
|
+
### Installation
|
12
|
+
|
13
|
+
Add call_action gem to your Gemfile
|
14
|
+
|
15
|
+
```sh
|
16
|
+
gem 'call_action'
|
17
|
+
```
|
18
|
+
and than execute following command on console
|
19
|
+
|
20
|
+
```sh
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
Generate configuration file using
|
25
|
+
|
26
|
+
```sh
|
27
|
+
rails generate call_action:install
|
28
|
+
```
|
29
|
+
|
30
|
+
It would generate call_action.rb file inside initializers folder of your application. Here you need to specify api version (current version is v1) and your auth token
|
31
|
+
|
32
|
+
### Usage
|
33
|
+
|
34
|
+
Please refer to [Official Documentation](https://callaction.co/documentation/developers/api/v1/index.html) to get list of all available API calls with details.
|
35
|
+
|
36
|
+
After installing gem, You can communicate to call_action using API class
|
37
|
+
|
38
|
+
#### Contacts
|
39
|
+
|
40
|
+
To get list of all contacts, call contacts method on call_action object
|
41
|
+
|
42
|
+
```sh
|
43
|
+
call_action = CallAction::Api.new
|
44
|
+
@contacts = call_action.contacts
|
45
|
+
@contact = @contacts.campaign_name
|
46
|
+
```
|
47
|
+
|
48
|
+
To get contact attribute
|
49
|
+
|
50
|
+
```sh
|
51
|
+
puts @contact.caller_id_name
|
52
|
+
puts @contact.caller_id_c
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
#### Activities
|
57
|
+
|
58
|
+
To get list of all activities by particular contact
|
59
|
+
|
60
|
+
```sh
|
61
|
+
@activities = call_action.activities(@contact.id)
|
62
|
+
```
|
63
|
+
|
64
|
+
Or you can directly access activities using activities method
|
65
|
+
|
66
|
+
```sh
|
67
|
+
@activities = @contact.activities
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Channels
|
71
|
+
|
72
|
+
Get list of all channels using channels method
|
73
|
+
|
74
|
+
```sh
|
75
|
+
call_action = CallAction::Api.new
|
76
|
+
@channels = call_action.channels
|
77
|
+
```
|
78
|
+
|
79
|
+
#### Sources
|
80
|
+
|
81
|
+
Get list of all sources using sources method
|
82
|
+
|
83
|
+
```sh
|
84
|
+
call_action = CallAction::Api.new
|
85
|
+
@sources = call_action.sources
|
86
|
+
```
|
87
|
+
### Contribution
|
88
|
+
|
89
|
+
You can contribute by making pull request and develop some owesome feature to help open source community
|
90
|
+
|
91
|
+
### Todos
|
92
|
+
|
93
|
+
- Multiple accounts
|
94
|
+
- Ability to switch Auth-Token at run time
|
95
|
+
|
96
|
+
License
|
97
|
+
----
|
98
|
+
|
99
|
+
MIT
|
100
|
+
|
101
|
+
**Free Software, Hell Yeah!**
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CallAction
|
2
|
+
class Activity
|
3
|
+
|
4
|
+
def initialize(hash)
|
5
|
+
hash.each do |k,v|
|
6
|
+
self.instance_variable_set("@#{k}", v.is_a?(Hash) ? Hashit.new(v) : v)
|
7
|
+
self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
|
8
|
+
self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "json"
|
3
|
+
require "uri"
|
4
|
+
|
5
|
+
module CallAction
|
6
|
+
|
7
|
+
class Api
|
8
|
+
|
9
|
+
attr_accessor :token, :base_url, :api_version, :headers
|
10
|
+
|
11
|
+
# Initializer
|
12
|
+
def initialize headers = {}
|
13
|
+
@token = CallAction.auth_token
|
14
|
+
@api_version = CallAction.api_version
|
15
|
+
@base_url = "https://callaction.co/api/"
|
16
|
+
@headers = {"Accept" => "application/json", "Content-Type" => "application/json", "X-AUTH-TOKEN" => @token}.merge(headers)
|
17
|
+
end
|
18
|
+
|
19
|
+
# To test installation
|
20
|
+
def self.hi
|
21
|
+
puts "Hello world!"
|
22
|
+
end
|
23
|
+
|
24
|
+
# To get list of all contacts
|
25
|
+
def contacts
|
26
|
+
url = URI.parse("#{@base_url}#{@api_version}/contacts")
|
27
|
+
request = Net::HTTP::Get.new(url.request_uri)
|
28
|
+
|
29
|
+
@headers.each {|k, v| request[k] = v }
|
30
|
+
|
31
|
+
response = Net::HTTP.start(url.hostname, url.port, :use_ssl => url.scheme == 'https') do |http|
|
32
|
+
http.request(request)
|
33
|
+
end
|
34
|
+
|
35
|
+
JSON.parse(response.body)["contacts"].collect {|contact| CallAction::Contact.new contact }
|
36
|
+
end
|
37
|
+
|
38
|
+
# To get list of all activities by particular contact specified by unique UUID
|
39
|
+
def activities contact_id
|
40
|
+
url = URI.parse("#{@base_url}#{@api_version}/contacts/#{contact_id}/activity")
|
41
|
+
request = Net::HTTP::Get.new(url.request_uri)
|
42
|
+
|
43
|
+
@headers.each {|k, v| request[k] = v }
|
44
|
+
|
45
|
+
response = Net::HTTP.start(url.hostname, url.port, :use_ssl => url.scheme == 'https') do |http|
|
46
|
+
http.request(request)
|
47
|
+
end
|
48
|
+
|
49
|
+
JSON.parse(response.body)["activities"].collect {|activity| CallAction::Activity.new activity }
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get list of all channels
|
53
|
+
def channels
|
54
|
+
url = URI.parse("#{@base_url}#{@api_version}/channels")
|
55
|
+
request = Net::HTTP::Get.new(url.request_uri)
|
56
|
+
|
57
|
+
@headers.each {|k, v| request[k] = v }
|
58
|
+
|
59
|
+
response = Net::HTTP.start(url.hostname, url.port, :use_ssl => url.scheme == 'https') do |http|
|
60
|
+
http.request(request)
|
61
|
+
end
|
62
|
+
|
63
|
+
JSON.parse(response.body)["channels"].collect {|channel| CallAction::Channel.new channel }
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get list of all sources
|
67
|
+
def sources
|
68
|
+
url = URI.parse("#{@base_url}#{@api_version}/sources")
|
69
|
+
request = Net::HTTP::Get.new(url.request_uri)
|
70
|
+
|
71
|
+
@headers.each {|k, v| request[k] = v }
|
72
|
+
|
73
|
+
response = Net::HTTP.start(url.hostname, url.port, :use_ssl => url.scheme == 'https') do |http|
|
74
|
+
http.request(request)
|
75
|
+
end
|
76
|
+
|
77
|
+
JSON.parse(response.body)["sources"].collect {|source| CallAction::Source.new source }
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CallAction
|
2
|
+
class Channel
|
3
|
+
|
4
|
+
def initialize(hash)
|
5
|
+
hash.each do |k,v|
|
6
|
+
self.instance_variable_set("@#{k}", v.is_a?(Hash) ? Hashit.new(v) : v)
|
7
|
+
self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
|
8
|
+
self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CallAction
|
2
|
+
class Contact
|
3
|
+
|
4
|
+
def initialize(hash)
|
5
|
+
hash.each do |k,v|
|
6
|
+
self.instance_variable_set("@#{k}", v.is_a?(Hash) ? Hashit.new(v) : v)
|
7
|
+
self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
|
8
|
+
self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def activities
|
14
|
+
call_action = CallAction::Api.new
|
15
|
+
call_action.activities self.id
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CallAction
|
2
|
+
class Source
|
3
|
+
|
4
|
+
def initialize(hash)
|
5
|
+
hash.each do |k,v|
|
6
|
+
self.instance_variable_set("@#{k}", v.is_a?(Hash) ? Hashit.new(v) : v)
|
7
|
+
self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
|
8
|
+
self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
data/lib/call_action.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module CallAction
|
2
|
+
class << self
|
3
|
+
attr_accessor :api_version, :auth_token
|
4
|
+
|
5
|
+
def config
|
6
|
+
yield(self)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'call_action/contact'
|
13
|
+
require 'call_action/activity'
|
14
|
+
require 'call_action/channel'
|
15
|
+
require 'call_action/source'
|
16
|
+
require 'call_action/api'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: call_action
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shahzad Tariq
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby wrapper for CallAction API to be used within Ruby On Rails (RoR)
|
14
14
|
and other Ruby based frameworks
|
@@ -16,7 +16,18 @@ email: m.shahzad.tariq@hotmaul.com
|
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
|
-
files:
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
- lib/call_action.rb
|
24
|
+
- lib/call_action/activity.rb
|
25
|
+
- lib/call_action/api.rb
|
26
|
+
- lib/call_action/channel.rb
|
27
|
+
- lib/call_action/contact.rb
|
28
|
+
- lib/call_action/source.rb
|
29
|
+
- lib/generators/call_action/install_generator.rb
|
30
|
+
- lib/generators/call_action/templates/initializer.rb
|
20
31
|
homepage: https://callaction.co/documentation/developers/api/v1/index.html
|
21
32
|
licenses:
|
22
33
|
- MIT
|