Home Reference Source Test Repository
public class | source

Rating

Container class for all metadata pertaining to an action that a user has taken against a recommendation.

Test:

Static Method Summary

Static Public Methods
public static

Only send the fields back that NPR has sent us

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

A convenience function to cast this object back to a string, generally only used by the Logger class.

Static Public Methods

public static privateMemberReplacer(key: string, value: boolean | string | number | Array | Object | Function): undefined | boolean | string | number | Array | Object | Function source

Only send the fields back that NPR has sent us

Params:

NameTypeAttributeDescription
key string
value boolean | string | number | Array | Object | Function

Test:

Public Constructors

public constructor(json: Object) source

Params:

NameTypeAttributeDescription
json Object

The decoded JSON object that should be used as the basis for this model

json.mediaId string

The media id as given by the media object

json.origin string

How the recommendation was generated

json.rating string

String representing the rating (action)

json.elapsed number

Number of seconds since the start of playback for this media item, as an integer

json.duration number

Number of seconds this audio piece is expected to last

json.timestamp string

ISO-8601 formatted date/time; typically replaced by the client with the actual rating time

json.channel string

The channel this media item was pulled from

json.cohort string

The primary cohort of the current logged-in user

json.affiliations Array

An array of IDs & other data about collections or podcasts the user has ratings for; produced by the server and should be sent back as received; used for tracking program and podcast suggestions

Test:

Public Methods

public toString(): string source

A convenience function to cast this object back to a string, generally only used by the Logger class.

Return:

string

Test: