Class: HaveAPI::Example
- Inherits:
-
Object
- Object
- HaveAPI::Example
- Defined in:
- lib/haveapi/example.rb
Instance Method Summary collapse
- #comment(str) ⇒ Object
- #describe ⇒ Object
-
#initialize(title) ⇒ Example
constructor
A new instance of Example.
- #provided? ⇒ Boolean
- #request(f) ⇒ Object
- #response(f) ⇒ Object
Constructor Details
#initialize(title) ⇒ Example
Returns a new instance of Example.
3 4 5 |
# File 'lib/haveapi/example.rb', line 3 def initialize(title) @title = title end |
Instance Method Details
#comment(str) ⇒ Object
15 16 17 |
# File 'lib/haveapi/example.rb', line 15 def comment(str) @comment = str end |
#describe ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/haveapi/example.rb', line 23 def describe if provided? { title: @title, request: @request, response: @response, comment: @comment } else {} end end |
#provided? ⇒ Boolean
19 20 21 |
# File 'lib/haveapi/example.rb', line 19 def provided? @request || @response || @comment end |
#request(f) ⇒ Object
7 8 9 |
# File 'lib/haveapi/example.rb', line 7 def request(f) @request = f end |
#response(f) ⇒ Object
11 12 13 |
# File 'lib/haveapi/example.rb', line 11 def response(f) @response = f end |