Commit 68d96a31 authored by theworldbright's avatar theworldbright

Add versionist gem

parent efdfe318
......@@ -195,6 +195,8 @@ gem "rubyzip", "1.1.7"
# https://github.com/discourse/discourse/pull/238
gem "minitest"
gem "versionist", "1.4.1"
# Windows and OSX have an execjs compatible runtime built-in, Linux users should
# install Node.js or use "therubyracer".
#
......
......@@ -849,6 +849,10 @@ GEM
validate_url (1.0.2)
activemodel (>= 3.0.0)
addressable
versionist (1.4.1)
activesupport (>= 3)
railties (>= 3)
yard (~> 0.7)
warden (1.2.4)
rack (>= 1.0)
webfinger (1.0.1)
......@@ -864,6 +868,7 @@ GEM
xml-simple (1.1.5)
xpath (2.0.0)
nokogiri (~> 1.3)
yard (0.8.7.6)
PLATFORMS
ruby
......@@ -1008,6 +1013,7 @@ DEPENDENCIES
uglifier (= 2.7.2)
unicorn (= 5.0.1)
uuid (= 2.3.8)
versionist (= 1.4.1)
webmock (= 1.22.3)
will_paginate (= 3.0.7)
......
Copyright (c) 2012 Brian Ploetz (bploetz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class Api::V2::BaseController < ApplicationController
include Openid::Authentication
before_action :authenticate_user!
before_filter :require_access_token
end
class Api::V2::UsersController < Api::V2::BaseController
def show
render json: current_user
end
end
......@@ -3,17 +3,10 @@
# the COPYRIGHT file.
class UsersController < ApplicationController
include Openid::Authentication
before_action :authenticate_user!, except: [:new, :create, :public, :user_photo]
before_filter :require_access_token, only: [:show]
respond_to :html
# TODO: Adjust so that it sends back only required elements, e.g, should not send hashed password (serialized_private_key) back
def show
render json: current_user
end
def edit
@aspect = :user_edit
@user = current_user
......
class Api::V2::BasePresenter
end
class UserSerializer < ActiveModel::Serializer
attributes :name, :email, :language, :username
end
......@@ -245,8 +245,11 @@ Diaspora::Application.routes.draw do
resource :openid do
resources :authorizations, only: [:new, :create]
match 'connect', to: 'connect#show', via: [:get, :post]
match '.well-known/:id', to: 'discovery#show' , :via => [:get, :post]
match '.well-known/:id', to: 'discovery#show' , via: [:get, :post]
post 'access_tokens', to: proc { |env| Openid::TokenEndpoint.new.call(env) }
match 'user_info', to: 'users#show', :via => [:get, :post]
end
api_version(:module => "Api::V2", path: {value: "api/v2"}, default: true) do
match 'user', to: 'users#show', via: :get
end
end
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Documentation for v2</title>
<link href="v2/style.css" media="screen" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<div id="operations">
<h3>API Operations</h3>
</div>
<div id="content">
<h1>Documentation for v2</h1>
</div>
</div>
</body>
</html>
body {margin: 0; background-color: #fff; color: #000; font-family: Arial,sans-serif;}
content {margin-left: 200px;}
content h1 {text-align: center;}
operations {float: left; width: 200px; border-right: 1px solid #ccc;}
operations h3 {text-align: center;}
require 'spec_helper'
describe Api::V2::BaseController do
end
require 'spec_helper'
describe Api::V2::BasePresenter do
end
require 'spec_helper'
describe Api::V2::BaseController do
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment