Class: LiveKit::SIPGrant

Inherits:
Object
  • Object
show all
Defined in:
lib/livekit/grants.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(admin: nil, call: nil) ⇒ SIPGrant

Returns a new instance of SIPGrant.



141
142
143
144
145
146
147
148
149
# File 'lib/livekit/grants.rb', line 141

def initialize(
  # true if can access SIP features
  admin: nil,
  # true if can make outgoing call
  call: nil
)
  @admin = admin
  @call = call
end

Instance Attribute Details

#adminObject

Returns the value of attribute admin.



139
140
141
# File 'lib/livekit/grants.rb', line 139

def admin
  @admin
end

#callObject

Returns the value of attribute call.



139
140
141
# File 'lib/livekit/grants.rb', line 139

def call
  @call
end

Class Method Details

.from_hash(hash) ⇒ Object



151
152
153
154
155
156
157
158
159
160
# File 'lib/livekit/grants.rb', line 151

def self.from_hash(hash)
  return nil if hash.nil?

  hash = hash.stringify_keys

  SIPGrant.new(
    admin: hash["admin"],
    call: hash["call"]
  )
end

Instance Method Details

#to_hashObject



162
163
164
165
166
167
168
169
170
171
# File 'lib/livekit/grants.rb', line 162

def to_hash
  hash = {}
  instance_variables.each { |var|
    val = instance_variable_get(var)
    if val != nil
      hash[var.to_s.delete("@")] = val
    end
  }
  hash
end