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.



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

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

Instance Attribute Details

#callback_urlString

Full callback url to use for notifications about this participant

Returns:

  • (String)


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

def callback_url
  @callback_url
end

#device_api_versionDeviceApiVersionEnum

Optional field to define the device api version of this participant



40
41
42
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 40

def device_api_version
  @device_api_version
end

#idString

Unique id of the participant

Returns:

  • (String)


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

def id
  @id
end

#publish_permissionsList of PublishPermissionEnum

Defines if this participant can publish audio or video

Returns:



22
23
24
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 22

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)


27
28
29
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 27

def sessions
  @sessions
end

#subscriptionsSubscriptions

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

Returns:



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

def subscriptions
  @subscriptions
end

#tagString

User defined tag to associate with the participant

Returns:

  • (String)


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

def tag
  @tag
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  callback_url = hash.key?('callbackUrl') ? hash['callbackUrl'] : SKIP
  publish_permissions =
    hash.key?('publishPermissions') ? hash['publishPermissions'] : SKIP
  sessions = hash.key?('sessions') ? hash['sessions'] : SKIP
  subscriptions = Subscriptions.from_hash(hash['subscriptions']) if hash['subscriptions']
  tag = hash.key?('tag') ? hash['tag'] : SKIP
  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.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 43

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

Instance Method Details

#nullablesObject

An array for nullable fields



69
70
71
72
73
# File 'lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb', line 69

def nullables
  %w[
    callback_url
  ]
end

#optionalsObject

An array for optional fields



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

def optionals
  %w[
    id
    callback_url
    publish_permissions
    sessions
    subscriptions
    tag
    device_api_version
  ]
end