Module: ChimeSdk::Controller::Meetings::Mixin

Extended by:
ActiveSupport::Concern
Defined in:
lib/chime_sdk/controller/meetings.rb

Overview

Controller implementation to be included in custom meetings controllers.

Instance Method Summary collapse

Instance Method Details

#application_attendee_metadata(attendee) ⇒ Hash (protected)

Appication metadata that attendees API returns as JSON response included in attendee resource. This is an optional parameter and configure it depending on your application.

Parameters:

  • attendee (Hash)

    Attendee JSON object as hash

Returns:

  • (Hash)

    Appication metadata for attendees



176
177
178
# File 'lib/chime_sdk/controller/meetings.rb', line 176

def (attendee)
  {}
end

#application_attendee_name(attendee) ⇒ String (protected)

Application attendee name to resolve from attendee object in your view. This is an optional parameter and configure it depending on your application.

Parameters:

  • attendee (Hash)

    Attendee JSON object as hash

Returns:

  • (String)

    Appication attendee name to resolve from attendee object in your view



185
186
187
# File 'lib/chime_sdk/controller/meetings.rb', line 185

def application_attendee_name(attendee)
  attendee[:Attendee][:AttendeeId]
end

#application_meeting_metadata(meeting) ⇒ Hash (protected)

Appication metadata that meetings API returns as JSON response included in meeting resource. This is an optional parameter and configure it depending on your application.

Parameters:

  • meeting (Hash)

    Meeting JSON object as hash

Returns:

  • (Hash)

    Appication metadata for meetings



167
168
169
# File 'lib/chime_sdk/controller/meetings.rb', line 167

def (meeting)
  {}
end

#attendee_request_idString (protected)

Unique attendee request id to identify attendee by Amazon Chime. Configure it depending on your application resources to identify attendee. For example, set "User-#ChimeSdk::Controller::Meetings::Mixin.current_usercurrent_user.id" by User model.

Returns:

  • (String)

    Unique attendee request id to identify attendee by Amazon Chime



102
103
104
# File 'lib/chime_sdk/controller/meetings.rb', line 102

def attendee_request_id
  "default"
end

#attendee_resource_path(meeting_id, attendee_id, params = {}) ⇒ String (protected)

Path for attendees#show action such as attendee_path(meeting_id, attendee_id). Configure it depending on your application routes.

Parameters:

  • meeting_id (String)

    Meeting id

  • attendee_id (String)

    Attendee id

  • params (Hash) (defaults to: {})

    Request parameters for path method

Returns:

  • (String)

    Path for attendees#index action such as attendees_path(meeting_id)



142
143
144
# File 'lib/chime_sdk/controller/meetings.rb', line 142

def attendee_resource_path(meeting_id, attendee_id, params = {})
  attendee_path(meeting_id, attendee_id, params)
end

#attendee_resources_path(meeting_id, params = {}) ⇒ String (protected)

Path for attendees#index action such as attendees_path(meeting_id). Configure it depending on your application routes.

Parameters:

  • meeting_id (String)

    Meeting id

  • params (Hash) (defaults to: {})

    Request parameters for path method

Returns:

  • (String)

    Path for attendees#index action such as attendees_path(meeting_id)



131
132
133
# File 'lib/chime_sdk/controller/meetings.rb', line 131

def attendee_resources_path(meeting_id, params = {})
  attendees_path(meeting_id, params)
end

#create(params) ⇒ Object

POST /meetings POST /meetings.json

Parameters:

  • params (Hash)

    Request parameter options

Options Hash (params):

  • :create_meeting_with_attendee (String) — default: ChimeSdk.config.create_meeting_with_attendee

    Whether the application creates meeting with attendee in this meetings#create action



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chime_sdk/controller/meetings.rb', line 54

def create
  if params[:create_meeting_with_attendee].to_s.to_boolean(false) || ChimeSdk.config.create_meeting_with_attendee && params[:create_meeting_with_attendee].to_s.to_boolean(true)
    create_meeting_with_attendee
  else
    create_meeting
  end
  respond_to do |format|
    format.html { redirect_to meeting_resource_path(meeting_id), notice: "Meeting <#{meeting_id}> was successfully created." }
    format.json { render status: 201, json: @meeting.merge(@attendee || {}) }
  end
end

#destroyObject

DELETE /meetings/:meeting_id DELETE /meetings/:meeting_id.json



68
69
70
71
72
73
74
# File 'lib/chime_sdk/controller/meetings.rb', line 68

def destroy
  delete_meeting
  respond_to do |format|
    format.html { redirect_to meeting_resources_path, notice: "Meeting <#{meeting_id}> was successfully destroyed." }
    format.json { head 204 }
  end
end

#index(params) ⇒ Object

GET /meetings GET /meetings.json

Parameters:

  • params (Hash)

    Request parameter options

Options Hash (params):

  • :create_meeting (String) — default: ChimeSdk.config.create_meeting_by_get_request

    Whether the application creates meeting in this meetings#index action by HTTP GET request



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/chime_sdk/controller/meetings.rb', line 20

def index
  if params[:create_meeting].to_s.to_boolean(false) || ChimeSdk.config.create_meeting_by_get_request && params[:create_meeting].to_s.to_boolean(true)
    create
  else
    @meeting_request_id = ChimeSdk.config.prefix + meeting_request_id
    @attendee_request_id = ChimeSdk.config.prefix + attendee_request_id
    respond_to do |format|
      format.html
      format.json { render json: { meeting_request_id: @meeting_request_id, attendee_request_id: @attendee_request_id } }
    end
  end
end

#meeting_id_paramString, Integer (protected)

Request parameter representing meeting id such as params[:id]. Configure it depending on your application routes.

Returns:

  • (String, Integer)

    Meeting id from request parameter



84
85
86
# File 'lib/chime_sdk/controller/meetings.rb', line 84

def meeting_id_param
  params[:id]
end

#meeting_request_idString (protected)

Unique meeting request id to identify meeting by Amazon Chime. Configure it depending on your application resources to identify meeting. For example, set "PrivateRoom-#ChimeSdk::Controller::Meetings::Mixin.@[email protected]" by Room model.

Returns:

  • (String)

    Unique meeting request id to identify meeting by Amazon Chime



93
94
95
# File 'lib/chime_sdk/controller/meetings.rb', line 93

def meeting_request_id
  "default"
end

#meeting_resource_path(meeting_id, params = {}) ⇒ String (protected)

Path for meetings#show action such as meeting_path(meeting_id). Configure it depending on your application routes.

Parameters:

  • meeting_id (String)

    Meeting id

  • params (Hash) (defaults to: {})

    Request parameters for path method

Returns:

  • (String)

    Path for meetings#show action such as meeting_path(meeting_id)



121
122
123
# File 'lib/chime_sdk/controller/meetings.rb', line 121

def meeting_resource_path(meeting_id, params = {})
  meeting_path(meeting_id, params)
end

#meeting_resources_path(params = {}) ⇒ String (protected)

Path for meetings#index action such as meetings_path. Configure it depending on your application routes.

Parameters:

  • params (Hash) (defaults to: {})

    Request parameters for path method

Returns:

  • (String)

    Path for meetings#index action such as meetings_path



111
112
113
# File 'lib/chime_sdk/controller/meetings.rb', line 111

def meeting_resources_path(params = {})
  meetings_path(params)
end

#optional_attendee_tagsArray<Hash> (protected)

Optional attendee tags to pass to Amazon Chime. This is an optional parameter and configure it depending on your application.

Returns:

  • (Array<Hash>)

    Optional tags for attendees



158
159
160
# File 'lib/chime_sdk/controller/meetings.rb', line 158

def optional_attendee_tags
  []
end

#optional_meeting_tagsArray<Hash> (protected)

Optional meeting tags to pass to Amazon Chime. This is an optional parameter and configure it depending on your application.

Returns:

  • (Array<Hash>)

    Optional tags for meetings



150
151
152
# File 'lib/chime_sdk/controller/meetings.rb', line 150

def optional_meeting_tags
  []
end

#show(params) ⇒ Object

GET /meetings/:meeting_id GET /meetings/:meeting_id.json

Parameters:

  • params (Hash)

    Request parameter options

Options Hash (params):

  • :create_attendee_from_meeting (String) — default: ChimeSdk.config.create_attendee_from_meeting

    Whether the application creates attendee from meeting in meetings#show action



38
39
40
41
42
43
44
45
46
47
# File 'lib/chime_sdk/controller/meetings.rb', line 38

def show
  get_meeting
  if params[:create_attendee_from_meeting].to_s.to_boolean(false) || ChimeSdk.config.create_attendee_from_meeting && params[:create_attendee_from_meeting].to_s.to_boolean(true)
    create_attendee_from_meeting
  end
  respond_to do |format|
    format.html
    format.json { render json: @meeting }
  end
end