forked from realadeel/pinterest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adeel Ahmad
committed
Oct 3, 2015
1 parent
7e9b7e8
commit bee39b2
Showing
8 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
require "pinterest/version" | ||
require "pinterest/client" | ||
require "pinterest/omniauth" | ||
|
||
module Pinterest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'omniauth-oauth2' | ||
|
||
module OmniAuth | ||
module Strategies | ||
class Pinterest < OmniAuth::Strategies::OAuth2 | ||
option :client_options, { | ||
:site => 'https://api.pinterest.com/', | ||
:authorize_url => 'https://api.pinterest.com/oauth/', | ||
:token_url => 'https://api.pinterest.com/v1/oauth/token' | ||
} | ||
|
||
def request_phase | ||
options[:scope] ||= 'read_public,write_public' | ||
options[:response_type] ||= 'token' | ||
#options[:state] ||= '22' | ||
super | ||
end | ||
|
||
uid { raw_info['id'] } | ||
|
||
info { raw_info } | ||
|
||
def raw_info | ||
@raw_info ||= access_token.get('/v1/me/').parsed['data'] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Pinterest | ||
VERSION = "0.1.1" | ||
VERSION = "0.2.0" | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper' | ||
|
||
describe "Omniauth::Strategies::Pinterest" do | ||
context 'client options' do | ||
before :each do | ||
@auth = OmniAuth::Strategies::Pinterest.new({}) | ||
end | ||
|
||
it 'should call correct base url' do | ||
expect(@auth.options.client_options.site).to eq('https://api.pinterest.com/') | ||
end | ||
|
||
it 'should call correct authorization url' do | ||
expect(@auth.options.client_options.authorize_url).to eq('https://api.pinterest.com/oauth/') | ||
end | ||
|
||
it 'should call correct token url' do | ||
expect(@auth.options.client_options.token_url).to eq('https://api.pinterest.com/v1/oauth/token') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters