rpdoc 0.1.3 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +1 -1
- data/VERSION.md +1 -1
- data/lib/rpdoc/postman_collection.rb +0 -4
- data/lib/rpdoc/postman_response.rb +19 -3
- data/lib/rpdoc/rpdoc.rake +8 -0
- data/lib/rpdoc/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 204129b067a6bafd639a29a0a18f361526855a2472d252f7b2f5f08258c91ff3
|
4
|
+
data.tar.gz: bf9fac67e3ccdd67441bd39cee555ef34af168367adae4832be6beb7cad2065a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b362d3e068426fc9eb21cd367d3caca67c9838e55a060954f5633415fdf8cca5ed10ce70199ff2a51eab65ffa54c09b9b443dd70c610cdea75beb6dcc2c8d73
|
7
|
+
data.tar.gz: a7ae37b09463579a01da095527e84b0af7adc0470df89462b064c556673a278f7656409d3d18821e1b390dd87a79059c38f306b72062ac8f0e3620f7a3595a69
|
data/CHANGELOG.md
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
data/VERSION.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -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,21 @@ 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: JSON.pretty_generate(JSON.parse(@rspec_response.body))
|
49
50
|
}
|
51
|
+
if @rspec_response.headers['Content-Type'].include?('application/json')
|
52
|
+
data[:body] = JSON.pretty_generate(JSON.parse(@rspec_response.body)) rescue nil
|
53
|
+
else
|
54
|
+
body = @rspec_response.body
|
55
|
+
data[:body] = body.encoding == 'ASCII-8BIT' ? body.force_encoding("ISO-8859-1").encode("UTF-8") : body
|
56
|
+
end
|
57
|
+
data
|
50
58
|
end
|
51
59
|
|
52
60
|
def rspec_location_header
|
@@ -65,6 +73,14 @@ module Rpdoc
|
|
65
73
|
value: @rspec_request.headers[header]
|
66
74
|
}
|
67
75
|
end.compact
|
76
|
+
query_string = @rspec_request.query_string.split('&').map do |string|
|
77
|
+
key, value = string.split('=')
|
78
|
+
{
|
79
|
+
key: key,
|
80
|
+
value: CGI.unescape(value),
|
81
|
+
text: 'text'
|
82
|
+
}
|
83
|
+
end
|
68
84
|
@original_request_data = {
|
69
85
|
method: @rspec_request.method,
|
70
86
|
header: filter_headers,
|
@@ -72,7 +88,7 @@ module Rpdoc
|
|
72
88
|
raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
|
73
89
|
host: [@configuration.rspec_server_host],
|
74
90
|
path: @rspec_request.path.split('/'),
|
75
|
-
|
91
|
+
query: query_string
|
76
92
|
},
|
77
93
|
body: nil
|
78
94
|
}
|
@@ -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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yuntai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_requester
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- CHANGELOG.md
|
95
95
|
- Gemfile
|
96
96
|
- Gemfile.lock
|
97
|
-
- LICENSE
|
97
|
+
- LICENSE
|
98
98
|
- README.md
|
99
99
|
- Rakefile
|
100
100
|
- VERSION.md
|
@@ -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
|