amazon-chime-sdk-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +87 -0
- data/.rspec +2 -0
- data/.travis.yml +47 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +25 -0
- data/LICENSE +21 -0
- data/README.md +1109 -0
- data/Rakefile +20 -0
- data/amazon-chime-sdk-rails.gemspec +29 -0
- data/gemfiles/Gemfile.rails-5.0 +25 -0
- data/gemfiles/Gemfile.rails-5.1 +25 -0
- data/gemfiles/Gemfile.rails-5.2 +25 -0
- data/gemfiles/Gemfile.rails-6.0 +25 -0
- data/lib/amazon-chime-sdk-rails.rb +37 -0
- data/lib/chime_sdk/config.rb +90 -0
- data/lib/chime_sdk/controller/attendees.rb +128 -0
- data/lib/chime_sdk/controller/common.rb +202 -0
- data/lib/chime_sdk/controller/meetings.rb +192 -0
- data/lib/chime_sdk/meeting_coordinator.rb +184 -0
- data/lib/chime_sdk/version.rb +4 -0
- data/lib/generators/chime_sdk/controllers_generator.rb +104 -0
- data/lib/generators/chime_sdk/install_generator.rb +27 -0
- data/lib/generators/chime_sdk/js_generator.rb +67 -0
- data/lib/generators/chime_sdk/views_generator.rb +43 -0
- data/lib/generators/templates/chime_sdk.rb +28 -0
- data/lib/generators/templates/controllers/README +35 -0
- data/lib/generators/templates/controllers/meeting_attendees_controller.rb +106 -0
- data/lib/generators/templates/controllers/meetings_controller.rb +146 -0
- data/lib/generators/templates/views/meetings/index.html.erb +27 -0
- data/lib/generators/templates/views/meetings/show.html.erb +136 -0
- data/spec/factories/rooms.rb +5 -0
- data/spec/factories/users.rb +8 -0
- data/spec/generators/controllers_generator_spec.rb +113 -0
- data/spec/generators/install_generator_spec.rb +24 -0
- data/spec/generators/js_generator_spec.rb +26 -0
- data/spec/generators/views_generator_spec.rb +46 -0
- data/spec/rails_app/Rakefile +15 -0
- data/spec/rails_app/app/assets/config/manifest.js +2 -0
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/assets/javascripts/.keep +0 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
- data/spec/rails_app/app/assets/stylesheets/scaffolds.scss +65 -0
- data/spec/rails_app/app/controllers/api/meeting_attendees_controller.rb +3 -0
- data/spec/rails_app/app/controllers/api/meetings_controller.rb +3 -0
- data/spec/rails_app/app/controllers/api/rooms_controller.rb +3 -0
- data/spec/rails_app/app/controllers/application_controller.rb +11 -0
- data/spec/rails_app/app/controllers/entries_controller.rb +47 -0
- data/spec/rails_app/app/controllers/meeting_attendees_controller.rb +121 -0
- data/spec/rails_app/app/controllers/meetings_controller.rb +162 -0
- data/spec/rails_app/app/controllers/rooms_controller.rb +76 -0
- data/spec/rails_app/app/controllers/spa_controller.rb +6 -0
- data/spec/rails_app/app/javascript/App.vue +50 -0
- data/spec/rails_app/app/javascript/channels/consumer.js +6 -0
- data/spec/rails_app/app/javascript/channels/index.js +5 -0
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +84 -0
- data/spec/rails_app/app/javascript/components/meetings/Index.vue +100 -0
- data/spec/rails_app/app/javascript/components/meetings/Meeting.vue +178 -0
- data/spec/rails_app/app/javascript/components/rooms/Index.vue +53 -0
- data/spec/rails_app/app/javascript/components/rooms/Show.vue +91 -0
- data/spec/rails_app/app/javascript/packs/application.js +17 -0
- data/spec/rails_app/app/javascript/packs/spa.js +14 -0
- data/spec/rails_app/app/javascript/router/index.js +74 -0
- data/spec/rails_app/app/javascript/store/index.js +37 -0
- data/spec/rails_app/app/models/application_record.rb +3 -0
- data/spec/rails_app/app/models/entry.rb +5 -0
- data/spec/rails_app/app/models/room.rb +12 -0
- data/spec/rails_app/app/models/user.rb +6 -0
- data/spec/rails_app/app/views/devise/registrations/new.html.erb +34 -0
- data/spec/rails_app/app/views/layouts/_header.html.erb +20 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +18 -0
- data/spec/rails_app/app/views/meetings/index.html.erb +28 -0
- data/spec/rails_app/app/views/meetings/show.html.erb +136 -0
- data/spec/rails_app/app/views/rooms/_form.html.erb +22 -0
- data/spec/rails_app/app/views/rooms/_room.json.jbuilder +7 -0
- data/spec/rails_app/app/views/rooms/edit.html.erb +6 -0
- data/spec/rails_app/app/views/rooms/index.html.erb +27 -0
- data/spec/rails_app/app/views/rooms/index.json.jbuilder +1 -0
- data/spec/rails_app/app/views/rooms/new.html.erb +5 -0
- data/spec/rails_app/app/views/rooms/show.html.erb +42 -0
- data/spec/rails_app/app/views/rooms/show.json.jbuilder +1 -0
- data/spec/rails_app/app/views/spa/index.html.erb +1 -0
- data/spec/rails_app/babel.config.js +72 -0
- data/spec/rails_app/bin/bundle +114 -0
- data/spec/rails_app/bin/rails +9 -0
- data/spec/rails_app/bin/rake +9 -0
- data/spec/rails_app/bin/setup +36 -0
- data/spec/rails_app/bin/spring +17 -0
- data/spec/rails_app/bin/webpack +18 -0
- data/spec/rails_app/bin/webpack-dev-server +18 -0
- data/spec/rails_app/bin/yarn +11 -0
- data/spec/rails_app/config.ru +5 -0
- data/spec/rails_app/config/application.rb +21 -0
- data/spec/rails_app/config/boot.rb +4 -0
- data/spec/rails_app/config/cable.yml +10 -0
- data/spec/rails_app/config/credentials.yml.enc +1 -0
- data/spec/rails_app/config/database.yml +25 -0
- data/spec/rails_app/config/environment.rb +14 -0
- data/spec/rails_app/config/environments/development.rb +62 -0
- data/spec/rails_app/config/environments/production.rb +112 -0
- data/spec/rails_app/config/environments/test.rb +49 -0
- data/spec/rails_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/rails_app/config/initializers/assets.rb +15 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/chime_sdk.rb +28 -0
- data/spec/rails_app/config/initializers/content_security_policy.rb +30 -0
- data/spec/rails_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/rails_app/config/initializers/devise.rb +311 -0
- data/spec/rails_app/config/initializers/devise_token_auth.rb +60 -0
- data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails_app/config/initializers/inflections.rb +16 -0
- data/spec/rails_app/config/initializers/mime_types.rb +4 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/devise.en.yml +65 -0
- data/spec/rails_app/config/locales/en.yml +33 -0
- data/spec/rails_app/config/puma.rb +38 -0
- data/spec/rails_app/config/routes.rb +24 -0
- data/spec/rails_app/config/secrets.yml +8 -0
- data/spec/rails_app/config/spring.rb +6 -0
- data/spec/rails_app/config/storage.yml +34 -0
- data/spec/rails_app/config/webpack/development.js +5 -0
- data/spec/rails_app/config/webpack/environment.js +7 -0
- data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
- data/spec/rails_app/config/webpack/production.js +5 -0
- data/spec/rails_app/config/webpack/test.js +5 -0
- data/spec/rails_app/config/webpacker.yml +97 -0
- data/spec/rails_app/db/migrate/20200912140231_devise_create_users.rb +45 -0
- data/spec/rails_app/db/migrate/20200912140352_add_tokens_to_users.rb +12 -0
- data/spec/rails_app/db/migrate/20200912140657_create_rooms.rb +9 -0
- data/spec/rails_app/db/migrate/20200912140749_create_entries.rb +10 -0
- data/spec/rails_app/db/schema.rb +49 -0
- data/spec/rails_app/db/seeds.rb +41 -0
- data/spec/rails_app/log/.keep +0 -0
- data/spec/rails_app/package.json +23 -0
- data/spec/rails_app/postcss.config.js +12 -0
- data/spec/rails_app/public/404.html +67 -0
- data/spec/rails_app/public/422.html +67 -0
- data/spec/rails_app/public/500.html +66 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/robots.txt +1 -0
- data/spec/rails_app/tmp/.keep +0 -0
- data/spec/requests/atendees_spec.rb +182 -0
- data/spec/requests/meetings_spec.rb +433 -0
- data/spec/spec_helper.rb +35 -0
- metadata +400 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
skip_before_action :verify_authenticity_token, if: :devise_controller? if Rails.version.to_f > 5.1
|
3
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
4
|
+
protect_from_forgery with: :null_session
|
5
|
+
|
6
|
+
protected
|
7
|
+
|
8
|
+
def configure_permitted_parameters
|
9
|
+
devise_parameter_sanitizer.permit :sign_up, keys: [:name]
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class EntriesController < ApplicationController
|
2
|
+
before_action :authenticate_user!
|
3
|
+
before_action :set_room
|
4
|
+
before_action :set_entry, only: [:destroy]
|
5
|
+
|
6
|
+
# POST /entries
|
7
|
+
# POST /entries.json
|
8
|
+
def create
|
9
|
+
@entry = Entry.new(entry_params)
|
10
|
+
|
11
|
+
respond_to do |format|
|
12
|
+
if @entry.save
|
13
|
+
format.html { redirect_to @room, notice: 'Member was successfully added.' }
|
14
|
+
format.json { render :show, status: :created, location: @room }
|
15
|
+
else
|
16
|
+
format.html { redirect_to @room, notice: @entry.errors }
|
17
|
+
format.json { render json: @entry.errors, status: :unprocessable_entity }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# DELETE /entries/1
|
23
|
+
# DELETE /entries/1.json
|
24
|
+
def destroy
|
25
|
+
@entry.destroy
|
26
|
+
respond_to do |format|
|
27
|
+
format.html { redirect_to @room, notice: 'Member was successfully removed.' }
|
28
|
+
format.json { head :no_content }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
# Use callbacks to share common setup or constraints between actions.
|
34
|
+
def set_room
|
35
|
+
@room = Room.find(params[:room_id])
|
36
|
+
end
|
37
|
+
|
38
|
+
# Use callbacks to share common setup or constraints between actions.
|
39
|
+
def set_entry
|
40
|
+
@entry = Entry.find(params[:id])
|
41
|
+
end
|
42
|
+
|
43
|
+
# Only allow a list of trusted parameters through.
|
44
|
+
def entry_params
|
45
|
+
params.require(:entry).permit(:room_id, :user_id)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# Generated by amazon-chime-sdk-rails
|
2
|
+
|
3
|
+
class MeetingAttendeesController < ApplicationController
|
4
|
+
before_action :authenticate_user!
|
5
|
+
before_action :set_room
|
6
|
+
before_action :check_membership
|
7
|
+
|
8
|
+
include ChimeSdk::Controller::Attendees::Mixin
|
9
|
+
|
10
|
+
private
|
11
|
+
# Use callbacks to share common setup or constraints between actions.
|
12
|
+
def set_room
|
13
|
+
@room = Room.find(params[:room_id])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Use callbacks to share common setup or constraints between actions.
|
17
|
+
def check_membership
|
18
|
+
unless @room.member?(current_user)
|
19
|
+
message = 'Unauthorized: you are not a member of this private room.'
|
20
|
+
render json: { room: @room, notice: message }, status: :forbidden
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Override the following functions in your controllers.
|
25
|
+
|
26
|
+
# Request parameter representing meeting id such as params[:meeting_id].
|
27
|
+
# Configure it depending on your application routes.
|
28
|
+
# @api protected
|
29
|
+
# @return [String, Integer] Meeting id from request parameter
|
30
|
+
def meeting_id_param
|
31
|
+
params[:meeting_id]
|
32
|
+
end
|
33
|
+
|
34
|
+
# Request parameter representing attendee id such as params[:id].
|
35
|
+
# Configure it depending on your application routes.
|
36
|
+
# @api protected
|
37
|
+
# @return [String] Unique meeting request id to identify meeting by Amazon Chime
|
38
|
+
# def attendee_id_param
|
39
|
+
# params[:id]
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Unique attendee request id to identify attendee by Amazon Chime.
|
43
|
+
# Configure it depending on your application resources to identify attendee.
|
44
|
+
# For example, set "User-#{current_user.id}" by User model.
|
45
|
+
# @api protected
|
46
|
+
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
47
|
+
def attendee_request_id
|
48
|
+
"User-#{current_user.id}"
|
49
|
+
end
|
50
|
+
|
51
|
+
# Path for meetings#index action such as meetings_path.
|
52
|
+
# Configure it depending on your application routes.
|
53
|
+
# @api protected
|
54
|
+
# @param [Hash] params Request parameters for path method
|
55
|
+
# @return [String] Path for meetings#index action such as meetings_path
|
56
|
+
def meeting_resources_path(params = {})
|
57
|
+
room_meetings_path(@room, params)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Path for meetings#show action such as meeting_path(meeting_id).
|
61
|
+
# Configure it depending on your application routes.
|
62
|
+
# @api protected
|
63
|
+
# @param [String] meeting_id Meeting id
|
64
|
+
# @param [Hash] params Request parameters for path method
|
65
|
+
# @return [String] Path for meetings#show action such as meeting_path(meeting_id)
|
66
|
+
def meeting_resource_path(meeting_id, params = {})
|
67
|
+
room_meeting_path(@room, meeting_id, params)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Path for attendees#index action such as attendees_path(meeting_id).
|
71
|
+
# Configure it depending on your application routes.
|
72
|
+
# @api protected
|
73
|
+
# @param [String] meeting_id Meeting id
|
74
|
+
# @param [Hash] params Request parameters for path method
|
75
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
76
|
+
def attendee_resources_path(meeting_id, params = {})
|
77
|
+
room_meeting_attendees_path(@room, meeting_id, params)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Path for attendees#show action such as attendee_path(meeting_id, attendee_id).
|
81
|
+
# Configure it depending on your application routes.
|
82
|
+
# @api protected
|
83
|
+
# @param [String] meeting_id Meeting id
|
84
|
+
# @param [String] attendee_id Attendee id
|
85
|
+
# @param [Hash] params Request parameters for path method
|
86
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
87
|
+
def attendee_resource_path(meeting_id, attendee_id, params = {})
|
88
|
+
room_meeting_attendee_path(@room, meeting_id, attendee_id, params)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
92
|
+
# This is an optional parameter and configure it depending on your application.
|
93
|
+
# @api protected
|
94
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
95
|
+
# @return [Array<Hash>] Appication metadata for attendees
|
96
|
+
def optional_attendee_tags
|
97
|
+
[
|
98
|
+
{
|
99
|
+
key: "AttendeeType",
|
100
|
+
value: "User"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
key: "UserId",
|
104
|
+
value: current_user.id.to_s
|
105
|
+
}
|
106
|
+
]
|
107
|
+
end
|
108
|
+
|
109
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
110
|
+
# This is an optional parameter and configure it depending on your application.
|
111
|
+
# @api protected
|
112
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
113
|
+
# @return [Hash] Appication metadata for attendees
|
114
|
+
def application_attendee_metadata(attendee)
|
115
|
+
user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
|
116
|
+
{
|
117
|
+
"AttendeeType": "User",
|
118
|
+
"User": User.find_by_id(user_id)
|
119
|
+
}
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
# Generated by amazon-chime-sdk-rails
|
2
|
+
|
3
|
+
class MeetingsController < ApplicationController
|
4
|
+
before_action :authenticate_user!
|
5
|
+
before_action :set_room
|
6
|
+
before_action :check_membership
|
7
|
+
|
8
|
+
include ChimeSdk::Controller::Meetings::Mixin
|
9
|
+
|
10
|
+
private
|
11
|
+
# Use callbacks to share common setup or constraints between actions.
|
12
|
+
def set_room
|
13
|
+
@room = Room.find(params[:room_id])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Use callbacks to share common setup or constraints between actions.
|
17
|
+
def check_membership
|
18
|
+
unless @room.member?(current_user)
|
19
|
+
message = 'Unauthorized: you are not a member of this private room.'
|
20
|
+
respond_to do |format|
|
21
|
+
format.html { redirect_to @room, notice: message }
|
22
|
+
format.json { render json: { room: @room, notice: message }, status: :forbidden }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Override the following functions in your controllers.
|
28
|
+
|
29
|
+
# Request parameter representing meeting id such as params[:id].
|
30
|
+
# Configure it depending on your application routes.
|
31
|
+
# @api protected
|
32
|
+
# @return [String, Integer] Meeting id from request parameter
|
33
|
+
# def meeting_id_param
|
34
|
+
# params[:id]
|
35
|
+
# end
|
36
|
+
|
37
|
+
# Unique meeting request id to identify meeting by Amazon Chime.
|
38
|
+
# Configure it depending on your application resources to identify meeting.
|
39
|
+
# For example, set "PrivateRoom-#{@room.id}" by Room model.
|
40
|
+
# @api protected
|
41
|
+
# @return [String] Unique meeting request id to identify meeting by Amazon Chime
|
42
|
+
def meeting_request_id
|
43
|
+
"PrivateRoom-#{@room.id}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Unique attendee request id to identify attendee by Amazon Chime.
|
47
|
+
# Configure it depending on your application resources to identify attendee.
|
48
|
+
# For example, set "User-#{current_user.id}" by User model.
|
49
|
+
# @api protected
|
50
|
+
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
51
|
+
def attendee_request_id
|
52
|
+
"User-#{current_user.id}"
|
53
|
+
end
|
54
|
+
|
55
|
+
# Path for meetings#index action such as meetings_path.
|
56
|
+
# Configure it depending on your application routes.
|
57
|
+
# @api protected
|
58
|
+
# @param [Hash] params Request parameters for path method
|
59
|
+
# @return [String] Path for meetings#index action such as meetings_path
|
60
|
+
def meeting_resources_path(params = {})
|
61
|
+
room_meetings_path(@room, params)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Path for meetings#show action such as meeting_path(meeting_id).
|
65
|
+
# Configure it depending on your application routes.
|
66
|
+
# @api protected
|
67
|
+
# @param [String] meeting_id Meeting id
|
68
|
+
# @param [Hash] params Request parameters for path method
|
69
|
+
# @return [String] Path for meetings#show action such as meeting_path(meeting_id)
|
70
|
+
def meeting_resource_path(meeting_id, params = {})
|
71
|
+
room_meeting_path(@room, meeting_id, params)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Path for attendees#index action such as attendees_path(meeting_id).
|
75
|
+
# Configure it depending on your application routes.
|
76
|
+
# @api protected
|
77
|
+
# @param [String] meeting_id Meeting id
|
78
|
+
# @param [Hash] params Request parameters for path method
|
79
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
80
|
+
def attendee_resources_path(meeting_id, params = {})
|
81
|
+
room_meeting_attendees_path(@room, meeting_id, params)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Path for attendees#show action such as attendee_path(meeting_id, attendee_id).
|
85
|
+
# Configure it depending on your application routes.
|
86
|
+
# @api protected
|
87
|
+
# @param [String] meeting_id Meeting id
|
88
|
+
# @param [String] attendee_id Attendee id
|
89
|
+
# @param [Hash] params Request parameters for path method
|
90
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
91
|
+
def attendee_resource_path(meeting_id, attendee_id, params = {})
|
92
|
+
room_meeting_attendee_path(@room, meeting_id, attendee_id, params)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Optional meeting tags to pass to Amazon Chime.
|
96
|
+
# This is an optional parameter and configure it depending on your application.
|
97
|
+
# @api protected
|
98
|
+
# @return [Array<Hash>] Optional tags for meetings
|
99
|
+
def optional_meeting_tags
|
100
|
+
[
|
101
|
+
{
|
102
|
+
key: "MeetingType",
|
103
|
+
value: "PrivateRoom"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
key: "RoomId",
|
107
|
+
value: @room.id.to_s
|
108
|
+
}
|
109
|
+
]
|
110
|
+
end
|
111
|
+
|
112
|
+
# Optional attendee tags to pass to Amazon Chime.
|
113
|
+
# This is an optional parameter and configure it depending on your application.
|
114
|
+
# @api protected
|
115
|
+
# @return [Array<Hash>] Optional tags for attendees
|
116
|
+
def optional_attendee_tags
|
117
|
+
[
|
118
|
+
{
|
119
|
+
key: "AttendeeType",
|
120
|
+
value: "User"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
key: "UserId",
|
124
|
+
value: current_user.id.to_s
|
125
|
+
}
|
126
|
+
]
|
127
|
+
end
|
128
|
+
|
129
|
+
# Appication metadata that meetings API returns as JSON response included in meeting resource.
|
130
|
+
# This is an optional parameter and configure it depending on your application.
|
131
|
+
# @api protected
|
132
|
+
# @param [Hash] meeting Meeting JSON object as hash
|
133
|
+
# @return [Hash] Appication metadata for meetings
|
134
|
+
def application_meeting_metadata(meeting)
|
135
|
+
{
|
136
|
+
"MeetingType": "PrivateRoom",
|
137
|
+
"Room": @room
|
138
|
+
}
|
139
|
+
end
|
140
|
+
|
141
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
142
|
+
# This is an optional parameter and configure it depending on your application.
|
143
|
+
# @api protected
|
144
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
145
|
+
# @return [Hash] Appication metadata for attendees
|
146
|
+
def application_attendee_metadata(attendee)
|
147
|
+
user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
|
148
|
+
{
|
149
|
+
"AttendeeType": "User",
|
150
|
+
"User": User.find_by_id(user_id)
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
# Application attendee name to resolve from attendee object in your view.
|
155
|
+
# This is an optional parameter and configure it depending on your application.
|
156
|
+
# @api protected
|
157
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
158
|
+
# @return [String] Appication attendee name to resolve from attendee object in your view
|
159
|
+
def application_attendee_name(attendee)
|
160
|
+
attendee[:Attendee][:ApplicationMetadata][:User][:name]
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class RoomsController < ApplicationController
|
2
|
+
before_action :authenticate_user!, except: [:index]
|
3
|
+
before_action :set_room, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
# GET /rooms
|
6
|
+
# GET /rooms.json
|
7
|
+
def index
|
8
|
+
@rooms = Room.all
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /rooms/1
|
12
|
+
# GET /rooms/1.json
|
13
|
+
def show
|
14
|
+
@entry = Entry.new
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /rooms/new
|
18
|
+
def new
|
19
|
+
@room = Room.new
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /rooms/1/edit
|
23
|
+
def edit
|
24
|
+
end
|
25
|
+
|
26
|
+
# POST /rooms
|
27
|
+
# POST /rooms.json
|
28
|
+
def create
|
29
|
+
@room = Room.new(room_params)
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
if @room.save
|
33
|
+
format.html { redirect_to @room, notice: 'Room was successfully created.' }
|
34
|
+
format.json { render :show, status: :created, location: @room }
|
35
|
+
else
|
36
|
+
format.html { render :new }
|
37
|
+
format.json { render json: @room.errors, status: :unprocessable_entity }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# PATCH/PUT /rooms/1
|
43
|
+
# PATCH/PUT /rooms/1.json
|
44
|
+
def update
|
45
|
+
respond_to do |format|
|
46
|
+
if @room.update(room_params)
|
47
|
+
format.html { redirect_to @room, notice: 'Room was successfully updated.' }
|
48
|
+
format.json { render :show, status: :ok, location: @room }
|
49
|
+
else
|
50
|
+
format.html { render :edit }
|
51
|
+
format.json { render json: @room.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# DELETE /rooms/1
|
57
|
+
# DELETE /rooms/1.json
|
58
|
+
def destroy
|
59
|
+
@room.destroy
|
60
|
+
respond_to do |format|
|
61
|
+
format.html { redirect_to rooms_url, notice: 'Room was successfully destroyed.' }
|
62
|
+
format.json { head :no_content }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
# Use callbacks to share common setup or constraints between actions.
|
68
|
+
def set_room
|
69
|
+
@room = Room.find(params[:id])
|
70
|
+
end
|
71
|
+
|
72
|
+
# Only allow a list of trusted parameters through.
|
73
|
+
def room_params
|
74
|
+
params.require(:room).permit(:name)
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div>
|
4
|
+
<strong><router-link v-bind:to="{ name: 'Root' }">SPA with Rails API</router-link></strong>
|
5
|
+
<a href="/">Rails App with Action View</a>
|
6
|
+
</div>
|
7
|
+
<div>
|
8
|
+
<strong>Rails Application for Amazon Chime SDK Meeting (SPA with Rails API)</strong>
|
9
|
+
</div>
|
10
|
+
<div>
|
11
|
+
<div v-if="userSignedIn">
|
12
|
+
{{ currentUser.name }}
|
13
|
+
<router-link v-bind:to="{ name: 'SignOut' }">Logout</router-link>
|
14
|
+
</div>
|
15
|
+
<div v-else>
|
16
|
+
<router-link v-bind:to="{ name: 'SignIn' }">Login</router-link>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<router-view />
|
20
|
+
</div>
|
21
|
+
</template>
|
22
|
+
|
23
|
+
<script>
|
24
|
+
import Vue from 'vue'
|
25
|
+
import axios from 'axios'
|
26
|
+
|
27
|
+
axios.defaults.baseURL = "/api/v1"
|
28
|
+
|
29
|
+
export default {
|
30
|
+
name: 'App',
|
31
|
+
computed: {
|
32
|
+
userSignedIn: function () {
|
33
|
+
return this.$store.getters.userSignedIn;
|
34
|
+
},
|
35
|
+
currentUser: function () {
|
36
|
+
return this.$store.getters.currentUser;
|
37
|
+
}
|
38
|
+
},
|
39
|
+
created () {
|
40
|
+
if (this.$store.getters.userSignedIn) {
|
41
|
+
for (var authHeader of Object.keys(this.$store.getters.authHeaders)) {
|
42
|
+
axios.defaults.headers.common[authHeader] = this.$store.getters.authHeaders[authHeader];
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<style scoped>
|
50
|
+
</style>
|