marchex 0.1.3 → 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/README.md +23 -12
- data/lib/marchex.rb +13 -13
- data/lib/marchex/version.rb +1 -1
- data/marchex.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d8f6534c0873d81a815890a1bd5cd739c8a99fa
|
4
|
+
data.tar.gz: d589ec0ecd5f51b50c2b9973c55408321d3298ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 607dff4dc79e1f0f9497d88c37bc0de99fbacf3c6e7edcc1af26c0b29afdd9074e6b4501d6eee0929de1f8e6117b0ee669ae5d8ba2c2df67bad14a433a1fdd49
|
7
|
+
data.tar.gz: 1d72909a0e9acb711285f01fa41b41464d1cd743559127e5df428e1d07b6573ea087da6b71a2717e0fcc8647bcb511a051f63fdfcb7d43ba53cac2b3bb6d90d4
|
data/README.md
CHANGED
@@ -20,34 +20,43 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
Create a connection using your Marchex account email address and password:
|
23
|
-
|
23
|
+
```ruby
|
24
24
|
@testcon = Marchex::Marchexapi.new("user@marchex.com", "password")
|
25
|
+
```
|
26
|
+
```@testcon.account_list ```
|
25
27
|
|
26
|
-
# @testcon.account_list
|
27
28
|
Retrieves all accounts
|
28
29
|
|
29
|
-
|
30
|
+
``` @testcon.client_ad_list(client_id, status) ```
|
31
|
+
|
30
32
|
Retrieves all ad campaigns for a client account. If disabled or active is passed for the status, only those ads will be returned.
|
31
33
|
|
32
|
-
|
34
|
+
``` @testcon.ad_forward_list(campaign_id) ```
|
35
|
+
|
33
36
|
Retrieves all forwarding numbers for a single ad campaign
|
34
37
|
|
35
|
-
|
38
|
+
``` @testcon.ad_record_status(campaign_id) ```
|
39
|
+
|
36
40
|
Checks if an ad campaign is set to record
|
37
41
|
|
38
|
-
|
42
|
+
``` @testcon.user_list(account_id)```
|
43
|
+
|
39
44
|
List all users in a client account
|
40
45
|
|
41
|
-
|
46
|
+
``` @testcon.user_permissions(user_id) ```
|
47
|
+
|
42
48
|
Grab permissions to see if a user is an admin
|
43
49
|
|
44
|
-
|
50
|
+
``` @testcon.ad_custom_define(acc_id,field_number, field_name, field_type, field_values) ```
|
51
|
+
|
45
52
|
Define a custom field for an ad
|
46
53
|
|
47
|
-
|
54
|
+
``` @testcon.ad_custom_set(acc_id, campaign_id, field_name, field_value) ```
|
55
|
+
|
48
56
|
Set the value of a custom field. For boolean, use yes/no
|
49
57
|
|
50
|
-
|
58
|
+
``` @testcon.call_search(search_options) ```
|
59
|
+
|
51
60
|
search_options = {}
|
52
61
|
search_options[:acct_id] Required string. The unique, system-generated account ID of the specified account.
|
53
62
|
|
@@ -93,10 +102,12 @@ Create a connection using your Marchex account email address and password:
|
|
93
102
|
|
94
103
|
search_options[:subacct] Optional boolean. true to search all calls in all client accounts of the specified parent account.
|
95
104
|
|
96
|
-
|
105
|
+
``` @testcon.get_call(call_id) ```
|
106
|
+
|
97
107
|
Return details for a single call
|
98
108
|
|
99
|
-
|
109
|
+
``` @testcon.get_call_audio(call_id, audio_format) ```
|
110
|
+
|
100
111
|
Gets a Base64-encoded string that contains the audio data of the specified call, in the specified format. (mp3 or wav)
|
101
112
|
|
102
113
|
## Development
|
data/lib/marchex.rb
CHANGED
@@ -11,21 +11,21 @@ require 'rest-client'
|
|
11
11
|
module Marchex
|
12
12
|
class Marchexapi
|
13
13
|
|
14
|
-
|
14
|
+
RestClient.log = 'stdout' #Debugging API calls
|
15
15
|
|
16
16
|
def initialize(u, p)
|
17
17
|
@url = 'https://userapi.voicestar.com/api/jsonrpc/1'
|
18
|
-
|
18
|
+
@auth = 'Basic ' + Base64.encode64(u + ':' + p).chomp
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
22
|
def account_list()
|
23
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'acct.list', 'params' => [] }.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
23
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'acct.list', 'params' => [] }.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def client_ad_list(client_id, status ='')
|
28
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.list.all', 'params' => [client_id, {'status' => status.downcase}]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
28
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.list.all', 'params' => [client_id, {'status' => status.downcase}]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
29
29
|
|
30
30
|
end
|
31
31
|
|
@@ -35,31 +35,31 @@ module Marchex
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def ad_forward_list(campaign_id)
|
38
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.forw.list', 'params' => [campaign_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
38
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.forw.list', 'params' => [campaign_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
39
39
|
end
|
40
40
|
|
41
41
|
def ad_record_status(campaign_id)
|
42
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.recordcall.get', 'params' => [campaign_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
42
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.recordcall.get', 'params' => [campaign_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
43
43
|
return response.body["result"]
|
44
44
|
end
|
45
45
|
|
46
46
|
def user_list(account_id)
|
47
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'user.list', 'params' => [account_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
47
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'user.list', 'params' => [account_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
48
48
|
return response.body["result"]
|
49
49
|
end
|
50
50
|
|
51
51
|
def user_permissions(user_id)
|
52
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'user.permissions.get', 'params' => [user_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
52
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'user.permissions.get', 'params' => [user_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
53
53
|
return response.body["result"]
|
54
54
|
end
|
55
55
|
|
56
56
|
def ad_custom_define(acc_id,field_number, field_name, field_type, field_values)
|
57
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.custom.define', 'params' => [acc_id,field_number, field_name, field_type, field_values]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
57
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.custom.define', 'params' => [acc_id,field_number, field_name, field_type, field_values]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
58
58
|
return response.body["result"]
|
59
59
|
end
|
60
60
|
|
61
61
|
def ad_custom_set(acc_id, campaign_id, field_name, field_value)
|
62
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.custom.set', 'params' => [acc_id,campaign_id, field_name, field_value]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
62
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'ad.custom.set', 'params' => [acc_id,campaign_id, field_name, field_value]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
63
63
|
return response.body["result"]
|
64
64
|
end
|
65
65
|
|
@@ -84,17 +84,17 @@ module Marchex
|
|
84
84
|
search_options[:status] = opts[:status] if opts[:status]
|
85
85
|
search_options[:spotted_keywords] = opts[:spotted_keywords] if opts[:spotted_keywords]
|
86
86
|
search_options[:subacct] = opts[:subacct] if opts[:subacct]
|
87
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.search', 'params' => [opts[:acct_id], search_options ]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
87
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.search', 'params' => [opts[:acct_id], search_options ]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
88
88
|
return response.body["result"]
|
89
89
|
end
|
90
90
|
|
91
91
|
def get_call (call_id)
|
92
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.get', 'params' => [call_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
92
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.get', 'params' => [call_id]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
93
93
|
return response.body["result"]
|
94
94
|
end
|
95
95
|
|
96
96
|
def get_call_audio(call_id, audio_format)
|
97
|
-
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.audio', 'params' => [call_id, audio_format]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization =>
|
97
|
+
response = parse_json(RestClient.post(@url, {'jsonrpc' => '2.0', 'id' => '1', 'method' => 'call.audio', 'params' => [call_id, audio_format]}.to_json, :content_type => 'application/json', :accept => 'application/json', :Authorization => @auth))
|
98
98
|
return response.body["result"]
|
99
99
|
end
|
100
100
|
|
data/lib/marchex/version.rb
CHANGED
data/marchex.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 1.10"
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
32
|
|
33
|
-
spec.add_dependency "rest-client", "~>
|
34
|
-
spec.add_dependency "json", "~> 1.
|
33
|
+
spec.add_dependency "rest-client", "~> 2.0.2"
|
34
|
+
spec.add_dependency "json", "~> 2.1.0"
|
35
35
|
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marchex
|
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: 2017-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.0.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 2.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 2.1.0
|
69
69
|
description: Marchex JSON API
|
70
70
|
email:
|
71
71
|
- mhoskison@etnainteractive.com
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.8
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Used to work with the Marchex API
|