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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82170672a23819b768a4f8df4e65cf99b9ba3d83
4
- data.tar.gz: 556f598d08d2ca6caea89193bce70c7a558abf0e
3
+ metadata.gz: 2b16286d4676a7d5afef9965e27828c11f510320
4
+ data.tar.gz: bd24b83493656bed754715cf849700be2f5ff02f
5
5
  SHA512:
6
- metadata.gz: 551af409f586176451cf72c5aeade220361b5a6a0b00dfffb225e905c1d15c8fe479808ecf048160a712a85af346641b8d0f16436552c4b845799519e654deb0
7
- data.tar.gz: 0c7412e9d3e45d33a3a51a11f951e065836fe76882cf243929ebad96cab76c4e039b021b7bf82441b4d9365dc5a11f91fda5b5106cae516e1044ecefa7c1ed73
6
+ metadata.gz: db9979088c3c55ab17b98c91a0e426b033cec75898c3d0b93b7b6343dfe7a02f1573e551d5a914c749ad05113d2198d26e3baf542bbf4687cd9cc978f242d732
7
+ data.tar.gz: 3dfc5c09a6f11b48e1da299da06d247fe89b5b5030590668f4abf364c3140969315998584b40522014b8e38ad1ed4c51bf5156305d3f0c0a3e237326e7cdd108
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.3
2
+
3
+ - Changed: Encode url params for get methods
4
+
1
5
  # 0.0.2
2
6
 
3
7
  - Changed: Functions now receive a single hash param like `{params: params, body: body}` instead of receiving two params `params, body` as before.
@@ -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(accept: "application/json")
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
@@ -1,4 +1,4 @@
1
1
  # :nodoc:
2
2
  module Gerencianet
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
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.3
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-16 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler