rspec_generate_doc 0.2.8 → 0.2.9
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/lib/rspec_generate_doc/decorators/action.rb +26 -9
- data/lib/rspec_generate_doc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 446334c3f0840f081d3828d9ab6ce9c30a809860
|
4
|
+
data.tar.gz: 0c8f391807fa3d9ff9e44aaa35678dfbd6631202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b8647d8811de47f70a2f8762f8cba52a4aa93eb858640d0ae83b226d0cd63cd44ffeec7219d968725ea13c24509715fe3c47613cac44fbdcc470c017f514791
|
7
|
+
data.tar.gz: 0f8fb750bfe754dbb8233778f2056153361f72a53f37616eaa45b6e720300e7a2705ed84cf91fc8de5e4b4e04a813fbbe89210584ad1e18002febdfe83f41829
|
@@ -3,23 +3,40 @@ require 'ostruct'
|
|
3
3
|
module RspecGenerateDoc
|
4
4
|
module Decorators
|
5
5
|
class Action
|
6
|
-
attr_reader :name, :response, :
|
7
|
-
:host, :request_method, :request_fullpath, :params, :options
|
6
|
+
attr_reader :name, :response, :params, :options
|
8
7
|
def initialize(data = {})
|
9
8
|
@name = (data[:name] || '').split('#').join(' ')
|
10
9
|
@response = data[:response]
|
11
|
-
@content_type = data[:content_type] || response.content_type
|
12
|
-
@status = data[:status] || response.status
|
13
|
-
@status_message = data[:status_message] || response.status_message
|
14
|
-
@host = data[:host] || request.host
|
15
|
-
@request_method = data[:request_method] || request.request_method
|
16
|
-
@request_fullpath = data[:request_fullpath] || request.original_fullpath.split('?').first
|
17
10
|
@params = to_params(data[:api_params])
|
18
11
|
@options = OpenStruct.new(data[:options] || {})
|
19
12
|
end
|
20
13
|
|
14
|
+
def request_method
|
15
|
+
@request_method ||= options.request_method || request.request_method
|
16
|
+
end
|
17
|
+
|
18
|
+
def request_fullpath
|
19
|
+
@request_fullpath ||= options.original_fullpath || request.original_fullpath.split('?').first
|
20
|
+
end
|
21
|
+
|
22
|
+
def host
|
23
|
+
@host ||= options.host || request.host
|
24
|
+
end
|
25
|
+
|
26
|
+
def status
|
27
|
+
@status ||= options.status || response.status
|
28
|
+
end
|
29
|
+
|
30
|
+
def status_message
|
31
|
+
@status_message ||= options.status_message || response.status_message
|
32
|
+
end
|
33
|
+
|
21
34
|
def status_with_message
|
22
|
-
"#{status} #{status_message}"
|
35
|
+
@status_with_message ||= "#{status} #{status_message}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def content_type
|
39
|
+
@content_type ||= options.content_type || response.content_type
|
23
40
|
end
|
24
41
|
|
25
42
|
def content_type?
|