Sha256: c0a47af0b66b347a7a64e2e3574510ce13eb8cd0b7f58b1a391494793d7f9fb6
Contents?: true
Size: 677 Bytes
Versions: 4
Compression:
Stored size: 677 Bytes
Contents
class YouTrack::Client::Request def find(collection, id, options={}) service.data.fetch(collection)[id] || service.response(status: 404, body: {"error" => "#{collection.to_s.gsub(/s\Z/, "").capitalize} not found."}) end def require_parameters(_params, *_requirements) params = Cistern::Hash.stringify_keys(_params) requirements = _requirements.map(&:to_s) requirements.each do |requirement| unless !params[requirement].nil? response( :status => 400, :body => {"error" => "Bad Request"}) end end values = params.values_at(*requirements) values.size == 1 ? values.first : values end end
Version data entries
4 entries across 4 versions & 1 rubygems