BaseService terminology: Rename url to route (#2278)

The term “url” is overloaded in services, to refer to the Shields route and also the API URL. Calling the Shields URL a “route” is on the whole more descriptive, and makes it clearer and more obvious which one of these we’re talking about. It’s a small thing, though seems like an improvement.

We have a few functions called `buildUrl`. I’ve renamed them to `buildRoute` when they refer to routes, and left them as `buildUrl` when they refer to API URLs.

I included a minor style tweak and some formatting cleanup in `TUTORIAL.md`.
This commit is contained in:
Paul Melnikow
2018-11-09 15:11:03 -05:00
committed by GitHub
parent c0f9a88719
commit 02ec19fd22
147 changed files with 225 additions and 224 deletions

View File

@@ -41,7 +41,7 @@ function DownloadsForExtensionType(extensionType) {
return { label: 'downloads' }
}
static get url() {
static get route() {
return {
base: `wordpress/${extensionType}/dt`,
pattern: ':slug',
@@ -88,7 +88,7 @@ function InstallsForExtensionType(extensionType) {
return { label: 'active installs' }
}
static get url() {
static get route() {
return {
base: `wordpress/${extensionType}/installs`,
format: '(.+)',
@@ -143,7 +143,7 @@ function DownloadsForInterval(interval) {
return { label: 'downloads' }
}
static get url() {
static get route() {
return {
base,
format: '(.*)',

View File

@@ -44,7 +44,7 @@ class BaseWordpressPlatform extends BaseWordpress {
}
class WordpressPluginRequiresVersion extends BaseWordpressPlatform {
static get url() {
static get route() {
return {
base: `wordpress/plugin/wp-version`,
pattern: ':slug',
@@ -113,7 +113,7 @@ class WordpressPluginTestedVersion extends BaseWordpressPlatform {
return this.constructor.render({ version: testedVersion, color })
}
static get url() {
static get route() {
return {
base: `wordpress/plugin/tested`,
format: '(.+)',
@@ -136,7 +136,7 @@ class WordpressPluginTestedVersion extends BaseWordpressPlatform {
}
class WordpressPluginTestedVersionAlias extends WordpressPluginTestedVersion {
static get url() {
static get route() {
return {
base: `wordpress/v`,
format: '(.+)',

View File

@@ -38,7 +38,7 @@ function RatingForExtensionType(extensionType) {
const { capt, exampleSlug } = extensionData[extensionType]
return class WordpressRating extends WordpressRatingBase {
static get url() {
static get route() {
return {
base: `wordpress/${extensionType}/rating`,
pattern: ':slug',
@@ -77,7 +77,7 @@ function StarsForExtensionType(extensionType) {
return { message: starRating(rating), color: floorCount(rating, 2, 3, 4) }
}
static get url() {
static get route() {
return {
base: `wordpress/${extensionType}`,
format: '(?:stars|r)/(.+)',

View File

@@ -36,7 +36,7 @@ function VersionForExtensionType(extensionType) {
return { label: extensionType }
}
static get url() {
static get route() {
return {
base: `wordpress/${extensionType}/v`,
pattern: ':slug',