From fdc0b681ebc8f6ada1c55cb01f4549a269840a08 Mon Sep 17 00:00:00 2001
From: danielgrippi <danielgrippi@gmail.com>
Date: Tue, 17 Jan 2012 16:03:24 -0800
Subject: [PATCH] remove unused api serializers (cruft)

---
 app/controllers/api/v0/tags_controller.rb     |  9 --------
 app/controllers/api/v0/users_controller.rb    | 13 -----------
 app/models/api/v0/serializers/tag.rb          | 19 ---------------
 app/models/api/v0/serializers/user.rb         | 20 ----------------
 .../api/v0/tags_controller_spec.rb            | 20 ----------------
 .../api/v0/users_controller_spec.rb           | 23 -------------------
 6 files changed, 104 deletions(-)
 delete mode 100644 app/controllers/api/v0/tags_controller.rb
 delete mode 100644 app/controllers/api/v0/users_controller.rb
 delete mode 100644 app/models/api/v0/serializers/tag.rb
 delete mode 100644 app/models/api/v0/serializers/user.rb
 delete mode 100644 spec/controllers/api/v0/tags_controller_spec.rb
 delete mode 100644 spec/controllers/api/v0/users_controller_spec.rb

diff --git a/app/controllers/api/v0/tags_controller.rb b/app/controllers/api/v0/tags_controller.rb
deleted file mode 100644
index 1ce401b1c2..0000000000
--- a/app/controllers/api/v0/tags_controller.rb
+++ /dev/null
@@ -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
diff --git a/app/controllers/api/v0/users_controller.rb b/app/controllers/api/v0/users_controller.rb
deleted file mode 100644
index 5328a63c3f..0000000000
--- a/app/controllers/api/v0/users_controller.rb
+++ /dev/null
@@ -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
diff --git a/app/models/api/v0/serializers/tag.rb b/app/models/api/v0/serializers/tag.rb
deleted file mode 100644
index bd378607d6..0000000000
--- a/app/models/api/v0/serializers/tag.rb
+++ /dev/null
@@ -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
diff --git a/app/models/api/v0/serializers/user.rb b/app/models/api/v0/serializers/user.rb
deleted file mode 100644
index 2dc94fc072..0000000000
--- a/app/models/api/v0/serializers/user.rb
+++ /dev/null
@@ -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
diff --git a/spec/controllers/api/v0/tags_controller_spec.rb b/spec/controllers/api/v0/tags_controller_spec.rb
deleted file mode 100644
index 1fd9867a4f..0000000000
--- a/spec/controllers/api/v0/tags_controller_spec.rb
+++ /dev/null
@@ -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
diff --git a/spec/controllers/api/v0/users_controller_spec.rb b/spec/controllers/api/v0/users_controller_spec.rb
deleted file mode 100644
index 1fc3e8e7b1..0000000000
--- a/spec/controllers/api/v0/users_controller_spec.rb
+++ /dev/null
@@ -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
-- 
GitLab