vonage 7.2.1 → 7.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -1
  3. data/lib/vonage/abstract_authentication.rb +1 -1
  4. data/lib/vonage/applications/list_response.rb +1 -1
  5. data/lib/vonage/applications.rb +11 -3
  6. data/lib/vonage/basic.rb +1 -1
  7. data/lib/vonage/bearer_token.rb +1 -1
  8. data/lib/vonage/config.rb +1 -1
  9. data/lib/vonage/conversations/events.rb +6 -2
  10. data/lib/vonage/conversations/legs.rb +6 -2
  11. data/lib/vonage/conversations/members.rb +6 -2
  12. data/lib/vonage/conversations/users.rb +6 -2
  13. data/lib/vonage/conversations.rb +10 -3
  14. data/lib/vonage/entity.rb +0 -2
  15. data/lib/vonage/form_data.rb +1 -1
  16. data/lib/vonage/gsm7.rb +4 -1
  17. data/lib/vonage/json.rb +1 -1
  18. data/lib/vonage/jwt.rb +1 -1
  19. data/lib/vonage/namespace.rb +121 -16
  20. data/lib/vonage/numbers/list_response.rb +1 -1
  21. data/lib/vonage/numbers/response.rb +2 -2
  22. data/lib/vonage/numbers.rb +9 -1
  23. data/lib/vonage/params.rb +1 -1
  24. data/lib/vonage/response.rb +1 -0
  25. data/lib/vonage/secrets/list_response.rb +1 -1
  26. data/lib/vonage/secrets.rb +6 -2
  27. data/lib/vonage/user_agent.rb +4 -1
  28. data/lib/vonage/verify.rb +1 -1
  29. data/lib/vonage/version.rb +1 -1
  30. data/lib/vonage/voice/actions/connect.rb +199 -0
  31. data/lib/vonage/voice/actions/conversation.rb +107 -0
  32. data/lib/vonage/voice/actions/input.rb +119 -0
  33. data/lib/vonage/voice/actions/notify.rb +57 -0
  34. data/lib/vonage/voice/actions/record.rb +130 -0
  35. data/lib/vonage/voice/actions/stream.rb +72 -0
  36. data/lib/vonage/voice/actions/talk.rb +73 -0
  37. data/lib/vonage/voice/list_response.rb +1 -1
  38. data/lib/vonage/voice/ncco.rb +42 -0
  39. data/lib/vonage/voice.rb +9 -1
  40. data/vonage.gemspec +2 -0
  41. metadata +39 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc5bab327c1d3fb5c689bdd5c8958e3441332ad3e498da73bd1a82a67df6aaf9
4
- data.tar.gz: 9c9964bd8cfc08afd014ec8f9af1e4ba1f3c3a58b9c53b223c62e64a2f86bfa2
3
+ metadata.gz: 8a1f06b8ae136e6b1f143c728880b50a76bc977e1126eee9d905dea632d70c8f
4
+ data.tar.gz: 457cca5f4c829ccd4a63365935b3b119d49464745f052ede7f973eac38fbcfdf
5
5
  SHA512:
6
- metadata.gz: b6d915e490cbe3908dc5d62bfc3b2cf245611fcc5bbcd27b10a0c8af41fbc356f2322bd6c98c0fa46623e2a48dffef0ea1f5b831c059d9dd85380f0678eb03bf
7
- data.tar.gz: e2abd40a4876cb74772884aaddedfd73726282939a9f1ef361684ff67963155cbe79374571e01a022270060c91a185180e384cf82a74d1ea0fa17a2a1ee3646b
6
+ metadata.gz: 30c2ff5cda3bf5132abed93e12f05113c523301f5b1aab5040a9c9f2f82d0baea9a0a0033f500376dc013a57e384fe01bbc83fa89eac31e208c8baab5700906d
7
+ data.tar.gz: 42586b2544c38fc72233a01af85130cf5d8e6a7b5385d096cb7fa5e74fec189a8977f051f69a760dcf1264247edf8710e59b00cad4e259207cdb69cd7d686c95
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Vonage Server SDK for Ruby
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/vonage.svg)](https://badge.fury.io/rb/vonage) [![Coverage Status](https://github.com/Vonage/vonage-ruby-sdk/workflows/CI/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/Vonage/vonage-ruby-sdk/badge.svg?branch=master)](https://coveralls.io/github/Vonage/vonage-ruby-sdk?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/vonage.svg)](https://badge.fury.io/rb/vonage) ![Coverage Status](https://github.com/Vonage/vonage-ruby-sdk/workflows/CI/badge.svg) [![codecov](https://codecov.io/gh/Vonage/vonage-ruby-sdk/branch/7.x/graph/badge.svg?token=FKW6KL532P)](https://codecov.io/gh/Vonage/vonage-ruby-sdk)
4
+
4
5
 
5
6
  <img src="https://developer.nexmo.com/assets/images/Vonage_Nexmo.svg" height="48px" alt="Nexmo is now known as Vonage" />
6
7
 
@@ -14,6 +15,8 @@ need a Vonage account. Sign up [for free at vonage.com][signup].
14
15
  * [Overriding the default hosts](#overriding-the-default-hosts)
15
16
  * [JWT authentication](#jwt-authentication)
16
17
  * [Webhook signatures](#webhook-signatures)
18
+ * [Pagination](#pagination)
19
+ * [NCCO Builder](#ncco-builder)
17
20
  * [Documentation](#documentation)
18
21
  * [Frequently Asked Questions](#frequently-asked-questions)
19
22
  * [Supported APIs](#supported-apis)
@@ -148,6 +151,48 @@ Alternatively you can set the `VONAGE_SIGNATURE_SECRET` environment variable.
148
151
 
149
152
  Note: you'll need to contact support@nexmo.com to enable message signing on your account.
150
153
 
154
+ ## Pagination
155
+
156
+ Vonage APIs paginate list requests. This means that if a collection is requested that is larger than the API default, the API will return the first page of items in the collection. The Ruby SDK provides an `auto_advance` parameter that will traverse through the pages and return all the results in one response object.
157
+
158
+ The `auto_advance` parameter is set to a default of `true` for the following APIs:
159
+
160
+ * [Account API](https://developer.nexmo.com/api/developer/account)
161
+ * [Application API](https://developer.nexmo.com/api/application.v2)
162
+ * [Conversation API](https://developer.nexmo.com/api/conversation)
163
+ * [Voice API](https://developer.nexmo.com/api/voice)
164
+
165
+ To modify the `auto_advance` behavior you can specify it in your method:
166
+
167
+ ```ruby
168
+ client.applications.list(auto_advance: false)
169
+ ```
170
+
171
+ ## NCCO Builder
172
+
173
+ The Vonage Voice API accepts instructions via JSON objects called NCCOs. Each NCCO can be made up multiple actions that are executed in the order they are written. The Vonage API Developer Portal contains an [NCCO Reference](https://developer.vonage.com/voice/voice-api/ncco-reference) with instructions and information on all the parameters possible.
174
+
175
+ The SDK includes an NCCO builder that you can use to build NCCOs for your Voice API methods.
176
+
177
+ For example, to build `talk` and `input` NCCO actions and then combine them into a single NCCO you would do the following:
178
+
179
+ ```ruby
180
+ talk = Vonage::Voice::Ncco.talk(text: 'Hello World!')
181
+ input = Vonage::Voice::Ncco.input(type: ['dtmf'], dtmf: { bargeIn: true })
182
+ ncco = Vonage::Voice::Ncco.build(talk, input)
183
+
184
+ # => [{:action=>"talk", :text=>"Hello World!"}, {:action=>"input", :type=>["dtmf"], :dtmf=>{:bargeIn=>true}}]
185
+ ```
186
+
187
+ Once you have the constructed NCCO you can then use it in a Voice API request:
188
+
189
+ ```ruby
190
+ response = client.voice.create({
191
+ to: [{type: 'phone', number: '14843331234'}],
192
+ from: {type: 'phone', number: '14843335555'},
193
+ ncco: ncco
194
+ })
195
+ ```
151
196
 
152
197
  ## Documentation
153
198
 
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  module Vonage
4
4
  class AbstractAuthentication
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  class Vonage::Applications::ListResponse < Vonage::Response
4
4
  include Enumerable
@@ -69,14 +69,22 @@ module Vonage
69
69
  # @option params [Integer] :page
70
70
  # The current page number (starts at 1).
71
71
  #
72
+ # @option params [Boolean] :auto_advance
73
+ # Set this to `false` to not auto-advance through all the pages in the record
74
+ # and collect all the data. The default is `true`.
72
75
  # @param [Hash] params
73
- #
76
+ #
74
77
  # @return [ListResponse]
75
78
  #
76
79
  # @see https://developer.nexmo.com/api/application.v2#listApplication
77
80
  #
78
- sig { params(params: T.nilable(T::Hash[Symbol, Integer])).returns(Vonage::Response) }
79
- def list(params = nil)
81
+ sig { params(
82
+ params: T.nilable(T::Hash[Symbol, Integer]), auto_advance: T::Boolean).returns(Vonage::Applications::ListResponse) }
83
+ def list(params = nil, auto_advance = true)
84
+ if params && !params.key?(:auto_advance)
85
+ params.merge!(auto_advance: true)
86
+ end
87
+
80
88
  request('/v2/applications', params: params, response_class: ListResponse)
81
89
  end
82
90
 
data/lib/vonage/basic.rb CHANGED
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  module Vonage
4
4
  class Basic < AbstractAuthentication
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Vonage
data/lib/vonage/config.rb CHANGED
@@ -200,7 +200,7 @@ module Vonage
200
200
 
201
201
  protected
202
202
 
203
- sig { params(name: Symbol, value: T.nilable(T.untyped)).void }
203
+ sig { params(name: Symbol, value: T.untyped).void }
204
204
  def write_attribute(name, value)
205
205
  public_send(:"#{name}=", value)
206
206
  end
@@ -36,12 +36,16 @@ module Vonage
36
36
  #
37
37
  # @param [String] conversation_id
38
38
  #
39
+ # @option params [Boolean] :auto_advance
40
+ # Set this to `false` to not auto-advance through all the pages in the record
41
+ # and collect all the data. The default is `true`.
42
+ #
39
43
  # @return [Response]
40
44
  #
41
45
  # @see https://developer.nexmo.com/api/conversation#getEvents
42
46
  #
43
- def list(conversation_id)
44
- request('/beta/conversations/' + conversation_id + '/events')
47
+ def list(conversation_id, params = nil, auto_advance = true)
48
+ request('/beta/conversations/' + conversation_id + '/events', params: params)
45
49
  end
46
50
 
47
51
  # Retrieve an event.
@@ -7,12 +7,16 @@ module Vonage
7
7
 
8
8
  # List legs.
9
9
  #
10
+ # @option params [Boolean] :auto_advance
11
+ # Set this to `false` to not auto-advance through all the pages in the record
12
+ # and collect all the data. The default is `true`.
13
+ #
10
14
  # @return [Response]
11
15
  #
12
16
  # @see https://developer.nexmo.com/api/conversation#listLegs
13
17
  #
14
- def list
15
- request('/beta/legs')
18
+ def list(params = nil, auto_advance = true)
19
+ request('/beta/legs', params: params)
16
20
  end
17
21
 
18
22
  # Delete a leg.
@@ -47,12 +47,16 @@ module Vonage
47
47
  #
48
48
  # @param [String] conversation_id
49
49
  #
50
+ # @option params [Boolean] :auto_advance
51
+ # Set this to `false` to not auto-advance through all the pages in the record
52
+ # and collect all the data. The default is `true`.
53
+ #
50
54
  # @return [Response]
51
55
  #
52
56
  # @see https://developer.nexmo.com/api/conversation#getMembers
53
57
  #
54
- def list(conversation_id)
55
- request('/beta/conversations/' + conversation_id + '/members')
58
+ def list(conversation_id, params = nil, auto_advance = true)
59
+ request('/beta/conversations/' + conversation_id + '/members', params: params)
56
60
  end
57
61
 
58
62
  # Retrieve a member.
@@ -31,12 +31,16 @@ module Vonage
31
31
 
32
32
  # List users.
33
33
  #
34
+ # @option params [Boolean] :auto_advance
35
+ # Set this to `false` to not auto-advance through all the pages in the record
36
+ # and collect all the data. The default is `true`.
37
+ #
34
38
  # @return [Response]
35
39
  #
36
40
  # @see https://developer.nexmo.com/api/conversation#getUsers
37
41
  #
38
- def list
39
- request('/beta/users')
42
+ def list(params = nil, auto_advance = true)
43
+ request('/beta/users', params: params)
40
44
  end
41
45
 
42
46
  # Retrieve a user.
@@ -60,14 +60,21 @@ module Vonage
60
60
  # @option params ['asc', 'desc'] :order
61
61
  # Return the records in ascending or descending order.
62
62
  #
63
+ # @option params [Boolean] :auto_advance
64
+ # Set this to `false` to not auto-advance through all the pages in the record
65
+ # and collect all the data. The default is `true`.
63
66
  # @param [Hash, nil] params
64
- #
67
+ #
65
68
  # @return [Response]
66
69
  #
67
70
  # @see https://developer.nexmo.com/api/conversation#replaceConversation
68
71
  #
69
- sig { params(params: T.nilable(T::Hash[Symbol, T.untyped])).returns(Vonage::Response) }
70
- def list(params = nil)
72
+ sig { params(params: T.nilable(T::Hash[Symbol, T.untyped]), auto_advance: T::Boolean).returns(Vonage::Response) }
73
+ def list(params = nil, auto_advance = true)
74
+ if params && !params.key?(:auto_advance)
75
+ params.merge!(auto_advance: true)
76
+ end
77
+
71
78
  request('/beta/conversations', params: params)
72
79
  end
73
80
 
data/lib/vonage/entity.rb CHANGED
@@ -36,8 +36,6 @@ module Vonage
36
36
 
37
37
  attr_reader :attributes
38
38
 
39
- protected :attributes
40
-
41
39
  def each_pair(&block)
42
40
  return to_enum(:each_pair) unless block
43
41
 
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  module Vonage
4
4
  module FormData
data/lib/vonage/gsm7.rb CHANGED
@@ -1,11 +1,14 @@
1
- # typed: ignore
1
+ # typed: strong
2
2
 
3
3
  module Vonage
4
4
  module GSM7
5
+ extend T::Sig
6
+
5
7
  CHARACTERS = "\n\f\r !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~ ¡£¤¥§¿ÄÅÆÉÑÖØÜßàäåæçèéìñòöøùüΓΔΘΛΞΠΣΦΨΩ€"
6
8
 
7
9
  REGEXP = /\A[#{Regexp.escape(CHARACTERS)}]*\z/
8
10
 
11
+ sig { params(string: T.nilable(String)).returns(T.nilable(Integer)) }
9
12
  def self.encoded?(string)
10
13
  REGEXP =~ string
11
14
  end
data/lib/vonage/json.rb CHANGED
@@ -6,7 +6,7 @@ module Vonage
6
6
  module JSON
7
7
  extend T::Sig
8
8
 
9
- sig { params(http_request: T.any(Net::HTTP::Put, Net::HTTP::Post), params: T::Hash[Symbol, T.untyped]).void }
9
+ sig { params(http_request: T.any(Net::HTTP::Put, Net::HTTP::Post, Net::HTTP::Get), params: T::Hash[Symbol, T.untyped]).void }
10
10
  def self.update(http_request, params)
11
11
  http_request['Content-Type'] = 'application/json'
12
12
  http_request.body = ::JSON.generate(params)
data/lib/vonage/jwt.rb CHANGED
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
  require 'securerandom'
4
4
  require 'openssl'
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
  require 'net/http'
4
4
  require 'json'
@@ -47,41 +47,47 @@ module Vonage
47
47
  end
48
48
 
49
49
  protected
50
+ # :nocov:
50
51
 
51
52
  Get = Net::HTTP::Get
52
53
  Put = Net::HTTP::Put
53
54
  Post = Net::HTTP::Post
54
55
  Delete = Net::HTTP::Delete
55
56
 
56
- def request(path, params: nil, type: Get, response_class: Response, &block)
57
- uri = URI('https://' + @host + path)
58
-
59
- params ||= {}
60
-
57
+ def build_request(path:, type: Get, params: {})
61
58
  authentication = self.class.authentication.new(@config)
62
59
  authentication.update(params)
63
60
 
64
- unless type::REQUEST_HAS_BODY || params.empty?
61
+ uri = URI('https://' + @host + path)
62
+ unless type.const_get(:REQUEST_HAS_BODY) || params.empty?
65
63
  uri.query = Params.encode(params)
66
64
  end
67
65
 
66
+ # Set BasicAuth if neeeded
68
67
  authentication.update(uri)
69
68
 
70
- message = type.new(uri)
71
-
72
- message['User-Agent'] = UserAgent.string(@config.app_name, @config.app_version)
69
+ # instantiate request
70
+ request = type.new(uri)
73
71
 
72
+ # set headers
73
+ request['User-Agent'] = UserAgent.string(@config.app_name, @config.app_version)
74
74
  self.class.request_headers.each do |key, value|
75
- message[key] = value
75
+ request[key] = value
76
76
  end
77
77
 
78
- authentication.update(message)
78
+ # Set BearerToken if needed
79
+ authentication.update(request)
80
+
81
+ # set body
82
+ self.class.request_body.update(request, params) if type.const_get(:REQUEST_HAS_BODY)
79
83
 
80
- self.class.request_body.update(message, params) if type::REQUEST_HAS_BODY
84
+ request
85
+ end
81
86
 
82
- logger.log_request_info(message)
87
+ def make_request!(request, &block)
88
+ logger.log_request_info(request)
83
89
 
84
- response = @http.request(message, &block)
90
+ response = @http.request(request, &block)
85
91
 
86
92
  logger.log_response_info(response, @host)
87
93
 
@@ -89,7 +95,105 @@ module Vonage
89
95
 
90
96
  logger.debug(response.body) if response.body
91
97
 
92
- parse(response, response_class)
98
+ response
99
+ end
100
+
101
+ def request(path, params: nil, type: Get, response_class: Response, &block)
102
+ auto_advance = !params.nil? && params.key?(:auto_advance) ? params[:auto_advance] : false
103
+
104
+ params = params.tap { |params| params.delete(:auto_advance) } if !params.nil? && params.key?(:auto_advance)
105
+
106
+ request = build_request(path: path, params: params || {}, type: type)
107
+
108
+ response = make_request!(request, &block)
109
+
110
+ if auto_advance
111
+ iterable_request(path, response: response, response_class: response_class, &block)
112
+ else
113
+ return if block
114
+
115
+ parse(response, response_class)
116
+ end
117
+ end
118
+
119
+ def iterable_request(path, response: nil, response_class: nil, &block)
120
+ json_response = ::JSON.parse(response.body)
121
+ response = parse(response, response_class)
122
+ remainder = remaining_count(json_response)
123
+
124
+ while remainder > 0
125
+ params = { page_size: json_response['page_size'] }
126
+
127
+ if json_response['record_index'] && json_response['record_index'] == 0
128
+ params[:record_index] = json_response['page_size']
129
+ elsif json_response['record_index'] && json_response['record_index'] != 0
130
+ params[:record_index] = (json_response['record_index'] + json_response['page_size'])
131
+ end
132
+
133
+ if json_response['total_pages']
134
+ params[:page] = json_response['page'] + 1
135
+ end
136
+
137
+ request = build_request(path: path, type: Get, params: params)
138
+
139
+ # Make request...
140
+ paginated_response = make_request!(request)
141
+ next_response = parse(paginated_response, response_class)
142
+ json_response = ::JSON.parse(paginated_response.body)
143
+ remainder = remaining_count(json_response)
144
+
145
+ if response.respond_to?('_embedded')
146
+ collection_name = collection_name(response['_embedded'])
147
+ response['_embedded'][collection_name].push(*next_response['_embedded'][collection_name])
148
+ else
149
+ response[collection_name(response)].push(*next_response[collection_name(next_response)])
150
+ end
151
+ end
152
+
153
+ response
154
+ end
155
+
156
+ def remaining_count(params)
157
+ if params.key?('total_pages')
158
+ params['total_pages'] - params['page']
159
+ elsif params.key?('count')
160
+ params['count'] - (params['record_index'] == 0 ? params['page_size'] : (params['record_index'] + params['page_size']))
161
+ else
162
+ 0
163
+ end
164
+ end
165
+
166
+ def collection_name(params)
167
+ @collection_name ||= case
168
+ when params.respond_to?('calls')
169
+ 'calls'
170
+ when params.respond_to?('users')
171
+ 'users'
172
+ when params.respond_to?('legs')
173
+ 'legs'
174
+ when params.respond_to?('data')
175
+ 'data'
176
+ when params.respond_to?('conversations')
177
+ 'conversations'
178
+ when params.respond_to?('applications')
179
+ 'applications'
180
+ when params.respond_to?('records')
181
+ 'records'
182
+ when params.respond_to?('reports')
183
+ 'reports'
184
+ when params.respond_to?('networks')
185
+ 'networks'
186
+ when params.respond_to?('countries')
187
+ 'countries'
188
+ when params.respond_to?('media')
189
+ 'media'
190
+ when params.respond_to?('numbers')
191
+ 'numbers'
192
+ when params.respond_to?('events')
193
+ 'events'
194
+ else
195
+ params.entity.attributes.keys[0].to_s
196
+ end
93
197
  end
94
198
 
95
199
  def parse(response, response_class)
@@ -115,4 +219,5 @@ module Vonage
115
219
  end
116
220
 
117
221
  private_constant :Namespace
222
+ # :nocov:
118
223
  end
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  class Vonage::Numbers::ListResponse < Vonage::Response
4
4
  include Enumerable
@@ -1,8 +1,8 @@
1
- # typed: false
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
4
  class Vonage::Numbers::Response < Vonage::Response
5
5
  def success?
6
- error_code == '200'
6
+ T.unsafe(self).error_code == '200'
7
7
  end
8
8
  end
@@ -40,7 +40,11 @@ module Vonage
40
40
  #
41
41
  # @option params [Integer] :index
42
42
  # Page index.
43
- #
43
+ #
44
+ # @option params [Boolean] :auto_advance
45
+ # Set this to `true` to auto-advance through all the pages in the record
46
+ # and collect all the data. The default is `false`.
47
+ #
44
48
  # @param [Hash] params
45
49
  #
46
50
  # @return [ListResponse]
@@ -85,6 +89,10 @@ module Vonage
85
89
  # @option params [Integer] :index
86
90
  # Page index.
87
91
  #
92
+ # @option params [Boolean] :auto_advance
93
+ # Set this to `true` to auto-advance through all the pages in the record
94
+ # and collect all the data. The default is `false`.
95
+ #
88
96
  # @param [Hash] params
89
97
  #
90
98
  # @return [ListResponse]
data/lib/vonage/params.rb CHANGED
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
  require 'cgi'
4
4
 
@@ -9,6 +9,7 @@ module Vonage
9
9
  end
10
10
 
11
11
  attr_reader :http_response
12
+ attr_reader :entity
12
13
 
13
14
  def respond_to_missing?(name, include_private = false)
14
15
  return super if @entity.nil?
@@ -1,4 +1,4 @@
1
- # typed: ignore
1
+ # typed: true
2
2
 
3
3
  class Vonage::Secrets::ListResponse < Vonage::Response
4
4
  include Enumerable
@@ -38,12 +38,16 @@ module Vonage
38
38
  # puts "#{item.created_at} #{item.id}"
39
39
  # end
40
40
  #
41
+ # @option params [Boolean] :auto_advance
42
+ # Set this to `false` to not auto-advance through all the pages in the record
43
+ # and collect all the data. The default is `true`.
44
+ #
41
45
  # @return [ListResponse]
42
46
  #
43
47
  # @see https://developer.nexmo.com/api/account#retrieveAPISecrets
44
48
  #
45
- def list
46
- request('/accounts/' + account_id + '/secrets', response_class: ListResponse)
49
+ def list(params = nil, auto_advance = true)
50
+ request('/accounts/' + account_id + '/secrets', params: params, response_class: ListResponse)
47
51
  end
48
52
 
49
53
  # Retrieve one API Secret.
@@ -1,8 +1,11 @@
1
- # typed: ignore
1
+ # typed: strong
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Vonage
5
5
  module UserAgent
6
+ extend T::Sig
7
+
8
+ sig { params(app_name: T.nilable(String), app_version: T.nilable(String)).returns(String) }
6
9
  def self.string(app_name, app_version)
7
10
  identifiers = []
8
11
  identifiers << 'vonage-ruby/' + VERSION
data/lib/vonage/verify.rb CHANGED
@@ -42,7 +42,7 @@ module Vonage
42
42
  # Use this parameter to explicitly control the language, accent and gender used for the Verify request.
43
43
  #
44
44
  # @option params [Integer] :pin_expiry
45
- # How log the generated verification code is valid for, in seconds.
45
+ # How long the generated verification code is valid for, in seconds.
46
46
  # When you specify both **:pin_expiry** and **:next_event_wait** then **:pin_expiry** must be an integer multiple of **:next_event_wait** otherwise **:pin_expiry** is defaulted to equal **:next_event_wait**.
47
47
  # See [changing the event timings](https://developer.nexmo.com/verify/guides/changing-default-timings).
48
48
  #
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module Vonage
4
- VERSION = '7.2.1'
4
+ VERSION = '7.4.1'
5
5
  end