seven_api 0.5.0 → 0.6.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/.idea/ruby-client.iml +16 -4
- data/README.md +2 -2
- data/doc/{Sms77 → SevenApi}/Client.html +222 -222
- data/doc/{Sms77 → SevenApi}/Contacts/Action.html +130 -130
- data/doc/{Sms77 → SevenApi}/Contacts.html +125 -125
- data/doc/{Sms77 → SevenApi}/Endpoint.html +186 -186
- data/doc/{Sms77 → SevenApi}/Hooks/Action.html +130 -130
- data/doc/{Sms77 → SevenApi}/Hooks/EventType.html +145 -145
- data/doc/{Sms77 → SevenApi}/Hooks/RequestMethod.html +130 -130
- data/doc/{Sms77 → SevenApi}/Hooks/Validator.html +582 -582
- data/doc/{Sms77 → SevenApi}/Hooks.html +125 -125
- data/doc/{Sms77 → SevenApi}/Journal/Type.html +135 -135
- data/doc/{Sms77 → SevenApi}/Journal/Validator.html +380 -380
- data/doc/{Sms77 → SevenApi}/Journal.html +125 -125
- data/doc/{Sms77 → SevenApi}/Lookup/Type.html +135 -135
- data/doc/{Sms77 → SevenApi}/Lookup.html +125 -125
- data/doc/{Sms77 → SevenApi}/Resource.html +857 -857
- data/doc/{Sms77 → SevenApi}/Resources/Analytics.html +260 -260
- data/doc/{Sms77 → SevenApi}/Resources/Balance.html +243 -243
- data/doc/{Sms77 → SevenApi}/Resources/Contacts.html +445 -445
- data/doc/{Sms77 → SevenApi}/Resources/Hooks.html +453 -453
- data/doc/{Sms77 → SevenApi}/Resources/Journal.html +258 -258
- data/doc/{Sms77 → SevenApi}/Resources/Lookup.html +535 -535
- data/doc/{Sms77 → SevenApi}/Resources/Pricing.html +260 -260
- data/doc/{Sms77 → SevenApi}/Resources/Sms.html +258 -258
- data/doc/{Sms77 → SevenApi}/Resources/Status.html +258 -258
- data/doc/{Sms77 → SevenApi}/Resources/Subaccounts.html +645 -645
- data/doc/{Sms77 → SevenApi}/Resources/ValidateForVoice.html +258 -258
- data/doc/{Sms77 → SevenApi}/Resources/Voice.html +258 -258
- data/doc/SevenApi/Resources.html +128 -0
- data/doc/{Sms77 → SevenApi}/Sms/Type.html +125 -125
- data/doc/{Sms77 → SevenApi}/Sms.html +125 -125
- data/doc/{Sms77 → SevenApi}/Subaccounts/Action.html +140 -140
- data/doc/SevenApi/Subaccounts/Validator.html +490 -0
- data/doc/{Sms77 → SevenApi}/Subaccounts.html +125 -125
- data/doc/{Sms77 → SevenApi}/Util.html +993 -993
- data/doc/{Sms77.html → SevenApi.html} +145 -145
- data/doc/_index.html +443 -443
- data/doc/class_list.html +51 -51
- data/doc/css/full_list.css +58 -58
- data/doc/css/style.css +497 -497
- data/doc/file.README.html +110 -111
- data/doc/file_list.html +56 -56
- data/doc/frames.html +17 -17
- data/doc/index.html +110 -111
- data/doc/js/app.js +314 -314
- data/doc/js/full_list.js +216 -216
- data/doc/js/jquery.js +3 -3
- data/doc/method_list.html +563 -563
- data/doc/top-level-namespace.html +109 -109
- data/lib/seven_api/client.rb +2 -0
- data/lib/seven_api/contacts.rb +0 -5
- data/lib/seven_api/endpoint.rb +5 -0
- data/lib/seven_api/hooks.rb +1 -0
- data/lib/seven_api/lookup.rb +1 -0
- data/lib/seven_api/numbers.rb +9 -0
- data/lib/seven_api/paginated.rb +10 -0
- data/lib/seven_api/rcs.rb +9 -0
- data/lib/seven_api/resource.rb +8 -3
- data/lib/seven_api/resources/analytics.rb +38 -5
- data/lib/seven_api/resources/balance.rb +2 -2
- data/lib/seven_api/resources/contacts.rb +36 -18
- data/lib/seven_api/resources/groups.rb +57 -0
- data/lib/seven_api/resources/hooks.rb +1 -1
- data/lib/seven_api/resources/journal.rb +1 -1
- data/lib/seven_api/resources/lookup.rb +36 -20
- data/lib/seven_api/resources/numbers.rb +70 -0
- data/lib/seven_api/resources/pricing.rb +1 -1
- data/lib/seven_api/resources/rcs.rb +39 -0
- data/lib/seven_api/resources/sms.rb +1 -1
- data/lib/seven_api/resources/status.rb +1 -1
- data/lib/seven_api/resources/subaccounts.rb +5 -5
- data/lib/seven_api/resources/validate_for_voice.rb +1 -1
- data/lib/seven_api/resources/voice.rb +1 -1
- data/lib/seven_api/version.rb +1 -1
- data/seven_api.gemspec +5 -5
- data/spec/seven_api/analytics_spec.rb +49 -0
- data/spec/seven_api/balance_spec.rb +8 -2
- data/spec/seven_api/contacts_spec.rb +52 -81
- data/spec/seven_api/groups_spec.rb +74 -0
- data/spec/seven_api/lookup_spec.rb +51 -33
- data/spec/seven_api/numbers_spec.rb +135 -0
- data/spec/seven_api/rcs_spec.rb +99 -0
- data/spec/seven_api/sms_spec.rb +2 -2
- data/spec/seven_api/voice_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -17
- metadata +64 -50
- data/doc/Sms77/Resources.html +0 -128
- data/doc/Sms77/Subaccounts/Validator.html +0 -490
@@ -1,110 +1,110 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Top Level Namespace
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
-
|
17
|
-
<script type="text/javascript">
|
18
|
-
pathId = "";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index</a> »
|
40
|
-
|
41
|
-
|
42
|
-
<span class="title">Top Level Namespace</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Top Level Namespace
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<h2>Defined Under Namespace</h2>
|
82
|
-
<p class="children">
|
83
|
-
|
84
|
-
|
85
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
</p>
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<div id="footer">
|
103
|
-
Generated on
|
104
|
-
<a href="
|
105
|
-
0.9.
|
106
|
-
</div>
|
107
|
-
|
108
|
-
</div>
|
109
|
-
</body>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Top Level Namespace</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<h2>Defined Under Namespace</h2>
|
82
|
+
<p class="children">
|
83
|
+
|
84
|
+
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="SevenApi.html" title="SevenApi (module)">SevenApi</a></span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="footer">
|
103
|
+
Generated on Fri Aug 25 14:18:45 2023 by
|
104
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
+
0.9.34 (ruby-3.2.2).
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</body>
|
110
110
|
</html>
|
data/lib/seven_api/client.rb
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
require 'seven_api/resources/analytics'
|
4
4
|
require 'seven_api/resources/balance'
|
5
5
|
require 'seven_api/resources/contacts'
|
6
|
+
require 'seven_api/resources/groups'
|
6
7
|
require 'seven_api/resources/hooks'
|
7
8
|
require 'seven_api/resources/journal'
|
8
9
|
require 'seven_api/resources/lookup'
|
10
|
+
require 'seven_api/resources/numbers'
|
9
11
|
require 'seven_api/resources/pricing'
|
10
12
|
require 'seven_api/resources/sms'
|
11
13
|
require 'seven_api/resources/status'
|
data/lib/seven_api/contacts.rb
CHANGED
data/lib/seven_api/endpoint.rb
CHANGED
@@ -5,10 +5,15 @@ module SevenApi::Endpoint
|
|
5
5
|
ANALYTICS = 'analytics'
|
6
6
|
BALANCE = 'balance'
|
7
7
|
CONTACTS = 'contacts'
|
8
|
+
GROUPS = 'groups'
|
8
9
|
HOOKS = 'hooks'
|
9
10
|
JOURNAL = 'journal'
|
10
11
|
LOOKUP = 'lookup'
|
12
|
+
NUMBERS = 'numbers'
|
11
13
|
PRICING = 'pricing'
|
14
|
+
RCS = 'rcs'
|
15
|
+
RCS_EVENTS = RCS + '/events'
|
16
|
+
RCS_MESSAGES = RCS + '/messages'
|
12
17
|
SMS = 'sms'
|
13
18
|
STATUS = 'status'
|
14
19
|
SUBACCOUNTS = 'subaccounts'
|
data/lib/seven_api/hooks.rb
CHANGED
data/lib/seven_api/lookup.rb
CHANGED
data/lib/seven_api/resource.rb
CHANGED
@@ -25,8 +25,8 @@ module SevenApi
|
|
25
25
|
|
26
26
|
protected
|
27
27
|
|
28
|
-
def request(payload = {}, query = {})
|
29
|
-
path = @endpoint
|
28
|
+
def request(payload = {}, query = {}, path = '')
|
29
|
+
path = "#{@endpoint}#{path}"
|
30
30
|
http_method = @http_methods[caller_locations.first.label.to_sym]
|
31
31
|
|
32
32
|
if :get == http_method
|
@@ -48,9 +48,14 @@ module SevenApi
|
|
48
48
|
end
|
49
49
|
|
50
50
|
headers = Hash[
|
51
|
-
|
51
|
+
'Accept', 'application/json',
|
52
52
|
'sentWith', @sent_with
|
53
53
|
]
|
54
|
+
if @api_key.start_with?('Bearer ')
|
55
|
+
headers.store(Faraday::Request::Authorization::KEY, @api_key)
|
56
|
+
else
|
57
|
+
headers.store('X-Api-Key', @api_key)
|
58
|
+
end
|
54
59
|
|
55
60
|
res = @conn.run_request(http_method, path, payload, headers)
|
56
61
|
|
@@ -6,16 +6,49 @@ require 'seven_api/resource'
|
|
6
6
|
module SevenApi::Resources
|
7
7
|
class Analytics < SevenApi::Resource
|
8
8
|
@endpoint = SevenApi::Endpoint::ANALYTICS
|
9
|
+
PATHS = {
|
10
|
+
:by_country => "/country",
|
11
|
+
:by_date => "/date",
|
12
|
+
:by_label => "/label",
|
13
|
+
:by_subaccount => "/subaccount",
|
14
|
+
}
|
9
15
|
@http_methods = {
|
10
|
-
:
|
16
|
+
:by_country => :get,
|
17
|
+
:by_date => :get,
|
18
|
+
:by_label => :get,
|
19
|
+
:by_subaccount => :get,
|
11
20
|
}
|
12
21
|
|
13
|
-
# Retrieve analytics
|
14
|
-
# read more: https://
|
22
|
+
# Retrieve analytics grouped by country
|
23
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#statistics
|
24
|
+
# @param params [Hash]
|
25
|
+
# @return [Array]
|
26
|
+
def by_country(params = {})
|
27
|
+
request({}, params, PATHS[:by_country])
|
28
|
+
end
|
29
|
+
|
30
|
+
# Retrieve analytics grouped by date
|
31
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#statistics
|
32
|
+
# @param params [Hash]
|
33
|
+
# @return [Array]
|
34
|
+
def by_date(params = {})
|
35
|
+
request({}, params, PATHS[:by_date])
|
36
|
+
end
|
37
|
+
|
38
|
+
# Retrieve analytics grouped by label
|
39
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#statistics
|
40
|
+
# @param params [Hash]
|
41
|
+
# @return [Array]
|
42
|
+
def by_label(params = {})
|
43
|
+
request({}, params, PATHS[:by_label])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Retrieve analytics grouped by subaccount
|
47
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#statistics
|
15
48
|
# @param params [Hash]
|
16
49
|
# @return [Array]
|
17
|
-
def
|
18
|
-
request(params)
|
50
|
+
def by_subaccount(params = {})
|
51
|
+
request({}, params, PATHS[:by_subaccount])
|
19
52
|
end
|
20
53
|
end
|
21
54
|
end
|
@@ -11,8 +11,8 @@ module SevenApi::Resources
|
|
11
11
|
}
|
12
12
|
|
13
13
|
# Retrieve account balance for associated API key
|
14
|
-
# read more: https://
|
15
|
-
# @return [
|
14
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#balance
|
15
|
+
# @return [Hash]
|
16
16
|
def retrieve
|
17
17
|
request
|
18
18
|
end
|
@@ -7,33 +7,51 @@ module SevenApi::Resources
|
|
7
7
|
class Contacts < SevenApi::Resource
|
8
8
|
@endpoint = SevenApi::Endpoint::CONTACTS
|
9
9
|
@http_methods = {
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
10
|
+
:all => :get,
|
11
|
+
:create => :post,
|
12
|
+
:delete => :delete,
|
13
|
+
:one => :get,
|
14
|
+
:update => :patch,
|
13
15
|
}
|
14
16
|
|
15
17
|
# Retrieve contacts associated with the API key
|
16
|
-
# read more: https://
|
18
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/contacts#query-contact-list
|
17
19
|
# @param params [Hash]
|
18
|
-
# @return [
|
19
|
-
def
|
20
|
-
request(params
|
20
|
+
# @return [Hash]
|
21
|
+
def all(params = {})
|
22
|
+
request(params)
|
21
23
|
end
|
22
24
|
|
23
|
-
#
|
24
|
-
# read more: https://
|
25
|
-
# @param
|
26
|
-
# @return [
|
27
|
-
def
|
28
|
-
request({},
|
25
|
+
# Retrieve a contact associated with the API key
|
26
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/contacts#retrieve-contact
|
27
|
+
# @param id [Int]
|
28
|
+
# @return [Hash]
|
29
|
+
def one(id)
|
30
|
+
request({}, {}, "/#{id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Delete a contact with given ID
|
34
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/contacts#delete-contact
|
35
|
+
# @param id [Integer]
|
36
|
+
# @return [Hash]
|
37
|
+
def delete(id)
|
38
|
+
request({}, {}, "/#{id}")
|
29
39
|
end
|
30
40
|
|
31
|
-
# Create
|
32
|
-
# read more: https://
|
41
|
+
# Create a contact
|
42
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/contacts#create-contact
|
33
43
|
# @param params [Hash]
|
34
|
-
# @return [
|
35
|
-
def
|
36
|
-
request(
|
44
|
+
# @return [Hash]
|
45
|
+
def create(params)
|
46
|
+
request( params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update a contact
|
50
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/contacts#update-contact
|
51
|
+
# @param contact [Hash]
|
52
|
+
# @return [Hash]
|
53
|
+
def update(contact)
|
54
|
+
request(contact, {}, "/#{contact['id']}")
|
37
55
|
end
|
38
56
|
end
|
39
57
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /groups.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Groups < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::GROUPS
|
9
|
+
@http_methods = {
|
10
|
+
:all => :get,
|
11
|
+
:create => :post,
|
12
|
+
:delete => :delete,
|
13
|
+
:one => :get,
|
14
|
+
:update => :patch,
|
15
|
+
}
|
16
|
+
|
17
|
+
# Retrieve contacts associated with the API key
|
18
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/groups#list-all-groups
|
19
|
+
# @param params [Hash]
|
20
|
+
# @return [Hash]
|
21
|
+
def all(params = {})
|
22
|
+
request(params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieve a contact associated with the API key
|
26
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/groups#retrieve-a-group
|
27
|
+
# @param id [Int]
|
28
|
+
# @return [Hash]
|
29
|
+
def one(id)
|
30
|
+
request({}, {}, "/#{id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Delete a contact with given ID
|
34
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/groups#delete-group
|
35
|
+
# @param id [Integer]
|
36
|
+
# @return [Hash]
|
37
|
+
def delete(id)
|
38
|
+
request({}, {}, "/#{id}")
|
39
|
+
end
|
40
|
+
|
41
|
+
# Create a contact
|
42
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/groups#create-group
|
43
|
+
# @param params [Hash]
|
44
|
+
# @return [Hash]
|
45
|
+
def create(params)
|
46
|
+
request( params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update a contact
|
50
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/groups#update-a-group
|
51
|
+
# @param contact [Hash]
|
52
|
+
# @return [Hash]
|
53
|
+
def update(contact)
|
54
|
+
request(contact, {}, "/#{contact['id']}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'seven_api/resource'
|
4
4
|
|
5
5
|
# This module exposes the methods for communicating with the API endpoint /hooks.
|
6
|
-
# read more: https://
|
6
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/webhooks
|
7
7
|
module SevenApi::Resources
|
8
8
|
class Hooks < SevenApi::Resource
|
9
9
|
@endpoint = SevenApi::Endpoint::HOOKS
|
@@ -11,7 +11,7 @@ module SevenApi::Resources
|
|
11
11
|
}
|
12
12
|
|
13
13
|
# Retrieve the journal for associated API key
|
14
|
-
# read more: https://
|
14
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/logbook
|
15
15
|
# @param params [Hash]
|
16
16
|
# @return [Array]
|
17
17
|
def retrieve(params)
|
@@ -7,42 +7,58 @@ module SevenApi::Resources
|
|
7
7
|
class Lookup < SevenApi::Resource
|
8
8
|
@endpoint = SevenApi::Endpoint::LOOKUP
|
9
9
|
@http_methods = {
|
10
|
-
:cnam => :
|
11
|
-
:format => :
|
12
|
-
:hlr => :
|
13
|
-
:mnp => :
|
10
|
+
:cnam => :get,
|
11
|
+
:format => :get,
|
12
|
+
:hlr => :get,
|
13
|
+
:mnp => :get,
|
14
|
+
:rcs_capabilities => :get
|
15
|
+
}
|
16
|
+
PATHS = {
|
17
|
+
:cnam => '/cnam',
|
18
|
+
:format => '/format',
|
19
|
+
:hlr => '/hlr',
|
20
|
+
:mnp => '/mnp',
|
21
|
+
:rcs_capabilities => '/rcs'
|
14
22
|
}
|
15
23
|
|
16
24
|
# Perform a caller name lookup
|
17
|
-
# read more: https://
|
18
|
-
# @param
|
25
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#cnam
|
26
|
+
# @param number [String]
|
19
27
|
# @return [Hash,Array]
|
20
|
-
def cnam(
|
21
|
-
request(
|
28
|
+
def cnam(number)
|
29
|
+
request({}, {number: number}, PATHS[:cnam])
|
22
30
|
end
|
23
31
|
|
24
32
|
# Retrieve phone number formats
|
25
|
-
# read more: https://
|
26
|
-
# @param
|
33
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#format
|
34
|
+
# @param number [String]
|
27
35
|
# @return [String,Hash]
|
28
|
-
def format(
|
29
|
-
request(
|
36
|
+
def format(number)
|
37
|
+
request({}, {number: number}, PATHS[:format])
|
30
38
|
end
|
31
39
|
|
32
40
|
# Perform a home location register lookup
|
33
|
-
# read more: https://
|
34
|
-
# @param
|
41
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#hlr
|
42
|
+
# @param number [String]
|
35
43
|
# @return [Hash,Array]
|
36
|
-
def hlr(
|
37
|
-
request(
|
44
|
+
def hlr(number)
|
45
|
+
request({}, {number: number}, PATHS[:hlr])
|
38
46
|
end
|
39
47
|
|
40
48
|
# Perform a mobile number portability lookup
|
41
|
-
# read more: https://
|
42
|
-
# @param
|
49
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#mnp
|
50
|
+
# @param number [String]
|
51
|
+
# @return [Hash,Array]
|
52
|
+
def mnp(number)
|
53
|
+
request({}, {number: number}, PATHS[:mnp])
|
54
|
+
end
|
55
|
+
|
56
|
+
# Perform a RCS capabilities lookup
|
57
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#rcs-capabilities
|
58
|
+
# @param number [String]
|
43
59
|
# @return [Hash,Array]
|
44
|
-
def
|
45
|
-
request(
|
60
|
+
def rcs_capabilities(number)
|
61
|
+
request({}, {number: number}, PATHS[:rcs])
|
46
62
|
end
|
47
63
|
end
|
48
64
|
end
|