spearly-sdk-ruby 0.3.2 → 0.4.0
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/CHANGELOG.md +4 -0
- data/lib/spearly/auth/rails/helpers.rb +3 -5
- data/lib/spearly/auth/token.rb +1 -6
- data/lib/spearly/auth/user.rb +2 -12
- data/lib/spearly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6ca2e7efcf2a6ef0c4c933c9edd49115fc2c82c5d601c34a84c76ca87bd1602
|
|
4
|
+
data.tar.gz: 2e924b9bf892c8504034bf654acdda7f28d6bdc36cc01b1bc915f6333b4c5648
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c73bf97ee424325e8032d2719e25dc38cdfd369fac1f3775af89324f152c513c1a147a3082fefe83dab2b39d03e7f303a75c4a38a54a4e7fbdc5d1fd1c564fb9
|
|
7
|
+
data.tar.gz: aa26cc8cb81db6f9587439fc297915deaf88c5bc61e83266390f25a9e6f37da2571de3eb17f040c12dfb8ad10d5800f8d7385ee4fb48fa813d9dc2b9527fb9fd
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@ module Spearly
|
|
|
5
5
|
module Rails
|
|
6
6
|
module Helpers
|
|
7
7
|
def spearly_authorize!
|
|
8
|
-
spearly_token
|
|
8
|
+
raise Spearly::Auth::AuthorizationError unless spearly_token
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
private
|
|
@@ -13,18 +13,16 @@ module Spearly
|
|
|
13
13
|
def spearly_token
|
|
14
14
|
@spearly_token ||= begin
|
|
15
15
|
token = Spearly::Auth::Token.new(request.authorization)
|
|
16
|
-
token.info
|
|
17
16
|
|
|
18
|
-
token
|
|
17
|
+
token.info ? token : nil
|
|
19
18
|
end
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
def spearly_user
|
|
23
22
|
@spearly_user ||= begin
|
|
24
23
|
user = Spearly::Auth::User.new(request.authorization)
|
|
25
|
-
user.find
|
|
26
24
|
|
|
27
|
-
user
|
|
25
|
+
user.find ? user : nil
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
end
|
data/lib/spearly/auth/token.rb
CHANGED
|
@@ -26,12 +26,7 @@ module Spearly
|
|
|
26
26
|
'Accept' => 'application/vnd.spearly.v2+json',
|
|
27
27
|
'Authorization' => @token)
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
when 401
|
|
31
|
-
raise Spearly::Auth::AuthorizationError
|
|
32
|
-
when 500
|
|
33
|
-
raise Spearly::Auth::ServerError
|
|
34
|
-
end
|
|
29
|
+
return unless res.status == 200
|
|
35
30
|
|
|
36
31
|
@data = JSON.parse(res.body)
|
|
37
32
|
end
|
data/lib/spearly/auth/user.rb
CHANGED
|
@@ -26,12 +26,7 @@ module Spearly
|
|
|
26
26
|
'Accept' => 'application/vnd.spearly.v2+json',
|
|
27
27
|
'Authorization' => @token)
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
when 401
|
|
31
|
-
raise Spearly::Auth::AuthorizationError
|
|
32
|
-
when 500
|
|
33
|
-
raise Spearly::Auth::ServerError
|
|
34
|
-
end
|
|
29
|
+
return unless res.status == 200
|
|
35
30
|
|
|
36
31
|
@data = JSON.parse(res.body)['data']
|
|
37
32
|
end
|
|
@@ -46,12 +41,7 @@ module Spearly
|
|
|
46
41
|
'Accept' => 'application/vnd.spearly.v2+json',
|
|
47
42
|
'Authorization' => @token)
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
when 401
|
|
51
|
-
raise Spearly::Auth::AuthorizationError
|
|
52
|
-
when 500
|
|
53
|
-
raise Spearly::Auth::ServerError
|
|
54
|
-
end
|
|
44
|
+
return [] unless res.status == 200
|
|
55
45
|
|
|
56
46
|
team_hashes = JSON.parse(res.body)['data']
|
|
57
47
|
|
data/lib/spearly/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spearly-sdk-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Spearly
|
|
@@ -166,7 +166,7 @@ licenses: []
|
|
|
166
166
|
metadata:
|
|
167
167
|
homepage_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
|
168
168
|
source_code_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
|
169
|
-
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.
|
|
169
|
+
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.4.0/CHANGELOG.md
|
|
170
170
|
post_install_message:
|
|
171
171
|
rdoc_options: []
|
|
172
172
|
require_paths:
|