oa-cadun 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module OACadun
2
2
  module VERSION
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY] * '.'
8
8
  end
@@ -19,31 +19,14 @@ module OmniAuth
19
19
  end
20
20
 
21
21
  def auth_hash
22
- {
23
- :provider => "cadun",
24
- :uid => user.id,
25
- :user_info => {
26
- :id => user.id,
27
- :GLBID => request.params['GLBID'],
28
- :url => request.params['url'],
29
- :email => user.email,
30
- :status => user.status,
31
- :nickname => user.login,
32
- :name => user.name,
33
- :address => user.address,
34
- :neighborhood => user.neighborhood,
35
- :city => user.city,
36
- :state => user.state,
37
- :country => user.country,
38
- :gender => user.gender,
39
- :birthday => user.birthday.strftime('%d/%m/%Y'),
40
- :mobile => user.mobile,
41
- :phone => user.phone,
42
- :cpf => user.cpf,
43
- :user_type => user.user_type,
44
- :zipcode => user.zipcode
45
- }
46
- }
22
+ self.class.build_auth_hash(user, request)
23
+ end
24
+
25
+ def self.build_auth_hash(user, request = nil)
26
+ hash = { :provider => "cadun", :uid => user.id, :user_info => user.to_hash.merge(:birthday => user.birthday.strftime('%d/%m/%Y')) }
27
+ hash[:user_info].merge!(:GLBID => request.params['GLBID'], :url => request.params['url']) if request
28
+
29
+ hash
47
30
  end
48
31
 
49
32
  protected
@@ -69,11 +69,11 @@ describe OmniAuth::Strategies::Cadun do
69
69
  specify { subject[:user_info].should include(:email => "fab1@spam.la") }
70
70
  specify { subject[:user_info].should include(:gender => "MASCULINO") }
71
71
  specify { subject[:user_info].should include(:GLBID => "GLBID") }
72
- specify { subject[:user_info].should include(:id => "21737810") }
72
+ specify { subject[:user_info].should include(:user_id => "21737810") }
73
73
  specify { subject[:user_info].should include(:mobile => "21 99999999") }
74
74
  specify { subject[:user_info].should include(:name => "Fabricio Rodrigo Lopes") }
75
75
  specify { subject[:user_info].should include(:neighborhood => "Andaraí") }
76
- specify { subject[:user_info].should include(:nickname => "fabricio_fab1") }
76
+ specify { subject[:user_info].should include(:login => "fabricio_fab1") }
77
77
  specify { subject[:user_info].should include(:phone => "21 22881060") }
78
78
  specify { subject[:user_info].should include(:state => "RJ") }
79
79
  specify { subject[:user_info].should include(:status => "ATIVO") }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: oa-cadun
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.1.2
5
+ version: 3.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bruno