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,27 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ChimeSdk
|
4
|
+
# Generators implementation by amazon-chime-sdk-rails.
|
5
|
+
module Generators #:nodoc:
|
6
|
+
# Install generator to copy initializer to rails application.
|
7
|
+
# @example Run install generator
|
8
|
+
# rails generate chime_sdk:install
|
9
|
+
class InstallGenerator < Rails::Generators::Base
|
10
|
+
desc <<-DESC.strip_heredoc
|
11
|
+
Create chime_sdk initializer in your application.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
|
15
|
+
rails generate chime_sdk:insall
|
16
|
+
|
17
|
+
DESC
|
18
|
+
|
19
|
+
source_root File.expand_path("../../templates", __FILE__)
|
20
|
+
|
21
|
+
# Copies initializer file in application directory
|
22
|
+
def copy_initializer
|
23
|
+
template "chime_sdk.rb", "config/initializers/chime_sdk.rb"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ChimeSdk
|
4
|
+
module Generators
|
5
|
+
# Amazon Chime SDK single .js file generator.
|
6
|
+
# Bundle Amazon Chime SDK into single amazon-chime-sdk.min.js file and copy it to app/assets/javascripts directory.
|
7
|
+
# @example Run Amazon Chime SDK single .js file generator
|
8
|
+
# rails generate chime_sdk:js
|
9
|
+
# @see https://github.com/aws/amazon-chime-sdk-js/tree/master/demos/singlejs
|
10
|
+
class JsGenerator < Rails::Generators::Base
|
11
|
+
desc <<-DESC.strip_heredoc
|
12
|
+
Bundle Amazon Chime SDK into single amazon-chime-sdk.min.js file and copy it to app/assets/javascripts directory.
|
13
|
+
|
14
|
+
Example:
|
15
|
+
|
16
|
+
rails generate chime_sdk:js
|
17
|
+
|
18
|
+
This generator requires npm installation.
|
19
|
+
|
20
|
+
DESC
|
21
|
+
|
22
|
+
source_root File.expand_path('./')
|
23
|
+
|
24
|
+
# Build amazon-chime-sdk.min.js and copy it to app/assets/javascripts directory
|
25
|
+
def build_and_copy_chime_sdk_js
|
26
|
+
# :nocov:
|
27
|
+
begin
|
28
|
+
node_version = Gem::Version.new(`node -v`.delete("v"))
|
29
|
+
puts "Found Node v#{node_version}"
|
30
|
+
if node_version < Gem::Version.new("10")
|
31
|
+
puts "Amazon Chime SDK single .js file generator requires Node 10+. Update Node before running."
|
32
|
+
return
|
33
|
+
end
|
34
|
+
rescue StandardError => e
|
35
|
+
puts "Amazon Chime SDK single .js file generator requires Node. Install Node before running."
|
36
|
+
return
|
37
|
+
end
|
38
|
+
begin
|
39
|
+
npm_version = Gem::Version.new(`npm -v`)
|
40
|
+
puts "Found npm v#{npm_version}"
|
41
|
+
if npm_version < Gem::Version.new("6.11")
|
42
|
+
puts "Amazon Chime SDK single .js file generator requires npm 6.11+. Update npm before running."
|
43
|
+
return
|
44
|
+
end
|
45
|
+
rescue StandardError => e
|
46
|
+
puts "Amazon Chime SDK single .js file generator requires npm. Install npm before running."
|
47
|
+
return
|
48
|
+
end
|
49
|
+
# :nocov:
|
50
|
+
|
51
|
+
`mkdir -p tmp`
|
52
|
+
puts "Cloning into 'amazon-chime-sdk-js' git repository in tmp directory ..."
|
53
|
+
`cd tmp; git clone https://github.com/aws/amazon-chime-sdk-js.git > /dev/null 2>&1`
|
54
|
+
puts "Running 'npm install @rollup/plugin-commonjs' in the repository ..."
|
55
|
+
`cd tmp/amazon-chime-sdk-js/demos/singlejs; npm install @rollup/plugin-commonjs > /dev/null 2>&1`
|
56
|
+
puts "Running 'npm run bundle' in the repository ..."
|
57
|
+
`cd tmp/amazon-chime-sdk-js/demos/singlejs; npm run bundle > /dev/null 2>&1`
|
58
|
+
puts "Built Amazon Chime SDK as amazon-chime-sdk.min.js"
|
59
|
+
copy_file "tmp/amazon-chime-sdk-js/demos/singlejs/build/amazon-chime-sdk.min.js", "app/assets/javascripts/amazon-chime-sdk.min.js"
|
60
|
+
copy_file "tmp/amazon-chime-sdk-js/demos/singlejs/build/amazon-chime-sdk.min.js.map", "app/assets/javascripts/amazon-chime-sdk.min.js.map"
|
61
|
+
`rm -rf tmp/amazon-chime-sdk-js`
|
62
|
+
puts "Cleaned up the repository in tmp directory"
|
63
|
+
puts "Completed"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ChimeSdk
|
4
|
+
module Generators
|
5
|
+
# View generator to copy customizable meetings view files from templates.
|
6
|
+
# @example Run view generator as default name
|
7
|
+
# rails generate chime_sdk:views
|
8
|
+
# @example Run view generator as room prefix
|
9
|
+
# rails generate chime_sdk:views rooms
|
10
|
+
class ViewsGenerator < Rails::Generators::Base
|
11
|
+
desc <<-DESC.strip_heredoc
|
12
|
+
Create meetings views for Amazon Chime SDK in your app/views folder.
|
13
|
+
|
14
|
+
Example:
|
15
|
+
|
16
|
+
rails generate chime_sdk:views
|
17
|
+
|
18
|
+
Views files will be generated in app/views/meetings directory.
|
19
|
+
You can also specify prefix of views name like this:
|
20
|
+
|
21
|
+
rails generate chime_sdk:views room
|
22
|
+
|
23
|
+
Then, views files will be generated in app/views/room_meetings directory.
|
24
|
+
DESC
|
25
|
+
|
26
|
+
# Views to be generated
|
27
|
+
VIEWS = [:meetings].freeze
|
28
|
+
|
29
|
+
source_root File.expand_path("../../templates/views", __FILE__)
|
30
|
+
argument :prefix, required: false,
|
31
|
+
desc: "Prefix of view directory name, e.g. room"
|
32
|
+
|
33
|
+
# Generate view files in application directory
|
34
|
+
def generate_views
|
35
|
+
target_views = VIEWS
|
36
|
+
file_prefix = prefix.blank? ? '' : prefix.singularize.underscore + '_'
|
37
|
+
target_views.each do |name|
|
38
|
+
directory name, "app/views/#{file_prefix}#{name}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
ChimeSdk.configure do |config|
|
2
|
+
# Configure application name for unique key and metadata of Chime SDK meetings and attendees.
|
3
|
+
# Do not use '-' in this application name since it is a delimiter.
|
4
|
+
config.application_name = 'ChimeSdkRailsApp'
|
5
|
+
|
6
|
+
# Configure media region to host Chime SDK meetings.
|
7
|
+
# Default value is 'us-east-1'.
|
8
|
+
config.media_region = 'us-east-1'
|
9
|
+
|
10
|
+
# Configure prefix to make unique key of Chime SDK meetings and attendees.
|
11
|
+
# Default value is "#{config.application_name}-#{Rails.env}-".
|
12
|
+
config.prefix = "#{config.application_name}-#{Rails.env}-"
|
13
|
+
|
14
|
+
# Configure default max_results value used in list_meetings API.
|
15
|
+
config.max_meeting_results = 10
|
16
|
+
|
17
|
+
# Configure default max_results value used in list_attendees API.
|
18
|
+
config.max_attendee_results = 10
|
19
|
+
|
20
|
+
# Configure whether the application creates meeting with attendee in meetings#create action.
|
21
|
+
config.create_meeting_with_attendee = true
|
22
|
+
|
23
|
+
# Configure whether the application creates attendee from meeting in meetings#show action.
|
24
|
+
config.create_attendee_from_meeting = true
|
25
|
+
|
26
|
+
# Configure whether the application creates meeting in meetings#index action by HTTP GET request.
|
27
|
+
config.create_meeting_by_get_request = false
|
28
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Routing setup you must do manually if you haven't yet:
|
4
|
+
|
5
|
+
Rails.application.routes.draw do
|
6
|
+
resources :meetings, only: [:index, :show, :create, :destroy] do
|
7
|
+
resources :meeting_attendees, as: :attendees, path: :attendees, only: [:index, :show]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Examples:
|
12
|
+
|
13
|
+
If you generated controllers with room as parent resource by --parent option, setup routes like this:
|
14
|
+
|
15
|
+
Rails.application.routes.draw do
|
16
|
+
resources :rooms do
|
17
|
+
resources :meetings, only: [:index, :show, :create, :destroy] do
|
18
|
+
resources :meeting_attendees, as: :attendees, path: :attendees, only: [:index, :show]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
If you generated controllers for Rails API with api as namespace by --namespace option, setup routes like this:
|
24
|
+
|
25
|
+
Rails.application.routes.draw do
|
26
|
+
namespace :api do
|
27
|
+
scope :"v1" do
|
28
|
+
resources :meetings, defaults: { format: :json }, only: [:index, :show, :create, :destroy] do
|
29
|
+
resources :meeting_attendees, as: :attendees, path: :attendees, only: [:index, :show, :create, :destroy]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
===============================================================================
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# Generated by amazon-chime-sdk-rails
|
2
|
+
|
3
|
+
class <%= @namespace %><%= @class_name_prefix %>MeetingAttendeesController < ApplicationController
|
4
|
+
|
5
|
+
include ChimeSdk::Controller::Attendees::Mixin
|
6
|
+
|
7
|
+
private
|
8
|
+
# Override the following functions in your controllers.
|
9
|
+
|
10
|
+
# Request parameter representing meeting id such as params[:meeting_id].
|
11
|
+
# Configure it depending on your application routes.
|
12
|
+
# @api protected
|
13
|
+
# @return [String, Integer] Meeting id from request parameter
|
14
|
+
def meeting_id_param
|
15
|
+
params[:<%= @param_name_prefix %>meeting_id]
|
16
|
+
end
|
17
|
+
|
18
|
+
# Request parameter representing attendee id such as params[:id].
|
19
|
+
# Configure it depending on your application routes.
|
20
|
+
# @api protected
|
21
|
+
# @return [String] Unique meeting request id to identify meeting by Amazon Chime
|
22
|
+
# def attendee_id_param
|
23
|
+
# params[:id]
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Unique attendee request id to identify attendee by Amazon Chime.
|
27
|
+
# Configure it depending on your application resources to identify attendee.
|
28
|
+
# For example, set "User-#{current_user.id}" by User model.
|
29
|
+
# @api protected
|
30
|
+
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
31
|
+
def attendee_request_id
|
32
|
+
# "User-#{current_user.id}"
|
33
|
+
"default"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Path for meetings#index action such as meetings_path.
|
37
|
+
# Configure it depending on your application routes.
|
38
|
+
# @api protected
|
39
|
+
# @param [Hash] params Request parameters for path method
|
40
|
+
# @return [String] Path for meetings#index action such as meetings_path
|
41
|
+
def meeting_resources_path(params = {})
|
42
|
+
<%= @path_name_prefix %>meetings_path(<%= @path_args_prefix %>params)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Path for meetings#show action such as meeting_path(meeting_id).
|
46
|
+
# Configure it depending on your application routes.
|
47
|
+
# @api protected
|
48
|
+
# @param [String] meeting_id Meeting id
|
49
|
+
# @param [Hash] params Request parameters for path method
|
50
|
+
# @return [String] Path for meetings#show action such as meeting_path(meeting_id)
|
51
|
+
def meeting_resource_path(meeting_id, params = {})
|
52
|
+
<%= @path_name_prefix %>meeting_path(<%= @path_args_prefix %>meeting_id, params)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Path for attendees#index action such as attendees_path(meeting_id).
|
56
|
+
# Configure it depending on your application routes.
|
57
|
+
# @api protected
|
58
|
+
# @param [String] meeting_id Meeting id
|
59
|
+
# @param [Hash] params Request parameters for path method
|
60
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
61
|
+
def attendee_resources_path(meeting_id, params = {})
|
62
|
+
<%= @path_name_prefix %>meeting_attendees_path(<%= @path_args_prefix %>meeting_id, params)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Path for attendees#show action such as attendee_path(meeting_id, attendee_id).
|
66
|
+
# Configure it depending on your application routes.
|
67
|
+
# @api protected
|
68
|
+
# @param [String] meeting_id Meeting id
|
69
|
+
# @param [String] attendee_id Attendee id
|
70
|
+
# @param [Hash] params Request parameters for path method
|
71
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
72
|
+
def attendee_resource_path(meeting_id, attendee_id, params = {})
|
73
|
+
<%= @path_name_prefix %>meeting_attendee_path(<%= @path_args_prefix %>meeting_id, attendee_id, params)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
77
|
+
# This is an optional parameter and configure it depending on your application.
|
78
|
+
# @api protected
|
79
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
80
|
+
# @return [Array<Hash>] Appication metadata for attendees
|
81
|
+
# def optional_attendee_tags
|
82
|
+
# [
|
83
|
+
# {
|
84
|
+
# key: "AttendeeType",
|
85
|
+
# value: "User"
|
86
|
+
# },
|
87
|
+
# {
|
88
|
+
# key: "UserId",
|
89
|
+
# value: current_user.id.to_s
|
90
|
+
# }
|
91
|
+
# ]
|
92
|
+
# end
|
93
|
+
|
94
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
95
|
+
# This is an optional parameter and configure it depending on your application.
|
96
|
+
# @api protected
|
97
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
98
|
+
# @return [Hash] Appication metadata for attendees
|
99
|
+
# def application_attendee_metadata(attendee)
|
100
|
+
# user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
|
101
|
+
# {
|
102
|
+
# "AttendeeType": "User",
|
103
|
+
# "User": User.find_by_id(user_id)
|
104
|
+
# }
|
105
|
+
# end
|
106
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# Generated by amazon-chime-sdk-rails
|
2
|
+
|
3
|
+
class <%= @namespace %><%= @class_name_prefix %>MeetingsController < ApplicationController
|
4
|
+
|
5
|
+
include ChimeSdk::Controller::Meetings::Mixin
|
6
|
+
|
7
|
+
private
|
8
|
+
# Override the following functions in your controllers.
|
9
|
+
|
10
|
+
# Request parameter representing meeting id such as params[:id].
|
11
|
+
# Configure it depending on your application routes.
|
12
|
+
# @api protected
|
13
|
+
# @return [String, Integer] Meeting id from request parameter
|
14
|
+
# def meeting_id_param
|
15
|
+
# params[:id]
|
16
|
+
# end
|
17
|
+
|
18
|
+
# Unique meeting request id to identify meeting by Amazon Chime.
|
19
|
+
# Configure it depending on your application resources to identify meeting.
|
20
|
+
# For example, set "PrivateRoom-#{@room.id}" by Room model.
|
21
|
+
# @api protected
|
22
|
+
# @return [String] Unique meeting request id to identify meeting by Amazon Chime
|
23
|
+
def meeting_request_id
|
24
|
+
# "PrivateRoom-#{@room.id}"
|
25
|
+
"<%= @default_meeting_request_id %>"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Unique attendee request id to identify attendee by Amazon Chime.
|
29
|
+
# Configure it depending on your application resources to identify attendee.
|
30
|
+
# For example, set "User-#{current_user.id}" by User model.
|
31
|
+
# @api protected
|
32
|
+
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
33
|
+
def attendee_request_id
|
34
|
+
# "User-#{current_user.id}"
|
35
|
+
"default"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Path for meetings#index action such as meetings_path.
|
39
|
+
# Configure it depending on your application routes.
|
40
|
+
# @api protected
|
41
|
+
# @param [Hash] params Request parameters for path method
|
42
|
+
# @return [String] Path for meetings#index action such as meetings_path
|
43
|
+
def meeting_resources_path(params = {})
|
44
|
+
<%= @path_name_prefix %>meetings_path(<%= @path_args_prefix %>params)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Path for meetings#show action such as meeting_path(meeting_id).
|
48
|
+
# Configure it depending on your application routes.
|
49
|
+
# @api protected
|
50
|
+
# @param [String] meeting_id Meeting id
|
51
|
+
# @param [Hash] params Request parameters for path method
|
52
|
+
# @return [String] Path for meetings#show action such as meeting_path(meeting_id)
|
53
|
+
def meeting_resource_path(meeting_id, params = {})
|
54
|
+
<%= @path_name_prefix %>meeting_path(<%= @path_args_prefix %>meeting_id, params)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Path for attendees#index action such as attendees_path(meeting_id).
|
58
|
+
# Configure it depending on your application routes.
|
59
|
+
# @api protected
|
60
|
+
# @param [String] meeting_id Meeting id
|
61
|
+
# @param [Hash] params Request parameters for path method
|
62
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
63
|
+
def attendee_resources_path(meeting_id, params = {})
|
64
|
+
<%= @path_name_prefix %>meeting_attendees_path(<%= @path_args_prefix %>meeting_id, params)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Path for attendees#show action such as attendee_path(meeting_id, attendee_id).
|
68
|
+
# Configure it depending on your application routes.
|
69
|
+
# @api protected
|
70
|
+
# @param [String] meeting_id Meeting id
|
71
|
+
# @param [String] attendee_id Attendee id
|
72
|
+
# @param [Hash] params Request parameters for path method
|
73
|
+
# @return [String] Path for attendees#index action such as attendees_path(meeting_id)
|
74
|
+
def attendee_resource_path(meeting_id, attendee_id, params = {})
|
75
|
+
<%= @path_name_prefix %>meeting_attendee_path(<%= @path_args_prefix %>meeting_id, attendee_id, params)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Optional meeting tags to pass to Amazon Chime.
|
79
|
+
# This is an optional parameter and configure it depending on your application.
|
80
|
+
# @api protected
|
81
|
+
# @return [Array<Hash>] Optional tags for meetings
|
82
|
+
# def optional_meeting_tags
|
83
|
+
# [
|
84
|
+
# {
|
85
|
+
# key: "MeetingType",
|
86
|
+
# value: "PrivateRoom"
|
87
|
+
# },
|
88
|
+
# {
|
89
|
+
# key: "RoomId",
|
90
|
+
# value: @room.id.to_s
|
91
|
+
# }
|
92
|
+
# ]
|
93
|
+
# end
|
94
|
+
|
95
|
+
# Optional attendee 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 attendees
|
99
|
+
# def optional_attendee_tags
|
100
|
+
# [
|
101
|
+
# {
|
102
|
+
# key: "AttendeeType",
|
103
|
+
# value: "User"
|
104
|
+
# },
|
105
|
+
# {
|
106
|
+
# key: "UserId",
|
107
|
+
# value: current_user.id.to_s
|
108
|
+
# }
|
109
|
+
# ]
|
110
|
+
# end
|
111
|
+
|
112
|
+
# Appication metadata that meetings API returns as JSON response included in meeting resource.
|
113
|
+
# This is an optional parameter and configure it depending on your application.
|
114
|
+
# @api protected
|
115
|
+
# @param [Hash] meeting Meeting JSON object as hash
|
116
|
+
# @return [Hash] Appication metadata for meetings
|
117
|
+
# def application_meeting_metadata(meeting)
|
118
|
+
# {
|
119
|
+
# "MeetingType": "PrivateRoom",
|
120
|
+
# "Room": @room
|
121
|
+
# }
|
122
|
+
# end
|
123
|
+
|
124
|
+
# Appication metadata that attendees API returns as JSON response included in attendee resource.
|
125
|
+
# This is an optional parameter and configure it depending on your application.
|
126
|
+
# @api protected
|
127
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
128
|
+
# @return [Hash] Appication metadata for attendees
|
129
|
+
# def application_attendee_metadata(attendee)
|
130
|
+
# user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
|
131
|
+
# {
|
132
|
+
# "AttendeeType": "User",
|
133
|
+
# "User": User.find_by_id(user_id)
|
134
|
+
# }
|
135
|
+
# end
|
136
|
+
|
137
|
+
# Application attendee name to resolve from attendee object in your view.
|
138
|
+
# This is an optional parameter and configure it depending on your application.
|
139
|
+
# @api protected
|
140
|
+
# @param [Hash] meeting Attendee JSON object as hash
|
141
|
+
# @return [String] Appication attendee name to resolve from attendee object in your view
|
142
|
+
def application_attendee_name(attendee)
|
143
|
+
# attendee[:Attendee][:ApplicationMetadata][:User][:name]
|
144
|
+
attendee[:Attendee][:AttendeeId]
|
145
|
+
end
|
146
|
+
end
|