amazon-chime-sdk-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +87 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +47 -0
  5. data/.yardopts +6 -0
  6. data/CHANGELOG.md +3 -0
  7. data/Gemfile +25 -0
  8. data/LICENSE +21 -0
  9. data/README.md +1109 -0
  10. data/Rakefile +20 -0
  11. data/amazon-chime-sdk-rails.gemspec +29 -0
  12. data/gemfiles/Gemfile.rails-5.0 +25 -0
  13. data/gemfiles/Gemfile.rails-5.1 +25 -0
  14. data/gemfiles/Gemfile.rails-5.2 +25 -0
  15. data/gemfiles/Gemfile.rails-6.0 +25 -0
  16. data/lib/amazon-chime-sdk-rails.rb +37 -0
  17. data/lib/chime_sdk/config.rb +90 -0
  18. data/lib/chime_sdk/controller/attendees.rb +128 -0
  19. data/lib/chime_sdk/controller/common.rb +202 -0
  20. data/lib/chime_sdk/controller/meetings.rb +192 -0
  21. data/lib/chime_sdk/meeting_coordinator.rb +184 -0
  22. data/lib/chime_sdk/version.rb +4 -0
  23. data/lib/generators/chime_sdk/controllers_generator.rb +104 -0
  24. data/lib/generators/chime_sdk/install_generator.rb +27 -0
  25. data/lib/generators/chime_sdk/js_generator.rb +67 -0
  26. data/lib/generators/chime_sdk/views_generator.rb +43 -0
  27. data/lib/generators/templates/chime_sdk.rb +28 -0
  28. data/lib/generators/templates/controllers/README +35 -0
  29. data/lib/generators/templates/controllers/meeting_attendees_controller.rb +106 -0
  30. data/lib/generators/templates/controllers/meetings_controller.rb +146 -0
  31. data/lib/generators/templates/views/meetings/index.html.erb +27 -0
  32. data/lib/generators/templates/views/meetings/show.html.erb +136 -0
  33. data/spec/factories/rooms.rb +5 -0
  34. data/spec/factories/users.rb +8 -0
  35. data/spec/generators/controllers_generator_spec.rb +113 -0
  36. data/spec/generators/install_generator_spec.rb +24 -0
  37. data/spec/generators/js_generator_spec.rb +26 -0
  38. data/spec/generators/views_generator_spec.rb +46 -0
  39. data/spec/rails_app/Rakefile +15 -0
  40. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  41. data/spec/rails_app/app/assets/images/.keep +0 -0
  42. data/spec/rails_app/app/assets/javascripts/.keep +0 -0
  43. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  44. data/spec/rails_app/app/assets/stylesheets/scaffolds.scss +65 -0
  45. data/spec/rails_app/app/controllers/api/meeting_attendees_controller.rb +3 -0
  46. data/spec/rails_app/app/controllers/api/meetings_controller.rb +3 -0
  47. data/spec/rails_app/app/controllers/api/rooms_controller.rb +3 -0
  48. data/spec/rails_app/app/controllers/application_controller.rb +11 -0
  49. data/spec/rails_app/app/controllers/entries_controller.rb +47 -0
  50. data/spec/rails_app/app/controllers/meeting_attendees_controller.rb +121 -0
  51. data/spec/rails_app/app/controllers/meetings_controller.rb +162 -0
  52. data/spec/rails_app/app/controllers/rooms_controller.rb +76 -0
  53. data/spec/rails_app/app/controllers/spa_controller.rb +6 -0
  54. data/spec/rails_app/app/javascript/App.vue +50 -0
  55. data/spec/rails_app/app/javascript/channels/consumer.js +6 -0
  56. data/spec/rails_app/app/javascript/channels/index.js +5 -0
  57. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +84 -0
  58. data/spec/rails_app/app/javascript/components/meetings/Index.vue +100 -0
  59. data/spec/rails_app/app/javascript/components/meetings/Meeting.vue +178 -0
  60. data/spec/rails_app/app/javascript/components/rooms/Index.vue +53 -0
  61. data/spec/rails_app/app/javascript/components/rooms/Show.vue +91 -0
  62. data/spec/rails_app/app/javascript/packs/application.js +17 -0
  63. data/spec/rails_app/app/javascript/packs/spa.js +14 -0
  64. data/spec/rails_app/app/javascript/router/index.js +74 -0
  65. data/spec/rails_app/app/javascript/store/index.js +37 -0
  66. data/spec/rails_app/app/models/application_record.rb +3 -0
  67. data/spec/rails_app/app/models/entry.rb +5 -0
  68. data/spec/rails_app/app/models/room.rb +12 -0
  69. data/spec/rails_app/app/models/user.rb +6 -0
  70. data/spec/rails_app/app/views/devise/registrations/new.html.erb +34 -0
  71. data/spec/rails_app/app/views/layouts/_header.html.erb +20 -0
  72. data/spec/rails_app/app/views/layouts/application.html.erb +18 -0
  73. data/spec/rails_app/app/views/meetings/index.html.erb +28 -0
  74. data/spec/rails_app/app/views/meetings/show.html.erb +136 -0
  75. data/spec/rails_app/app/views/rooms/_form.html.erb +22 -0
  76. data/spec/rails_app/app/views/rooms/_room.json.jbuilder +7 -0
  77. data/spec/rails_app/app/views/rooms/edit.html.erb +6 -0
  78. data/spec/rails_app/app/views/rooms/index.html.erb +27 -0
  79. data/spec/rails_app/app/views/rooms/index.json.jbuilder +1 -0
  80. data/spec/rails_app/app/views/rooms/new.html.erb +5 -0
  81. data/spec/rails_app/app/views/rooms/show.html.erb +42 -0
  82. data/spec/rails_app/app/views/rooms/show.json.jbuilder +1 -0
  83. data/spec/rails_app/app/views/spa/index.html.erb +1 -0
  84. data/spec/rails_app/babel.config.js +72 -0
  85. data/spec/rails_app/bin/bundle +114 -0
  86. data/spec/rails_app/bin/rails +9 -0
  87. data/spec/rails_app/bin/rake +9 -0
  88. data/spec/rails_app/bin/setup +36 -0
  89. data/spec/rails_app/bin/spring +17 -0
  90. data/spec/rails_app/bin/webpack +18 -0
  91. data/spec/rails_app/bin/webpack-dev-server +18 -0
  92. data/spec/rails_app/bin/yarn +11 -0
  93. data/spec/rails_app/config.ru +5 -0
  94. data/spec/rails_app/config/application.rb +21 -0
  95. data/spec/rails_app/config/boot.rb +4 -0
  96. data/spec/rails_app/config/cable.yml +10 -0
  97. data/spec/rails_app/config/credentials.yml.enc +1 -0
  98. data/spec/rails_app/config/database.yml +25 -0
  99. data/spec/rails_app/config/environment.rb +14 -0
  100. data/spec/rails_app/config/environments/development.rb +62 -0
  101. data/spec/rails_app/config/environments/production.rb +112 -0
  102. data/spec/rails_app/config/environments/test.rb +49 -0
  103. data/spec/rails_app/config/initializers/application_controller_renderer.rb +8 -0
  104. data/spec/rails_app/config/initializers/assets.rb +15 -0
  105. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  106. data/spec/rails_app/config/initializers/chime_sdk.rb +28 -0
  107. data/spec/rails_app/config/initializers/content_security_policy.rb +30 -0
  108. data/spec/rails_app/config/initializers/cookies_serializer.rb +5 -0
  109. data/spec/rails_app/config/initializers/devise.rb +311 -0
  110. data/spec/rails_app/config/initializers/devise_token_auth.rb +60 -0
  111. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  112. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  113. data/spec/rails_app/config/initializers/mime_types.rb +4 -0
  114. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  115. data/spec/rails_app/config/locales/devise.en.yml +65 -0
  116. data/spec/rails_app/config/locales/en.yml +33 -0
  117. data/spec/rails_app/config/puma.rb +38 -0
  118. data/spec/rails_app/config/routes.rb +24 -0
  119. data/spec/rails_app/config/secrets.yml +8 -0
  120. data/spec/rails_app/config/spring.rb +6 -0
  121. data/spec/rails_app/config/storage.yml +34 -0
  122. data/spec/rails_app/config/webpack/development.js +5 -0
  123. data/spec/rails_app/config/webpack/environment.js +7 -0
  124. data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
  125. data/spec/rails_app/config/webpack/production.js +5 -0
  126. data/spec/rails_app/config/webpack/test.js +5 -0
  127. data/spec/rails_app/config/webpacker.yml +97 -0
  128. data/spec/rails_app/db/migrate/20200912140231_devise_create_users.rb +45 -0
  129. data/spec/rails_app/db/migrate/20200912140352_add_tokens_to_users.rb +12 -0
  130. data/spec/rails_app/db/migrate/20200912140657_create_rooms.rb +9 -0
  131. data/spec/rails_app/db/migrate/20200912140749_create_entries.rb +10 -0
  132. data/spec/rails_app/db/schema.rb +49 -0
  133. data/spec/rails_app/db/seeds.rb +41 -0
  134. data/spec/rails_app/log/.keep +0 -0
  135. data/spec/rails_app/package.json +23 -0
  136. data/spec/rails_app/postcss.config.js +12 -0
  137. data/spec/rails_app/public/404.html +67 -0
  138. data/spec/rails_app/public/422.html +67 -0
  139. data/spec/rails_app/public/500.html +66 -0
  140. data/spec/rails_app/public/favicon.ico +0 -0
  141. data/spec/rails_app/public/robots.txt +1 -0
  142. data/spec/rails_app/tmp/.keep +0 -0
  143. data/spec/requests/atendees_spec.rb +182 -0
  144. data/spec/requests/meetings_spec.rb +433 -0
  145. data/spec/spec_helper.rb +35 -0
  146. metadata +400 -0
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateUsers < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :users do |t|
6
+ ## Database authenticatable
7
+ t.string :email, null: false, default: ""
8
+ t.string :encrypted_password, null: false, default: ""
9
+
10
+ ## Recoverable
11
+ t.string :reset_password_token
12
+ t.datetime :reset_password_sent_at
13
+
14
+ ## Rememberable
15
+ t.datetime :remember_created_at
16
+
17
+ ## Trackable
18
+ # t.integer :sign_in_count, default: 0, null: false
19
+ # t.datetime :current_sign_in_at
20
+ # t.datetime :last_sign_in_at
21
+ # t.string :current_sign_in_ip
22
+ # t.string :last_sign_in_ip
23
+
24
+ ## Confirmable
25
+ # t.string :confirmation_token
26
+ # t.datetime :confirmed_at
27
+ # t.datetime :confirmation_sent_at
28
+ # t.string :unconfirmed_email # Only if using reconfirmable
29
+
30
+ ## Lockable
31
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
33
+ # t.datetime :locked_at
34
+
35
+ t.string :name
36
+
37
+ t.timestamps null: false
38
+ end
39
+
40
+ add_index :users, :email, unique: true
41
+ add_index :users, :reset_password_token, unique: true
42
+ # add_index :users, :confirmation_token, unique: true
43
+ # add_index :users, :unlock_token, unique: true
44
+ end
45
+ end
@@ -0,0 +1,12 @@
1
+ class AddTokensToUsers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ ## Required
4
+ add_column :users, :provider, :string, null: false, default: "email"
5
+ add_column :users, :uid, :string, null: false, default: ""
6
+
7
+ ## Tokens
8
+ add_column :users, :tokens, :text
9
+
10
+ add_index :users, [:uid, :provider], unique: true
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateRooms < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :rooms do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateEntries < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :entries do |t|
4
+ t.references :room, null: false, foreign_key: true
5
+ t.references :user, null: false, foreign_key: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,49 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 2020_09_12_140749) do
14
+
15
+ create_table "entries", force: :cascade do |t|
16
+ t.integer "room_id", null: false
17
+ t.integer "user_id", null: false
18
+ t.datetime "created_at", precision: 6, null: false
19
+ t.datetime "updated_at", precision: 6, null: false
20
+ t.index ["room_id"], name: "index_entries_on_room_id"
21
+ t.index ["user_id"], name: "index_entries_on_user_id"
22
+ end
23
+
24
+ create_table "rooms", force: :cascade do |t|
25
+ t.string "name"
26
+ t.datetime "created_at", precision: 6, null: false
27
+ t.datetime "updated_at", precision: 6, null: false
28
+ end
29
+
30
+ create_table "users", force: :cascade do |t|
31
+ t.string "email", default: "", null: false
32
+ t.string "encrypted_password", default: "", null: false
33
+ t.string "reset_password_token"
34
+ t.datetime "reset_password_sent_at"
35
+ t.datetime "remember_created_at"
36
+ t.string "name"
37
+ t.datetime "created_at", precision: 6, null: false
38
+ t.datetime "updated_at", precision: 6, null: false
39
+ t.string "provider", default: "email", null: false
40
+ t.string "uid", default: "", null: false
41
+ t.text "tokens"
42
+ t.index ["email"], name: "index_users_on_email", unique: true
43
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
44
+ t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
45
+ end
46
+
47
+ add_foreign_key "entries", "rooms"
48
+ add_foreign_key "entries", "users"
49
+ end
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ # This file is seed file for test data on development environment.
3
+
4
+ def clean_database
5
+ [Entry, Room, User].each do |model|
6
+ model.delete_all
7
+ end
8
+ end
9
+
10
+ def reset_pk_sequence
11
+ ActiveRecord::Base.connection.execute("UPDATE sqlite_sequence SET seq = 0")
12
+ end
13
+
14
+ clean_database
15
+ puts "* Cleaned database"
16
+
17
+ reset_pk_sequence
18
+ puts "* Reset sequences for primary keys"
19
+
20
+ ['Ichiro', 'Stephen', 'Klay', 'Kevin'].each do |name|
21
+ email = "#{name.downcase}@example.com"
22
+ user = User.create(
23
+ email: email,
24
+ password: 'changeit',
25
+ password_confirmation: 'changeit',
26
+ name: name,
27
+ uid: email
28
+ )
29
+ end
30
+ puts "* Created #{User.count} user records"
31
+
32
+ room = Room.create
33
+ puts "* Created #{Room.count} room records"
34
+
35
+ ['Ichiro', 'Stephen'].each do |name|
36
+ user = User.find_by(name: name)
37
+ room.add_member(user)
38
+ end
39
+ puts "* Created #{Entry.count} entry records"
40
+
41
+ puts "Created amazon-chime-sdk-rails test records!"
File without changes
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "rails_app",
3
+ "private": true,
4
+ "dependencies": {
5
+ "@rails/actioncable": "^6.0.0",
6
+ "@rails/activestorage": "^6.0.0",
7
+ "@rails/ujs": "^6.0.0",
8
+ "@rails/webpacker": "4.3.0",
9
+ "amazon-chime-sdk-js": "^1.17.2",
10
+ "axios": "^0.20.0",
11
+ "turbolinks": "^5.2.0",
12
+ "vue": "^2.6.12",
13
+ "vue-loader": "^15.9.3",
14
+ "vue-router": "^3.4.3",
15
+ "vue-template-compiler": "^2.6.12",
16
+ "vuex": "^3.5.1",
17
+ "vuex-persistedstate": "^3.1.0"
18
+ },
19
+ "version": "0.1.0",
20
+ "devDependencies": {
21
+ "webpack-dev-server": "^3.11.0"
22
+ }
23
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('postcss-flexbugs-fixes'),
5
+ require('postcss-preset-env')({
6
+ autoprefixer: {
7
+ flexbox: 'no-2009'
8
+ },
9
+ stage: 3
10
+ })
11
+ ]
12
+ }
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1 @@
1
+ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
File without changes
@@ -0,0 +1,182 @@
1
+ describe ChimeSdk::Controller::Attendees, type: :request do
2
+ before(:all) do
3
+ @meeting_id = "01234567-89ab-cdef-ghij-klmnopqrstuv"
4
+ @attendee_id = "76543210-ba98-fedc-jihg-vutsrqponmlk"
5
+ @dummy_meeting_id = "91234567-89ab-cdef-ghij-klmnopqrstuv"
6
+ @dummy_attendee_id = "96543210-ba98-fedc-jihg-vutsrqponmlk"
7
+
8
+ @room = create(:room)
9
+ @attendee_user = create(:user)
10
+ @room.add_member(@attendee_user)
11
+ test_attendee = {
12
+ external_user_id: "ChimeSdkRailsApp-test-User-#{@attendee_user.id}",
13
+ attendee_id: @attendee_id,
14
+ join_token: "dummy"
15
+ }
16
+ dummy_attendee = {
17
+ external_user_id: "ChimeSdkRailsApp-test-User-0",
18
+ attendee_id: @dummy_attendee_id,
19
+ join_token: "dummy"
20
+ }
21
+
22
+ # Use stubs for the AWS SDK for Ruby
23
+ client = Aws::Chime::Client.new(stub_responses: true)
24
+ client.stub_responses(:list_attendees, {
25
+ attendees: [ test_attendee, dummy_attendee ]
26
+ })
27
+ client.stub_responses(:get_attendee, -> (context) {
28
+ context.params[:meeting_id] == @meeting_id ?
29
+ (context.params[:attendee_id] == @attendee_id ? { attendee: test_attendee } : 'NotFoundException') :
30
+ 'ForbiddenException'
31
+ })
32
+ client.stub_responses(:create_attendee, -> (context) {
33
+ context.params[:meeting_id] == @meeting_id ? {
34
+ attendee: {
35
+ external_user_id: context.params[:external_user_id],
36
+ attendee_id: @attendee_id,
37
+ join_token: "dummy"
38
+ }
39
+ } : 'BadRequestException'
40
+ })
41
+ client.stub_responses(:delete_attendee, -> (context) {
42
+ context.params[:attendee_id] == @attendee_id ? {} : 'NotFoundException'
43
+ })
44
+ ChimeSdk::MeetingCoordinator.reset_client(client)
45
+ end
46
+
47
+ context "Rails API" do
48
+ let(:api_root_path) { "/api/v1" }
49
+ let(:api_path) { "#{api_root_path}/rooms/#{@room.id}" }
50
+ let(:api_meetings_path) { "#{api_path}/meetings/#{@meeting_id}" }
51
+
52
+ before do
53
+ @user = create(:user)
54
+ end
55
+
56
+ context "requests from unauthorized user" do
57
+ describe "GET /meetings/:meeting_id/attendees" do
58
+ it "returns response with 401 status" do
59
+ get "#{api_meetings_path}/attendees", headers: @auth_headers
60
+ expect(response).to have_http_status(401)
61
+ end
62
+ end
63
+ end
64
+
65
+ context "requests from authorized user" do
66
+ before do
67
+ # Sign in with Devise Token Auth
68
+ post "#{api_root_path}/auth/sign_in", params: { email: @user.email, password: "password" }
69
+ @auth_headers = response.header.slice("access-token", "client", "uid")
70
+ end
71
+
72
+ context "when the authorized user is not a member of the private room" do
73
+ describe "GET /meetings/:meeting_id/attendees" do
74
+ it "returns response with 403 status" do
75
+ get "#{api_meetings_path}/attendees", headers: @auth_headers
76
+ expect(response).to have_http_status(403)
77
+ end
78
+ end
79
+ end
80
+
81
+ context "when the authorized user is a member of the private room" do
82
+ before do
83
+ @room.add_member(@user)
84
+ end
85
+
86
+ describe "GET /meetings/:meeting_id/attendees" do
87
+ before do
88
+ get "#{api_meetings_path}/attendees", headers: @auth_headers
89
+ end
90
+
91
+ it "returns response with 200 status" do
92
+ expect(response).to have_http_status(200)
93
+ end
94
+
95
+ it "returns attendees list" do
96
+ expect(JSON.parse(response.body)["attendees"].length).to eq(2)
97
+ end
98
+
99
+ it "returns valid attendee in the list" do
100
+ expect(JSON.parse(response.body)["attendees"][0]["Attendee"]["AttendeeId"]).to eq(@attendee_id)
101
+ end
102
+ end
103
+
104
+ describe "GET /meetings/:meeting_id/attendees/:attendee_id" do
105
+ context "when the attendee is found" do
106
+ before do
107
+ get "#{api_meetings_path}/attendees/#{@attendee_id}", headers: @auth_headers
108
+ end
109
+
110
+ it "returns response with 200 status" do
111
+ expect(response).to have_http_status(200)
112
+ end
113
+
114
+ it "returns valid attendee" do
115
+ expect(JSON.parse(response.body)["Attendee"]["AttendeeId"]).to eq(@attendee_id)
116
+ end
117
+
118
+ it "returns application metadata in the attendee" do
119
+ expect(JSON.parse(response.body)["Attendee"]["ApplicationMetadata"]["User"]["id"]).to eq(@attendee_user.id)
120
+ end
121
+ end
122
+
123
+ context "when the attendee is not found" do
124
+ before do
125
+ get "#{api_meetings_path}/attendees/#{@dummy_attendee_id}", headers: @auth_headers
126
+ end
127
+
128
+ it "returns response with 404 status" do
129
+ expect(response).to have_http_status(404)
130
+ end
131
+ end
132
+
133
+ context "when the attendee is not in the meeting" do
134
+ before do
135
+ get "#{api_path}/meetings/#{@dummy_meeting_id}/attendees/#{@dummy_attendee_id}", headers: @auth_headers
136
+ end
137
+
138
+ it "returns response with 403 status" do
139
+ expect(response).to have_http_status(403)
140
+ end
141
+ end
142
+ end
143
+
144
+ describe "POST /meetings/:meeting_id/attendees" do
145
+ before do
146
+ post "#{api_meetings_path}/attendees", headers: @auth_headers
147
+ end
148
+
149
+ it "returns response with 201 status" do
150
+ expect(response).to have_http_status(201)
151
+ end
152
+
153
+ it "returns created attendee" do
154
+ expect(JSON.parse(response.body)["Attendee"]["AttendeeId"]).to eq(@attendee_id)
155
+ end
156
+ end
157
+
158
+ describe "DELETE /meetings/:meeting_id/attendees/:attendee_id" do
159
+ context "when the attendee is found" do
160
+ before do
161
+ delete "#{api_meetings_path}/attendees/#{@attendee_id}", headers: @auth_headers
162
+ end
163
+
164
+ it "returns response with 204 status" do
165
+ expect(response).to have_http_status(204)
166
+ end
167
+ end
168
+
169
+ context "when the attendee is not found" do
170
+ before do
171
+ get "#{api_meetings_path}/attendees/#{@dummy_attendee_id}", headers: @auth_headers
172
+ end
173
+
174
+ it "returns response with 404 status" do
175
+ expect(response).to have_http_status(404)
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end