neon_api 0.1.5 → 0.1.6
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/neon_api/client.rb +8 -4
- data/lib/neon_api/configuration.rb +1 -2
- data/lib/neon_api/version.rb +1 -1
- data/neon_api.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3ad67af734dbf0937cbd2619b09fa7f0a9b69fd
|
4
|
+
data.tar.gz: c462a501ad976b369bacbcda3d8d69adfda6c515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be704db7bed792423df83b9c651d05b9aa26e9c03f0d337a7a2ae642cf0d95ad110a222d72b7bbd09c5a3147ddf47e7d00e2a4ac95329a670e2f5e1681e14333
|
7
|
+
data.tar.gz: a9d0f8c449e8f0f9523c71c3ed258bad6dc4a962c6c73b3e4d06441e3428ad14328edf0f6cc9adfe5d46ca428e44aa80731c65f3b7cfc1947d5b488997033650
|
data/lib/neon_api/client.rb
CHANGED
@@ -9,6 +9,8 @@ module NeonApi
|
|
9
9
|
attr_accessor :url, :environment, :payload, :token, :last_authenticated_at, :response,
|
10
10
|
:auth_token, :aes_key, :aes_iv, :expire_time, :client_id, :bank_account, :response, :base_url
|
11
11
|
|
12
|
+
attr_reader :time_klass
|
13
|
+
|
12
14
|
def initialize(environment, token, login, password, encrypt_pem, decrypt_pem, proxy)
|
13
15
|
@environment = environment
|
14
16
|
@token = token
|
@@ -17,12 +19,14 @@ module NeonApi
|
|
17
19
|
@encrypt_pem = encrypt_pem
|
18
20
|
@decrypt_pem = decrypt_pem
|
19
21
|
@proxy = proxy
|
22
|
+
@time_klass = Time.respond_to?(:zone) ? Time.zone : Time
|
23
|
+
@expire_time = time_klass.now
|
20
24
|
|
21
25
|
RestClient.proxy = @proxy if @proxy
|
22
26
|
end
|
23
27
|
|
24
28
|
def authenticate
|
25
|
-
@last_authenticated_at =
|
29
|
+
@last_authenticated_at = time_klass.now
|
26
30
|
|
27
31
|
request = begin
|
28
32
|
RestClient::Request.execute(method: :post, url: "#{base_url}/V1/Client/Authentication",
|
@@ -40,7 +44,7 @@ module NeonApi
|
|
40
44
|
|
41
45
|
def send_request(object, url)
|
42
46
|
|
43
|
-
authenticate if
|
47
|
+
authenticate if time_klass.now > expire_time
|
44
48
|
|
45
49
|
request = begin
|
46
50
|
RestClient::Request.execute(method: :post, url: base_url + url,
|
@@ -82,7 +86,7 @@ module NeonApi
|
|
82
86
|
@auth_token = auth_answer['DataReturn']['Token']
|
83
87
|
@aes_key = auth_answer['DataReturn']['AESKey']
|
84
88
|
@aes_iv = auth_answer['DataReturn']['AESIV']
|
85
|
-
@expire_time =
|
89
|
+
@expire_time = time_klass.at(auth_answer['DataReturn']['DataExpiracao'].gsub(/[^\d]/, '').to_i)
|
86
90
|
@client_id = auth_answer['DataReturn']['ClientId']
|
87
91
|
@bank_account = auth_answer['DataReturn']['BankAccountId']
|
88
92
|
end
|
@@ -115,7 +119,7 @@ module NeonApi
|
|
115
119
|
{
|
116
120
|
"Username": @username,
|
117
121
|
"Password": @password,
|
118
|
-
"RequestDate":
|
122
|
+
"RequestDate": time_klass.now.strftime('%Y-%m-%dT%H:%M:%S')
|
119
123
|
}.to_json
|
120
124
|
end
|
121
125
|
|
data/lib/neon_api/version.rb
CHANGED
data/neon_api.gemspec
CHANGED
@@ -34,5 +34,5 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
spec.add_development_dependency "openssl", "~> 2.0"
|
37
|
-
spec.
|
37
|
+
spec.add_dependency "aes", "~> 0.5.0"
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neon_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Hamdan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.5.0
|
76
|
-
type: :
|
76
|
+
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|