spaceborne 0.1.31 → 0.1.32

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
  SHA256:
3
- metadata.gz: 72968f57b5658b95c645404742ac5e797915c4e501d041627d879c5f79eef156
4
- data.tar.gz: 98b7748f61e8f46429761b0aac26a6295b9a086539c28250bca4d18edaf7432d
3
+ metadata.gz: 1d0cc2ecd5be2a2cf85fe7df08c05514ab0cb74a5904eaf5b3a8b1c70a2e375f
4
+ data.tar.gz: 04d190d82b7a1e207ec8f0a24263ac43b141e04350f763a80b86c7362dc60625
5
5
  SHA512:
6
- metadata.gz: f2dd692da19d246bcc617dd386451aba0e675ab0597a252368d44bbcf2f067201f41443143e449d8e8af22203c4bd918980ef2b89678ec03316ce2833d70e5c3
7
- data.tar.gz: 809f4fe5a6a537f7f4f11aaeabcc460d35f3ada01ecc7d6042f9970dea0236cee97094612755069b2c70129b4dc6ed8953fca252a9785f8e99b219b4356dca93
6
+ metadata.gz: e8c1d2bedc95a45d5320e6b69a116ea470bb200f67e801258c34e3968c0cd6d90021c70890467c68bfd5d63f79bc7688959ac5da921e0faecffae0de690c5287
7
+ data.tar.gz: 28784cf263020280389d5efa9a45ac19c1fa463c0476dfae384d4b47b5f5683962e483790e2ea6d5a48716d69cde1c6a951fe718824521a1a0df0986a959e3a4
data/README.md CHANGED
@@ -205,8 +205,9 @@ Validation for headers follows the same pattern as above, although nesting of mu
205
205
  * `expect_header_types same arguments/handling as expect_json_types`
206
206
  5. It is possible to use non-json data in a request
207
207
  6. Expectations on a response with an array of hashes with keys that are unknown, but that have a defined structure are supported (using the '*' in a path)
208
+ 7. Responses that have header with Content-Encoding of gzip are gunzip'd in json_body
208
209
 
209
- The following example shows how this works
210
+ The following example shows how extension # 6 works
210
211
 
211
212
  ```ruby
212
213
  { "array_of_hashes": [
data/lib/spaceborne.rb CHANGED
@@ -58,8 +58,16 @@ end
58
58
 
59
59
  # monkeypatch Airborne
60
60
  module Airborne
61
+ def decode_body
62
+ if response.headers[:content_encoding]&.include?('gzip')
63
+ Zlib::Inflate.new(32 + Zlib::MAX_WBITS).inflate(response.body)
64
+ else
65
+ response.body
66
+ end
67
+ end
68
+
61
69
  def json_body
62
- @json_body ||= JSON.parse(response.body, symbolize_names: true)
70
+ @json_body ||= JSON.parse(decode_body, symbolize_names: true)
63
71
  rescue StandardError
64
72
  raise InvalidJsonError, 'Api request returned invalid json'
65
73
  end
@@ -1,3 +1,3 @@
1
1
  module Spaceborne
2
- VERSION = '0.1.31'.freeze
2
+ VERSION = '0.1.32'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spaceborne
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.31
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport