spaceborne 0.1.1 → 0.1.2

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: 13c1d8bcaa3182efbb6bede8275cd46c64a2f246
4
- data.tar.gz: a5555d947093d64d822136c07daf2371f8cf7aab
3
+ metadata.gz: eb88641f7013185d05fc068fd5084259aab37f49
4
+ data.tar.gz: bf09c61c4b58470f409283389fc716e96c1b665a
5
5
  SHA512:
6
- metadata.gz: 6b9bbe4271a67462eb617092d6603c9545565b3dd767fa0d71848e9f27f23185e4c86f004744debc01b20671a030fce62da50b94d76014933c04acb1504d3d8b
7
- data.tar.gz: 29cfb18415e5e30568b42381677c4464bd47ee88fd30e35fcf987cb3969fde7c925094b948bf476ba2a8c0f2cd62670e3521347fdf8d76916e97cdc80540907f
6
+ metadata.gz: '0519ee8bb46df927398bd14c6db32281c6759a3cf718c75d38fb4299a0bbb10c9e837e8887711e8ca1430b2cdf60fa8a3e26383c3f0f8239e87dbc1a2bb65855'
7
+ data.tar.gz: 853e45e5cf65cfa3a51c6d991b8fa973fc4e05e75dee5fca4baca6e33653be11e7cd03928876c9fba523403629535a0a62a4c289fc47c228dce2a465463b638f
@@ -10,7 +10,7 @@ module Spaceborne
10
10
  rescue Exception => e
11
11
  puts "REQUEST: #{response.request.method.upcase} #{response.request.url}"
12
12
  puts " HEADERS:\n#{JSON::pretty_generate(response.request.headers)}"
13
- puts " PAYLOAD:\n#{response.request.payload}" if response.request.payload
13
+ puts " PAYLOAD:\n#{@request_body}" if @request_body
14
14
  puts "RESPONSE: #{response.code}"
15
15
  puts " HEADERS:\n#{JSON::pretty_generate(response.headers)}"
16
16
  is_json = response.headers[:content_type].include?('application/json')
@@ -29,12 +29,16 @@ module Airborne
29
29
  module RestClientRequester
30
30
  def make_request(method, url, options = {})
31
31
  @json_body = nil
32
+ @requet_body = nil
32
33
  headers = base_headers.merge(options[:headers] || {})
33
34
  res = if method == :post || method == :patch || method == :put
34
35
  begin
35
- request_body = options[:body].nil? ? '' : options[:body]
36
- request_body = request_body.to_json if options[:body].is_a?(Hash)
37
- RestClient.send(method, get_url(url), request_body, headers)
36
+ @request_body = options[:body].nil? ? '' : options[:body]
37
+ if options[:body].is_a?(Hash)
38
+ headers.merge!(no_restclient_headers: true)
39
+ @request_body = @request_body.to_json
40
+ end
41
+ RestClient.send(method, get_url(url), @request_body, headers)
38
42
  rescue RestClient::Exception => e
39
43
  e.response
40
44
  end
@@ -47,7 +51,13 @@ module Airborne
47
51
  end
48
52
  res
49
53
  end
54
+
55
+ private
56
+ def base_headers
57
+ { "Content-Type" => 'application/json' }.merge(Airborne.configuration.headers || {})
58
+ end
50
59
  end
60
+
51
61
  module RequestExpectations
52
62
  def call_with_relative_path(data, args)
53
63
  if args.length == 2
@@ -1,3 +1,3 @@
1
1
  module Spaceborne
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
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.1
4
+ version: 0.1.2
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-18 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.5.2.1
147
+ rubygems_version: 2.6.14
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Gem supporting API testing