class Travis::Client::Session
def find_one_or_many(entity, args = nil)
def find_one_or_many(entity, args = nil) raise Travis::Client::Error, "cannot fetch #{entity}" unless entity.respond_to?(:many) and entity.many cached(entity, :one_or_many, args) do path = "/#{entity.many}" path, args = "#{path}/#{args}", {} unless args.is_a? Hash result = get(path, args) one = result[entity.one] if result.include? entity.many Array(one) + Array(result[entity.many]) else one end end end