Class: Esplanade::Request::Doc
- Inherits:
-
Object
- Object
- Esplanade::Request::Doc
- Defined in:
- lib/esplanade/request/doc.rb
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(main_documentation, raw) ⇒ Doc
constructor
A new instance of Doc.
- #json_schemas ⇒ Object
- #method ⇒ Object
- #path ⇒ Object
- #responses ⇒ Object
- #tomogram ⇒ Object
Constructor Details
#initialize(main_documentation, raw) ⇒ Doc
Returns a new instance of Doc.
4 5 6 7 |
# File 'lib/esplanade/request/doc.rb', line 4 def initialize(main_documentation, raw) @main_documentation = main_documentation @raw = raw end |
Instance Method Details
#content_type ⇒ Object
34 35 36 |
# File 'lib/esplanade/request/doc.rb', line 34 def content_type @content_type ||= tomogram.content_type.to_s end |
#json_schemas ⇒ Object
22 23 24 |
# File 'lib/esplanade/request/doc.rb', line 22 def json_schemas @json_schemas ||= tomogram.requests end |
#method ⇒ Object
26 27 28 |
# File 'lib/esplanade/request/doc.rb', line 26 def method @method ||= tomogram.method end |
#path ⇒ Object
30 31 32 |
# File 'lib/esplanade/request/doc.rb', line 30 def path @path ||= tomogram.path.to_s end |
#responses ⇒ Object
38 39 40 41 42 |
# File 'lib/esplanade/request/doc.rb', line 38 def responses @responses ||= tomogram.responses rescue NotDocumented [] end |
#tomogram ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/esplanade/request/doc.rb', line 9 def tomogram raise PrefixNotMatch.new(**) unless @main_documentation.prefix_match?(@raw.path) @tomogram = @main_documentation.find_request_with_content_type( method: @raw.method, path: @raw.path, content_type: @raw.content_type ) raise NotDocumented.new(**) if @tomogram.nil? @tomogram end |