coach4rb 0.0.1 → 0.0.2
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/lib/coach4rb/coach.rb +7 -2
- data/lib/coach4rb/version.rb +1 -1
- data/test/test_coach_user.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c7a15d1bfa99d3a6990b264fe6ce78347d3a39
|
4
|
+
data.tar.gz: 32e02876ce2c59c826b0f812f26388045ff48eaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9bba4dff4f118b80d790eb0756264ed3b17220bbec5a297c6eb49c3b448cdf41aae0f2268aa195ce9f60e2311d82483b6e16d4bf74e26d999f8c3c6db53195b
|
7
|
+
data.tar.gz: 84b4b2443d2d037b8bb7ada4896e74d6889009c615f87254c8711e156cb4e6b4dc1abd066ad85817d74fcb8c65be50a4c44c1c40a1d75f6f1f8156587f6d88a7
|
data/lib/coach4rb/coach.rb
CHANGED
@@ -21,7 +21,7 @@ module Coach4rb
|
|
21
21
|
#
|
22
22
|
# @param username
|
23
23
|
# @param password
|
24
|
-
# @return [
|
24
|
+
# @return [User]
|
25
25
|
#
|
26
26
|
# ====Example
|
27
27
|
#
|
@@ -32,7 +32,12 @@ module Coach4rb
|
|
32
32
|
options = {authorization: basic_auth_encryption(username, password)}
|
33
33
|
url = url_for_path('/authenticateduser/')
|
34
34
|
client.get(url, options) do |response|
|
35
|
-
response.code == 200
|
35
|
+
if response.code == 200
|
36
|
+
a_hash = parse response
|
37
|
+
Resource::User.from_coach a_hash
|
38
|
+
else
|
39
|
+
false
|
40
|
+
end
|
36
41
|
end
|
37
42
|
rescue
|
38
43
|
raise 'Error: Could not authenticate user!'
|
data/lib/coach4rb/version.rb
CHANGED
data/test/test_coach_user.rb
CHANGED
@@ -116,12 +116,15 @@ class TestUserCoach < MiniTest::Test
|
|
116
116
|
|
117
117
|
|
118
118
|
def test_should_authenticate_user
|
119
|
-
|
119
|
+
user = @coach.authenticate('arueedlinger','test')
|
120
|
+
assert user
|
121
|
+
assert user.is_a?(Coach4rb::Resource::User)
|
122
|
+
assert user.real_name
|
120
123
|
end
|
121
124
|
|
122
125
|
|
123
126
|
def test_should_not_authenticate_user
|
124
|
-
|
127
|
+
assert @coach.authenticate('arueedlinger','sajdhjkasdjka') == false
|
125
128
|
end
|
126
129
|
|
127
130
|
|