VRFS-3276 : Routes and controller implementation of user calendar ICS feed, which uses calendar manager.
This commit is contained in:
parent
21fd80a188
commit
e632f48600
|
|
@ -1,7 +1,7 @@
|
|||
require 'sanitize'
|
||||
class ApiUsersController < ApiController
|
||||
|
||||
before_filter :api_signed_in_user, :except => [:create, :show, :signup_confirm, :auth_session_create, :complete, :finalize_update_email, :isp_scoring, :add_play, :crash_dump, :validate_data]
|
||||
before_filter :api_signed_in_user, :except => [:create, :calendar, :show, :signup_confirm, :auth_session_create, :complete, :finalize_update_email, :isp_scoring, :add_play, :crash_dump, :validate_data]
|
||||
before_filter :auth_user, :only => [:session_settings_show, :session_history_index, :session_user_history_index, :update, :delete,
|
||||
:liking_create, :liking_destroy, # likes
|
||||
:following_create, :following_show, :following_destroy, # followings
|
||||
|
|
@ -15,19 +15,23 @@ class ApiUsersController < ApiController
|
|||
:share_session, :share_recording,
|
||||
:affiliate_report, :audio_latency, :broadcast_notification]
|
||||
|
||||
respond_to :json
|
||||
respond_to :json, :except => :calendar
|
||||
respond_to :ics, :only => :calendar
|
||||
|
||||
def index
|
||||
@users = User.paginate(page: params[:page])
|
||||
respond_with @users, responder: ApiResponder, :status => 200
|
||||
end
|
||||
|
||||
def calendar
|
||||
@user=lookup_user
|
||||
ics = CalendarManager.new.create_ics_feed(@user)
|
||||
puts "ICS: #{ics}"
|
||||
send_data ics, :filename => 'JamKazam', :disposition => 'inline', :type => "text/calendar"
|
||||
end
|
||||
|
||||
def show
|
||||
@user = User.includes([{musician_instruments: :instrument},
|
||||
{band_musicians: :user},
|
||||
{genre_players: :genre},
|
||||
:bands, :instruments, :genres, :jam_track_rights, :affiliate_partner])
|
||||
.find(params[:id])
|
||||
@user=lookup_user
|
||||
|
||||
respond_with @user, responder: ApiResponder, :status => 200
|
||||
end
|
||||
|
|
@ -880,6 +884,14 @@ class ApiUsersController < ApiController
|
|||
render json: { }, status: 200
|
||||
end
|
||||
|
||||
def lookup_user
|
||||
User.includes([{musician_instruments: :instrument},
|
||||
{band_musicians: :user},
|
||||
{genre_players: :genre},
|
||||
:bands, :instruments, :genres, :jam_track_rights, :affiliate_partner])
|
||||
.find(params[:id])
|
||||
end
|
||||
|
||||
###################### RECORDINGS #######################
|
||||
# def recording_index
|
||||
# @recordings = User.recording_index(current_user, params[:id])
|
||||
|
|
|
|||
|
|
@ -271,9 +271,9 @@ SampleApp::Application.routes.draw do
|
|||
#match '/users' => 'api_users#create', :via => :post
|
||||
match '/users/:id' => 'api_users#update', :via => :post
|
||||
match '/users/:id' => 'api_users#delete', :via => :delete
|
||||
match '/users/:id/calendar.ics' => 'api_users#calendar', :via => :get, :as => 'api_users_calendar_feed'
|
||||
match '/users/confirm/:signup_token' => 'api_users#signup_confirm', :via => :post, :as => 'api_signup_confirmation'
|
||||
match '/users/complete/:signup_token' => 'api_users#complete', as: 'complete', via: 'post'
|
||||
|
||||
match '/users/:id/set_password' => 'api_users#set_password', :via => :post
|
||||
|
||||
# recurly
|
||||
|
|
|
|||
Loading…
Reference in New Issue