lib/evil/client/operation/request.rb in evil-client-0.3.1 vs lib/evil/client/operation/request.rb in evil-client-0.3.2

- old
+ new

@@ -10,28 +10,17 @@ # @param [Hash<Symbol, Object>] options # @return [Hash] # def build(options) { - format: schema[:format], - http_method: extract(:method), - path: extract(:path).call(options), - security: schema[:security]&.call(options), - files: schema[:files]&.call(options), - query: schema[:query]&.new(options).to_h, - body: schema[:body]&.new(options).to_h, - headers: schema[:headers]&.new(options).to_h + format: schema[:format], + http_method: schema[:method].call(options), + path: schema[:path].call(options), + security: schema[:security]&.call(options), + files: schema[:files]&.call(options), + query: schema[:query]&.new(options).to_h, + body: schema[:body]&.new(options).to_h, + headers: schema[:headers]&.new(options).to_h } - end - - private - - def key - @key ||= schema[:key] - end - - def extract(property) - return schema[property] if schema[property] - raise NotImplementedError, "No #{property} defined for operation '#{key}'" end end end