remove unused api serializers (cruft)

This commit is contained in:
danielgrippi 2012-01-17 16:03:24 -08:00
parent b7ac77daa5
commit fdc0b681eb
6 changed files with 0 additions and 104 deletions

View file

@ -1,9 +0,0 @@
# 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
render :json => Api::V0::Serializers::Tag.new(params[:name])
end
end

View file

@ -1,13 +0,0 @@
# 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])
render :json => Api::V0::Serializers::User.new(user)
else
head :not_found
end
end
end

View file

@ -1,19 +0,0 @@
# 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.tagged_people_count,
"followed_count" => @stream.tag_follow_count,
"posts" => []
}
end
end

View file

@ -1,20 +0,0 @@
# 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)
@person = user.person
@profile = @person.profile
end
def as_json(opts={})
{
"diaspora_id" => @person.diaspora_handle,
"first_name" => @profile.first_name,
"last_name" => @profile.last_name,
"image_url" => @profile.image_url,
"searchable" => @profile.searchable
}
end
end

View file

@ -1,20 +0,0 @@
# 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'
describe Api::V0::TagsController do
describe '#show' do
it 'succeeds' do
get :show, :name => 'alice'
response.should be_success
end
it "returns the basic tag data" do
get :show, :name => 'alice'
parsed_json = JSON.parse(response.body)
parsed_json.keys.should =~ %w(name person_count followed_count posts)
end
end
end

View file

@ -1,23 +0,0 @@
# 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'
describe Api::V0::UsersController do
describe '#show' do
it 'succeeds' do
get :show, :username => 'alice'
response.should be_success
end
it "404s if there's no such user" do
get :show, :username => "*****"
response.should be_not_found
end
it "returns the public profile data" do
get :show, :username => 'alice'
parsed_json = JSON.parse(response.body)
parsed_json.keys.should =~ %w( diaspora_id first_name last_name image_url searchable )
end
end
end