omniauth-accredify 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cabd8bc6cdb8c006b213fa8b4180983aa5f2242
4
- data.tar.gz: bb8843890d8f620cbf305012eef266b41f5bea95
3
+ metadata.gz: 3bba56938ac66ae20c380354c234fa3ead5cbc50
4
+ data.tar.gz: ebe7da90cbb01a595a6c075391b80179307a2a18
5
5
  SHA512:
6
- metadata.gz: e884ffe040cb8df6a108eee846e30fb8161ec10845de47c7cd894cc4f5f71c671ad9f3070fe8364b2ff6d330dc9abdd279df8fffc1d5a51b25f43fdf18cc74cc
7
- data.tar.gz: 80e2090e3a28645998388579324ee882523db7c44b89bc75ecc1ec36c6f91485d4d4d7761ad4bfcb609d07daac0461a5cd823fe1aeb45d2cee50977688fe586c
6
+ metadata.gz: b74b06f50ba802f0613485e0a11eb2f84d03cf9d71a0380752d015937ba7f04034d382db4edc3dd0f03c883fc512d7392685771bcc5d7c111af2c9f55d0a4a83
7
+ data.tar.gz: 38ac31d7d6386d458447306b1d84f0373719e0b16f5951003db76b1973511313877ed5d2dad100be6d970f3f349af828389333345b3578082feef59d6bd7ca15
data/README.md CHANGED
@@ -1 +1,66 @@
1
- # Init
1
+ # OmniAuth Accredify  
2
+
3
+ **These notes are based on master, please see tags for README pertaining to specific releases.**
4
+
5
+ Accredify OAuth2 Strategy for OmniAuth.
6
+
7
+ Supports the OAuth 2.0 server-side and client-side flows.
8
+
9
+ ## Installing
10
+
11
+ Add to your `Gemfile`:
12
+
13
+ ```ruby
14
+ gem 'omniauth-accredify'
15
+ ```
16
+
17
+ Then `bundle install`.
18
+
19
+ ## Usage
20
+
21
+ `OmniAuth::Strategies::Accredify` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
22
+
23
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ provider :accredify, ENV['ACCREDIFY_APP_ID'], ENV['ACCREDIFY_SECRET'], :redirect_uri=>ENV['ACCREDIFY_CALLBACK']
28
+ end
29
+ ```
30
+
31
+ ## Auth Hash
32
+
33
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
34
+
35
+ ```ruby
36
+ {
37
+ :provider => 'accredify',
38
+ :info => {
39
+ :legal_name => 'John Doe',
40
+ :primary_address => '123 Mayberry Lane',
41
+ :email => 'Jhon@Doe.com',
42
+ :basis => 'asset',
43
+ :is_federally_accredited => 'true'
44
+ :certificate_url => 'https://api.accredify.com/certificates/9e5d467c8a61cac3b8698a6b76ba6ed4',
45
+ :created_on => '2014-08-26T14:05:03.009Z',
46
+ :expires_on => '2014-08-26T14:05:03.009Z',
47
+ :year1 => '',
48
+ :year2 => '',
49
+ :income_level_year1 => '',
50
+ :income_level_year2 => '',
51
+ :asset_level => '1B+',
52
+ :verified_state_of_residence => 'Florida',
53
+ :letter_link => '',
54
+ :verifier_link => '',
55
+ :facebook_profile => 'https://www.Facebook.com/JohnDoe',
56
+ :twitter_profile => 'http://www.twitter.com/JohnDoe',
57
+ :linkedin_profile => 'https://www.linkedin.com/JohnDoe',
58
+ :google_plus_profile => 'https://plus.google.com/+JohnDoe',
59
+ },
60
+ :credentials => {
61
+ :token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
62
+ :expires_at => 1321747205, # when the access token expires (it always will)
63
+ :expires => true # this will always be true
64
+ }
65
+ }
66
+ ```
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Accredify
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -10,20 +10,41 @@ module OmniAuth
10
10
  }
11
11
 
12
12
  def request_phase
13
- redirect client.auth_code.authorize_url({:client_id => client_id})
13
+ redirect client.auth_code.authorize_url({:redirect_uri => redirect_uri}.merge(authorize_params))
14
14
  end
15
15
 
16
- uid { user_data['id'] }
16
+ def redirect_uri
17
+ options.redirect_uri ||= request.params["redirect_uri"] || nil rescue nil
18
+ end
19
+
17
20
 
18
21
  info do
19
- {
20
- 'email' => user_data['email'],
22
+ {
23
+ 'legal_name' => raw_info['legal_name'],
24
+ 'primary_address' => raw_info['primary_address'],
25
+ 'email' => raw_info['email'],
26
+ 'basis' => raw_info['basis'],
27
+ 'is_federally_accredited' => raw_info['is_federally_accredited'],
28
+ 'certificate_url' => raw_info['certificate_url'],
29
+ 'created_on' => raw_info['created_on'],
30
+ 'expires_on' => raw_info['expires_on'],
31
+ 'year1' => raw_info['year1'],
32
+ 'year2' => raw_info['year2'],
33
+ 'income_level_year1' => raw_info['income_level_year1'],
34
+ 'income_level_year2' => raw_info['income_level_year2'],
35
+ 'asset_level' => raw_info['asset_level'],
36
+ 'verified_state_of_residence' => raw_info['verified_state_of_residence'],
37
+ 'letter_link' => raw_info['letter_link'],
38
+ 'verifier_link' => raw_info['verifier_link'],
39
+ 'facebook_profile' => raw_info['facebook_profile'],
40
+ 'twitter_profile' => raw_info['twitter_profile'],
41
+ 'linkedin_profile' => raw_info['linkedin_profile'],
42
+ 'google_plus_profile' => raw_info['google_plus_profile'],
21
43
  }
22
44
  end
23
45
 
24
- def user_data
25
- access_token.options[:mode] = :query
26
- user_data ||= access_token.get('/api/v1/me.json').parsed
46
+ def raw_info
47
+ @raw_info ||= access_token.get('https://api.accredify.com/api/v1/me.json').parsed
27
48
  end
28
49
 
29
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-accredify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Martinez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth