spaceborne 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spaceborne.rb +8 -3
- data/lib/spaceborne/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49705ebda515a9c14fb5ec1fa7c60dca3f5c0db
|
4
|
+
data.tar.gz: 170d373aa2b69dc469f1857c01eca40a1c04aca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262d9a5527212d2da5585edd66970d14e98e3a4b6dc4ec624a3c9199aea62805dab3a5c4f8567d81403a7e2f863e0bf1d1cee9ec90875cb9aa1dc5904feb5a4b
|
7
|
+
data.tar.gz: deae16b58e7ab67d7e1521a0bb4594f68ca126c40ae5add2b7baa87783ba6b936f2e09d1f5dfff14bcfcf13e0f58f6831e9409fc0af06b84f59610d395dda44e
|
data/lib/spaceborne.rb
CHANGED
@@ -5,6 +5,9 @@ require 'byebug'
|
|
5
5
|
require 'json'
|
6
6
|
|
7
7
|
module Spaceborne
|
8
|
+
def is_json?(headers)
|
9
|
+
headers.get(:content_type) && headers[:content_type].include?('application/json')
|
10
|
+
end
|
8
11
|
def wrap_request(&block)
|
9
12
|
block.call
|
10
13
|
rescue Exception => e
|
@@ -13,9 +16,11 @@ module Spaceborne
|
|
13
16
|
puts " PAYLOAD:\n#{@request_body}" if @request_body
|
14
17
|
puts "RESPONSE: #{response.code}"
|
15
18
|
puts " HEADERS:\n#{JSON::pretty_generate(response.headers)}"
|
16
|
-
is_json
|
17
|
-
|
18
|
-
|
19
|
+
if is_json?(response.headers)
|
20
|
+
puts " JSON_BODY\n#{JSON::pretty_generate(json_body)}"
|
21
|
+
else
|
22
|
+
puts " BODY\n#{response.body}"
|
23
|
+
end
|
19
24
|
raise e
|
20
25
|
end
|
21
26
|
end
|
data/lib/spaceborne/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|