class Gruf::Rspec::MetadataFactory
Factory for building metadata in an incoming controller request
Public Class Methods
new(options = {})
click to toggle source
@param [Hash] options
# File lib/gruf/rspec/metadata_factory.rb, line 25 def initialize(options = {}) @options = options || {} end
Public Instance Methods
build(metadata = {})
click to toggle source
@param [Hash] metadata @return [Hash]
# File lib/gruf/rspec/metadata_factory.rb, line 33 def build(metadata = {}) metadata ||= {} authentication_hydrator.hydrate(metadata) end
Private Instance Methods
authentication_hydrator()
click to toggle source
@return [Gruf::Rspec::AuthenticationHydrator::Base]
# File lib/gruf/rspec/metadata_factory.rb, line 43 def authentication_hydrator unless @authentication_hydrator auth_type = @options.fetch(:authentication_type, :basic).to_sym auth_type = :base unless Gruf::Rspec.authentication_hydrators.key?(auth_type) @authentication_hydrator = Gruf::Rspec.authentication_hydrators[auth_type].new(@options) end @authentication_hydrator end