nexmo 4.8.0 → 5.0.0.pre1
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/README.md +48 -42
- data/lib/nexmo.rb +20 -0
- data/lib/nexmo/account.rb +23 -0
- data/lib/nexmo/alerts.rb +25 -0
- data/lib/nexmo/applications.rb +25 -0
- data/lib/nexmo/call_dtmf.rb +15 -0
- data/lib/nexmo/call_stream.rb +19 -0
- data/lib/nexmo/call_talk.rb +19 -0
- data/lib/nexmo/calls.rb +68 -0
- data/lib/nexmo/client.rb +75 -324
- data/lib/nexmo/conversions.rb +15 -0
- data/lib/nexmo/entity.rb +53 -0
- data/lib/nexmo/files.rb +25 -0
- data/lib/nexmo/jwt.rb +2 -1
- data/lib/nexmo/keys.rb +31 -0
- data/lib/nexmo/messages.rb +23 -0
- data/lib/nexmo/namespace.rb +83 -0
- data/lib/nexmo/number_insight.rb +21 -0
- data/lib/nexmo/numbers.rb +33 -0
- data/lib/nexmo/pricing.rb +31 -0
- data/lib/nexmo/pricing_types.rb +17 -0
- data/lib/nexmo/signature.rb +9 -1
- data/lib/nexmo/sms.rb +17 -0
- data/lib/nexmo/user_agent.rb +13 -0
- data/lib/nexmo/verify.rb +31 -0
- data/lib/nexmo/version.rb +1 -1
- data/nexmo.gemspec +3 -11
- metadata +39 -23
- data/spec/nexmo/client_spec.rb +0 -651
- data/spec/nexmo/jwt_spec.rb +0 -53
- data/spec/nexmo/params_spec.rb +0 -18
- data/spec/nexmo/signature_spec.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 639e15b4528acd516e42819a9e31082679af8602
|
4
|
+
data.tar.gz: 3668f21fa546e4de69cd4341655a64a5438d8273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 715dc4611c9310ae2776a43ab422c1d6a61980277b6ac62c52bfc3d02428d3d93de99749fc7e7e4d3ccfeb4c7b5cba97e5e61d6dbf55b4199b041a12d32759ab
|
7
|
+
data.tar.gz: 5c4f1fd0ee8fb5b8202082643b386f8aea7596b2ac5ccab568530f19f6c32cdb60331c7d159212b0e85b3cc300a1f9507df7f6cd36c8c3e5bf24e14de7a97a2c
|
data/README.md
CHANGED
@@ -17,6 +17,11 @@ need a Nexmo account. Sign up [for free at nexmo.com][signup].
|
|
17
17
|
* [License](#license)
|
18
18
|
|
19
19
|
|
20
|
+
## Requirements
|
21
|
+
|
22
|
+
Nexmo Ruby supports CRuby 2.0.0+ and JRuby 9k.
|
23
|
+
|
24
|
+
|
20
25
|
## Installation
|
21
26
|
|
22
27
|
To install the Ruby client library using Rubygems:
|
@@ -39,7 +44,7 @@ require 'nexmo'
|
|
39
44
|
Then construct a client object with your key and secret:
|
40
45
|
|
41
46
|
```ruby
|
42
|
-
client = Nexmo::Client.new(
|
47
|
+
client = Nexmo::Client.new(api_key: 'YOUR-API-KEY', api_secret: 'YOUR-API-SECRET')
|
43
48
|
```
|
44
49
|
|
45
50
|
You can now use the client object to [send a text message](#send-a-text-message),
|
@@ -79,12 +84,12 @@ of source control, or in some kind of key management infrastructure.
|
|
79
84
|
### Send a text message
|
80
85
|
|
81
86
|
```ruby
|
82
|
-
response = client.
|
87
|
+
response = client.sms.send(from: 'Ruby', to: 'YOUR NUMBER', text: 'Hello world')
|
83
88
|
|
84
|
-
if response
|
85
|
-
puts "Sent message
|
89
|
+
if response.messages.first.status == '0'
|
90
|
+
puts "Sent message id=#{response.messages.first.message_id}"
|
86
91
|
else
|
87
|
-
puts "Error: #{response
|
92
|
+
puts "Error: #{response.messages.first.error_text}"
|
88
93
|
end
|
89
94
|
```
|
90
95
|
|
@@ -96,7 +101,7 @@ Docs: [https://developer.nexmo.com/api/sms#request](https://developer.nexmo.com/
|
|
96
101
|
### Make a call
|
97
102
|
|
98
103
|
```ruby
|
99
|
-
response = client.
|
104
|
+
response = client.calls.create({
|
100
105
|
to: [{type: 'phone', number: '14843331234'}],
|
101
106
|
from: {type: 'phone', number: '14843335555'},
|
102
107
|
answer_url: ['https://example.com/answer']
|
@@ -108,7 +113,7 @@ Docs: [https://developer.nexmo.com/api/voice#create-an-outbound-call](https://de
|
|
108
113
|
### Retrieve a list of calls
|
109
114
|
|
110
115
|
```ruby
|
111
|
-
response = client.
|
116
|
+
response = client.calls.list
|
112
117
|
```
|
113
118
|
|
114
119
|
Docs: [https://developer.nexmo.com/api/voice#retrieve-information-about-all-your-calls](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieve-information-about-all-your-calls)
|
@@ -116,7 +121,7 @@ Docs: [https://developer.nexmo.com/api/voice#retrieve-information-about-all-your
|
|
116
121
|
### Retrieve a single call
|
117
122
|
|
118
123
|
```ruby
|
119
|
-
response = client.
|
124
|
+
response = client.calls.get(uuid)
|
120
125
|
```
|
121
126
|
|
122
127
|
Docs: [https://developer.nexmo.com/api/voice#retrieve-information-about-a-single-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#retrieve-information-about-a-single-call)
|
@@ -124,7 +129,7 @@ Docs: [https://developer.nexmo.com/api/voice#retrieve-information-about-a-single
|
|
124
129
|
### Update a call
|
125
130
|
|
126
131
|
```ruby
|
127
|
-
response = client.
|
132
|
+
response = client.calls.hangup(uuid)
|
128
133
|
```
|
129
134
|
|
130
135
|
Docs: [https://developer.nexmo.com/api/voice#modify-an-existing-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#modify-an-existing-call)
|
@@ -134,7 +139,7 @@ Docs: [https://developer.nexmo.com/api/voice#modify-an-existing-call](https://de
|
|
134
139
|
```ruby
|
135
140
|
stream_url = 'https://nexmo-community.github.io/ncco-examples/assets/voice_api_audio_streaming.mp3'
|
136
141
|
|
137
|
-
response = client.
|
142
|
+
response = client.stream.start(uuid, stream_url: stream_url)
|
138
143
|
```
|
139
144
|
|
140
145
|
Docs: [https://developer.nexmo.com/api/voice#stream-an-audio-file-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stream-an-audio-file-to-an-active-call)
|
@@ -142,7 +147,7 @@ Docs: [https://developer.nexmo.com/api/voice#stream-an-audio-file-to-an-active-c
|
|
142
147
|
### Stop streaming audio to a call
|
143
148
|
|
144
149
|
```ruby
|
145
|
-
response = client.
|
150
|
+
response = client.stream.stop(uuid)
|
146
151
|
```
|
147
152
|
|
148
153
|
Docs: [https://developer.nexmo.com/api/voice#stop-streaming-an-audio-file-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stop-streaming-an-audio-file-to-an-active-call)
|
@@ -150,7 +155,7 @@ Docs: [https://developer.nexmo.com/api/voice#stop-streaming-an-audio-file-to-an-
|
|
150
155
|
### Send a synthesized speech message to a call
|
151
156
|
|
152
157
|
```ruby
|
153
|
-
response = client.
|
158
|
+
response = client.talk.start(uuid, text: 'Hello')
|
154
159
|
```
|
155
160
|
|
156
161
|
Docs: [https://developer.nexmo.com/api/voice#send-a-synthesized-speech-message-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#send-a-synthesized-speech-message-to-an-active-call)
|
@@ -158,7 +163,7 @@ Docs: [https://developer.nexmo.com/api/voice#send-a-synthesized-speech-message-t
|
|
158
163
|
### Stop sending a synthesized speech message to a call
|
159
164
|
|
160
165
|
```ruby
|
161
|
-
response = client.
|
166
|
+
response = client.talk.stop(uuid)
|
162
167
|
```
|
163
168
|
|
164
169
|
Docs: [https://developer.nexmo.com/api/voice#stop-sending-a-synthesized-speech-message-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#stop-sending-a-synthesized-speech-message-to-an-active-call)
|
@@ -166,7 +171,7 @@ Docs: [https://developer.nexmo.com/api/voice#stop-sending-a-synthesized-speech-m
|
|
166
171
|
### Send DTMF tones to a call
|
167
172
|
|
168
173
|
```ruby
|
169
|
-
response = client.
|
174
|
+
response = client.dtmf.send(uuid, digits: '1234')
|
170
175
|
```
|
171
176
|
|
172
177
|
Docs: [https://developer.nexmo.com/api/voice#send-dual-tone-multi-frequency-dtmf-tones-to-an-active-call](https://developer.nexmo.com/api/voice?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library#send-dual-tone-multi-frequency-dtmf-tones-to-an-active-call)
|
@@ -177,12 +182,12 @@ Docs: [https://developer.nexmo.com/api/voice#send-dual-tone-multi-frequency-dtmf
|
|
177
182
|
### Start a verification
|
178
183
|
|
179
184
|
```ruby
|
180
|
-
response = client.
|
185
|
+
response = client.verify.request(number: '441632960960', brand: 'MyApp')
|
181
186
|
|
182
|
-
if response
|
183
|
-
puts "Started verification request_id=#{response
|
187
|
+
if response.status == '0'
|
188
|
+
puts "Started verification request_id=#{response.request_id}"
|
184
189
|
else
|
185
|
-
puts "Error: #{response
|
190
|
+
puts "Error: #{response.error_text}"
|
186
191
|
end
|
187
192
|
```
|
188
193
|
|
@@ -193,25 +198,25 @@ The response contains a verification request id which you will need to store tem
|
|
193
198
|
### Check a verification
|
194
199
|
|
195
200
|
```ruby
|
196
|
-
response = client.
|
201
|
+
response = client.verify.check(request_id: '00e6c3377e5348cdaf567e1417c707a5', code: '1234')
|
197
202
|
|
198
|
-
if response
|
199
|
-
puts "Verification complete, event_id=#{response
|
203
|
+
if response.status == '0'
|
204
|
+
puts "Verification complete, event_id=#{response.event_id}"
|
200
205
|
else
|
201
|
-
puts "Error: #{response
|
206
|
+
puts "Error: #{response.error_text}"
|
202
207
|
end
|
203
208
|
```
|
204
209
|
|
205
210
|
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)
|
206
211
|
|
207
|
-
The verification request id comes from the call to
|
212
|
+
The verification request id comes from the call to `client.verify.request`.
|
208
213
|
|
209
214
|
The PIN code is entered into your application by the user.
|
210
215
|
|
211
216
|
### Cancel a verification
|
212
217
|
|
213
218
|
```ruby
|
214
|
-
client.
|
219
|
+
client.verify.cancel('00e6c3377e5348cdaf567e1417c707a5')
|
215
220
|
```
|
216
221
|
|
217
222
|
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)
|
@@ -219,17 +224,18 @@ Docs: [https://developer.nexmo.com/api/verify#verify-control](https://developer.
|
|
219
224
|
### Trigger next verification step
|
220
225
|
|
221
226
|
```ruby
|
222
|
-
client.
|
227
|
+
client.verify.trigger_next_event('00e6c3377e5348cdaf567e1417c707a5')
|
223
228
|
```
|
224
229
|
|
225
230
|
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)
|
226
231
|
|
232
|
+
|
227
233
|
## Number Insight API
|
228
234
|
|
229
235
|
### Basic Number Insight
|
230
236
|
|
231
237
|
```ruby
|
232
|
-
client.
|
238
|
+
client.number_insight.basic(number: '447700900000')
|
233
239
|
```
|
234
240
|
|
235
241
|
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)
|
@@ -237,7 +243,7 @@ Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer
|
|
237
243
|
### Standard Number Insight
|
238
244
|
|
239
245
|
```ruby
|
240
|
-
client.
|
246
|
+
client.number_insight.standard(number: '447700900000')
|
241
247
|
```
|
242
248
|
|
243
249
|
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)
|
@@ -245,7 +251,7 @@ Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer
|
|
245
251
|
### Advanced Number Insight
|
246
252
|
|
247
253
|
```ruby
|
248
|
-
client.
|
254
|
+
client.number_insight.advanced(number: '447700900000')
|
249
255
|
```
|
250
256
|
|
251
257
|
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)
|
@@ -253,7 +259,7 @@ Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer
|
|
253
259
|
### Advanced Number Insight Async
|
254
260
|
|
255
261
|
```ruby
|
256
|
-
client.
|
262
|
+
client.number_insight.advanced_async(number: '447700900000', callback: webhook_url)
|
257
263
|
```
|
258
264
|
|
259
265
|
The results of the API call will be sent via HTTP POST to the webhook URL specified in the callback parameter.
|
@@ -266,7 +272,7 @@ Docs: [https://developer.nexmo.com/api/number-insight#request](https://developer
|
|
266
272
|
### Create an application
|
267
273
|
|
268
274
|
```ruby
|
269
|
-
response = client.
|
275
|
+
response = client.applications.create(name: 'Example App', type: 'voice', answer_url: answer_url, event_url: event_url)
|
270
276
|
```
|
271
277
|
|
272
278
|
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)
|
@@ -274,7 +280,7 @@ Docs: [https://developer.nexmo.com/api/application#create-an-application](https:
|
|
274
280
|
### Retrieve a list of applications
|
275
281
|
|
276
282
|
```ruby
|
277
|
-
response = client.
|
283
|
+
response = client.applications.list
|
278
284
|
```
|
279
285
|
|
280
286
|
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)
|
@@ -282,7 +288,7 @@ Docs: [https://developer.nexmo.com/api/application#retrieve-your-applications](h
|
|
282
288
|
### Retrieve a single application
|
283
289
|
|
284
290
|
```ruby
|
285
|
-
response = client.
|
291
|
+
response = client.applications.get(uuid)
|
286
292
|
```
|
287
293
|
|
288
294
|
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)
|
@@ -290,7 +296,7 @@ Docs: [https://developer.nexmo.com/api/application#retrieve-an-application](http
|
|
290
296
|
### Update an application
|
291
297
|
|
292
298
|
```ruby
|
293
|
-
response = client.
|
299
|
+
response = client.applications.update(uuid, answer_method: 'POST')
|
294
300
|
```
|
295
301
|
|
296
302
|
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)
|
@@ -298,7 +304,7 @@ Docs: [https://developer.nexmo.com/api/application#update-an-application](https:
|
|
298
304
|
### Delete an application
|
299
305
|
|
300
306
|
```ruby
|
301
|
-
response = client.
|
307
|
+
response = client.applications.delete(uuid)
|
302
308
|
```
|
303
309
|
|
304
310
|
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)
|
@@ -309,7 +315,7 @@ Docs: [https://developer.nexmo.com/api/application#destroy-an-application](https
|
|
309
315
|
### List owned numbers
|
310
316
|
|
311
317
|
```ruby
|
312
|
-
client.
|
318
|
+
client.numbers.list
|
313
319
|
```
|
314
320
|
|
315
321
|
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)
|
@@ -317,7 +323,7 @@ Docs: [https://developer.nexmo.com/api/developer/numbers#list-owned-numbers](htt
|
|
317
323
|
### Search available numbers
|
318
324
|
|
319
325
|
```ruby
|
320
|
-
client.
|
326
|
+
client.numbers.search(country: 'GB')
|
321
327
|
```
|
322
328
|
|
323
329
|
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)
|
@@ -325,7 +331,7 @@ Docs: [https://developer.nexmo.com/api/developer/numbers#search-available-number
|
|
325
331
|
### Buy a number
|
326
332
|
|
327
333
|
```ruby
|
328
|
-
client.
|
334
|
+
client.numbers.buy(country: 'GB', msisdn: '447700900000')
|
329
335
|
```
|
330
336
|
|
331
337
|
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)
|
@@ -333,7 +339,7 @@ Docs: [https://developer.nexmo.com/api/developer/numbers#buy-a-number](https://d
|
|
333
339
|
### Cancel a number
|
334
340
|
|
335
341
|
```ruby
|
336
|
-
client.
|
342
|
+
client.numbers.cancel(country: 'GB', msisdn: '447700900000')
|
337
343
|
```
|
338
344
|
|
339
345
|
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)
|
@@ -341,7 +347,7 @@ Docs: [https://developer.nexmo.com/api/developer/numbers#cancel-a-number](https:
|
|
341
347
|
### Update a number
|
342
348
|
|
343
349
|
```ruby
|
344
|
-
client.
|
350
|
+
client.numbers.update(country: 'GB', msisdn: '447700900000', voiceCallbackType: 'app', voiceCallbackValue: application_id)
|
345
351
|
```
|
346
352
|
|
347
353
|
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)
|
@@ -352,7 +358,7 @@ Docs: [https://developer.nexmo.com/api/developer/numbers#update-a-number](https:
|
|
352
358
|
By default the library generates a short lived JWT per request.
|
353
359
|
|
354
360
|
To generate a long lived JWT for multiple requests or to specify JWT claims
|
355
|
-
directly call Nexmo::JWT.
|
361
|
+
directly call `Nexmo::JWT.generate` to generate a token, and set the auth_token
|
356
362
|
attribute on the client object. For example:
|
357
363
|
|
358
364
|
```ruby
|
@@ -365,7 +371,7 @@ claims = {
|
|
365
371
|
|
366
372
|
private_key = File.read('path/to/private.key')
|
367
373
|
|
368
|
-
auth_token = Nexmo::JWT.
|
374
|
+
auth_token = Nexmo::JWT.generate(claims, private_key)
|
369
375
|
|
370
376
|
client.auth_token = auth_token
|
371
377
|
````
|
@@ -376,7 +382,7 @@ client.auth_token = auth_token
|
|
376
382
|
```ruby
|
377
383
|
client = Nexmo::Client.new(signature_secret: 'secret')
|
378
384
|
|
379
|
-
if client.
|
385
|
+
if client.signature.check(request.GET)
|
380
386
|
# valid signature
|
381
387
|
else
|
382
388
|
# invalid signature
|
data/lib/nexmo.rb
CHANGED
@@ -2,8 +2,28 @@ require 'nexmo/version'
|
|
2
2
|
require 'nexmo/params'
|
3
3
|
require 'nexmo/jwt'
|
4
4
|
require 'nexmo/signature'
|
5
|
+
require 'nexmo/user_agent'
|
6
|
+
require 'nexmo/entity'
|
7
|
+
require 'nexmo/keys'
|
5
8
|
require 'nexmo/errors/error'
|
6
9
|
require 'nexmo/errors/client_error'
|
7
10
|
require 'nexmo/errors/server_error'
|
8
11
|
require 'nexmo/errors/authentication_error'
|
12
|
+
require 'nexmo/namespace'
|
9
13
|
require 'nexmo/client'
|
14
|
+
require 'nexmo/account'
|
15
|
+
require 'nexmo/alerts'
|
16
|
+
require 'nexmo/applications'
|
17
|
+
require 'nexmo/call_dtmf'
|
18
|
+
require 'nexmo/call_stream'
|
19
|
+
require 'nexmo/call_talk'
|
20
|
+
require 'nexmo/calls'
|
21
|
+
require 'nexmo/conversions'
|
22
|
+
require 'nexmo/files'
|
23
|
+
require 'nexmo/messages'
|
24
|
+
require 'nexmo/number_insight'
|
25
|
+
require 'nexmo/numbers'
|
26
|
+
require 'nexmo/pricing_types'
|
27
|
+
require 'nexmo/pricing'
|
28
|
+
require 'nexmo/sms'
|
29
|
+
require 'nexmo/verify'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nexmo
|
4
|
+
class Account < Namespace
|
5
|
+
def balance
|
6
|
+
request('/account/get-balance')
|
7
|
+
end
|
8
|
+
|
9
|
+
def update(params)
|
10
|
+
request('/account/settings', params: params, type: Post)
|
11
|
+
end
|
12
|
+
|
13
|
+
def topup(params)
|
14
|
+
request('/account/top-up', params: params, type: Post)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def host
|
20
|
+
'rest.nexmo.com'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/nexmo/alerts.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nexmo
|
4
|
+
class Alerts < Namespace
|
5
|
+
def list
|
6
|
+
request('/sc/us/alert/opt-in/query/json')
|
7
|
+
end
|
8
|
+
|
9
|
+
def remove(params)
|
10
|
+
request('/sc/us/alert/opt-in/manage/json', params: params, type: Post)
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method :resubscribe, :remove
|
14
|
+
|
15
|
+
def send(params)
|
16
|
+
request('/sc/us/alert/json', params: params, type: Post)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def host
|
22
|
+
'rest.nexmo.com'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nexmo
|
4
|
+
class Applications < Namespace
|
5
|
+
def create(params)
|
6
|
+
request('/v1/applications', params: params, type: Post)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(params = nil)
|
10
|
+
request('/v1/applications', params: params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(id)
|
14
|
+
request('/v1/applications/' + id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def update(id, params)
|
18
|
+
request('/v1/applications/' + id, params: params, type: Put)
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete(id)
|
22
|
+
request('/v1/applications/' + id, type: Delete)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|