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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/ruby-client.iml +16 -4
  3. data/README.md +2 -2
  4. data/doc/{Sms77 → SevenApi}/Client.html +222 -222
  5. data/doc/{Sms77 → SevenApi}/Contacts/Action.html +130 -130
  6. data/doc/{Sms77 → SevenApi}/Contacts.html +125 -125
  7. data/doc/{Sms77 → SevenApi}/Endpoint.html +186 -186
  8. data/doc/{Sms77 → SevenApi}/Hooks/Action.html +130 -130
  9. data/doc/{Sms77 → SevenApi}/Hooks/EventType.html +145 -145
  10. data/doc/{Sms77 → SevenApi}/Hooks/RequestMethod.html +130 -130
  11. data/doc/{Sms77 → SevenApi}/Hooks/Validator.html +582 -582
  12. data/doc/{Sms77 → SevenApi}/Hooks.html +125 -125
  13. data/doc/{Sms77 → SevenApi}/Journal/Type.html +135 -135
  14. data/doc/{Sms77 → SevenApi}/Journal/Validator.html +380 -380
  15. data/doc/{Sms77 → SevenApi}/Journal.html +125 -125
  16. data/doc/{Sms77 → SevenApi}/Lookup/Type.html +135 -135
  17. data/doc/{Sms77 → SevenApi}/Lookup.html +125 -125
  18. data/doc/{Sms77 → SevenApi}/Resource.html +857 -857
  19. data/doc/{Sms77 → SevenApi}/Resources/Analytics.html +260 -260
  20. data/doc/{Sms77 → SevenApi}/Resources/Balance.html +243 -243
  21. data/doc/{Sms77 → SevenApi}/Resources/Contacts.html +445 -445
  22. data/doc/{Sms77 → SevenApi}/Resources/Hooks.html +453 -453
  23. data/doc/{Sms77 → SevenApi}/Resources/Journal.html +258 -258
  24. data/doc/{Sms77 → SevenApi}/Resources/Lookup.html +535 -535
  25. data/doc/{Sms77 → SevenApi}/Resources/Pricing.html +260 -260
  26. data/doc/{Sms77 → SevenApi}/Resources/Sms.html +258 -258
  27. data/doc/{Sms77 → SevenApi}/Resources/Status.html +258 -258
  28. data/doc/{Sms77 → SevenApi}/Resources/Subaccounts.html +645 -645
  29. data/doc/{Sms77 → SevenApi}/Resources/ValidateForVoice.html +258 -258
  30. data/doc/{Sms77 → SevenApi}/Resources/Voice.html +258 -258
  31. data/doc/SevenApi/Resources.html +128 -0
  32. data/doc/{Sms77 → SevenApi}/Sms/Type.html +125 -125
  33. data/doc/{Sms77 → SevenApi}/Sms.html +125 -125
  34. data/doc/{Sms77 → SevenApi}/Subaccounts/Action.html +140 -140
  35. data/doc/SevenApi/Subaccounts/Validator.html +490 -0
  36. data/doc/{Sms77 → SevenApi}/Subaccounts.html +125 -125
  37. data/doc/{Sms77 → SevenApi}/Util.html +993 -993
  38. data/doc/{Sms77.html → SevenApi.html} +145 -145
  39. data/doc/_index.html +443 -443
  40. data/doc/class_list.html +51 -51
  41. data/doc/css/full_list.css +58 -58
  42. data/doc/css/style.css +497 -497
  43. data/doc/file.README.html +110 -111
  44. data/doc/file_list.html +56 -56
  45. data/doc/frames.html +17 -17
  46. data/doc/index.html +110 -111
  47. data/doc/js/app.js +314 -314
  48. data/doc/js/full_list.js +216 -216
  49. data/doc/js/jquery.js +3 -3
  50. data/doc/method_list.html +563 -563
  51. data/doc/top-level-namespace.html +109 -109
  52. data/lib/seven_api/client.rb +2 -0
  53. data/lib/seven_api/contacts.rb +0 -5
  54. data/lib/seven_api/endpoint.rb +5 -0
  55. data/lib/seven_api/hooks.rb +1 -0
  56. data/lib/seven_api/lookup.rb +1 -0
  57. data/lib/seven_api/numbers.rb +9 -0
  58. data/lib/seven_api/paginated.rb +10 -0
  59. data/lib/seven_api/rcs.rb +9 -0
  60. data/lib/seven_api/resource.rb +8 -3
  61. data/lib/seven_api/resources/analytics.rb +38 -5
  62. data/lib/seven_api/resources/balance.rb +2 -2
  63. data/lib/seven_api/resources/contacts.rb +36 -18
  64. data/lib/seven_api/resources/groups.rb +57 -0
  65. data/lib/seven_api/resources/hooks.rb +1 -1
  66. data/lib/seven_api/resources/journal.rb +1 -1
  67. data/lib/seven_api/resources/lookup.rb +36 -20
  68. data/lib/seven_api/resources/numbers.rb +70 -0
  69. data/lib/seven_api/resources/pricing.rb +1 -1
  70. data/lib/seven_api/resources/rcs.rb +39 -0
  71. data/lib/seven_api/resources/sms.rb +1 -1
  72. data/lib/seven_api/resources/status.rb +1 -1
  73. data/lib/seven_api/resources/subaccounts.rb +5 -5
  74. data/lib/seven_api/resources/validate_for_voice.rb +1 -1
  75. data/lib/seven_api/resources/voice.rb +1 -1
  76. data/lib/seven_api/version.rb +1 -1
  77. data/seven_api.gemspec +5 -5
  78. data/spec/seven_api/analytics_spec.rb +49 -0
  79. data/spec/seven_api/balance_spec.rb +8 -2
  80. data/spec/seven_api/contacts_spec.rb +52 -81
  81. data/spec/seven_api/groups_spec.rb +74 -0
  82. data/spec/seven_api/lookup_spec.rb +51 -33
  83. data/spec/seven_api/numbers_spec.rb +135 -0
  84. data/spec/seven_api/rcs_spec.rb +99 -0
  85. data/spec/seven_api/sms_spec.rb +2 -2
  86. data/spec/seven_api/voice_spec.rb +2 -2
  87. data/spec/spec_helper.rb +8 -17
  88. metadata +64 -50
  89. data/doc/Sms77/Resources.html +0 -128
  90. 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
- &mdash; Documentation by YARD 0.9.27
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> &raquo;
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="Sms77.html" title="Sms77 (module)">Sms77</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 Wed Mar 30 13:55:36 2022 by
104
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
- 0.9.27 (ruby-2.7.4).
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
+ &mdash; 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> &raquo;
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>
@@ -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'
@@ -2,9 +2,4 @@
2
2
 
3
3
  # This module holds all utilities related to the /contacts endpoint.
4
4
  module SevenApi::Contacts
5
- module Action
6
- DEL = 'del'
7
- READ = 'read'
8
- WRITE = 'write'
9
- end
10
5
  end
@@ -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'
@@ -11,6 +11,7 @@ module SevenApi::Hooks
11
11
  module EventType
12
12
  ALL = 'all'
13
13
  NEW_INBOUND_SMS = 'sms_mo'
14
+ RCS = 'rcs'
14
15
  SMS_STATUS_UPDATE = 'dlr'
15
16
  TRACKING = 'tracking'
16
17
  VOICE_CALL = 'voice_call'
@@ -7,5 +7,6 @@ module SevenApi::Lookup
7
7
  FORMAT = 'format'
8
8
  HLR = 'hlr'
9
9
  MNP = 'mnp'
10
+ RCS = 'rcs'
10
11
  end
11
12
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This module holds all utilities related to the /numbers endpoint.
4
+ module SevenApi::Numbers
5
+ module PaymentInterval
6
+ ANNUALLY = 'annually'
7
+ MONTHLY = 'monthly'
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SevenApi
4
+ module Paginated
5
+ module OrderDirection
6
+ ASCENDING = 'asc'
7
+ DESCENDING = 'desc'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This module holds all utilities related to the /rcs endpoint.
4
+ module SevenApi::Rcs
5
+ module Event
6
+ IS_TYPING = 'IS_TYPING'
7
+ READ = 'READ'
8
+ end
9
+ end
@@ -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
- Faraday::Request::Authorization::KEY, "Bearer #{@api_key}",
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
- :retrieve => :get,
16
+ :by_country => :get,
17
+ :by_date => :get,
18
+ :by_label => :get,
19
+ :by_subaccount => :get,
11
20
  }
12
21
 
13
- # Retrieve analytics for associated API key
14
- # read more: https://www.seven.io/en/docs/gateway/http-api/analytics/
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 retrieve(params = {})
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://www.seven.io/en/docs/gateway/http-api/credit-balance/
15
- # @return [Float]
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
- :delete => :post,
11
- :read => :get,
12
- :write => :post,
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://www.seven.io/en/docs/gateway/http-api/contacts/#read-contacts
18
+ # read more: https://docs.seven.io/en/rest-api/endpoints/contacts#query-contact-list
17
19
  # @param params [Hash]
18
- # @return [String, Hash]
19
- def read(params = {})
20
- request(params.merge({ :action => SevenApi::Contacts::Action::READ }))
20
+ # @return [Hash]
21
+ def all(params = {})
22
+ request(params)
21
23
  end
22
24
 
23
- # Delete an account with given ID
24
- # read more: https://www.seven.io/en/docs/gateway/http-api/contacts/#delete-contacts
25
- # @param params [Hash]
26
- # @return [String, Hash]
27
- def delete(params)
28
- request({}, params.merge({ :action => SevenApi::Contacts::Action::DEL }))
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 or update a contact
32
- # read more: https://www.seven.io/en/docs/gateway/http-api/contacts/#create-and-edit-contacts
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 [String, Hash]
35
- def write(params)
36
- request({}, params.merge({ :action => SevenApi::Contacts::Action::WRITE }))
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://www.seven.io/en/docs/gateway/http-api/webhooks/
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://www.seven.io/en/docs/gateway/http-api/journal/
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 => :post,
11
- :format => :post,
12
- :hlr => :post,
13
- :mnp => :post,
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://www.seven.io/en/docs/gateway/http-api/cnam-lookup/
18
- # @param params [Hash]
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(params)
21
- request(params.merge({ :type => SevenApi::Lookup::Type::CNAM }))
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://www.seven.io/en/docs/gateway/http-api/nummernformat-lookup/
26
- # @param params [Hash]
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(params)
29
- request(params.merge({ :type => SevenApi::Lookup::Type::FORMAT }))
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://www.seven.io/en/docs/gateway/http-api/hlr-lookup/
34
- # @param params [Hash]
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(params)
37
- request(params.merge({ :type => SevenApi::Lookup::Type::HLR }))
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://www.seven.io/en/docs/gateway/http-api/mnp-lookup/
42
- # @param params [Hash]
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 mnp(params)
45
- request(params.merge({ :type => SevenApi::Lookup::Type::MNP }))
60
+ def rcs_capabilities(number)
61
+ request({}, {number: number}, PATHS[:rcs])
46
62
  end
47
63
  end
48
64
  end