omniauth-teamsnap 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83fbc211023278b4432be966d30137e5ee689a85
4
- data.tar.gz: ab9dbbe8ef3649b70bfc5ef0b29890215bb8b085
3
+ metadata.gz: 540222c492e87a75c182d19da9c20381ed6e3e42
4
+ data.tar.gz: 897951250e344e8e184fe662bfdb45fb9424d490
5
5
  SHA512:
6
- metadata.gz: ad5c18eb61a4ba8c5735546057f34e98ca163ca3ccaa80070b76deac33d9cc6c7461ce4223283606f35d788cbc744a8491df17b0f3a9cfae7e14920453d96e5f
7
- data.tar.gz: 88a5f6c24383b86b0d9cf61c9444e65f402f48ed675adb32443e00f77398243405e91e30f6475162a02758da33a1d0060b729cb35abbaec05f618d736065f327
6
+ metadata.gz: c6aa2b1c59e2531735ce8d96ef18021bcd2d9deff98b8e4eea70ce8544e2e838a53c7848756646269f869c05dfceb4576e45257e6632544947e89e7718f361ca
7
+ data.tar.gz: 668000b20b4c305d9410a3e7876971ef1d4b8b0b90348b54bef6d01da47b9131ae1141e6ed04a356c77fd27f3496071ba5a3ee29d69105f3cad0d5fada3ea4c3
data/README.md CHANGED
@@ -18,3 +18,21 @@ TeamSnap API v3 lets you set scopes to provide granular access to different type
18
18
  provider :teamsnap, ENV['TEAMSNAP_KEY'], ENV['TEAMSNAP_SECRET'], scope: "read write"
19
19
  end
20
20
 
21
+ ## Authentication Hash
22
+ An example auth hash available in `request.env['omniauth.auth']`:
23
+
24
+ ```
25
+ {
26
+ :provider => "teamsnap",
27
+ :uid => "123456",
28
+ :info => {
29
+ :email => "player@example.com",
30
+ :first_name => "John",
31
+ :last_name => "Player",
32
+ },
33
+ :credentials => {
34
+ :token => "a1b2c3d4...", # The OAuth 2.0 access token
35
+ },
36
+ :extra = {}
37
+ }
38
+ ```
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Teamsnap
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -12,13 +12,13 @@ module OmniAuth
12
12
  :token_method => :post
13
13
  }
14
14
 
15
- uid { raw_info.find { |d| d.name == "id"}.value }
15
+ uid { parse_datum("id") }
16
16
 
17
17
  info do
18
18
  {
19
- :email => raw_info.find { |d| d.name == "email"}.value,
20
- :first_name => raw_info.find { |d| d.name == "first_name"}.value,
21
- :last_name => raw_info.find { |d| d.name == "last_name"}.value
19
+ :email => parse_datum("email"),
20
+ :first_name => parse_datum("first_name"),
21
+ :last_name => parse_datum("last_name")
22
22
  }
23
23
  end
24
24
 
@@ -32,12 +32,16 @@ module OmniAuth
32
32
  req.url "https://api.teamsnap.com/v3/me"
33
33
  req.headers["Authorization"] = "Bearer #{access_token.token}"
34
34
  end
35
- deserializer = Conglomerate::TreeDeserializer.new(JSON.parse(response.body))
36
- collection_json = deserializer.deserialize
35
+ collection_json = JSON.parse(response.body)
37
36
 
38
- @raw_info = collection_json.items.first.data
37
+ @raw_info = collection_json["collection"]["items"].first.fetch("data")
39
38
  end
40
39
 
40
+ private
41
+
42
+ def parse_datum(property)
43
+ raw_info.find { |d| d["name"] == property }.fetch("value")
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -18,9 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "omniauth", "~> 1.2"
21
- spec.add_dependency "omniauth-oauth2", "~> 1.2"
22
- spec.add_dependency "faraday", "~> 0.9"
23
- spec.add_dependency "conglomerate", "~> 0.15"
21
+ spec.add_dependency "omniauth-oauth2", "~> 1.3.1"
22
+ spec.add_dependency "faraday", "~> 0.9.2"
24
23
  spec.add_development_dependency "rspec", "~> 2.7"
25
24
  spec.add_development_dependency "rack-test"
26
25
  spec.add_development_dependency "simplecov"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-teamsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -30,42 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: 1.3.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.2'
40
+ version: 1.3.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.9'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.9'
55
- - !ruby/object:Gem::Dependency
56
- name: conglomerate
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.15'
47
+ version: 0.9.2
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0.15'
54
+ version: 0.9.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rspec
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -161,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
147
  version: '0'
162
148
  requirements: []
163
149
  rubyforge_project:
164
- rubygems_version: 2.2.2
150
+ rubygems_version: 2.4.5
165
151
  signing_key:
166
152
  specification_version: 4
167
153
  summary: Official OmniAuth strategy for TeamSnap