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 +4 -4
- data/lib/spaceborne.rb +14 -4
- data/lib/spaceborne/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb88641f7013185d05fc068fd5084259aab37f49
|
4
|
+
data.tar.gz: bf09c61c4b58470f409283389fc716e96c1b665a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0519ee8bb46df927398bd14c6db32281c6759a3cf718c75d38fb4299a0bbb10c9e837e8887711e8ca1430b2cdf60fa8a3e26383c3f0f8239e87dbc1a2bb65855'
|
7
|
+
data.tar.gz: 853e45e5cf65cfa3a51c6d991b8fa973fc4e05e75dee5fca4baca6e33653be11e7cd03928876c9fba523403629535a0a62a4c289fc47c228dce2a465463b638f
|
data/lib/spaceborne.rb
CHANGED
@@ -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#{
|
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
|
-
|
37
|
-
|
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
|
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.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-
|
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.
|
147
|
+
rubygems_version: 2.6.14
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Gem supporting API testing
|