Skip to content
Extraits de code Groupes Projets
Valider 80821c9c rédigé par Sarah Mei's avatar Sarah Mei
Parcourir les fichiers

Basic tag metadata returned. Now what to do about posts?...

parent 42e061df
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Api::V0::TagsController < ApplicationController
def show
head :ok
render :json => Api::V0::Serializers::Tag.new(params[:name])
end
end
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Api::V0::UsersController < ApplicationController
def show
if user = User.find_by_username(params[:username])
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Api::V0::Serializers::Tag
def initialize(tag)
@stream = Stream::Tag.new(nil, tag)
end
def as_json(opts={})
{
"name" => @stream.tag_name,
"person_count" => @stream.people_count,
"followed_count" => @stream.tag_follow_count,
"posts" => []
}
end
end
class Api::V0::Serializers::User
attr_accessor :user
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Api::V0::Serializers::User
def initialize(user)
@user = user
@person = user.person
@profile = @person.profile
end
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class Stream::Tag < Stream::Base
attr_accessor :tag_name, :people_page
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter