nexmo 5.9.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -465
  3. data/lib/nexmo.rb +31 -48
  4. data/lib/nexmo/{authentication/abstract.rb → abstract_authentication.rb} +2 -2
  5. data/lib/nexmo/account.rb +4 -2
  6. data/lib/nexmo/alerts.rb +3 -3
  7. data/lib/nexmo/applications.rb +45 -63
  8. data/lib/nexmo/applications/list_response.rb +9 -0
  9. data/lib/nexmo/{errors/authentication_error.rb → authentication_error.rb} +0 -0
  10. data/lib/nexmo/{authentication/basic.rb → basic.rb} +1 -1
  11. data/lib/nexmo/{authentication/bearer_token.rb → bearer_token.rb} +1 -1
  12. data/lib/nexmo/calls.rb +18 -18
  13. data/lib/nexmo/{call_dtmf.rb → calls/dtmf.rb} +2 -2
  14. data/lib/nexmo/calls/list_response.rb +9 -0
  15. data/lib/nexmo/{call_stream.rb → calls/stream.rb} +3 -3
  16. data/lib/nexmo/{call_talk.rb → calls/talk.rb} +3 -3
  17. data/lib/nexmo/client.rb +20 -169
  18. data/lib/nexmo/{errors/client_error.rb → client_error.rb} +0 -0
  19. data/lib/nexmo/config.rb +165 -0
  20. data/lib/nexmo/conversations.rb +44 -13
  21. data/lib/nexmo/{conversation_events.rb → conversations/events.rb} +5 -5
  22. data/lib/nexmo/{conversation_legs.rb → conversations/legs.rb} +3 -3
  23. data/lib/nexmo/{conversation_members.rb → conversations/members.rb} +6 -6
  24. data/lib/nexmo/{conversation_users.rb → conversations/users.rb} +6 -6
  25. data/lib/nexmo/entity.rb +14 -0
  26. data/lib/nexmo/{errors/error.rb → error.rb} +0 -0
  27. data/lib/nexmo/files.rb +1 -2
  28. data/lib/nexmo/gsm7.rb +13 -0
  29. data/lib/nexmo/{authentication/key_secret_params.rb → key_secret_params.rb} +2 -2
  30. data/lib/nexmo/{authentication/key_secret_query.rb → key_secret_query.rb} +2 -2
  31. data/lib/nexmo/keys.rb +4 -22
  32. data/lib/nexmo/namespace.rb +22 -12
  33. data/lib/nexmo/number_insight.rb +6 -4
  34. data/lib/nexmo/number_insight/response.rb +5 -0
  35. data/lib/nexmo/numbers.rb +20 -12
  36. data/lib/nexmo/numbers/list_response.rb +9 -0
  37. data/lib/nexmo/numbers/response.rb +7 -0
  38. data/lib/nexmo/pricing.rb +2 -2
  39. data/lib/nexmo/pricing_types.rb +4 -4
  40. data/lib/nexmo/redact.rb +1 -1
  41. data/lib/nexmo/response.rb +23 -0
  42. data/lib/nexmo/secrets.rb +7 -7
  43. data/lib/nexmo/secrets/list_response.rb +9 -0
  44. data/lib/nexmo/{errors/server_error.rb → server_error.rb} +0 -0
  45. data/lib/nexmo/sms.rb +17 -3
  46. data/lib/nexmo/sms/response.rb +7 -0
  47. data/lib/nexmo/verify.rb +10 -8
  48. data/lib/nexmo/verify/response.rb +5 -0
  49. data/lib/nexmo/version.rb +1 -1
  50. data/nexmo.gemspec +4 -2
  51. metadata +45 -20
  52. data/lib/nexmo/applications_v2.rb +0 -102
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be987b38a38248e453aea6b9ea2497c90f217c28c0390660fbe662dc5d803153
4
- data.tar.gz: b497634a50563e3585438756a3b49cedda24292a0c0ffc23eab44f4a88b11f1e
3
+ metadata.gz: 5e702df1de8b82ca41c9e2eb4c74d728dcb085bb9acfa8c5f923f4d784fae31f
4
+ data.tar.gz: d57281c6ca1f226264089cf7b8fb1f9225387d0e467260db4425f1ae80dbf545
5
5
  SHA512:
6
- metadata.gz: 523601a55f30f41b2120447f706c3dbac0f09266af1cab4b4c0649d0007d0e811ada5e47a7e16475e8d33c8e05d5bec94bdbf7269d9fe41acd21181937e474df
7
- data.tar.gz: 93d788bbe424ed9076405eec77311e2880281dcd42f68996655f94679bd76c4ce4579f1751adcfa1d31041ec4bd140ac759f9121a6a83a0425c71605132fd2dc
6
+ metadata.gz: 3e698a4c3111bd3617256d548ac937b63c8b7d32bc08214eaa5fa17ee5d3725a03786a45e5fb2df6ee4e85e9e3db1f3668eaac47c92aeb0f4a0cee54575cff39
7
+ data.tar.gz: 6c395081cef140f543c2029ccc14a6f248467db19696c0f1455013253435afd677d224570d756d07a010fef3eb37cfd561015bf200bbb94adfecb4cfdaa86dc4
data/README.md CHANGED
@@ -8,26 +8,16 @@ need a Nexmo account. Sign up [for free at nexmo.com][signup].
8
8
  * [Requirements](#requirements)
9
9
  * [Installation](#installation)
10
10
  * [Usage](#usage)
11
- * [SMS API](#sms-api)
12
- * [2FA API](#2fa-api)
13
- * [Voice API](#voice-api)
14
- * [Verify API](#verify-api)
15
- * [Conversation API](#conversation-api)
16
- * [Number Insight API](#number-insight-api)
17
- * [Application API](#application-api)
18
- * [Numbers API](#numbers-api)
19
- * [Secret Management API](#secret-management-api)
20
- * [Redact API](#redact-api)
21
11
  * [Logging](#logging)
22
12
  * [JWT authentication](#jwt-authentication)
23
13
  * [Webhook signatures](#webhook-signatures)
24
- * [API coverage](#api-coverage)
14
+ * [Documentation](#documentation)
25
15
  * [License](#license)
26
16
 
27
17
 
28
18
  ## Requirements
29
19
 
30
- Nexmo Ruby supports CRuby 2.1.0+ and JRuby 9k.
20
+ Nexmo Ruby supports MRI/CRuby (2.5 or newer), JRuby (9.2.x), and Truffleruby.
31
21
 
32
22
 
33
23
  ## Installation
@@ -55,421 +45,20 @@ Then construct a client object with your key and secret:
55
45
  client = Nexmo::Client.new(api_key: 'YOUR-API-KEY', api_secret: 'YOUR-API-SECRET')
56
46
  ```
57
47
 
58
- You can now use the client object to [send an SMS](#send-an-sms),
59
- [start a verification](#start-a-verification), or [create an application](#create-an-application).
60
-
61
- For production you can specify the `NEXMO_API_KEY` and `NEXMO_API_SECRET`
62
- environment variables instead of specifying the key and secret explicitly,
63
- keeping your credentials out of source control.
64
-
65
-
66
- ## Credentials
67
-
68
- To check signatures for incoming webhook requests you'll also need to specify
69
- the `signature_secret` argument:
70
-
71
- ```ruby
72
- client = Nexmo::Client.new(signature_secret: 'secret')
73
- ```
74
-
75
- Alternatively you can set the `NEXMO_SIGNATURE_SECRET` environment variable.
76
-
77
- To call newer endpoints that support JWT authentication such as the Voice API you'll
78
- also need to specify the `application_id` and `private_key` arguments. For example:
79
-
80
- ```ruby
81
- client = Nexmo::Client.new(application_id: application_id, private_key: private_key)
82
- ```
83
-
84
- Both arguments should have string values corresponding to the `id` and `private_key`
85
- values returned in a ["create an application"](#create-an-application) response. These
86
- credentials can be stored in a datastore, in environment variables, on disk outside
87
- of source control, or in some kind of key management infrastructure.
88
-
89
-
90
- ## SMS API
91
-
92
- ### Send an SMS
93
-
94
- ```ruby
95
- response = client.sms.send(from: 'Ruby', to: 'YOUR NUMBER', text: 'Hello world')
96
-
97
- if response.messages.first.status == '0'
98
- puts "Sent message id=#{response.messages.first.message_id}"
99
- else
100
- puts "Error: #{response.messages.first.error_text}"
101
- end
102
- ```
103
-
104
- Docs: [https://developer.nexmo.com/api/sms#send-an-sms](https://developer.nexmo.com/api/sms?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#send-an-sms)
105
-
106
-
107
- ## 2FA API
108
-
109
- ### Send a 2FA Token
110
-
111
- ```ruby
112
- response = client.tfa.send(to: 'YOUR NUMBER', pin: '12345')
113
-
114
- if response.messages.first.status == '0'
115
- puts "Sent message id=#{response.messages.first.message_id}"
116
- else
117
- puts "Error: #{response.messages.first.error_text}"
118
- end
119
- ```
120
-
121
- Docs: [https://developer.nexmo.com/api/sms/us-short-codes/2fa](https://developer.nexmo.com/api/sms/us-short-codes/2fa?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library)
122
-
123
-
124
- ## Voice API
125
-
126
- ### Create an outbound call
127
-
128
- ```ruby
129
- response = client.calls.create({
130
- to: [{type: 'phone', number: '14843331234'}],
131
- from: {type: 'phone', number: '14843335555'},
132
- answer_url: ['https://example.com/answer']
133
- })
134
- ```
135
-
136
- Docs: [https://developer.nexmo.com/api/voice#createCall](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#createCall)
137
-
138
- ### Get details of your calls
139
-
140
- ```ruby
141
- response = client.calls.list
142
- ```
143
-
144
- Docs: [https://developer.nexmo.com/api/voice#getCalls](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#getCalls)
145
-
146
- ### Get detail of a specific call
147
-
148
- ```ruby
149
- response = client.calls.get(uuid)
150
- ```
151
-
152
- Docs: [https://developer.nexmo.com/api/voice#getCall](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#getCall)
153
-
154
- ### Modify an in progress call
155
-
156
- ```ruby
157
- response = client.calls.hangup(uuid)
158
- ```
159
-
160
- Docs: [https://developer.nexmo.com/api/voice#updateCall](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#updateCall)
161
-
162
- ### Play an audio file into a call
163
-
164
- ```ruby
165
- stream_url = 'https://nexmo-community.github.io/ncco-examples/assets/voice_api_audio_streaming.mp3'
166
-
167
- response = client.calls.stream.start(uuid, stream_url: [stream_url])
168
- ```
169
-
170
- Docs: [https://developer.nexmo.com/api/voice#startStream](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#startStream)
171
-
172
- ### Stop playing an audio file into a call
173
-
174
- ```ruby
175
- response = client.calls.stream.stop(uuid)
176
- ```
177
-
178
- Docs: [https://developer.nexmo.com/api/voice#stopStream](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stopStream)
179
-
180
- ### Play text to speech into a call
181
-
182
- ```ruby
183
- response = client.calls.talk.start(uuid, text: 'Hello')
184
- ```
185
-
186
- Docs: [https://developer.nexmo.com/api/voice#startTalk](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#startTalk)
187
-
188
- ### Stop text to speech in a call
189
-
190
- ```ruby
191
- response = client.calls.talk.stop(uuid)
192
- ```
193
-
194
- Docs: [https://developer.nexmo.com/api/voice#stopTalk](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stopTalk)
195
-
196
- ### Play DTMF tones into a call
197
-
198
- ```ruby
199
- response = client.calls.dtmf.send(uuid, digits: '1234')
200
- ```
201
-
202
- Docs: [https://developer.nexmo.com/api/voice#startDTMF](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#startDTMF)
203
-
204
-
205
- ## Verify API
206
-
207
- ### Start a verification
208
-
209
- ```ruby
210
- response = client.verify.request(number: '441632960960', brand: 'MyApp')
211
-
212
- if response.status == '0'
213
- puts "Started verification request_id=#{response.request_id}"
214
- else
215
- puts "Error: #{response.error_text}"
216
- end
217
- ```
218
-
219
- Docs: [https://developer.nexmo.com/api/verify#verify-request](https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#verify-request)
220
-
221
- The response contains a verification request id which you will need to store temporarily.
222
-
223
- ### Check a verification
224
-
225
- ```ruby
226
- response = client.verify.check(request_id: '00e6c3377e5348cdaf567e1417c707a5', code: '1234')
227
-
228
- if response.status == '0'
229
- puts "Verification complete, event_id=#{response.event_id}"
230
- else
231
- puts "Error: #{response.error_text}"
232
- end
233
- ```
234
-
235
- Docs: [https://developer.nexmo.com/api/verify#verify-check](https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#verify-check)
236
-
237
- The verification request id comes from the call to `client.verify.request`.
238
-
239
- The PIN code is entered into your application by the user.
240
-
241
- ### Cancel a verification
242
-
243
- ```ruby
244
- client.verify.cancel('00e6c3377e5348cdaf567e1417c707a5')
245
- ```
246
-
247
- Docs: [https://developer.nexmo.com/api/verify#verify-control](https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#verify-control)
248
-
249
- ### Trigger next verification step
250
-
251
- ```ruby
252
- client.verify.trigger_next_event('00e6c3377e5348cdaf567e1417c707a5')
253
- ```
254
-
255
- Docs: [https://developer.nexmo.com/api/verify#verify-control](https://developer.nexmo.com/api/verify?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#verify-control)
256
-
257
-
258
- ## Conversation API
259
-
260
- ### Create a conversation
261
-
262
- ```ruby
263
- response = client.conversations.create(name: 'Example Conversation', display_name: 'Example Display Name')
264
- ```
265
-
266
- Docs: [https://developer.nexmo.com/api/conversation#createConversation](https://developer.nexmo.com/api/conversation?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#createConversation)
267
-
268
- ### Retrieve a list of conversations
269
-
270
- ```ruby
271
- response = client.conversations.list
272
- ```
273
-
274
- Docs: [https://developer.nexmo.com/api/conversation#listConversations](https://developer.nexmo.com/api/conversation?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#listConversations)
275
-
276
- ### Retrieve a single conversation
48
+ You can now use the client object to call Nexmo APIs. For example, to send an SMS:
277
49
 
278
50
  ```ruby
279
- response = client.conversations.get(conversation_id)
51
+ client.sms.send(from: 'Ruby', to: '447700900000', text: 'Hello world')
280
52
  ```
281
53
 
282
- Docs: [https://developer.nexmo.com/api/conversation#retrieveConversation](https://developer.nexmo.com/api/conversation?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieveConversation)
283
-
284
- ### Update a conversation
285
-
286
- ```ruby
287
- response = client.conversations.update(conversation_id, answer_method: 'PUT')
288
- ```
289
-
290
- Docs: [https://developer.nexmo.com/api/conversation#replaceConversation](https://developer.nexmo.com/api/conversation?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#replaceConversation)
291
-
292
- ### Delete a conversation
293
-
294
- ```ruby
295
- response = client.conversations.delete(conversation_id)
296
- ```
297
-
298
- Docs: [https://developer.nexmo.com/api/conversation#deleteConversation](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#deleteConversation)
299
-
300
-
301
- ## Number Insight API
302
-
303
- ### Basic Number Insight
304
-
305
- ```ruby
306
- client.number_insight.basic(number: '447700900000')
307
- ```
308
-
309
- Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer.nexmo.com/api/number-insight?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#request)
310
-
311
- ### Standard Number Insight
312
-
313
- ```ruby
314
- client.number_insight.standard(number: '447700900000')
315
- ```
316
-
317
- Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer.nexmo.com/api/number-insight?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#request)
318
-
319
- ### Advanced Number Insight
320
-
321
- ```ruby
322
- client.number_insight.advanced(number: '447700900000')
323
- ```
324
-
325
- Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer.nexmo.com/api/number-insight?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#request)
326
-
327
- ### Advanced Number Insight Async
328
-
329
- ```ruby
330
- client.number_insight.advanced_async(number: '447700900000', callback: webhook_url)
331
- ```
332
-
333
- The results of the API call will be sent via HTTP POST to the webhook URL specified in the callback parameter.
334
-
335
- Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer.nexmo.com/api/number-insight?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#request)
336
-
337
-
338
- ## Application API
339
-
340
- ### Create an application
341
-
342
- ```ruby
343
- response = client.applications.create(name: 'Example App', type: 'voice', answer_url: answer_url, event_url: event_url)
344
- ```
345
-
346
- Docs: [https://developer.nexmo.com/api/application#create-an-application](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#create-an-application)
347
-
348
- ### Retrieve a list of applications
349
-
350
- ```ruby
351
- response = client.applications.list
352
- ```
353
-
354
- Docs: [https://developer.nexmo.com/api/application#retrieve-your-applications](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieve-your-applications)
355
-
356
- ### Retrieve a single application
357
-
358
- ```ruby
359
- response = client.applications.get(uuid)
360
- ```
361
-
362
- Docs: [https://developer.nexmo.com/api/application#retrieve-an-application](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieve-an-application)
363
-
364
- ### Update an application
365
-
366
- ```ruby
367
- response = client.applications.update(uuid, answer_method: 'POST')
368
- ```
369
-
370
- Docs: [https://developer.nexmo.com/api/application#update-an-application](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#update-an-application)
371
-
372
- ### Delete an application
373
-
374
- ```ruby
375
- response = client.applications.delete(uuid)
376
- ```
377
-
378
- Docs: [https://developer.nexmo.com/api/application#destroy-an-application](https://developer.nexmo.com/api/application?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#destroy-an-application)
379
-
380
-
381
- ## Numbers API
382
-
383
- ### List owned numbers
384
-
385
- ```ruby
386
- client.numbers.list
387
- ```
388
-
389
- Docs: [https://developer.nexmo.com/api/developer/numbers#list-owned-numbers](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#list-owned-numbers)
390
-
391
- ### Search available numbers
392
-
393
- ```ruby
394
- client.numbers.search(country: 'GB')
395
- ```
396
-
397
- Docs: [https://developer.nexmo.com/api/developer/numbers#search-available-numbers](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#search-available-numbers)
398
-
399
- ### Buy a number
400
-
401
- ```ruby
402
- client.numbers.buy(country: 'GB', msisdn: '447700900000')
403
- ```
404
-
405
- Docs: [https://developer.nexmo.com/api/developer/numbers#buy-a-number](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#buy-a-number)
406
-
407
- ### Cancel a number
408
-
409
- ```ruby
410
- client.numbers.cancel(country: 'GB', msisdn: '447700900000')
411
- ```
412
-
413
- Docs: [https://developer.nexmo.com/api/developer/numbers#cancel-a-number](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#cancel-a-number)
414
-
415
- ### Update a number
416
-
417
- ```ruby
418
- client.numbers.update(country: 'GB', msisdn: '447700900000', voice_callback_type: 'app', voice_callback_value: application_id)
419
- ```
420
-
421
- Docs: [https://developer.nexmo.com/api/developer/numbers#update-a-number](https://developer.nexmo.com/api/developer/numbers?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#update-a-number)
422
-
423
-
424
- ## Secret Management API
425
-
426
- ### Retrieve a list of secrets
427
-
428
- ```ruby
429
- client.secrets.list
430
- ```
431
-
432
- Docs: [https://developer.nexmo.com/api/account/secret-management#retrieveSecrets](https://developer.nexmo.com/api/account/secret-management?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieveSecrets)
433
-
434
- ### Create a secret
435
-
436
- ```ruby
437
- client.secrets.create(secret: 't0ps3cr3t')
438
- ```
439
-
440
- Docs: [https://developer.nexmo.com/api/account/secret-management#createSecret](https://developer.nexmo.com/api/account/secret-management?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#createSecret)
441
-
442
- ### Retrieve a secret
443
-
444
- ```ruby
445
- client.secrets.get(secret_id)
446
- ```
447
-
448
- Docs: [https://developer.nexmo.com/api/account/secret-management#retrieveSecret](https://developer.nexmo.com/api/account/secret-management?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieveSecret)
449
-
450
- ### Revoke a secret
451
-
452
- ```ruby
453
- client.secrets.revoke(secret_id)
454
- ```
455
-
456
- Docs: [https://developer.nexmo.com/api/account/secret-management#revokeSecret](https://developer.nexmo.com/api/account/secret-management?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#revokeSecret)
457
-
458
-
459
- ## Redact API
460
-
461
- ### Redact a specific message
462
-
463
- ```ruby
464
- client.redact.transaction(id: '00A0B0C0', product: 'sms')
465
- ```
466
-
467
- Docs: [https://developer.nexmo.com/api/redact#transaction](https://developer.nexmo.com/api/redact?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#transaction)
54
+ For production you can specify the `NEXMO_API_KEY` and `NEXMO_API_SECRET`
55
+ environment variables instead of specifying the key and secret explicitly,
56
+ keeping your credentials out of source control.
468
57
 
469
58
 
470
59
  ## Logging
471
60
 
472
- Use the logger option or attribute writer method to specify a logger. For example:
61
+ Use the logger option to specify a logger. For example:
473
62
 
474
63
  ```ruby
475
64
  require 'logger'
@@ -486,11 +75,21 @@ To disable logging set the logger to `nil`.
486
75
 
487
76
  ## JWT authentication
488
77
 
489
- By default the library generates a short lived JWT per request.
78
+ To call newer endpoints that support JWT authentication such as the Voice API you'll
79
+ also need to specify the `application_id` and `private_key` options. For example:
80
+
81
+ ```ruby
82
+ client = Nexmo::Client.new(application_id: application_id, private_key: private_key)
83
+ ```
84
+
85
+ Both arguments should have string values corresponding to the `id` and `private_key`
86
+ values returned in a ["create an application"](https://developer.nexmo.com/api/application.v2#createApplication)
87
+ response. These credentials can be stored in a datastore, in environment variables,
88
+ on disk outside of source control, or in some kind of key management infrastructure.
490
89
 
491
- To generate a long lived JWT for multiple requests or to specify JWT claims
492
- directly call `Nexmo::JWT.generate` to generate a token, and set the token
493
- attribute on the client object. For example:
90
+ By default the library generates a short lived JWT per request. To generate a long lived
91
+ JWT for multiple requests or to specify JWT claims directly use `Nexmo::JWT.generate` and
92
+ the token option. For example:
494
93
 
495
94
  ```ruby
496
95
  claims = {
@@ -502,12 +101,16 @@ claims = {
502
101
 
503
102
  private_key = File.read('path/to/private.key')
504
103
 
505
- client.token = Nexmo::JWT.generate(claims, private_key)
104
+ token = Nexmo::JWT.generate(claims, private_key)
105
+
106
+ client = Nexmo::Client.new(token: token)
506
107
  ````
507
108
 
508
109
 
509
110
  ## Webhook signatures
510
111
 
112
+ To check webhook signatures you'll also need to specify the `signature_secret` option. For example:
113
+
511
114
  ```ruby
512
115
  client = Nexmo::Client.new(signature_secret: 'secret')
513
116
 
@@ -518,51 +121,18 @@ else
518
121
  end
519
122
  ```
520
123
 
521
- Docs: [https://developer.nexmo.com/concepts/guides/signing-messages](https://developer.nexmo.com/concepts/guides/signing-messages?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library)
124
+ Alternatively you can set the `NEXMO_SIGNATURE_SECRET` environment variable.
522
125
 
523
126
  Note: you'll need to contact support@nexmo.com to enable message signing on your account.
524
127
 
525
128
 
526
- ## API coverage
527
-
528
- * Account
529
- * [X] Balance
530
- * [X] Pricing
531
- * [X] Settings
532
- * [X] Top Up
533
- * [X] Numbers
534
- * [X] Search
535
- * [X] Buy
536
- * [X] Cancel
537
- * [X] Update
538
- * Number Insight
539
- * [X] Basic
540
- * [X] Standard
541
- * [X] Advanced
542
- * [ ] Webhook Notification
543
- * Verify
544
- * [X] Verify
545
- * [X] Check
546
- * [X] Search
547
- * [X] Control
548
- * Messaging
549
- * [X] Send
550
- * [ ] Delivery Receipt
551
- * [ ] Inbound Messages
552
- * [X] Search
553
- * [X] Message
554
- * [X] Messages
555
- * [X] Rejections
556
- * [X] US Short Codes
557
- * [X] Two-Factor Authentication
558
- * [X] Event Based Alerts
559
- * [X] Sending Alerts
560
- * [X] Campaign Subscription Management
561
- * Voice
562
- * [X] Outbound Calls
563
- * [ ] Inbound Call
564
- * [X] Text-To-Speech Call
565
- * [X] Text-To-Speech Prompt
129
+ ## Documentation
130
+
131
+ Nexmo Ruby documentation: https://www.rubydoc.info/github/nexmo/nexmo-ruby
132
+
133
+ Nexmo Ruby code examples: https://github.com/Nexmo/nexmo-ruby-code-snippets
134
+
135
+ Nexmo API reference: https://developer.nexmo.com/api
566
136
 
567
137
 
568
138
  ## License