Class: OBS::WebSocket::Protocol::Request

Inherits:
ClientMessage show all
Defined in:
lib/obs/websocket.rb

Direct Known Subclasses

OBS::WebSocket::Protocol::Requests::AddFilterToSource, OBS::WebSocket::Protocol::Requests::AddSceneItem, OBS::WebSocket::Protocol::Requests::Authenticate, OBS::WebSocket::Protocol::Requests::BroadcastCustomMessage, OBS::WebSocket::Protocol::Requests::CreateScene, OBS::WebSocket::Protocol::Requests::CreateSource, OBS::WebSocket::Protocol::Requests::DeleteSceneItem, OBS::WebSocket::Protocol::Requests::DisableStudioMode, OBS::WebSocket::Protocol::Requests::DuplicateSceneItem, OBS::WebSocket::Protocol::Requests::EnableStudioMode, OBS::WebSocket::Protocol::Requests::ExecuteBatch, OBS::WebSocket::Protocol::Requests::GetAudioActive, OBS::WebSocket::Protocol::Requests::GetAudioMonitorType, OBS::WebSocket::Protocol::Requests::GetAuthRequired, OBS::WebSocket::Protocol::Requests::GetBrowserSourceProperties, OBS::WebSocket::Protocol::Requests::GetCurrentProfile, OBS::WebSocket::Protocol::Requests::GetCurrentScene, OBS::WebSocket::Protocol::Requests::GetCurrentSceneCollection, OBS::WebSocket::Protocol::Requests::GetCurrentTransition, OBS::WebSocket::Protocol::Requests::GetFilenameFormatting, OBS::WebSocket::Protocol::Requests::GetMediaDuration, OBS::WebSocket::Protocol::Requests::GetMediaSourcesList, OBS::WebSocket::Protocol::Requests::GetMediaState, OBS::WebSocket::Protocol::Requests::GetMediaTime, OBS::WebSocket::Protocol::Requests::GetMute, OBS::WebSocket::Protocol::Requests::GetOutputInfo, OBS::WebSocket::Protocol::Requests::GetPreviewScene, OBS::WebSocket::Protocol::Requests::GetRecordingFolder, OBS::WebSocket::Protocol::Requests::GetRecordingStatus, OBS::WebSocket::Protocol::Requests::GetReplayBufferStatus, OBS::WebSocket::Protocol::Requests::GetSceneItemList, OBS::WebSocket::Protocol::Requests::GetSceneItemProperties, OBS::WebSocket::Protocol::Requests::GetSceneList, OBS::WebSocket::Protocol::Requests::GetSceneTransitionOverride, OBS::WebSocket::Protocol::Requests::GetSourceActive, OBS::WebSocket::Protocol::Requests::GetSourceDefaultSettings, OBS::WebSocket::Protocol::Requests::GetSourceFilterInfo, OBS::WebSocket::Protocol::Requests::GetSourceFilters, OBS::WebSocket::Protocol::Requests::GetSourceSettings, OBS::WebSocket::Protocol::Requests::GetSourceTypesList, OBS::WebSocket::Protocol::Requests::GetSourcesList, OBS::WebSocket::Protocol::Requests::GetSpecialSources, OBS::WebSocket::Protocol::Requests::GetStats, OBS::WebSocket::Protocol::Requests::GetStreamSettings, OBS::WebSocket::Protocol::Requests::GetStreamingStatus, OBS::WebSocket::Protocol::Requests::GetStudioModeStatus, OBS::WebSocket::Protocol::Requests::GetSyncOffset, OBS::WebSocket::Protocol::Requests::GetTextFreetype2Properties, OBS::WebSocket::Protocol::Requests::GetTextGDIPlusProperties, OBS::WebSocket::Protocol::Requests::GetTracks, OBS::WebSocket::Protocol::Requests::GetTransitionDuration, OBS::WebSocket::Protocol::Requests::GetTransitionList, OBS::WebSocket::Protocol::Requests::GetTransitionPosition, OBS::WebSocket::Protocol::Requests::GetTransitionSettings, OBS::WebSocket::Protocol::Requests::GetVersion, OBS::WebSocket::Protocol::Requests::GetVideoInfo, OBS::WebSocket::Protocol::Requests::GetVirtualCamStatus, OBS::WebSocket::Protocol::Requests::GetVolume, OBS::WebSocket::Protocol::Requests::ListOutputs, OBS::WebSocket::Protocol::Requests::ListProfiles, OBS::WebSocket::Protocol::Requests::ListSceneCollections, OBS::WebSocket::Protocol::Requests::MoveSourceFilter, OBS::WebSocket::Protocol::Requests::NextMedia, OBS::WebSocket::Protocol::Requests::OpenProjector, OBS::WebSocket::Protocol::Requests::PauseRecording, OBS::WebSocket::Protocol::Requests::PlayPauseMedia, OBS::WebSocket::Protocol::Requests::PreviousMedia, OBS::WebSocket::Protocol::Requests::RefreshBrowserSource, OBS::WebSocket::Protocol::Requests::ReleaseTBar, OBS::WebSocket::Protocol::Requests::RemoveFilterFromSource, OBS::WebSocket::Protocol::Requests::RemoveSceneTransitionOverride, OBS::WebSocket::Protocol::Requests::ReorderSceneItems, OBS::WebSocket::Protocol::Requests::ReorderSourceFilter, OBS::WebSocket::Protocol::Requests::ResetSceneItem, OBS::WebSocket::Protocol::Requests::RestartMedia, OBS::WebSocket::Protocol::Requests::ResumeRecording, OBS::WebSocket::Protocol::Requests::SaveReplayBuffer, OBS::WebSocket::Protocol::Requests::SaveStreamSettings, OBS::WebSocket::Protocol::Requests::ScrubMedia, OBS::WebSocket::Protocol::Requests::SendCaptions, OBS::WebSocket::Protocol::Requests::SetAudioMonitorType, OBS::WebSocket::Protocol::Requests::SetBrowserSourceProperties, OBS::WebSocket::Protocol::Requests::SetCurrentProfile, OBS::WebSocket::Protocol::Requests::SetCurrentScene, OBS::WebSocket::Protocol::Requests::SetCurrentSceneCollection, OBS::WebSocket::Protocol::Requests::SetCurrentTransition, OBS::WebSocket::Protocol::Requests::SetFilenameFormatting, OBS::WebSocket::Protocol::Requests::SetHeartbeat, OBS::WebSocket::Protocol::Requests::SetMediaTime, OBS::WebSocket::Protocol::Requests::SetMute, OBS::WebSocket::Protocol::Requests::SetPreviewScene, OBS::WebSocket::Protocol::Requests::SetRecordingFolder, OBS::WebSocket::Protocol::Requests::SetSceneItemCrop, OBS::WebSocket::Protocol::Requests::SetSceneItemPosition, OBS::WebSocket::Protocol::Requests::SetSceneItemProperties, OBS::WebSocket::Protocol::Requests::SetSceneItemRender, OBS::WebSocket::Protocol::Requests::SetSceneItemTransform, OBS::WebSocket::Protocol::Requests::SetSceneTransitionOverride, OBS::WebSocket::Protocol::Requests::SetSourceFilterSettings, OBS::WebSocket::Protocol::Requests::SetSourceFilterVisibility, OBS::WebSocket::Protocol::Requests::SetSourceName, OBS::WebSocket::Protocol::Requests::SetSourceSettings, OBS::WebSocket::Protocol::Requests::SetStreamSettings, OBS::WebSocket::Protocol::Requests::SetSyncOffset, OBS::WebSocket::Protocol::Requests::SetTBarPosition, OBS::WebSocket::Protocol::Requests::SetTextFreetype2Properties, OBS::WebSocket::Protocol::Requests::SetTextGDIPlusProperties, OBS::WebSocket::Protocol::Requests::SetTracks, OBS::WebSocket::Protocol::Requests::SetTransitionDuration, OBS::WebSocket::Protocol::Requests::SetTransitionSettings, OBS::WebSocket::Protocol::Requests::SetVolume, OBS::WebSocket::Protocol::Requests::Sleep, OBS::WebSocket::Protocol::Requests::StartOutput, OBS::WebSocket::Protocol::Requests::StartRecording, OBS::WebSocket::Protocol::Requests::StartReplayBuffer, OBS::WebSocket::Protocol::Requests::StartStopRecording, OBS::WebSocket::Protocol::Requests::StartStopReplayBuffer, OBS::WebSocket::Protocol::Requests::StartStopStreaming, OBS::WebSocket::Protocol::Requests::StartStopVirtualCam, OBS::WebSocket::Protocol::Requests::StartStreaming, OBS::WebSocket::Protocol::Requests::StartVirtualCam, OBS::WebSocket::Protocol::Requests::StopMedia, OBS::WebSocket::Protocol::Requests::StopOutput, OBS::WebSocket::Protocol::Requests::StopRecording, OBS::WebSocket::Protocol::Requests::StopReplayBuffer, OBS::WebSocket::Protocol::Requests::StopStreaming, OBS::WebSocket::Protocol::Requests::StopVirtualCam, OBS::WebSocket::Protocol::Requests::TakeSourceScreenshot, OBS::WebSocket::Protocol::Requests::ToggleMute, OBS::WebSocket::Protocol::Requests::ToggleStudioMode, OBS::WebSocket::Protocol::Requests::TransitionToProgram, OBS::WebSocket::Protocol::Requests::TriggerHotkeyByName, OBS::WebSocket::Protocol::Requests::TriggerHotkeyBySequence

Defined Under Namespace

Modules: Mixin

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Request

Returns a new instance of Request.



409
410
411
412
413
414
415
416
# File 'lib/obs/websocket.rb', line 409

def initialize(args)
  @json = self.class.instance_variable_get(:@params).to_h do |name, v|
    type = v[:type]
    json_name = v[:json_name]
    [json_name, type.as_json(args[name])]
  end
  @json['request-type'] = self.class.instance_variable_get(:@json_name)
end

Class Method Details

.json_name(json_name) ⇒ Object



400
401
402
# File 'lib/obs/websocket.rb', line 400

def json_name(json_name)
  @json_name = json_name
end

.params(params = {}) ⇒ Object



404
405
406
# File 'lib/obs/websocket.rb', line 404

def params(params = {})
  (@params ||= {}).update(params)
end

Instance Method Details

#to_hObject



418
419
420
# File 'lib/obs/websocket.rb', line 418

def to_h
  @json
end