neon_api 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neon_api/client.rb +9 -10
- data/lib/neon_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c44cfef9037b9533821395ce1db80e395f6f6b4
|
4
|
+
data.tar.gz: 471549846983383c4e8c23bbb39d1d56deb64bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e02907d429b3f63dc97bed50cb42a32a257d057b932a5343d2713e4c1a46647a12ba0697cff9cd2fa751d0d2ad7452ba770aceceb3e4de0face65729e9bb2707
|
7
|
+
data.tar.gz: 464c1068a815567c258d3862353eab65da49623750608a354545f2f15e3d430575148809fc12397ff367013df8e06bf5325fa36eeea7dc225ab2afd6e5e14cf1
|
data/lib/neon_api/client.rb
CHANGED
@@ -7,14 +7,9 @@ module NeonApi
|
|
7
7
|
|
8
8
|
class Client
|
9
9
|
attr_accessor :url, :environment, :payload, :token, :last_authenticated_at, :response,
|
10
|
-
:auth_token, :aes_key, :aes_iv, :expire_time, :client_id, :bank_account, :response
|
11
|
-
def initialize(environment = :development, token, login, password, encrypt_pem, decrypt_pem, proxy)
|
12
|
-
@base_url = if production?
|
13
|
-
'https://apiparceiros.banconeon.com.br/ '
|
14
|
-
else
|
15
|
-
'https://servicosdev.neonhomol.com.br/servicopj/'
|
16
|
-
end
|
10
|
+
:auth_token, :aes_key, :aes_iv, :expire_time, :client_id, :bank_account, :response, :base_url
|
17
11
|
|
12
|
+
def initialize(environment, token, login, password, encrypt_pem, decrypt_pem, proxy)
|
18
13
|
@environment = environment
|
19
14
|
@token = token
|
20
15
|
@username = login
|
@@ -30,7 +25,7 @@ module NeonApi
|
|
30
25
|
@last_authenticated_at = Time.now
|
31
26
|
|
32
27
|
request = begin
|
33
|
-
RestClient::Request.execute(method: :post, url: "#{
|
28
|
+
RestClient::Request.execute(method: :post, url: "#{base_url}/V1/Client/Authentication",
|
34
29
|
payload: { "Data": encrypted_payload(authentication: true) }, headers: auth_headers)
|
35
30
|
rescue RestClient::ExceptionWithResponse => err
|
36
31
|
err.response
|
@@ -48,7 +43,7 @@ module NeonApi
|
|
48
43
|
authenticate if expire_time > Time.now
|
49
44
|
|
50
45
|
request = begin
|
51
|
-
RestClient::Request.execute(method: :post, url:
|
46
|
+
RestClient::Request.execute(method: :post, url: base_url + url,
|
52
47
|
payload: { "Data": encrypted_payload(payload: object) }, headers: headers)
|
53
48
|
rescue RestClient::ExceptionWithResponse => err
|
54
49
|
err.response
|
@@ -123,5 +118,9 @@ module NeonApi
|
|
123
118
|
"RequestDate": Time.now.strftime('%Y-%m-%dT%H:%M:%S')
|
124
119
|
}.to_json
|
125
120
|
end
|
121
|
+
|
122
|
+
def base_url
|
123
|
+
@base_url ||= production? ? 'https://apiparceiros.banconeon.com.br/' : 'https://servicosdev.neonhomol.com.br/servicopj/'
|
124
|
+
end
|
126
125
|
end
|
127
|
-
end
|
126
|
+
end
|
data/lib/neon_api/version.rb
CHANGED
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.5
|
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-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|