Class: Rambo::RamlModels::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/rambo/raml_models/method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raml_method) ⇒ Method

Returns a new instance of Method.



6
7
8
# File 'lib/rambo/raml_models/method.rb', line 6

def initialize(raml_method)
  @schema = raml_method
end

Instance Attribute Details

#schemaObject (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

#descriptionObject



18
19
20
# File 'lib/rambo/raml_models/method.rb', line 18

def description
  @description ||= schema.description
end

#headersObject



22
23
24
# File 'lib/rambo/raml_models/method.rb', line 22

def headers
  @headers ||= Rambo::RamlModels::Headers.new(schema.headers) if schema.headers
end

#methodObject



10
11
12
# File 'lib/rambo/raml_models/method.rb', line 10

def method
  schema.method
end

#request_bodyObject



14
15
16
# File 'lib/rambo/raml_models/method.rb', line 14

def request_body
  Rambo::RamlModels::Body.new(schema.bodies.first) if has_request_body?
end

#responsesObject



26
27
28
# File 'lib/rambo/raml_models/method.rb', line 26

def responses
  @responses ||= schema.responses.map {|resp| Rambo::RamlModels::Response.new(resp) }
end