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, 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

#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



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

def description
  @description ||= schema.description
end

#headersObject



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

def headers
  @headers.add(schema.headers) if schema.headers
end

#methodObject



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

def method
  schema.method
end

#request_bodyObject



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

#responsesObject



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