Sha256: 3c52ee7412a40febde69c9cdf20092e21b8647d686a84f50193b189ad1816770

Contents?: true

Size: 730 Bytes

Versions: 5

Compression:

Stored size: 730 Bytes

Contents

module Rambo
  module RamlModels
    class Method
      attr_reader :schema

      def initialize(raml_method)
        @schema = raml_method
      end

      def method
        schema.method
      end

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

      def description
        @description ||= schema.description
      end

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

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

      private

      def has_request_body?
        !!schema.bodies.first
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rambo_ruby-0.2.3 lib/rambo/raml_models/method.rb
rambo_ruby-0.2.2 lib/rambo/raml_models/method.rb
rambo_ruby-0.2.1 lib/rambo/raml_models/method.rb
rambo_ruby-0.2.0 lib/rambo/raml_models/method.rb
rambo_ruby-0.1.0 lib/raml_models/method.rb