sticapi_client 3.0.0 → 3.0.1
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 +4 -4
- data/lib/sticapi_client/sticapi_devise_strategy.rb +18 -37
- data/lib/sticapi_client/version.rb +1 -1
- data/lib/sticapi_client.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e569cede5e4127038d797c4f5241f06a73883dfd41e34c296c022c33b3e208a3
|
4
|
+
data.tar.gz: ddb92b5a9a61d55337a7c64820b6321fe69ab08b373dc1126c04bc8b6751a959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 360ff3496070858144cc5dac05e0880a5f8f764e14e3eee0240ffed9db8ca683d60cd150d2d3fd7e96eafbbd023d0fa5ddb81b93b76732656cd3b1e641a20282
|
7
|
+
data.tar.gz: 79079047830b4c107aa1bf45c5671222d52bba5cbf4f35cf4abd63941c3f910cd74b521b96407c3a805b4a0494a3921526a1985d1a07c13fa3ce631616029c88
|
@@ -35,44 +35,25 @@ module Devise
|
|
35
35
|
}
|
36
36
|
token = JWT.encode payload, secret, 'HS256'
|
37
37
|
|
38
|
-
|
39
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
40
|
-
request = Net::HTTP::Post.new(uri.request_uri)
|
41
|
-
request['Content-Type'] = 'application/json'
|
42
|
-
request['access-token'] = Sticapi::SticapiClient.instance.access_token
|
43
|
-
request['client'] = Sticapi::SticapiClient.instance.client
|
44
|
-
request['uid'] = Sticapi::SticapiClient.instance.uid
|
45
|
-
request.body = { data: token }.to_json
|
46
|
-
response = http.request(request)
|
47
|
-
Sticapi::SticapiClient.instance.update_token(response)
|
38
|
+
data = Sticapi::SticapiClient.instance.sticapi_request("/users/log_in", data: token)
|
48
39
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
return
|
67
|
-
else
|
68
|
-
return fail(:invalid)
|
69
|
-
end
|
70
|
-
when Net::HTTPUnauthorized
|
71
|
-
return fail(:invalid)
|
72
|
-
when Net::HTTPServerError
|
73
|
-
return fail(:invalid)
|
74
|
-
else
|
75
|
-
return fail(:invalid)
|
40
|
+
if data['user']
|
41
|
+
unless user = User.find_by(username: data['user']['username'])
|
42
|
+
user = User.new
|
43
|
+
user.name = data['user']['name'] if user.respond_to? :name
|
44
|
+
user.username = data['user']['username'] if user.respond_to? :username
|
45
|
+
user.email = data['user']['email']
|
46
|
+
user.cpf = data['user']['cpf'] if user.respond_to? :cpf
|
47
|
+
end
|
48
|
+
user.password = params[:user][:password] if user.respond_to? :password
|
49
|
+
user.password_confirmation = params[:user][:password] if user.respond_to? :password_confirmation
|
50
|
+
user.unities = data['user']['unities'] if user.respond_to? :unities
|
51
|
+
user.skip_confirmation! if user.respond_to? 'skip_confirmation!'
|
52
|
+
user.save
|
53
|
+
success!(user)
|
54
|
+
return
|
55
|
+
else
|
56
|
+
return fail(:invalid)
|
76
57
|
end
|
77
58
|
end
|
78
59
|
else
|
data/lib/sticapi_client.rb
CHANGED
@@ -57,6 +57,7 @@ module Sticapi
|
|
57
57
|
http = Net::HTTP.new(uri.host, uri.port)
|
58
58
|
http.use_ssl = @ssl
|
59
59
|
request = Net::HTTP::Post.new(uri.request_uri)
|
60
|
+
request['Content-Type'] = 'application/json'
|
60
61
|
request['email'] = @user
|
61
62
|
request['password'] = @password
|
62
63
|
response = http.request(request)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sticapi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Viana
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|