omniauth-netatmo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/lib/omniauth/netatmo/version.rb +1 -1
- data/lib/omniauth/strategies/netatmo.rb +8 -7
- data/omniauth-netatmo.gemspec +2 -2
- data/spec/omniauth/strategies/netatmo_spec.rb +6 -4
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc5e81607fe509f9c0ac24a05958d46b95f07d86
|
4
|
+
data.tar.gz: 290d81c586651f4f6a1cf62bfaba31380ed1dea4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3479227d44cf89344a836b8ef5053cd527574f35b1c6abed67291729b01dcb4097362fc0212ea0e054c2f80ae149887826dc2f107d6dbfd50fe856e271b9b5f0
|
7
|
+
data.tar.gz: f90013f51e20d49c153876bcfeadd9fcd1e5f93e4c9584ea7aa478ef214a155447aca9d5c61b2adf0c3631eff21a94d789d9ffc0d761367bf7a40debce943f5d
|
data/Rakefile
CHANGED
@@ -5,13 +5,14 @@ module OmniAuth
|
|
5
5
|
class Netatmo < OmniAuth::Strategies::OAuth2
|
6
6
|
|
7
7
|
option :client_options, {
|
8
|
-
:site => '
|
9
|
-
:authorize_url => '
|
10
|
-
:token_url => '
|
8
|
+
:site => 'https://api.netatmo.net/',
|
9
|
+
:authorize_url => 'https://api.netatmo.net/oauth2/authorize',
|
10
|
+
:token_url => 'https://api.netatmo.net/oauth2/token'
|
11
11
|
}
|
12
12
|
|
13
13
|
option :token_params, {
|
14
|
-
:parse => :
|
14
|
+
:parse => :json,
|
15
|
+
:grant_type => 'authorization_code'
|
15
16
|
}
|
16
17
|
|
17
18
|
option :access_token_options, {
|
@@ -32,10 +33,10 @@ module OmniAuth
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
uid { raw_info['_id'] }
|
36
|
+
uid { raw_info['body']['_id'] }
|
36
37
|
|
37
38
|
info do
|
38
|
-
{ :email => raw_info['
|
39
|
+
{ :email => raw_info['body']['mail'] }
|
39
40
|
end
|
40
41
|
|
41
42
|
extra do
|
@@ -43,7 +44,7 @@ module OmniAuth
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def raw_info
|
46
|
-
@raw_info ||= access_token.get('/api/getuser'
|
47
|
+
@raw_info ||= access_token.get('/api/getuser', params: { access_token: access_token.token }).parsed
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
data/omniauth-netatmo.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "omniauth/netatmo/version"
|
2
|
+
require File.expand_path('../lib/omniauth/netatmo/version', __FILE__)
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "omniauth-netatmo"
|
@@ -18,6 +17,7 @@ Gem::Specification.new do |s|
|
|
18
17
|
|
19
18
|
s.add_dependency 'omniauth', '~> 1.0'
|
20
19
|
s.add_dependency 'omniauth-oauth2', '~> 1.1'
|
20
|
+
s.add_development_dependency 'rake', '~> 10.4.0'
|
21
21
|
s.add_development_dependency 'rspec', '~> 2.7'
|
22
22
|
s.add_development_dependency 'rack-test'
|
23
23
|
s.add_development_dependency 'simplecov'
|
@@ -4,6 +4,7 @@ describe OmniAuth::Strategies::Netatmo do
|
|
4
4
|
let(:access_token) { stub('AccessToken', :options => {}) }
|
5
5
|
let(:parsed_response) { stub('ParsedResponse') }
|
6
6
|
let(:response) { stub('Response', :parsed => parsed_response) }
|
7
|
+
let(:token) { stub('Token') }
|
7
8
|
|
8
9
|
subject do
|
9
10
|
OmniAuth::Strategies::Netatmo.new({})
|
@@ -15,21 +16,22 @@ describe OmniAuth::Strategies::Netatmo do
|
|
15
16
|
|
16
17
|
context "client options" do
|
17
18
|
it 'should have correct site' do
|
18
|
-
subject.options.client_options.site.should eq("
|
19
|
+
subject.options.client_options.site.should eq("https://api.netatmo.net/")
|
19
20
|
end
|
20
21
|
|
21
22
|
it 'should have correct authorize url' do
|
22
|
-
subject.options.client_options.authorize_url.should eq('
|
23
|
+
subject.options.client_options.authorize_url.should eq('https://api.netatmo.net/oauth2/authorize')
|
23
24
|
end
|
24
25
|
|
25
26
|
it 'should have correct token url' do
|
26
|
-
subject.options.client_options.token_url.should eq('
|
27
|
+
subject.options.client_options.token_url.should eq('https://api.netatmo.net/oauth2/token')
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
31
|
context "#raw_info" do
|
31
32
|
it "should use relative paths" do
|
32
|
-
access_token.should_receive(:
|
33
|
+
access_token.should_receive(:token).and_return(token)
|
34
|
+
access_token.should_receive(:get).with('/api/getuser', { params: { access_token: token } }).and_return(response)
|
33
35
|
subject.raw_info.should eq(parsed_response)
|
34
36
|
end
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-netatmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Pochet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 10.4.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 10.4.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,4 +152,3 @@ signing_key:
|
|
138
152
|
specification_version: 4
|
139
153
|
summary: Netatmo OAuth2 Strategy for OmniAuth
|
140
154
|
test_files: []
|
141
|
-
has_rdoc:
|