zaig 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zaig/connection.rb +3 -2
- data/lib/zaig/version.rb +1 -1
- data/lib/zaig.rb +1 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '03094fa60fc889bb1771ce1e6ae0daf0e2df220d669fecdd9afac1bcc2de5991'
|
4
|
+
data.tar.gz: 61de42ec0c42be9c38469a7f9bec9b32b7cc5257d28cc8b912e0ea6e644ebcd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 751ae73d08258541b3d1d98b82f0730d113c80c6c81b26121318a446a9f914457a4cf1b4d0f224e010359fca221255cc5d7d6195716ec2fd77f61e92ac553682
|
7
|
+
data.tar.gz: 5547939be36e3dbda4f8a366486f9e1a305875733e362e9e70c4c641dee5e7ed714d39e4e0336abb3191ffab232c8d9a95e3ecc435cbef1bb35dae2da67ddd72
|
data/lib/zaig/connection.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
module Zaig
|
4
4
|
# Class to instance a authenticated connection object.
|
5
5
|
class Connection < Flash::Integration::Connection
|
6
|
+
JWT_EXP_TIME = DateTime.now.next_day(1).to_time.to_i.freeze
|
7
|
+
|
6
8
|
def initialize(request_class: Faraday, base_url: Zaig.configuration.base_url)
|
7
9
|
@jwt_algorithm = Zaig.configuration.jwt_algorithm
|
8
|
-
@jwt_exp_time = Zaig.configuration.jwt_exp_time
|
9
10
|
@jwt_secret = Zaig.configuration.jwt_secret
|
10
11
|
@jwt_user = Zaig.configuration.jwt_user
|
11
12
|
|
@@ -26,7 +27,7 @@ module Zaig
|
|
26
27
|
|
27
28
|
private
|
28
29
|
def access_token
|
29
|
-
JWT.encode({ exp:
|
30
|
+
JWT.encode({ exp: JWT_EXP_TIME, user: @jwt_user }, @jwt_secret, @jwt_algorithm)
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/zaig/version.rb
CHANGED
@@ -8,5 +8,5 @@ module Zaig
|
|
8
8
|
# Major - Incremented for incompatible changes with previous release (or big enough new features)
|
9
9
|
# Minor - Incremented for new backwards-compatible features + deprecations
|
10
10
|
# Patch - Incremented for backwards-compatible bug fixes
|
11
|
-
VERSION = "1.0.
|
11
|
+
VERSION = "1.0.11"
|
12
12
|
end
|
data/lib/zaig.rb
CHANGED
@@ -49,16 +49,12 @@ module Zaig
|
|
49
49
|
# Basic configuration settings
|
50
50
|
class Configuration
|
51
51
|
attr_accessor :base_url, :jwt_secret, :jwt_user
|
52
|
-
attr_writer :jwt_algorithm, :
|
52
|
+
attr_writer :jwt_algorithm, :registration_endpoint
|
53
53
|
|
54
54
|
def jwt_algorithm
|
55
55
|
@jwt_algorithm ||= "HS256"
|
56
56
|
end
|
57
57
|
|
58
|
-
def jwt_exp_time
|
59
|
-
@jwt_exp_time ||= 1_658_439_475
|
60
|
-
end
|
61
|
-
|
62
58
|
def registration_endpoint
|
63
59
|
@registration_endpoint ||= "zaig/consulta_de_credito"
|
64
60
|
end
|