messagebird-rest 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -9
- data/lib/messagebird.rb +2 -2
- data/lib/messagebird/client.rb +26 -21
- data/lib/messagebird/{otp.rb → verify.rb} +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4726ce8ee0e2583a41d1f73a7e6866dda139fb14
|
4
|
+
data.tar.gz: 484cd5e20ed84a89ea58e969289e58daa2d02bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a490c8dd3d3af74ff5ab0bb45209982f35dae182fc6b83cb90177e5b75a60afd36c56bb4285f0affbc1fff15cc7eacf0542e88a1fe742fc88c5a39eee11985
|
7
|
+
data.tar.gz: 6869c83755659c52549eee08b411076a42ed4c469d7ba1b8016f1b3b1668e681db46d8439ac32c2fcb32054207db9a51cdbf76d57c76ddf3d352af121c6ef26b
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ This repository contains the open source Ruby client for MessageBird's REST API.
|
|
4
4
|
|
5
5
|
Requirements
|
6
6
|
------------
|
7
|
-
- [Sign up](https://
|
7
|
+
- [Sign up](https://dashboard.messagebird.com/app/en/sign-up) for a free MessageBird account
|
8
8
|
- Create a new `access_key` in the developers sections
|
9
9
|
- MessageBird's API client for Ruby requires Ruby >= 1.9
|
10
10
|
|
@@ -111,14 +111,14 @@ Similar to the **message_create** and **message** methods, the **hlr_create** me
|
|
111
111
|
client.hlr('4933bed0453ba7455031712h16830892')
|
112
112
|
```
|
113
113
|
|
114
|
-
#####
|
115
|
-
You can send and verify One-Time Passwords through the MessageBird API using the **
|
114
|
+
##### Verify (One-Time Password)
|
115
|
+
You can send and verify One-Time Passwords through the MessageBird API using the **verify_create** and **verify_token** methods.
|
116
116
|
|
117
117
|
```ruby
|
118
|
-
#
|
119
|
-
client.
|
118
|
+
# verify_create requires a recipient as a required parameter, and other optional paramaters
|
119
|
+
client.verify_create(31612345678, {:reference => "YourReference"})
|
120
120
|
|
121
|
-
#<MessageBird::
|
121
|
+
#<MessageBird::Verify:0x007fb3c18c8148
|
122
122
|
@id="080b7f804555213678f14f6o24607735",
|
123
123
|
@recipient="31612345678",
|
124
124
|
@reference="YourReference",
|
@@ -128,11 +128,11 @@ client.otp_generate(31612345678, {:reference => "YourReference"})
|
|
128
128
|
@validUntilDatetime=2015-05-12 16:51:49 +0200>
|
129
129
|
```
|
130
130
|
|
131
|
-
This sends a token to the recipient, which can be verified with the **
|
131
|
+
This sends a token to the recipient, which can be verified with the **verify_token** method.
|
132
132
|
|
133
133
|
```ruby
|
134
|
-
#
|
135
|
-
client.
|
134
|
+
# verify_token requires the id of the verify request and a token as required parameters.
|
135
|
+
client.verify_token('080b7f804555213678f14f6o24607735', 123456)
|
136
136
|
```
|
137
137
|
|
138
138
|
##### Voice Message
|
data/lib/messagebird.rb
CHANGED
@@ -2,7 +2,7 @@ libdir = File.dirname(__FILE__)
|
|
2
2
|
$:.unshift(libdir) unless $:.include?(libdir)
|
3
3
|
|
4
4
|
module MessageBird
|
5
|
-
CLIENT_VERSION = '1.3.
|
5
|
+
CLIENT_VERSION = '1.3.3'
|
6
6
|
ENDPOINT = 'https://rest.messagebird.com'
|
7
7
|
end
|
8
8
|
|
@@ -10,6 +10,6 @@ require 'messagebird/balance'
|
|
10
10
|
require 'messagebird/client'
|
11
11
|
require 'messagebird/error'
|
12
12
|
require 'messagebird/hlr'
|
13
|
-
require 'messagebird/
|
13
|
+
require 'messagebird/verify'
|
14
14
|
require 'messagebird/message'
|
15
15
|
require 'messagebird/voicemessage'
|
data/lib/messagebird/client.rb
CHANGED
@@ -5,7 +5,7 @@ require 'uri'
|
|
5
5
|
require 'messagebird/balance'
|
6
6
|
require 'messagebird/error'
|
7
7
|
require 'messagebird/hlr'
|
8
|
-
require 'messagebird/
|
8
|
+
require 'messagebird/verify'
|
9
9
|
require 'messagebird/message'
|
10
10
|
require 'messagebird/voicemessage'
|
11
11
|
require 'messagebird/lookup'
|
@@ -19,6 +19,8 @@ module MessageBird
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
class InvalidPhoneNumberException < TypeError; end
|
23
|
+
|
22
24
|
class Client
|
23
25
|
attr_reader :access_key
|
24
26
|
|
@@ -51,7 +53,7 @@ module MessageBird
|
|
51
53
|
when 200, 201, 204, 401, 404, 405, 422
|
52
54
|
json = JSON.parse(response.body)
|
53
55
|
else
|
54
|
-
raise
|
56
|
+
raise InvalidPhoneNumberException, 'Unknown response from server'
|
55
57
|
end
|
56
58
|
|
57
59
|
# If the request returned errors, create Error objects and raise.
|
@@ -81,27 +83,30 @@ module MessageBird
|
|
81
83
|
:reference => reference))
|
82
84
|
end
|
83
85
|
|
84
|
-
#
|
85
|
-
def
|
86
|
-
|
87
|
-
:post,
|
88
|
-
'otp/generate',
|
89
|
-
params.merge({
|
90
|
-
:recipient => recipient
|
91
|
-
})
|
92
|
-
))
|
86
|
+
# Retrieve the information of specific Verify.
|
87
|
+
def verify(id)
|
88
|
+
Verify.new(request(:get, "verify/#{id.to_s}"))
|
93
89
|
end
|
94
90
|
|
95
|
-
#
|
96
|
-
def
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
91
|
+
# Generate a new One-Time-Password message.
|
92
|
+
def verify_create(recipient, params={})
|
93
|
+
Verify.new(request(
|
94
|
+
:post,
|
95
|
+
'verify',
|
96
|
+
params.merge({
|
97
|
+
:recipient => recipient
|
98
|
+
})
|
99
|
+
))
|
100
|
+
end
|
103
101
|
|
104
|
-
|
102
|
+
# Verify the One-Time-Password.
|
103
|
+
def verify_token(id, token)
|
104
|
+
Verify.new(request(:get, "verify/#{id.to_s}?token=#{token}"))
|
105
|
+
end
|
106
|
+
|
107
|
+
# Delete a Verify
|
108
|
+
def verify_delete(id)
|
109
|
+
Verify.new(request(:delete, "verify/#{id.to_s}"))
|
105
110
|
end
|
106
111
|
|
107
112
|
# Retrieve the information of specific message.
|
@@ -141,7 +146,7 @@ module MessageBird
|
|
141
146
|
|
142
147
|
def lookup(phoneNumber, params={})
|
143
148
|
Lookup.new(request(:get, "lookup/#{phoneNumber}", params))
|
144
|
-
end
|
149
|
+
end
|
145
150
|
|
146
151
|
def lookup_hlr_create(phoneNumber, params={})
|
147
152
|
HLR.new(request(:post, "lookup/#{phoneNumber}/hlr", params))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagebird-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maurice Nonnekes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple REST API for MessageBird in Ruby
|
14
14
|
email: maurice@messagebird.com
|
@@ -16,6 +16,9 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
- lib/messagebird.rb
|
19
22
|
- lib/messagebird/balance.rb
|
20
23
|
- lib/messagebird/base.rb
|
21
24
|
- lib/messagebird/client.rb
|
@@ -23,12 +26,9 @@ files:
|
|
23
26
|
- lib/messagebird/hlr.rb
|
24
27
|
- lib/messagebird/lookup.rb
|
25
28
|
- lib/messagebird/message.rb
|
26
|
-
- lib/messagebird/otp.rb
|
27
29
|
- lib/messagebird/recipient.rb
|
30
|
+
- lib/messagebird/verify.rb
|
28
31
|
- lib/messagebird/voicemessage.rb
|
29
|
-
- lib/messagebird.rb
|
30
|
-
- LICENSE
|
31
|
-
- README.md
|
32
32
|
homepage: https://github.com/messagebird/ruby-rest-api
|
33
33
|
licenses:
|
34
34
|
- BSD-2-Clause
|
@@ -39,17 +39,17 @@ require_paths:
|
|
39
39
|
- lib
|
40
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
52
|
+
rubygems_version: 2.5.2
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: MessageBird's REST API
|