metova 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTRmMjlkYjFiZGIxNzU2M2FkNmY2NjM1MDM1MDQ0NDVkOTJhYzA1MA==
4
+ ZDFiZDg5N2UxN2E5ZDIxY2NiMmI4YjhkYzRmY2Y3OGIzYWFjYjA0ZA==
5
5
  data.tar.gz: !binary |-
6
- OGFiMWRhYjhiMzU2NWJlYjMyZGMyNGE5Yjc1ZTFhOWMxNDhjNjE0Mw==
6
+ MWEzZTNkYmY5OWNiNGYwNzVlOGQwMWRiODg4Y2EwMWUzODY5ZGVlZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzU1MjY2NjA2YzBlNGRmOWM3ZGUxZjM1NGFmMWU5MmRkOTg5MzI4YWEyOTA4
10
- NTA4OGIyZmQxNzk2YTgzYjJkZmE3OTViNWI5ZGRjZTk3NWNiOTYwMGU2MDhi
11
- N2YyYTJjYWM3MWY0YzYzNjI5OTMzNDIwODExMzU4Nzk4MmMxYTc=
9
+ ZDhlYzQ1YzdlZDk5MDcxZTk2NzAzMGNiZTBiYTMxMzM1MGRjNTI3NzgxMDU0
10
+ Yzc2OWFkNGM0ZWI0Y2E1NTEwMDZmMWRlYTA2MzQ5YTY1MjkxNzdlNGU5ZDZh
11
+ NjNkYjNlM2QzZmFmMjM4Mjc5MGRjMTliOGVlMmQ2MDFlYWZiZTE=
12
12
  data.tar.gz: !binary |-
13
- NzI0M2Q4NjEyNjgzMmYwM2M4YWI5YTc1MGFjZjhjOWU2NDA5YmE0NjZlOTAw
14
- NTVjZjhkNDllYzkzZjdhNmQxNzBmMWViZTdkYWUzYjg2M2M4NjMzMGJhNGU5
15
- MjJmOTI1NWIwOWM0MzQ0NjI0MWVlZWJlMmM1MzE1OWY4NTBkMjY=
13
+ NmIzNjU1NDc4YmI0NjJkOTc5NDQxYmVlYmZmNGQ2NTRjOTA5NzYwMDQxN2Zk
14
+ ZGZhYTk5YmY4MGExY2FkMDNlOGE1YzY4ZjFiMDE2YWVlMzkzZTM5NmQ5OTg2
15
+ ZDY5YzI1MGRlZTllNTBhOTljM2U5M2UxMmIzOWZhYzhhOGU0NDM=
@@ -1,5 +1,6 @@
1
1
  class Metova::API::SessionsController < ::Devise::SessionsController
2
2
  respond_to :json
3
+ self.responder = Metova::Responder
3
4
 
4
5
  def create
5
6
  if params[:provider]
@@ -42,10 +43,15 @@ class Metova::API::SessionsController < ::Devise::SessionsController
42
43
 
43
44
  def sign_up_user(auth, identity)
44
45
  user = User.new Hash[email: auth.info.email, password: SecureRandom.hex].merge(sign_in_params)
45
- if user.save and identity.update(user: user)
46
- sign_in_user user
46
+ identity.user = user
47
+ if identity.valid?
48
+ if user.save and identity.save
49
+ sign_in_user user
50
+ else
51
+ respond_with user
52
+ end
47
53
  else
48
- respond_with user
54
+ render json: Metova::GenericError.new("#{auth.name} authentication failed")
49
55
  end
50
56
  end
51
57
  end
data/lib/metova/error.rb CHANGED
@@ -10,5 +10,8 @@ module Metova
10
10
  [@error]
11
11
  end
12
12
 
13
+ def to_json(*)
14
+ { errors: errors }.to_json
15
+ end
13
16
  end
14
17
  end
@@ -10,6 +10,10 @@ module Metova
10
10
  self
11
11
  end
12
12
 
13
+ def name
14
+ 'Facebook'
15
+ end
16
+
13
17
  def provider
14
18
  :facebook
15
19
  end
@@ -10,6 +10,10 @@ module Metova
10
10
  self
11
11
  end
12
12
 
13
+ def name
14
+ 'FluxID'
15
+ end
16
+
13
17
  def provider
14
18
  :flux
15
19
  end
@@ -12,6 +12,10 @@ module Metova
12
12
  find_provider(provider).new(access_token, token_secret).authenticate
13
13
  end
14
14
 
15
+ def name
16
+ 'OAuth'
17
+ end
18
+
15
19
  private
16
20
  def self.find_provider(provider)
17
21
  map = {
@@ -10,6 +10,10 @@ module Metova
10
10
  self
11
11
  end
12
12
 
13
+ def name
14
+ 'Google'
15
+ end
16
+
13
17
  def provider
14
18
  :google_oauth2
15
19
  end
@@ -11,6 +11,10 @@ module Metova
11
11
  self
12
12
  end
13
13
 
14
+ def name
15
+ 'Twitter'
16
+ end
17
+
14
18
  def provider
15
19
  :twitter
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Metova
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metova
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails