Class: Evil::Client::DSL::Operations
- Inherits:
-
Object
- Object
- Evil::Client::DSL::Operations
- Defined in:
- lib/evil/client/dsl/operations.rb
Overview
Container for operations definitions Applies settings to definitions and returns a final schema
Instance Method Summary collapse
-
#finalize(settings) ⇒ Hash<Symbol, Object>
Applies settings to all definitions and returns a final schema.
-
#register(key, &block) ⇒ self
Adds block definition as a named operation.
Instance Method Details
#finalize(settings) ⇒ Hash<Symbol, Object>
Applies settings to all definitions and returns a final schema
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/evil/client/dsl/operations.rb', line 23 def finalize(settings) default = @schema[nil].finalize(settings) custom = @schema.select { |key| key } custom.each_with_object({}) do |(key, operation), hash| custom = operation.finalize(settings) hash[key] = default.merge(custom) hash[key][:format] ||= "json" hash[key][:responses] = default[:responses].merge(custom[:responses]) end end |