json_http_connection 1.0.1 → 1.1.0

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: 9e7086901aafe7fee66e5e61b3c7d0811986f9e2
4
- data.tar.gz: 32cb9ced064e2301f3bc4ebce82cab3a41343481
3
+ metadata.gz: ad091e9bade8c47a035ee637c87e379cfd2e7a3c
4
+ data.tar.gz: 78c7209f127a5da9fabe3e6bdb78db0ed38b4760
5
5
  SHA512:
6
- metadata.gz: 84b18280290ee52752ea52ffd4cab9720214031f9b234a449926c80e1bcf4e7582c971ecd72d96a00db049d09698e90ea19fb96c6f1998e857f72438eb1e2677
7
- data.tar.gz: 219514b61bfe6281c845abe7c952e9577b92ec4569fd3c41864fbd05b9145704593a7ee8b38688672ef8ad716f5367d89f80956e1cfce1fbb5e3b8c74d2db566
6
+ metadata.gz: 577f62ed3d72d649dd5f316a7070d630c0bf60e1d8ebce6938743ecb5071e7fd588ad826ee68b761746f8895b8d19fa9b678dde4dd4d1cedf2e483a78b4ee016
7
+ data.tar.gz: c153e1814c68b67db5a0a45a00362c95250871db82f6df084dc77587001837cb3a1543781d5c61a87fe9bff6cbd9b5e538afa6411d094d4ea036b3c834935f6e
@@ -13,24 +13,17 @@ module JsonHttpConnection
13
13
 
14
14
  def initialize(config)
15
15
  @config = config
16
+ @config[:headers] ||= {}
17
+ @config[:headers].merge!('Content-Type' => 'application/json',
18
+ 'Accept' => 'application/json')
16
19
 
17
20
  super(faraday_connection)
18
21
  end
19
22
 
20
23
  private
21
24
 
22
- def faraday_opts
23
- {
24
- url: config[:url],
25
- headers: {
26
- 'Content-Type' => 'application/json',
27
- 'Accept' => 'application/json'
28
- }
29
- }
30
- end
31
-
32
25
  def faraday_connection
33
- @connection ||= Faraday.new(faraday_opts) do |c|
26
+ @connection ||= Faraday.new(@config) do |c|
34
27
  c.request :json
35
28
  c.adapter :typhoeus
36
29
  c.response :json, content_type: /\bjson$/
@@ -1,3 +1,3 @@
1
1
  module JsonHttpConnection
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_http_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Raganhan Barbosa