Class: BigMarkerClient::Api::V1::Presenter

Inherits:
Base
  • Object
show all
Defined in:
lib/big_marker_client/api/v1/presenter.rb

Constant Summary collapse

LIST_PRESENTER_CONFERENCES =
"/presenters/{id}/list_conferences".freeze
CREATE_PRESENTER =
"/presenters".freeze
UPDATE_PRESENTER =
"/presenters/{id}".freeze
DELETE_PRESENTER =
"/presenters/{id}".freeze

Constants inherited from Base

Base::DEFAULT_PER_PAGE_SIZE

Class Method Summary collapse

Methods inherited from Base

delete, get, patch, post, put

Class Method Details

.create(conference_id, body = {}) ⇒ BigMarkerClient::Models::Presenter

add a presenter to a conference either with a Models::Presenter object or single properties as hash

Parameters:

Returns:



44
45
46
47
48
49
50
51
# File 'lib/big_marker_client/api/v1/presenter.rb', line 44

def create(conference_id, body = {})
  body = body.to_h if body.is_a?(::BigMarkerClient::Models::Base)
  body["conference_id"] = conference_id
  result = post(CREATE_PRESENTER, body)
  return ::BigMarkerClient::Models::Presenter.new(result["presenter"]) if result["presenter"]

  result
end

.destroy(member_id) ⇒ Object

remove a presenter from a conference

Parameters:

  • member_id (String)

    BigMarker member identifier (BMID)



56
57
58
# File 'lib/big_marker_client/api/v1/presenter.rb', line 56

def destroy(member_id)
  delete(replace_path_params(path: DELETE_PRESENTER, replacements: { "{id}": member_id }))
end

.list_conferences(member_id, channel_id) ⇒ BigMarkerClient::Models::Conference[]

lists all conferences of a presenter

Parameters:

  • member_id (String)

    BigMarker member id (BMID)

  • channel_id (String)

    BigMarker channel id

Returns:



16
17
18
19
20
21
22
23
24
# File 'lib/big_marker_client/api/v1/presenter.rb', line 16

def list_conferences(member_id, channel_id)
  result = get(replace_path_params(path: LIST_PRESENTER_CONFERENCES, replacements: { "{id}": member_id }),
               { channel_id: channel_id })
  if result["conferences"]
    return result["conferences"].map { |conference| ::BigMarkerClient::Models::Conference.new(conference) }
  end

  result
end

.update(member_id, body = {}) ⇒ BigMarkerClient::Models::Presenter

update a presenter to a conference either with a Models::Presenter object or single properties as hash

Parameters:

Returns:



31
32
33
34
35
36
37
# File 'lib/big_marker_client/api/v1/presenter.rb', line 31

def update(member_id, body = {})
  body = body.to_h if body.is_a?(::BigMarkerClient::Models::Presenter)
  result = put(replace_path_params(path: UPDATE_PRESENTER, replacements: { "{id}": member_id }), body)
  return ::BigMarkerClient::Models::Presenter.new(result["presenter"]) if result["presenter"]

  result
end