public void Deserialize(IDictionary<string, object> dictionary, JavaScriptSerializer serializer)
{
foreach (string key in dictionary.Keys)
{
switch (key)
{
case "error":
ApiUtil.ThrowIfError(dictionary, key, serializer);
break;
case "accountId":
AccountId = Convert.ToInt64(dictionary[key]);
break;
case "creationDate":
DateUtil.ConvertAndSetDate(dictionary[key], d => CreationDate = d);
break;
case "cuePoints":
CuePoints = serializer.ConvertToType<List<BrightcoveCuePoint>>(dictionary[key]);
break;
case "customFields":
CustomFields = serializer.ConvertToType<CustomFieldCollection>(dictionary[key]);
break;
case "economics":
Economics = ((string)dictionary[key]).ToBrightcoveEnum<Economics>();
break;
case "endDate":
DateUtil.ConvertAndSetDate(dictionary[key], d => EndDate = d);
break;
case "FLVURL":
FlvUrl = (string)dictionary[key];
break;
case "id":
Id = Convert.ToInt64(dictionary[key]);
break;
case "itemState":
ItemState = ((string)dictionary[key]).ToBrightcoveEnum<ItemState>();
break;
case "lastModifiedDate":
DateUtil.ConvertAndSetDate(dictionary[key], d => LastModifiedDate = d);
break;
case "length":
Length = Convert.ToInt64(dictionary[key]);
break;
case "linkURL":
LinkUrl = (string)dictionary[key];
break;
case "linkText":
LinkText = (string)dictionary[key];
break;
case "longDescription":
LongDescription = (string)dictionary[key];
break;
case "name":
Name = (string)dictionary[key];
break;
case "playsTotal":
// sometimes this come back null, it seems
if (dictionary[key] != null)
{
PlaysTotal = (int)dictionary[key];
}
break;
case "playsTrailingWeek":
if (dictionary[key] != null)
{
PlaysTrailingWeek = (int)dictionary[key];
}
break;
case "publishedDate":
DateUtil.ConvertAndSetDate(dictionary[key], d => PublishedDate = d);
break;
case "referenceId":
ReferenceId = (string)dictionary[key];
break;
case "renditions":
Renditions = serializer.ConvertToType<BrightcoveItemCollection<BrightcoveRendition>>(dictionary[key]);
break;
case "shortDescription":
ShortDescription = (string)dictionary[key];
break;
case "startDate":
DateUtil.ConvertAndSetDate(dictionary[key], d => StartDate = d);
break;
case "tags":
Tags.Clear();
Tags.AddRange(serializer.ConvertToType<List<string>>(dictionary[key]));
break;
case "thumbnailURL":
ThumbnailUrl = (string)dictionary[key];
break;
case "videoStillURL":
VideoStillUrl = (string)dictionary[key];
break;
case "videoFullLength":
VideoFullLength = serializer.ConvertToType<BrightcoveRendition>(dictionary[key]);
break;
default:
break;
}
}
}