Class: Rambo::RamlModels::Method
- Inherits:
-
Object
- Object
- Rambo::RamlModels::Method
- Defined in:
- lib/rambo/raml_models/method.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #description ⇒ Object
- #headers ⇒ Object
-
#initialize(raml_method, headers = Headers.new({})) ⇒ Method
constructor
A new instance of Method.
- #method ⇒ Object
- #request_body ⇒ Object
- #responses ⇒ Object
Constructor Details
#initialize(raml_method, headers = Headers.new({})) ⇒ Method
Returns a new instance of Method.
6 7 8 9 |
# File 'lib/rambo/raml_models/method.rb', line 6 def initialize(raml_method, headers=Headers.new({})) @schema = raml_method @headers = headers end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
4 5 6 |
# File 'lib/rambo/raml_models/method.rb', line 4 def schema @schema end |
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/rambo/raml_models/method.rb', line 19 def description @description ||= schema.description end |
#headers ⇒ Object
23 24 25 |
# File 'lib/rambo/raml_models/method.rb', line 23 def headers @headers.add(schema.headers) if schema.headers end |
#method ⇒ Object
11 12 13 |
# File 'lib/rambo/raml_models/method.rb', line 11 def method schema.method end |
#request_body ⇒ Object
15 16 17 |
# File 'lib/rambo/raml_models/method.rb', line 15 def request_body Rambo::RamlModels::Body.new(schema.bodies.first) if has_request_body? end |
#responses ⇒ Object
27 28 29 |
# File 'lib/rambo/raml_models/method.rb', line 27 def responses @responses ||= schema.responses.map {|resp| Rambo::RamlModels::Response.new(resp) } end |