seven_api 0.6.0 → 0.6.1
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 +7 -6
- data/.idea/inspectionProfiles/Project_Default.xml +5 -5
- data/.idea/ruby-client.iml +48 -13
- data/Gemfile +2 -2
- data/LICENSE +21 -21
- data/README.md +1 -1
- data/Rakefile +5 -5
- data/doc/SevenApi/Client.html +8 -8
- data/doc/SevenApi/Contacts/Action.html +0 -0
- data/doc/SevenApi/Contacts.html +0 -0
- data/doc/SevenApi/Endpoint.html +0 -0
- data/doc/SevenApi/Hooks/Action.html +0 -0
- data/doc/SevenApi/Hooks/EventType.html +0 -0
- data/doc/SevenApi/Hooks/RequestMethod.html +0 -0
- data/doc/SevenApi/Hooks/Validator.html +26 -26
- data/doc/SevenApi/Hooks.html +0 -0
- data/doc/SevenApi/Journal/Type.html +0 -0
- data/doc/SevenApi/Journal/Validator.html +18 -18
- data/doc/SevenApi/Journal.html +0 -0
- data/doc/SevenApi/Lookup/Type.html +0 -0
- data/doc/SevenApi/Lookup.html +0 -0
- data/doc/SevenApi/Resource.html +13 -13
- data/doc/SevenApi/Resources/Analytics.html +2 -2
- data/doc/SevenApi/Resources/Balance.html +2 -2
- data/doc/SevenApi/Resources/Contacts.html +6 -6
- data/doc/SevenApi/Resources/Hooks.html +10 -10
- data/doc/SevenApi/Resources/Journal.html +2 -2
- data/doc/SevenApi/Resources/Lookup.html +8 -8
- data/doc/SevenApi/Resources/Pricing.html +2 -2
- data/doc/SevenApi/Resources/Sms.html +2 -2
- data/doc/SevenApi/Resources/Status.html +2 -2
- data/doc/SevenApi/Resources/Subaccounts.html +18 -18
- data/doc/SevenApi/Resources/ValidateForVoice.html +2 -2
- data/doc/SevenApi/Resources/Voice.html +2 -2
- data/doc/SevenApi/Resources.html +0 -0
- data/doc/SevenApi/Sms/Type.html +0 -0
- data/doc/SevenApi/Sms.html +0 -0
- data/doc/SevenApi/Subaccounts/Action.html +0 -0
- data/doc/SevenApi/Subaccounts/Validator.html +29 -29
- data/doc/SevenApi/Subaccounts.html +0 -0
- data/doc/SevenApi/Util.html +39 -39
- data/doc/SevenApi.html +0 -0
- data/document.sh +3 -0
- data/lib/seven_api/client.rb +32 -32
- data/lib/seven_api/contacts.rb +5 -5
- data/lib/seven_api/endpoint.rb +0 -0
- data/lib/seven_api/hooks.rb +69 -68
- data/lib/seven_api/journal.rb +39 -39
- data/lib/seven_api/lookup.rb +12 -12
- data/lib/seven_api/numbers.rb +9 -9
- data/lib/seven_api/paginated.rb +10 -10
- data/lib/seven_api/rcs.rb +0 -0
- data/lib/seven_api/resource.rb +1 -2
- data/lib/seven_api/resources/analytics.rb +54 -54
- data/lib/seven_api/resources/balance.rb +19 -19
- data/lib/seven_api/resources/contacts.rb +56 -56
- data/lib/seven_api/resources/groups.rb +56 -56
- data/lib/seven_api/resources/hooks.rb +40 -40
- data/lib/seven_api/resources/journal.rb +20 -20
- data/lib/seven_api/resources/lookup.rb +63 -63
- data/lib/seven_api/resources/numbers.rb +70 -69
- data/lib/seven_api/resources/pricing.rb +20 -20
- data/lib/seven_api/resources/rcs.rb +3 -3
- data/lib/seven_api/resources/sms.rb +29 -20
- data/lib/seven_api/resources/status.rb +20 -20
- data/lib/seven_api/resources/subaccounts.rb +65 -65
- data/lib/seven_api/resources/validate_for_voice.rb +20 -20
- data/lib/seven_api/resources/voice.rb +29 -20
- data/lib/seven_api/sms.rb +9 -9
- data/lib/seven_api/subaccounts.rb +55 -55
- data/lib/seven_api/util.rb +68 -68
- data/lib/seven_api/version.rb +5 -5
- data/lib/seven_api.rb +6 -6
- data/release.sh +4 -4
- data/seven_api.gemspec +0 -0
- data/spec/EnvKeyStore.rb +14 -14
- data/spec/matchers.rb +22 -22
- data/spec/seven_api/analytics_spec.rb +49 -49
- data/spec/seven_api/balance_spec.rb +18 -18
- data/spec/seven_api/client_spec.rb +15 -15
- data/spec/seven_api/contacts_spec.rb +100 -100
- data/spec/seven_api/groups_spec.rb +74 -74
- data/spec/seven_api/hooks_spec.rb +108 -108
- data/spec/seven_api/instance_spec.rb +22 -22
- data/spec/seven_api/journal_spec.rb +86 -86
- data/spec/seven_api/lookup_spec.rb +197 -197
- data/spec/seven_api/numbers_spec.rb +135 -135
- data/spec/seven_api/pricing_spec.rb +76 -76
- data/spec/seven_api/rcs_spec.rb +0 -0
- data/spec/seven_api/sms_spec.rb +103 -103
- data/spec/seven_api/subaccounts_spec.rb +121 -121
- data/spec/seven_api/validate_for_voice_spec.rb +19 -19
- data/spec/seven_api/voice_spec.rb +51 -51
- data/spec/seven_api_spec.rb +9 -9
- metadata +4 -6
@@ -1,57 +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
|
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
|
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
|
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
|
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
|
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
|
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 groups 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(:get, params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieve a group 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(:get,{}, {}, "/#{id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Delete a group 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(:delete,{}, {}, "/#{id}")
|
39
|
+
end
|
40
|
+
|
41
|
+
# Create a group
|
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(:post, params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update a group
|
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(:patch, contact, {}, "/#{contact['id']}")
|
55
|
+
end
|
56
|
+
end
|
57
57
|
end
|
@@ -1,41 +1,41 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /hooks.
|
6
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/webhooks
|
7
|
-
module SevenApi::Resources
|
8
|
-
class Hooks < SevenApi::Resource
|
9
|
-
@endpoint = SevenApi::Endpoint::HOOKS
|
10
|
-
@http_methods = {
|
11
|
-
:read => :get,
|
12
|
-
:subscribe => :post,
|
13
|
-
:unsubscribe => :post,
|
14
|
-
}
|
15
|
-
|
16
|
-
# Retrieve all webhooks
|
17
|
-
# @param params [Hash]
|
18
|
-
# @return [Hash]
|
19
|
-
def read(params = {})
|
20
|
-
request(params.merge({ :action => SevenApi::Hooks::Action::READ }))
|
21
|
-
end
|
22
|
-
|
23
|
-
# Register a new webhook
|
24
|
-
# @param params [Hash]
|
25
|
-
# @return [Hash]
|
26
|
-
def subscribe(params)
|
27
|
-
SevenApi::Hooks::Validator::subscribe(params)
|
28
|
-
|
29
|
-
request(params.merge({ :action => SevenApi::Hooks::Action::SUBSCRIBE }))
|
30
|
-
end
|
31
|
-
|
32
|
-
# Delete a webhook
|
33
|
-
# @param params [Hash]
|
34
|
-
# @return [Hash]
|
35
|
-
def unsubscribe(params)
|
36
|
-
SevenApi::Hooks::Validator::unsubscribe(params)
|
37
|
-
|
38
|
-
request(params.merge({ :action => SevenApi::Hooks::Action::UNSUBSCRIBE }))
|
39
|
-
end
|
40
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /hooks.
|
6
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/webhooks
|
7
|
+
module SevenApi::Resources
|
8
|
+
class Hooks < SevenApi::Resource
|
9
|
+
@endpoint = SevenApi::Endpoint::HOOKS
|
10
|
+
@http_methods = {
|
11
|
+
:read => :get,
|
12
|
+
:subscribe => :post,
|
13
|
+
:unsubscribe => :post,
|
14
|
+
}
|
15
|
+
|
16
|
+
# Retrieve all webhooks
|
17
|
+
# @param params [Hash]
|
18
|
+
# @return [Hash]
|
19
|
+
def read(params = {})
|
20
|
+
request(:get, params.merge({ :action => SevenApi::Hooks::Action::READ }))
|
21
|
+
end
|
22
|
+
|
23
|
+
# Register a new webhook
|
24
|
+
# @param params [Hash]
|
25
|
+
# @return [Hash]
|
26
|
+
def subscribe(params)
|
27
|
+
SevenApi::Hooks::Validator::subscribe(params)
|
28
|
+
|
29
|
+
request(:post, params.merge({ :action => SevenApi::Hooks::Action::SUBSCRIBE }))
|
30
|
+
end
|
31
|
+
|
32
|
+
# Delete a webhook
|
33
|
+
# @param params [Hash]
|
34
|
+
# @return [Hash]
|
35
|
+
def unsubscribe(params)
|
36
|
+
SevenApi::Hooks::Validator::unsubscribe(params)
|
37
|
+
|
38
|
+
request(:post, params.merge({ :action => SevenApi::Hooks::Action::UNSUBSCRIBE }))
|
39
|
+
end
|
40
|
+
end
|
41
41
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /journal.
|
6
|
-
module SevenApi::Resources
|
7
|
-
class Journal < SevenApi::Resource
|
8
|
-
@endpoint = SevenApi::Endpoint::JOURNAL
|
9
|
-
@http_methods = {
|
10
|
-
:retrieve => :get,
|
11
|
-
}
|
12
|
-
|
13
|
-
# Retrieve the journal for associated API key
|
14
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/logbook
|
15
|
-
# @param params [Hash]
|
16
|
-
# @return [Array]
|
17
|
-
def retrieve(params)
|
18
|
-
request(params)
|
19
|
-
end
|
20
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /journal.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Journal < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::JOURNAL
|
9
|
+
@http_methods = {
|
10
|
+
:retrieve => :get,
|
11
|
+
}
|
12
|
+
|
13
|
+
# Retrieve the journal for associated API key
|
14
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/logbook
|
15
|
+
# @param params [Hash]
|
16
|
+
# @return [Array]
|
17
|
+
def retrieve(params)
|
18
|
+
request(:get, params)
|
19
|
+
end
|
20
|
+
end
|
21
21
|
end
|
@@ -1,64 +1,64 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /lookup.
|
6
|
-
module SevenApi::Resources
|
7
|
-
class Lookup < SevenApi::Resource
|
8
|
-
@endpoint = SevenApi::Endpoint::LOOKUP
|
9
|
-
@http_methods = {
|
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'
|
22
|
-
}
|
23
|
-
|
24
|
-
# Perform a caller name lookup
|
25
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#cnam
|
26
|
-
# @param number [String]
|
27
|
-
# @return [Hash,Array]
|
28
|
-
def cnam(number)
|
29
|
-
request({}, {number: number}, PATHS[:cnam])
|
30
|
-
end
|
31
|
-
|
32
|
-
# Retrieve phone number formats
|
33
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#format
|
34
|
-
# @param number [String]
|
35
|
-
# @return [String,Hash]
|
36
|
-
def format(number)
|
37
|
-
request({}, {number: number}, PATHS[:format])
|
38
|
-
end
|
39
|
-
|
40
|
-
# Perform a home location register lookup
|
41
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#hlr
|
42
|
-
# @param number [String]
|
43
|
-
# @return [Hash,Array]
|
44
|
-
def hlr(number)
|
45
|
-
request({}, {number: number}, PATHS[:hlr])
|
46
|
-
end
|
47
|
-
|
48
|
-
# Perform a mobile number portability lookup
|
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]
|
59
|
-
# @return [Hash,Array]
|
60
|
-
def rcs_capabilities(number)
|
61
|
-
request({}, {number: number}, PATHS[:rcs])
|
62
|
-
end
|
63
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /lookup.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Lookup < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::LOOKUP
|
9
|
+
@http_methods = {
|
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'
|
22
|
+
}
|
23
|
+
|
24
|
+
# Perform a caller name lookup
|
25
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#cnam
|
26
|
+
# @param number [String]
|
27
|
+
# @return [Hash,Array]
|
28
|
+
def cnam(number)
|
29
|
+
request(:get, {}, {number: number}, PATHS[:cnam])
|
30
|
+
end
|
31
|
+
|
32
|
+
# Retrieve phone number formats
|
33
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#format
|
34
|
+
# @param number [String]
|
35
|
+
# @return [String,Hash]
|
36
|
+
def format(number)
|
37
|
+
request(:get, {}, {number: number}, PATHS[:format])
|
38
|
+
end
|
39
|
+
|
40
|
+
# Perform a home location register lookup
|
41
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/lookup#hlr
|
42
|
+
# @param number [String]
|
43
|
+
# @return [Hash,Array]
|
44
|
+
def hlr(number)
|
45
|
+
request(:get, {}, {number: number}, PATHS[:hlr])
|
46
|
+
end
|
47
|
+
|
48
|
+
# Perform a mobile number portability lookup
|
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(:get, {}, {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]
|
59
|
+
# @return [Hash,Array]
|
60
|
+
def rcs_capabilities(number)
|
61
|
+
request(:get, {}, {number: number}, PATHS[:rcs])
|
62
|
+
end
|
63
|
+
end
|
64
64
|
end
|
@@ -1,70 +1,71 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /numbers.
|
6
|
-
module SevenApi::Resources
|
7
|
-
class
|
8
|
-
@endpoint = SevenApi::Endpoint::NUMBERS
|
9
|
-
@http_methods = {
|
10
|
-
:active => :get,
|
11
|
-
:available => :get,
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# @param
|
36
|
-
# @
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# @
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# @
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
#
|
63
|
-
#
|
64
|
-
# @param
|
65
|
-
# @
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /numbers.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Numbers < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::NUMBERS
|
9
|
+
@http_methods = {
|
10
|
+
:active => :get,
|
11
|
+
:available => :get,
|
12
|
+
:delete => :delete,
|
13
|
+
:order => :post,
|
14
|
+
:one => :get,
|
15
|
+
:update => :patch,
|
16
|
+
}
|
17
|
+
|
18
|
+
# Retrieve active phone numbers
|
19
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#active-numbers
|
20
|
+
# @return [Array]
|
21
|
+
def active
|
22
|
+
request(:get, {}, {}, '/active')
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
# Retrieve available phone numbers
|
27
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#available-numbers
|
28
|
+
# @return [Hash]
|
29
|
+
def available
|
30
|
+
request(:get, params, {}, '/available')
|
31
|
+
end
|
32
|
+
|
33
|
+
# Order a phone number
|
34
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#order-a-number
|
35
|
+
# @param number [String]
|
36
|
+
# @param payment_interval [String]
|
37
|
+
# @return [Hash]
|
38
|
+
def order(number, payment_interval = PaymentInterval.ASCENDING)
|
39
|
+
payload = {
|
40
|
+
number => number,
|
41
|
+
payment_interval => payment_interval,
|
42
|
+
}
|
43
|
+
request(:post, payload, {}, '/order')
|
44
|
+
end
|
45
|
+
|
46
|
+
# Delete a number
|
47
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#delete-number
|
48
|
+
# @param number [String]
|
49
|
+
# @return [Hash]
|
50
|
+
def delete(number, delete_immediately = false)
|
51
|
+
request(:delete, {}, {delete_immediately => delete_immediately}, "/active/#{number}")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retrieve a number
|
55
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#get-number
|
56
|
+
# @param number [String]
|
57
|
+
# @return [Hash]
|
58
|
+
def one(number)
|
59
|
+
request(:get, {}, {}, "/active/#{number}")
|
60
|
+
end
|
61
|
+
|
62
|
+
# Update a number
|
63
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/numbers#update-number
|
64
|
+
# @param number [String]
|
65
|
+
# @param params [Hash]
|
66
|
+
# @return [Hash]
|
67
|
+
def update(number, params)
|
68
|
+
request(:patch, params, {}, "/active/#{number}")
|
69
|
+
end
|
70
|
+
end
|
70
71
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /pricing.
|
6
|
-
module SevenApi::Resources
|
7
|
-
class Pricing < SevenApi::Resource
|
8
|
-
@endpoint = SevenApi::Endpoint::PRICING
|
9
|
-
@http_methods = {
|
10
|
-
:retrieve => :get,
|
11
|
-
}
|
12
|
-
|
13
|
-
# Retrieve pricing
|
14
|
-
# read more: https://docs.seven.io/en/rest-api/endpoints/account#prices
|
15
|
-
# @param params [Hash]
|
16
|
-
# @return [Hash,String]
|
17
|
-
def retrieve(params = {})
|
18
|
-
request(params)
|
19
|
-
end
|
20
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /pricing.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Pricing < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::PRICING
|
9
|
+
@http_methods = {
|
10
|
+
:retrieve => :get,
|
11
|
+
}
|
12
|
+
|
13
|
+
# Retrieve pricing
|
14
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/account#prices
|
15
|
+
# @param params [Hash]
|
16
|
+
# @return [Hash,String]
|
17
|
+
def retrieve(params = {})
|
18
|
+
request(:get, params)
|
19
|
+
end
|
20
|
+
end
|
21
21
|
end
|
@@ -17,7 +17,7 @@ module SevenApi::Resources
|
|
17
17
|
# @param params [Hash]
|
18
18
|
# @return [Hash]
|
19
19
|
def dispatch(params)
|
20
|
-
request(params, {}, '/messages')
|
20
|
+
request(:post, params, {}, '/messages')
|
21
21
|
end
|
22
22
|
|
23
23
|
# Delete scheduled RCS
|
@@ -25,7 +25,7 @@ module SevenApi::Resources
|
|
25
25
|
# @param params [Hash]
|
26
26
|
# @return [Hash]
|
27
27
|
def delete(params)
|
28
|
-
request({}, {}, "/messages/#{params[:id]}")
|
28
|
+
request(:delete, {}, {}, "/messages/#{params[:id]}")
|
29
29
|
end
|
30
30
|
|
31
31
|
# Send Event
|
@@ -33,7 +33,7 @@ module SevenApi::Resources
|
|
33
33
|
# @param params [Hash]
|
34
34
|
# @return [Hash]
|
35
35
|
def event(params)
|
36
|
-
request(params, {}, '/events')
|
36
|
+
request(:post, params, {}, '/events')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -1,21 +1,30 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'seven_api/resource'
|
4
|
-
|
5
|
-
# This module exposes the methods for communicating with the API endpoint /sms.
|
6
|
-
module SevenApi::Resources
|
7
|
-
class Sms < SevenApi::Resource
|
8
|
-
@endpoint = SevenApi::Endpoint::SMS
|
9
|
-
@http_methods = {
|
10
|
-
:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
# @
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'seven_api/resource'
|
4
|
+
|
5
|
+
# This module exposes the methods for communicating with the API endpoint /sms.
|
6
|
+
module SevenApi::Resources
|
7
|
+
class Sms < SevenApi::Resource
|
8
|
+
@endpoint = SevenApi::Endpoint::SMS
|
9
|
+
@http_methods = {
|
10
|
+
:delete => :delete,
|
11
|
+
:retrieve => :post,
|
12
|
+
}
|
13
|
+
|
14
|
+
# Delete SMS
|
15
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/sms#delete-sms
|
16
|
+
# @param ids [Array]
|
17
|
+
# @return [Hash]
|
18
|
+
def delete(ids)
|
19
|
+
request(:delete, ids)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Send SMS
|
23
|
+
# read more: https://docs.seven.io/en/rest-api/endpoints/sms#send-sms
|
24
|
+
# @param params [Hash]
|
25
|
+
# @return [Integer,String,Hash]
|
26
|
+
def retrieve(params)
|
27
|
+
request(:post, params)
|
28
|
+
end
|
29
|
+
end
|
21
30
|
end
|