/
unity-search-result.js
59 lines (57 loc) · 1.53 KB
/
unity-search-result.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
module.exports = class UnitySearchResult {
constructor(resultObj, moneyFormat) {
moneyFormat = moneyFormat || "USD"
this._id = resultObj.id
this._title = resultObj.title
this._version = resultObj.version
this._publishedDate = new Date(resultObj.pubdate_iso)
this._publisherId = resultObj.publisher.id
this._publisherLabel = resultObj.publisher.label
this._categoryId = resultObj.category.id
this._categoryLabel = resultObj.category.label
this._hotness = resultObj.hotness
this._iconUrl = resultObj.icon
this._ratingAverage = resultObj.rating.average
this._ratingCount = resultObj.rating.count
this._price = (resultObj.price) ? resultObj.price[moneyFormat] : "0.00"
}
get id() {
return this._id
}
get title() {
return this._title
}
get version() {
return this._version
}
get publishedDate() {
return this._publishedDate
}
get publisherId() {
return this._publisherId
}
get publisherLabel() {
return this._publisherLabel
}
get categoryId() {
return this._categoryId
}
get categoryLabel() {
return this._categoryLabel
}
get hotness() {
return this._hotness
}
get iconUrl() {
return this._iconUrl
}
get ratingAverage() {
return this._ratingAverage
}
get ratingCount() {
return this._ratingCount
}
get price() {
return this._price
}
}