rspec_generate_doc 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8f7de53e6515d9a9760672bbad9ad6dfe2613d8
4
- data.tar.gz: e64fe541f4074f8afc30376d9583dbecf81b73f5
3
+ metadata.gz: 446334c3f0840f081d3828d9ab6ce9c30a809860
4
+ data.tar.gz: 0c8f391807fa3d9ff9e44aaa35678dfbd6631202
5
5
  SHA512:
6
- metadata.gz: 2ef86ddc3d635fe52a735903df346eec35927b8deb6485c2997d83e32ee83df0747990b61850da7b968bf9df825cd28b2f5a670f3287636f5785d29591315896
7
- data.tar.gz: 551702d46f53d6dbc8ffbac0f43c0a8fa2ba5d1a5c1e74ce3c3f14b88f67b1c46f4414507f704822b4ed9cdbc5d907e8c0d0850de40aeb6f5ffb2e52e81e84e0
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, :content_type, :status, :status_message,
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?
@@ -1,3 +1,3 @@
1
1
  module RspecGenerateDoc
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_generate_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kutyavin