Skip to content

Commit

Permalink
api: /api/v1/messages index
Browse files Browse the repository at this point in the history
requires OAuth readmessages scope
  • Loading branch information
talklittle committed Mar 28, 2018
1 parent 95451e8 commit fe07c34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/api/v1/messages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Api::V1::MessagesController < Api::V1::BaseController
skip_before_action :doorkeeper_authorize!
before_action -> { doorkeeper_authorize! :readmessages }

def index
@messages = current_user.undeleted_received_messages
render :json => @messages
end
end
8 changes: 8 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,12 @@
get "/about" => "home#about"
get "/chat" => "home#chat"
end

scope :format => "json" do
namespace :api do
namespace :v1 do
get "/messages" => "messages#index"
end
end
end
end

0 comments on commit fe07c34

Please sign in to comment.