authy 2.3.0 → 2.3.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -66,6 +66,11 @@ module Authy
66
66
  post_request("protected/json/users/delete/:user_id", params.merge({"user_id" =>user_id}))
67
67
  end
68
68
 
69
+ def self.user_status(params)
70
+ user_id = params.delete(:id) || params.delete("id")
71
+ get_request("protected/json/users/:user_id/status", params.merge({"user_id" => user_id}))
72
+ end
73
+
69
74
  private
70
75
 
71
76
  def self.post_request(uri, params = {})
@@ -1,3 +1,3 @@
1
1
  module Authy
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
@@ -21,7 +21,7 @@ describe "Authy::API" do
21
21
  :country_code => 1)
22
22
 
23
23
  user.errors.should be_kind_of(Hash)
24
- user.errors['cellphone'].should == 'must be a valid cellphone number.'
24
+ user.errors['cellphone'].should == 'is invalid'
25
25
  end
26
26
 
27
27
  it "should allow to override the API key" do
@@ -38,18 +38,20 @@ describe "Authy::API" do
38
38
 
39
39
  describe "verificating tokens" do
40
40
  before do
41
- @user = Authy::API.register_user(:email => generate_email,
42
- :cellphone => generate_cellphone,
41
+ @email = generate_email
42
+ @cellphone = generate_cellphone
43
+ @user = Authy::API.register_user(:email => @email,
44
+ :cellphone => @cellphone,
43
45
  :country_code => 1)
44
46
  @user.should be_ok
45
47
  end
46
48
 
47
49
  it "should fail to validate a given token if the user is not registered" do
48
- response = Authy::API.verify(:token => 'invalid_token', :id => @user['id'])
50
+ response = Authy::API.verify(:token => 'invalid_token', :id => @user.id)
49
51
 
50
52
  response.should be_kind_of(Authy::Response)
51
53
  response.ok?.should be_false
52
- response.errors['message'].should == 'token is invalid'
54
+ response.errors['message'].should == 'Token is invalid.'
53
55
  end
54
56
 
55
57
  it "should allow to override the API key" do
@@ -98,7 +100,7 @@ describe "Authy::API" do
98
100
  context "user doesn't exist" do
99
101
  it "should not be ok" do
100
102
  response = Authy::API.send("request_#{kind}", :id => "tony")
101
- response.errors['message'].should == "User doesn't exist."
103
+ response.errors['message'].should == "User not found."
102
104
  response.should_not be_ok
103
105
  end
104
106
  end
@@ -110,7 +112,7 @@ describe "Authy::API" do
110
112
  context "user doesn't exist" do
111
113
  it "should not be ok" do
112
114
  response = Authy::API.delete_user(:id => "tony")
113
- response.errors['message'].should == "User doesn't exist."
115
+ response.errors['message'].should == "User not found."
114
116
  response.should_not be_ok
115
117
  end
116
118
  end
@@ -129,6 +131,29 @@ describe "Authy::API" do
129
131
  end
130
132
  end
131
133
 
134
+ describe "user status" do
135
+ context "user doesn't exist" do
136
+ it "should not be ok" do
137
+ response = Authy::API.user_status(:id => "tony")
138
+ response.errors["message"].should == "User not found."
139
+ response.should_not be_ok
140
+ end
141
+ end
142
+
143
+ context "user exists" do
144
+ before do
145
+ @user = Authy::API.register_user(:email => generate_email, :cellphone => generate_cellphone, :country_code => 1)
146
+ @user.should be_ok
147
+ end
148
+
149
+ it "should be ok" do
150
+ response = Authy::API.user_status(:id => @user.id)
151
+ response.status.should be_kind_of(Hash)
152
+ response.should be_ok
153
+ end
154
+ end
155
+ end
156
+
132
157
  describe "blank params" do
133
158
  before do
134
159
  @user = Authy::API.register_user(:email => generate_email, :cellphone => generate_cellphone, :country_code => 1)
@@ -29,6 +29,6 @@ RSpec.configure do |config|
29
29
 
30
30
  def generate_cellphone
31
31
  n = rand(999) + 1000
32
- "305-967-#{n}"
32
+ "192-967-#{n}"
33
33
  end
34
34
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: authy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.3.0
5
+ version: 2.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Authy Inc
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-19 00:00:00.000000000 Z
12
+ date: 2014-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false