Unify remaining service order and enforce (#3359)

Ref #3353
This commit is contained in:
Paul Melnikow
2019-04-24 16:53:33 -04:00
committed by GitHub
parent f8aeb56129
commit 0088a9d0da
38 changed files with 665 additions and 665 deletions

View File

@@ -8,25 +8,10 @@ const { metric } = require('../text-formatters')
const schema = Joi.object({ activity_total: nonNegativeInteger })
module.exports = class Bountysource extends BaseJsonService {
async fetch({ team }) {
const url = `https://api.bountysource.com/teams/${team}`
return this._requestJson({
schema,
url,
options: {
headers: { Accept: 'application/vnd.bountysource+json; version=2' },
},
})
}
static get category() {
return 'funding'
}
static get defaultBadgeData() {
return { label: 'bounties' }
}
static get route() {
return {
base: 'bountysource/team',
@@ -44,6 +29,10 @@ module.exports = class Bountysource extends BaseJsonService {
]
}
static get defaultBadgeData() {
return { label: 'bounties' }
}
static render({ total }) {
return {
message: metric(total),
@@ -51,6 +40,17 @@ module.exports = class Bountysource extends BaseJsonService {
}
}
async fetch({ team }) {
const url = `https://api.bountysource.com/teams/${team}`
return this._requestJson({
schema,
url,
options: {
headers: { Accept: 'application/vnd.bountysource+json; version=2' },
},
})
}
async handle({ team }) {
const json = await this.fetch({ team })
return this.constructor.render({ total: json.activity_total })