class Rambo::RamlModels::SecurityScheme
Attributes
schema[RW]
title[RW]
Public Class Methods
new(raml, options={})
click to toggle source
# File lib/rambo/raml_models/security_scheme.rb, line 7 def initialize(raml, options={}) @options = options @schema, @title = raml.last.fetch("describedBy", {}), raml.first use_token! end
Public Instance Methods
api_token_header()
click to toggle source
# File lib/rambo/raml_models/security_scheme.rb, line 19 def api_token_header return unless h = schema.fetch("headers", nil) h.find {|key, value| key.match(/(token|key)/i) }.first end
headers()
click to toggle source
# File lib/rambo/raml_models/security_scheme.rb, line 25 def headers @headers ||= Rambo::RamlModels::Headers.new(schema.fetch("headers") || {}) end
use_token!()
click to toggle source
# File lib/rambo/raml_models/security_scheme.rb, line 13 def use_token! if schema.fetch("headers", nil) schema.fetch("headers")[api_token_header] = @options[:token] end end