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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7b56cb7d21fce083daee10d1a80608983e98642
4
- data.tar.gz: 2d4ac890cff9f4cf2b92bcbce9c95f9729647ff5
3
+ metadata.gz: c49705ebda515a9c14fb5ec1fa7c60dca3f5c0db
4
+ data.tar.gz: 170d373aa2b69dc469f1857c01eca40a1c04aca5
5
5
  SHA512:
6
- metadata.gz: b26c55ae5fe82eb73be7e09969baa0e9912156182e971157f5fcd521ab3a87d69a183886cc1616e641f21b028c6558557dfd7352e2253844c653e05951703996
7
- data.tar.gz: 55f595c2d5ec68f99cd7d158f3f67c7f970f5d55a2f00417cd7ef4f9c2ede4732e8fcd8ab64afa025059cc38ccd0c18db5db834a50a7b81afbdcc3753b88778b
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 = response.headers[:content_type].include?('application/json')
17
- puts " JSON_BODY\n#{JSON::pretty_generate(json_body)}" if is_json
18
- puts " BODY\n#{response.body}" unless is_json
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
@@ -1,3 +1,3 @@
1
1
  module Spaceborne
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
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.3
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-19 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler