Skip to content

Commit

Permalink
Fix naming and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrojo77 committed Jan 2, 2025
1 parent 5759c2d commit 46d4e79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ trait NdlaBrightcoveClient {
val brightcoveClient: NdlaBrightcoveClient

class NdlaBrightcoveClient {
private val authUrl = props.brightCoveAuthUri
private val backend = HttpClientSyncBackend() // Or AsyncHttpClientFutureBackend()
private val backend = HttpClientSyncBackend()

def getToken(clientID: String, clientSecret: String): Either[String, String] = {
val request =
basicRequest.auth
.basic(clientID, clientSecret)
.post(uri"$authUrl?grant_type=client_credentials")
.post(uri"${props.BrightCoveAuthUri}?grant_type=client_credentials")
val authResponse = request.send(backend)

authResponse.body match {
Expand All @@ -43,7 +42,7 @@ trait NdlaBrightcoveClient {

def getVideoSource(accountId: String, videoId: String, bearerToken: String): Either[String, Vector[Json]] = {

val videoSourceUrl = props.brightCoveVideoUri(accountId, videoId)
val videoSourceUrl = props.BrightCoveVideoUri(accountId, videoId)
val request = basicRequest
.header("Authorization", s"Bearer $bearerToken")
.get(videoSourceUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ trait BaseProps {

def TAPIR_THREADS: Int = intPropOrDefault("TAPIR_THREADS", 100)

def brightCoveAuthUri: String = s"https://oauth.brightcove.com/v4/access_token"
def brightCoveVideoUri(accountId: String, videoId: String): Uri =
def BrightCoveAuthUri: String = s"https://oauth.brightcove.com/v4/access_token"
def BrightCoveVideoUri(accountId: String, videoId: String): Uri =
uri"https://cms.api.brightcove.com/v1/accounts/$accountId/videos/$videoId/sources"

}

0 comments on commit 46d4e79

Please sign in to comment.