gerencianet 0.0.3 → 0.0.4
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/CHANGELOG.md +4 -0
- data/lib/gerencianet/endpoints.rb +14 -8
- data/lib/gerencianet/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: 2b16286d4676a7d5afef9965e27828c11f510320
|
|
4
|
+
data.tar.gz: bd24b83493656bed754715cf849700be2f5ff02f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db9979088c3c55ab17b98c91a0e426b033cec75898c3d0b93b7b6343dfe7a02f1573e551d5a914c749ad05113d2198d26e3baf542bbf4687cd9cc978f242d732
|
|
7
|
+
data.tar.gz: 3dfc5c09a6f11b48e1da299da06d247fe89b5b5030590668f4abf364c3140969315998584b40522014b8e38ad1ed4c51bf5156305d3f0c0a3e237326e7cdd108
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@ require "http"
|
|
|
2
2
|
require "cgi"
|
|
3
3
|
require "gerencianet/constants"
|
|
4
4
|
require "gerencianet/status"
|
|
5
|
+
require "gerencianet/version"
|
|
5
6
|
|
|
6
7
|
module Gerencianet
|
|
7
8
|
# Given the constants file, with the endpoints signatures,
|
|
@@ -48,9 +49,13 @@ module Gerencianet
|
|
|
48
49
|
|
|
49
50
|
def make_request(params, body, settings)
|
|
50
51
|
url = get_url(params, settings[:route])
|
|
52
|
+
headers = {
|
|
53
|
+
"accept" => "application/json",
|
|
54
|
+
"api-sdk" => "ruby-#{Gerencianet::VERSION}"
|
|
55
|
+
}
|
|
51
56
|
|
|
52
57
|
HTTP
|
|
53
|
-
.headers(
|
|
58
|
+
.headers(headers)
|
|
54
59
|
.auth("Bearer #{@token['access_token']}")
|
|
55
60
|
.method(settings[:method])
|
|
56
61
|
.call(url, json: body)
|
|
@@ -74,7 +79,8 @@ module Gerencianet
|
|
|
74
79
|
def auth_headers
|
|
75
80
|
{
|
|
76
81
|
user: @options[:client_id],
|
|
77
|
-
pass: @options[:client_secret]
|
|
82
|
+
pass: @options[:client_secret],
|
|
83
|
+
"api-sdk" => "ruby-#{Gerencianet::VERSION}"
|
|
78
84
|
}
|
|
79
85
|
end
|
|
80
86
|
|
|
@@ -82,12 +88,6 @@ module Gerencianet
|
|
|
82
88
|
{grant_type: :client_credentials}
|
|
83
89
|
end
|
|
84
90
|
|
|
85
|
-
def respond(response)
|
|
86
|
-
JSON.parse(response)
|
|
87
|
-
rescue JSON::ParserError
|
|
88
|
-
raise "unable to parse server response, not a valid json"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
91
|
def get_url(params, route)
|
|
92
92
|
params = {} if params.nil?
|
|
93
93
|
route = remove_placeholders(params, route)
|
|
@@ -125,5 +125,11 @@ module Gerencianet
|
|
|
125
125
|
def current_base_url
|
|
126
126
|
@options[:sandbox] ? @urls[:sandbox] : @urls[:production]
|
|
127
127
|
end
|
|
128
|
+
|
|
129
|
+
def respond(response)
|
|
130
|
+
JSON.parse(response)
|
|
131
|
+
rescue JSON::ParserError
|
|
132
|
+
raise "unable to parse server response, not a valid json"
|
|
133
|
+
end
|
|
128
134
|
end
|
|
129
135
|
end
|
data/lib/gerencianet/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gerencianet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Francisco Carvalho
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-11-
|
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|