diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index 36aaa46d230da939be925b2dbd29055d96c0dcf1..1aface5c4982f95aaf96b6d8a87d9f03337c8721 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -1,47 +1,11 @@ -import Joi from 'joi' -import { metric } from '../text-formatters.js' -import { BaseJsonService, pathParams } from '../index.js' - -const schema = Joi.object({ activity_total: Joi.number().required() }) - -export default class Bountysource extends BaseJsonService { - static category = 'funding' - static route = { base: 'bountysource/team', pattern: ':team/activity' } - - static openApi = { - '/bountysource/team/{team}/activity': { - get: { - summary: 'Bountysource', - parameters: pathParams({ - name: 'team', - example: 'mozilla-core', - }), - }, - }, - } - - static defaultBadgeData = { label: 'bounties' } - - static render({ total }) { - return { - message: metric(total), - color: 'brightgreen', - } - } - - 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 }) - } -} +import { deprecatedService } from '../index.js' + +export const Bountysource = deprecatedService({ + category: 'funding', + route: { + base: 'bountysource/team', + pattern: ':team/activity', + }, + label: 'bountysource', + dateAdded: new Date('2024-07-18'), +}) diff --git a/services/bountysource/bountysource.tester.js b/services/bountysource/bountysource.tester.js index cec68a500c333d06b9a856646b2ae1eb8c289213..53d27dc1e4524c6d9e061b782b987caa30dc02a9 100644 --- a/services/bountysource/bountysource.tester.js +++ b/services/bountysource/bountysource.tester.js @@ -1,4 +1,3 @@ -import { isMetric } from '../test-validators.js' import { ServiceTester } from '../tester.js' export const t = new ServiceTester({ @@ -6,16 +5,7 @@ export const t = new ServiceTester({ title: 'Bountysource', }) -t.create('bounties (valid)') - .get('/team/mozilla-core/activity.json') - .expectBadge({ - label: 'bounties', - message: isMetric, - }) - -t.create('bounties (invalid team)') - .get('/team/not-a-real-team/activity.json') - .expectBadge({ - label: 'bounties', - message: 'not found', - }) +t.create('bounties').get('/team/mozilla-core/activity.json').expectBadge({ + label: 'bountysource', + message: 'no longer available', +})