# bandwidth # # This file was automatically generated by APIMATIC v2.0 # ( https://apimatic.io ). module Bandwidth # Subscriptions Model. class Subscriptions < BaseModel SKIP = Object.new private_constant :SKIP # Session the subscriptions are associated with # If this is the only field, the subscriber will be subscribed to all # participants in the session (including any participants that are later # added to the session) # @return [String] attr_accessor :session_id # Subset of participants to subscribe to in the session. Optional. # @return [List of ParticipantSubscription] attr_accessor :participants # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @_hash['session_id'] = 'sessionId' @_hash['participants'] = 'participants' @_hash end # An array for optional fields def optionals %w[ participants ] end # An array for nullable fields def nullables [] end def initialize(session_id = nil, participants = nil) @session_id = session_id unless session_id == SKIP @participants = participants unless participants == SKIP end # Creates an instance of the object from a hash. def self.from_hash(hash) return nil unless hash # Extract variables from the hash. session_id = hash.key?('sessionId') ? hash['sessionId'] : SKIP # Parameter is an array, so we need to iterate through it participants = nil unless hash['participants'].nil? participants = [] hash['participants'].each do |structure| participants << (ParticipantSubscription.from_hash(structure) if structure) end end participants = SKIP unless hash.key?('participants') # Create object from extracted values. Subscriptions.new(session_id, participants) end end end