omniauth-wepay 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -25,9 +25,27 @@ Here's a quick example, adding the middleware to a Rails app in config/initializ
25
25
  Rails.application.config.middleware.use OmniAuth::Builder do
26
26
  provider :wepay, ENV['APP_ID'], ENV['SECRET']
27
27
  end
28
+ ```
29
+
30
+ ### Note
31
+
32
+ Currently the gem only supports the "stage" endpoints. When you are ready to go into production, modify the omniauth.rb as follows to use the production endpoints:
28
33
 
34
+
35
+ ```ruby
36
+ Rails.application.config.middleware.use OmniAuth::Builder do
37
+ provider :wepay, ENV['APP_ID'], ENV['SECRET'] do |config|
38
+ config.client_options.authorize_url = "https://www.wepay.com/v2/oauth2/authorize"
39
+ config.client_options.token_url = "https://www.wepayapi.com/v2/oauth2/token"
40
+ config.client_options.site = "https://www.wepayapi.com/v2"
41
+ end
42
+ end
29
43
  ```
30
44
 
45
+
46
+
47
+
48
+
31
49
  ## Contributing
32
50
 
33
51
  1. Fork it
@@ -4,39 +4,39 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Wepay < OmniAuth::Strategies::OAuth2
6
6
 
7
- DEFAULT_PERMISSIONS = "manage_accounts,view_balance,collect_payments,refund_payments,view_user"
7
+ DEFAULT_PERMISSIONS = "manage_accounts,view_balance,collect_payments,refund_payments,view_user"
8
8
 
9
9
  option :fields, [:user_id, :name, :email]
10
- option :uid_field, :user_id
11
- option :scope, DEFAULT_PERMISSIONS
10
+ option :uid_field, :user_id
11
+ option :scope, DEFAULT_PERMISSIONS
12
12
  option :client_options, {
13
13
  :authorize_url => "https://stage.wepay.com/v2/oauth2/authorize",
14
- :token_url => "https://stage.wepayapi.com/v2/oauth2/token",
15
- :site => "https://stage.wepayapi.com/v2"
14
+ :token_url => "https://stage.wepayapi.com/v2/oauth2/token",
15
+ :site => "https://stage.wepayapi.com/v2"
16
16
  }
17
17
 
18
18
  uid do
19
- raw_info["user_id"]
19
+ raw_info["user_id"]
20
20
  end
21
21
 
22
- info do
23
- {"email"=> raw_info["email"], "name"=> "#{raw_info['first_name']} #{raw_info['last_name']}"}
24
- end
25
-
26
- def raw_info
27
- params = {code: request.params['code'], client_id:options.client_id, redirect_uri: callback_url, client_secret: options.client_secret}.to_param
28
- url = options.client_options.token_url + "?" + params
29
-
30
- info = access_token.post(url).parsed
31
-
32
- user_url = "https://stage.wepayapi.com/v2/user"
33
- info2 = client.request(:post, user_url) do |req|
34
- req.headers["Authorization"] = "Bearer #{info["access_token"]}"
35
- end.parsed
36
-
37
- @raw_info ||= info.merge(info2)
38
- end
39
- end
22
+ info do
23
+ {"email"=> raw_info["email"], "name"=> "#{raw_info['first_name']} #{raw_info['last_name']}"}
24
+ end
25
+
26
+ def raw_info
27
+ params = {code: request.params['code'], client_id:options.client_id, redirect_uri: callback_url, client_secret: options.client_secret}.to_param
28
+ url = options.client_options.token_url + "?" + params
29
+
30
+ info = access_token.post(url).parsed
31
+
32
+ user_url = "https://stage.wepayapi.com/v2/user"
33
+ info2 = client.request(:post, user_url) do |req|
34
+ req.headers["Authorization"] = "Bearer #{info["access_token"]}"
35
+ end.parsed
36
+
37
+ @raw_info ||= info.merge(info2)
38
+ end
39
+ end
40
40
  end
41
41
  end
42
42
 
@@ -1,6 +1,6 @@
1
- module Omniauth
1
+ module OmniAuth
2
2
  module Wepay
3
- VERSION = [0, 0, 3]
3
+ VERSION = [0, 0, 4]
4
4
 
5
5
  class << VERSION
6
6
  include Comparable
data/lib/wepay.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "omniauth/strategies/wepay"
2
2
 
3
- module Omniauth
3
+ module OmniAuth
4
4
  module Wepay
5
5
  autoload :VERSION, 'omniauth/version'
6
6
  end
@@ -4,7 +4,7 @@ require 'omniauth/version'
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'omniauth-wepay'
7
- gem.version = Omniauth::Wepay::VERSION
7
+ gem.version = OmniAuth::Wepay::VERSION
8
8
  gem.authors = ['Volkan Unsal']
9
9
  gem.email = ['spocksplanet@gmail.com']
10
10
  gem.summary = %q{Omniauth strategy for WePay}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-wepay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: