Class: Conversant::V3::Services::LMS

Inherits:
Base
  • Object
show all
Includes:
Authorization
Defined in:
lib/conversant/v3/services/lms.rb,
lib/conversant/v3/services/lms/job.rb,
lib/conversant/v3/services/lms/domain.rb,
lib/conversant/v3/services/lms/preset.rb,
lib/conversant/v3/services/lms/partner.rb,
lib/conversant/v3/services/lms/dashboard.rb,
lib/conversant/v3/services/lms/partner/report.rb,
lib/conversant/v3/services/lms/partner/business.rb,
lib/conversant/v3/services/lms/partner/analytics.rb,
sig/conversant/v3/services/lms.rbs

Overview

LMS (Live Media Streaming) service

Defined Under Namespace

Classes: Dashboard, Domain, Job, Partner, Preset

Constant Summary

Constants included from HttpClient

HttpClient::PORTAL_SESSION_REDIS_KEY, HttpClient::SSO_GW_SESSION2_REDIS_KEY

Instance Attribute Summary

Attributes inherited from Base

#customer_id, #type

Instance Method Summary collapse

Methods included from Authorization

#authorize, #authorized_headers, #base_headers, #build_cookie_hash, #build_headers_with_cookies, #cached_session, #fetch_session_cookie, #fetch_sso_session, #format_cookies, #log_missing_session, #session_cache_key, #sso_cache_key

Methods inherited from Base

#configuration, #identifier, #initialize, #logger, #portal_endpoint, #redis, #sso_endpoint, #validate_configuration!

Methods included from HttpClient

#add_cookies_to_headers, #authenticate, #configuration, #cookie_jar, #cookie_jar=, #debug_log, #extract_form_action, #http_get, #http_post, #login_url, #parse_cookie_to_jar, #redis, #request, #sso_login, #update_cookie_jar

Constructor Details

This class inherits a constructor from Conversant::V3::Base

Instance Method Details

#build_reporting_urlString

Returns:

  • (String)


67
# File 'sig/conversant/v3/services/lms.rbs', line 67

def build_reporting_url: () -> String

#build_request_headersHash[String | Symbol, untyped]

Parameters:

  • sessions (Hash[Symbol, String])

Returns:

  • (Hash[String | Symbol, untyped])


68
# File 'sig/conversant/v3/services/lms.rbs', line 68

def build_request_headers: (Hash[Symbol, String] sessions) -> Hash[String | Symbol, untyped]

#cache_jsessionidvoid

This method returns an undefined value.

Parameters:

  • jsessionid (String)


70
# File 'sig/conversant/v3/services/lms.rbs', line 70

def cache_jsessionid: (String jsessionid) -> void

#dashboardDashboard

Get dashboard metrics service instance

Returns:

  • (Dashboard)

    dashboard service for streaming metrics

Since:

  • 1.0.0



47
48
49
# File 'lib/conversant/v3/services/lms.rb', line 47

def dashboard
  @dashboard ||= Dashboard.new(self)
end

#domainDomain

Get domain management service instance

Returns:

  • (Domain)

    domain service for streaming domain management

Since:

  • 1.0.0



39
40
41
# File 'lib/conversant/v3/services/lms.rb', line 39

def domain
  @domain ||= Domain.new(self)
end

#extract_and_cache_jsessionidString?

Parameters:

  • response (Object)

Returns:

  • (String, nil)


69
# File 'sig/conversant/v3/services/lms.rbs', line 69

def extract_and_cache_jsessionid: (untyped response) -> String?

#fetch_new_sessionString?

Returns:

  • (String, nil)

Since:

  • 1.0.0



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/conversant/v3/services/lms.rb', line 121

def fetch_new_session
  sessions = authenticate
  return nil unless sessions && sessions[:session] && sessions[:sso_gw_session2]

  timestamp = (Time.now.to_f * 1000).to_i
  reporting_url = "#{configuration.private_lms_endpoint}/?customerId=#{customer_id}&isHideMenu=f&t=#{timestamp}"

  logger.debug "#{identifier}.METHOD:authorize.REQUESTING_JSESSIONID"

  response = RestClient.get(
    reporting_url,
    {
      authority: URI.parse(configuration.private_lms_endpoint).hostname,
      referer: portal_endpoint,
      user_agent: configuration.default_ua,
      cookies: {
        'SESSION': sessions[:session],
        'SSO_GW_SESSION2': sessions[:sso_gw_session2]
      },
      timeout: 30,
      open_timeout: 30
    }
  )

  if response.cookies['JSESSIONID']
    jsessionid = response.cookies['JSESSIONID']
    redis.set(session_cache_key, jsessionid, ex: configuration.cache_ttl)
    logger.debug "#{identifier}.METHOD:authorize.JSESSIONID_OBTAINED"
    jsessionid
  else
    logger.error "#{identifier}.METHOD:authorize.NO_JSESSIONID_IN_RESPONSE"
    nil
  end
rescue RestClient::Unauthorized, RestClient::Forbidden => e
  logger.error "#{identifier}.METHOD:authorize.AUTH_ERROR:#{e.message}"
  nil
rescue StandardError => e
  logger.error "#{identifier}.METHOD:authorize.ERROR:#{e.message}"
  nil
end

#jobJob

Service accessors

Returns:



31
32
33
# File 'lib/conversant/v3/services/lms.rb', line 31

def job
  @job ||= Job.new(self)
end

#log_and_return_nilnil

Parameters:

  • message (String)

Returns:

  • (nil)


71
# File 'sig/conversant/v3/services/lms.rbs', line 71

def log_and_return_nil: (String message) -> nil

#partnerPartner

Get partner service instance

Provides access to partner-level analytics for Live Media Streaming that aggregate data across multiple customer accounts.

Examples:

Access partner analytics

lms = Conversant::V3.lms(12345)
duration = lms.partner.analytics.duration(payload)

Returns:

  • (Partner)

    partner service for LMS analytics

Since:

  • 1.0.12



70
71
72
# File 'lib/conversant/v3/services/lms.rb', line 70

def partner
  @partner ||= Partner.new(self)
end

#partner_analyticsLMS::Partner::Analytics

Deprecated.

Use #partner instead

Get partner analytics service instance (deprecated)

Returns:

Since:

  • 1.0.8



80
81
82
# File 'lib/conversant/v3/services/lms.rb', line 80

def partner_analytics
  @partner_analytics ||= Partner::Analytics.new(self)
end

#presetPreset

Get preset service instance

Returns:

  • (Preset)

    preset service for transcoding configuration

Since:

  • 1.0.8



55
56
57
# File 'lib/conversant/v3/services/lms.rb', line 55

def preset
  @preset ||= Preset.new(self)
end

#request_jsessionidObject

Parameters:

  • sessions (Hash[Symbol, String])

Returns:

  • (Object)


66
# File 'sig/conversant/v3/services/lms.rbs', line 66

def request_jsessionid: (Hash[Symbol, String] sessions) -> untyped

#requires_session?Boolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



115
116
117
# File 'lib/conversant/v3/services/lms.rb', line 115

def requires_session?
  true
end

#service_endpointString

Returns:

  • (String)

Since:

  • 1.0.0



107
108
109
# File 'lib/conversant/v3/services/lms.rb', line 107

def service_endpoint
  configuration.private_lms_endpoint
end

Returns:

  • (String)

Since:

  • 1.0.0



111
112
113
# File 'lib/conversant/v3/services/lms.rb', line 111

def session_cookie_name
  'JSESSIONID'
end

#valid_sessions?Boolean

Parameters:

  • sessions (Hash[Symbol, String], nil)

Returns:

  • (Boolean)


65
# File 'sig/conversant/v3/services/lms.rbs', line 65

def valid_sessions?: (Hash[Symbol, String]? sessions) -> bool