rpdoc 0.1.3 → 0.1.4
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/VERSION.md +1 -1
- data/lib/rpdoc/postman_collection.rb +0 -4
- data/lib/rpdoc/postman_response.rb +15 -3
- data/lib/rpdoc/rpdoc.rake +8 -0
- data/lib/rpdoc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f234d1015e23861e910744f7ada506266c634096c6f577e49d6fc6af11301b
|
4
|
+
data.tar.gz: a57bf4be6484e6f313260fc425b5ad41c1b1cd02c62e2de4a59f107cb9590aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30be6db46768982228147275570ab650c77ae1f60d399fa93d8b10e9464c6f4d190eaca3d5001b43d9ed66bfbdd52110b0dc7f2c99c96c2c138430e0e2489de7
|
7
|
+
data.tar.gz: 5a82d9b23f537e680eb9460d2dcabe307953d47c93264aca310bf8dcc0ee42cd6840e714abfbe8bac13ad76f834659dc32812ed3daa05e903850da097a85f7a5
|
data/CHANGELOG.md
CHANGED
data/VERSION.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -40,10 +40,6 @@ module Rpdoc
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
def collection_data
|
44
|
-
@collection_data ||= @original_collection.present? ? @original_collection.deeper_merge(collection_from_rspec, merge_hash_arrays: true) : collection_from_rspec
|
45
|
-
end
|
46
|
-
|
47
43
|
def generated_collection_data
|
48
44
|
{
|
49
45
|
collection: {
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'cgi'
|
4
|
+
|
3
5
|
module Rpdoc
|
4
6
|
class PostmanResponse
|
5
7
|
attr_reader :data
|
@@ -38,15 +40,17 @@ module Rpdoc
|
|
38
40
|
def response_data
|
39
41
|
headers = @rspec_response.header.map { |key, value| {key: key, value: value} }
|
40
42
|
headers << rspec_location_header
|
41
|
-
{
|
43
|
+
data = {
|
42
44
|
name: @rspec_example.metadata[:rpdoc_example_name],
|
43
45
|
originalRequest: original_request_data,
|
44
46
|
status: @rspec_response.status.to_s,
|
45
47
|
code: @rspec_response.code.to_i,
|
46
48
|
_postman_previewlanguage: "json",
|
47
49
|
header: headers,
|
48
|
-
body:
|
50
|
+
body: nil
|
49
51
|
}
|
52
|
+
data[:body] = JSON.pretty_generate(JSON.parse(@rspec_response.body)) rescue nil if @rspec_response.headers['Content-Type'].include?('application/json')
|
53
|
+
data
|
50
54
|
end
|
51
55
|
|
52
56
|
def rspec_location_header
|
@@ -65,6 +69,14 @@ module Rpdoc
|
|
65
69
|
value: @rspec_request.headers[header]
|
66
70
|
}
|
67
71
|
end.compact
|
72
|
+
query_string = @rspec_request.query_string.split('&').map do |string|
|
73
|
+
key, value = string.split('=')
|
74
|
+
{
|
75
|
+
key: key,
|
76
|
+
value: CGI.unescape(value),
|
77
|
+
text: 'text'
|
78
|
+
}
|
79
|
+
end
|
68
80
|
@original_request_data = {
|
69
81
|
method: @rspec_request.method,
|
70
82
|
header: filter_headers,
|
@@ -72,7 +84,7 @@ module Rpdoc
|
|
72
84
|
raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
|
73
85
|
host: [@configuration.rspec_server_host],
|
74
86
|
path: @rspec_request.path.split('/'),
|
75
|
-
|
87
|
+
query: query_string
|
76
88
|
},
|
77
89
|
body: nil
|
78
90
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
namespace :rpdoc do
|
2
|
+
desc 'push collection to the Postman server'
|
3
|
+
task :push => :environment do
|
4
|
+
postman_collection = Rpdoc::PostmanCollection.new
|
5
|
+
postman_collection.save
|
6
|
+
postman_collection.send(Rpdoc.configuration.rpdoc_auto_push_strategy) if Rpdoc.configuration.rpdoc_auto_push
|
7
|
+
end
|
8
|
+
end
|
data/lib/rpdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpdoc
|
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
|
- yuntai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_requester
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/rpdoc/helper.rb
|
108
108
|
- lib/rpdoc/postman_collection.rb
|
109
109
|
- lib/rpdoc/postman_response.rb
|
110
|
+
- lib/rpdoc/rpdoc.rake
|
110
111
|
- lib/rpdoc/version.rb
|
111
112
|
- rpdoc.gemspec
|
112
113
|
homepage: https://github.com/kdan-mobile-software-ltd/rpdoc
|