Class: Conversant::V3::Services::LMS::Job
- Inherits:
-
Object
- Object
- Conversant::V3::Services::LMS::Job
- Defined in:
- lib/conversant/v3/services/lms/job.rb
Overview
Job management service for live streaming operations
Provides comprehensive job management functionality for live streaming including:
- Job listing and filtering
- Job status tracking
- Stream profile information
- Manifest URL generation
Instance Attribute Summary collapse
-
#parent ⇒ LMS
readonly
The parent LMS service instance.
Instance Method Summary collapse
-
#initialize(parent) ⇒ Job
constructor
Initialize job service.
-
#where(**params) ⇒ Array<Hash>?
Query streaming jobs with filters.
Constructor Details
#initialize(parent) ⇒ Job
Initialize job service
35 36 37 |
# File 'lib/conversant/v3/services/lms/job.rb', line 35 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ LMS (readonly)
Returns the parent LMS service instance.
30 31 32 |
# File 'lib/conversant/v3/services/lms/job.rb', line 30 def parent @parent end |
Instance Method Details
#where(**params) ⇒ Array<Hash>?
Query streaming jobs with filters
Retrieves a list of streaming jobs matching the specified filters. Returns detailed information about each job including status, profiles, and manifest URLs.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/conversant/v3/services/lms/job.rb', line 78 def where(**params) response = JSON.parse(@parent.send(:call, 'GET', "/v4/streams?#{params.to_query}")) return nil unless response items = response['list'] || response[:list] || [] items.map do |item| status = item['status']&.to_i || item[:status]&.to_i inbound = item['stream_rtmp_inbound'] || item[:stream_rtmp_inbound] profiles = (item['stream_rtmp_outbounds'] || item[:stream_rtmp_outbounds])&.map do |stream| { preset: stream['preset_name'] || stream[:preset_name], type: stream['type'] || stream[:type], profile: build_profile_url(inbound, item, stream) } end { entity: item['osp_id'] || item[:osp_id], id: item['id'] || item[:id], app: item['app'] || item[:app], name: item['stream'] || item[:stream], status: parse_status(status), created_at: (item['created'] || item[:created]), started_at: (item['started'] || item[:started]), ended_at: (item['ended'] || item[:ended]), client: inbound && (inbound['client_ip'] || inbound[:client_ip]), encoder: extract_encoder(item), server: item['exec_ta'] || item[:exec_ta], manifest: build_manifest_url(inbound, item, profiles), profiles: profiles || [], transcoding: item['transcoding'] || item[:transcoding], gpu: (item['gpu'] || item[:gpu]) == 'gpu' } end rescue StandardError => e @parent.send(:logger).error "LMS::Job.where error: #{e.}" nil end |