Class: Bandwidth::Participant

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb

Overview

A participant object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, callback_url = nil, publish_permissions = nil, sessions = nil, subscriptions = nil, tag = nil, device_api_version = DeviceApiVersionEnum::V2) ⇒ Participant

Returns a new instance of Participant.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 52

def initialize(id = nil,
               callback_url = nil,
               publish_permissions = nil,
               sessions = nil,
               subscriptions = nil,
               tag = nil,
               device_api_version = DeviceApiVersionEnum::V2)
  @id = id
  @callback_url = callback_url
  @publish_permissions = publish_permissions
  @sessions = sessions
  @subscriptions = subscriptions
  @tag = tag
  @device_api_version = device_api_version
end

Instance Attribute Details

#callback_urlString

Full callback url to use for notifications about this participant

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 15

def callback_url
  @callback_url
end

#device_api_versionDeviceApiVersionEnum

Optional field to define the device api version of this participant



37
38
39
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 37

def device_api_version
  @device_api_version
end

#idString

Unique id of the participant

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 11

def id
  @id
end

#publish_permissionsList of PublishPermissionEnum

Defines if this participant can publish audio or video

Returns:



19
20
21
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 19

def publish_permissions
  @publish_permissions
end

#sessionsList of String

List of session ids this participant is associated with Capped to one

Returns:

  • (List of String)


24
25
26
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 24

def sessions
  @sessions
end

#subscriptionsSubscriptions

List of session ids this participant is associated with Capped to one

Returns:



29
30
31
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 29

def subscriptions
  @subscriptions
end

#tagString

User defined tag to associate with the participant

Returns:

  • (String)


33
34
35
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 33

def tag
  @tag
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash['id']
  callback_url = hash['callbackUrl']
  publish_permissions = hash['publishPermissions']
  sessions = hash['sessions']
  subscriptions = Subscriptions.from_hash(hash['subscriptions']) if
    hash['subscriptions']
  tag = hash['tag']
  device_api_version = hash['deviceApiVersion'] ||= DeviceApiVersionEnum::V2

  # Create object from extracted values.
  Participant.new(id,
                  callback_url,
                  publish_permissions,
                  sessions,
                  subscriptions,
                  tag,
                  device_api_version)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['callback_url'] = 'callbackUrl'
  @_hash['publish_permissions'] = 'publishPermissions'
  @_hash['sessions'] = 'sessions'
  @_hash['subscriptions'] = 'subscriptions'
  @_hash['tag'] = 'tag'
  @_hash['device_api_version'] = 'deviceApiVersion'
  @_hash
end