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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 412f9ffde0208d1f386a7a179ca397d044e90179
4
- data.tar.gz: e862eea49492255fa1cd90240ffc8ca1493d0851
3
+ metadata.gz: e4c7a15d1bfa99d3a6990b264fe6ce78347d3a39
4
+ data.tar.gz: 32e02876ce2c59c826b0f812f26388045ff48eaa
5
5
  SHA512:
6
- metadata.gz: eea2b892f25a2c60673bf387be62016c98ba6cec03e9fdc3c24a0148e989963a8def1f46c26b7ef064fd46f2ecaa5356b2496d4e69f11c0e9cea22a72e09f4ba
7
- data.tar.gz: e789f89d7244757f89c7d7245d7645edb6671a80442b70aad9584b791e5e07b2295bb5e7728963f66eb7eba538838b4c24ecf35243e48fc15c3cf369c14550ce
6
+ metadata.gz: d9bba4dff4f118b80d790eb0756264ed3b17220bbec5a297c6eb49c3b448cdf41aae0f2268aa195ce9f60e2311d82483b6e16d4bf74e26d999f8c3c6db53195b
7
+ data.tar.gz: 84b4b2443d2d037b8bb7ada4896e74d6889009c615f87254c8711e156cb4e6b4dc1abd066ad85817d74fcb8c65be50a4c44c1c40a1d75f6f1f8156587f6d88a7
@@ -21,7 +21,7 @@ module Coach4rb
21
21
  #
22
22
  # @param username
23
23
  # @param password
24
- # @return [Boolean]
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!'
@@ -1,3 +1,3 @@
1
1
  module Coach4rb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -116,12 +116,15 @@ class TestUserCoach < MiniTest::Test
116
116
 
117
117
 
118
118
  def test_should_authenticate_user
119
- assert @coach.authenticate('arueedlinger','test')
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
- refute @coach.authenticate('arueedlinger','sajdhjkasdjka')
127
+ assert @coach.authenticate('arueedlinger','sajdhjkasdjka') == false
125
128
  end
126
129
 
127
130
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coach4rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Rueedlinger