rpdoc 0.1.2 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +1 -1
- data/VERSION.md +1 -1
- data/lib/rpdoc/helper.rb +1 -0
- data/lib/rpdoc/postman_collection.rb +0 -4
- data/lib/rpdoc/postman_response.rb +18 -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: caba52d54294faa94238dc9788932f4220a8aca303edd1168ac50e6525bd4648
|
4
|
+
data.tar.gz: 40377c908e39e6eef198030ad51d33475d2c7d7360ea68491cb8d383eb8eeb3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc7e20fdd92637027e1023b5fdaf3426456fcf7fc76038c694421d610f45bc28399c135a1d7f88baf209ae9fbffbb95c9f352300f230940730c93ee96e6ef9c
|
7
|
+
data.tar.gz: 0a7c973ed4df9555bb348d5c7a6a513d834c6e8c4f8fdfc8862d24302e83db70c44f2d78398d8bf4d8ed7acea9f4ad77c490a439289a4f17548981199dfda01c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [0.1.6] - 2022-02-14
|
2
|
+
- Update licnese
|
3
|
+
|
4
|
+
## [0.1.4, 0.1.5] - 2021-12-22
|
5
|
+
- Fix rspec parsing bugs
|
6
|
+
|
7
|
+
## [0.1.3] - 2021-11-09
|
8
|
+
- Add require 'rspec/rails' if RSpec::Rails exists
|
9
|
+
|
1
10
|
## [0.1.2] - 2021-11-04
|
2
11
|
- Add gem description
|
3
12
|
- Remove unecessary gem dependency
|
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
data/VERSION.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/rpdoc/helper.rb
CHANGED
@@ -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,20 @@ 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
|
+
data[:body] = @rspec_response.body
|
55
|
+
end
|
56
|
+
data
|
50
57
|
end
|
51
58
|
|
52
59
|
def rspec_location_header
|
@@ -65,6 +72,14 @@ module Rpdoc
|
|
65
72
|
value: @rspec_request.headers[header]
|
66
73
|
}
|
67
74
|
end.compact
|
75
|
+
query_string = @rspec_request.query_string.split('&').map do |string|
|
76
|
+
key, value = string.split('=')
|
77
|
+
{
|
78
|
+
key: key,
|
79
|
+
value: CGI.unescape(value),
|
80
|
+
text: 'text'
|
81
|
+
}
|
82
|
+
end
|
68
83
|
@original_request_data = {
|
69
84
|
method: @rspec_request.method,
|
70
85
|
header: filter_headers,
|
@@ -72,7 +87,7 @@ module Rpdoc
|
|
72
87
|
raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
|
73
88
|
host: [@configuration.rspec_server_host],
|
74
89
|
path: @rspec_request.path.split('/'),
|
75
|
-
|
90
|
+
query: query_string
|
76
91
|
},
|
77
92
|
body: nil
|
78
93
|
}
|
@@ -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.6
|
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
|