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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21f3fab1c77372a64b0b3238dd1279e7acf56185
4
- data.tar.gz: 2cae5689a0eb9e1a429bbad3eb22c04806a92009
3
+ metadata.gz: dc5e81607fe509f9c0ac24a05958d46b95f07d86
4
+ data.tar.gz: 290d81c586651f4f6a1cf62bfaba31380ed1dea4
5
5
  SHA512:
6
- metadata.gz: fd8deab27e837bf66d69828bc70af7440e1dba224ff356b630af1db35cd3d8012b75438515ccc9c555a1d61beb05a9b77a72ac00eda57b7b648a7a6f8da62131
7
- data.tar.gz: faabda16aef8ff547d4ac120f529b8d6ad6bb96b75c985eaeac1a93654c8e7aecda6ae98733d7ba3457ebf29fe67f64ee47494d1d58e5f8ca3eed73a81aa68af
6
+ metadata.gz: 3479227d44cf89344a836b8ef5053cd527574f35b1c6abed67291729b01dcb4097362fc0212ea0e054c2f80ae149887826dc2f107d6dbfd50fe856e271b9b5f0
7
+ data.tar.gz: f90013f51e20d49c153876bcfeadd9fcd1e5f93e4c9584ea7aa478ef214a155447aca9d5c61b2adf0c3631eff21a94d789d9ffc0d761367bf7a40debce943f5d
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
+ #!/usr/bin/env rake
1
2
  require "bundler/gem_tasks"
2
3
  require 'rspec/core/rake_task'
3
4
 
4
- desc "Run specs"
5
5
  RSpec::Core::RakeTask.new
6
6
 
7
- desc 'Default: run specs.'
8
- task :default => :spec
7
+ desc 'Run specs'
8
+ task :default => :spec
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Netatmo
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -5,13 +5,14 @@ module OmniAuth
5
5
  class Netatmo < OmniAuth::Strategies::OAuth2
6
6
 
7
7
  option :client_options, {
8
- :site => 'http://api.netatmo.com',
9
- :authorize_url => 'http://api.netatmo.net/oauth2/authorize',
10
- :token_url => 'http://api.netatmo.net/oauth2/token'
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 => :query
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['email'] }
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').parsed || {}
47
+ @raw_info ||= access_token.get('/api/getuser', params: { access_token: access_token.token }).parsed
47
48
  end
48
49
  end
49
50
  end
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
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("http://api.netatmo.com")
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('http://api.netatmo.net/oauth2/authorize')
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('http://api.netatmo.net/oauth2/token')
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(:get).with('/api/getuser').and_return(response)
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.1
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-01 00:00:00.000000000 Z
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: