ezapi_client 1.0.3 → 1.1.0

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: 2b722d7d9408b1bd107cb6e9030377697bcc10dd60f3f13629f596b0423da53a
4
- data.tar.gz: bf780364b5b1ed143f10236ac85c53471f1b7bd8b991d32b46a5709274b9a655
3
+ metadata.gz: 23f3f08aa7781e5f8b56fb3762850658faf5615908f26c6bf69d533c3317ff40
4
+ data.tar.gz: 9b2c8d600f6d9e434b9dde451eae2be618be110208f9aaf3b26f019bc6396dfa
5
5
  SHA512:
6
- metadata.gz: 8ef972672fe065716c03140d8db738b51294fc0335e52548cd497415e7f65248c77c558a1aa79f6daafae50a30567ebda67f15f241da87634d0d830b164a8037
7
- data.tar.gz: 8c89dc1ce80a906688a4ec4b1172869875003ae57d9f06a217dfb87ca062d584f873124d24fc16d5b5bab8349169fb50e5769930be57f4d9a3fd33365b54c12b
6
+ metadata.gz: 3876343644d65cf75b669d0aecf2ec2c61add2507114c1a860e9da54e46c395535148b624789ed9c96e171b6b6cbca0dc1d35fd6cd9606ab2666b5730c863475
7
+ data.tar.gz: fcff3a8348f0bd5034157c605de5e55e66ed95146929f590bb19e76d16261e16cce39e69f8a67bedcd931905623944de43d0244f1d29516b743e4d505ddb6dd9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [1.1.0] - 2019-05-27
6
+ ### Added
7
+ - Response `#raw_body` to access the raw, unparsed body directly
8
+
9
+ ### Fixed
10
+ - BaseResponse #code and #message are nil if #response_body is nil
11
+
5
12
  ## [1.0.3] - 2019-05-27
6
13
  ### Fixed
7
14
  - EZAPI server couldn't parse escaped JSON; escape values instead of whole JSON instead
@@ -3,6 +3,7 @@ module EZAPIClient
3
3
 
4
4
  include Virtus.model
5
5
  attribute :raw_response, Object
6
+ attribute :raw_body, String, lazy: true, default: :default_raw_body
6
7
  attribute(:response_body, IndifferentHash, {
7
8
  lazy: true,
8
9
  default: :default_response_body,
@@ -18,17 +19,23 @@ module EZAPIClient
18
19
  response_body[:success]
19
20
  end
20
21
 
22
+ def default_raw_body
23
+ raw_response.body
24
+ end
25
+
21
26
  def default_response_body
22
- JSON.parse(raw_response.body)
27
+ JSON.parse(raw_body)
23
28
  rescue JSON::ParserError
24
29
  nil
25
30
  end
26
31
 
27
32
  def default_code
33
+ return nil if response_body.nil?
28
34
  response_body[:code]
29
35
  end
30
36
 
31
37
  def default_message
38
+ return nil if response_body.nil?
32
39
  response_body[:message]
33
40
  end
34
41
 
@@ -1,3 +1,3 @@
1
1
  module EZAPIClient
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezapi_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag