koine-rest_client 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da36fc4df6eb2531f9c94cb98cfc95e56a0943464a517b73ad1d5845a1944cc0
4
- data.tar.gz: ad8f8705d5da75a29caddb8ffae8477fc1e308771b6c559cb113206b9e707fba
3
+ metadata.gz: 11c13b889e0dd93439ed547233da15fcadc920721f8c8eb8e71f60ec2e1dd835
4
+ data.tar.gz: 3f8c917838bb488ca456e8439b2f846462530b29115eb9b2df3918fcfabf8341
5
5
  SHA512:
6
- metadata.gz: 5137beef343e4fb1d7b038fe7b6f38dcd996acf4203e4bf6796f6492af2d0dc04c727533c7e9033e1f2a2fca990a8e00054ece027306139da27e1b57d1306756
7
- data.tar.gz: 795b538464313e54b848a7fa7a405d053b4158069df31e6148e2e7633248fda106abb95deeeed152103fad3c4cab5deeaefe7482c7fe6825dd2f94c79f14d787
6
+ metadata.gz: c335ee8ca7d89cee48ab922b7489c61bba707cf3d97e7a66fc9f4a4e47d866918429624042c3ecfb75cd7abb67de2e3c38d02bb4939a00557d72fd409655e519
7
+ data.tar.gz: 71e17720a95bf74661fe368a63162c03206541fe52306908e144d1e6032095be80dc40d9f6b04ca4243ce7475c3854c69194035d71de36b02f6ef25bdfbb1d2e
@@ -7,7 +7,7 @@ Metrics/BlockLength:
7
7
  - 'spec/**/*'
8
8
  - '*.gemspec'
9
9
 
10
- Metrics/LineLength:
10
+ Layout/LineLength:
11
11
  Max: 100
12
12
  Exclude:
13
13
  - '*.gemspec'
@@ -77,7 +77,6 @@ module Koine
77
77
  attr_writer :path
78
78
  attr_writer :query_params
79
79
  attr_writer :headers
80
- attr_writer :body
81
80
 
82
81
  # :reek:FeatureEnvy
83
82
  def new(attribute, value)
@@ -86,6 +85,22 @@ module Koine
86
85
  object.freeze
87
86
  end
88
87
  end
88
+
89
+ def body=(body)
90
+ if json_request? && body.is_a?(Hash)
91
+ body = JSON.dump(body)
92
+ end
93
+
94
+ @body = body
95
+ end
96
+
97
+ # rubocop:disable Performance/Casecmp
98
+ def json_request?
99
+ headers.find do |key, value|
100
+ key.downcase == 'content-type' && value.downcase.match('application/json')
101
+ end
102
+ end
103
+ # rubocop:enable Performance/Casecmp
89
104
  end
90
105
  end
91
106
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Koine
4
4
  module RestClient
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koine-rest_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus