8000 Update GET statuses/oembed with new endpoint · jublo/codebird-js@c4ed527 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4ed527

Browse files
committed
Update GET statuses/oembed with new endpoint
Fix #116.
1 parent 5d93dba commit c4ed527

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ codebird-js - changelog
1111
+ Transform codebase to EcmaScript 7
1212
+ #25 Add unit testing suite
1313
+ Add POST statuses/unretweet/:id
14+
+ #116 Update GET statuses/oembed with new endpoint
1415

1516
2.6.0 (2015-04-08)
1617
+ Allow to get the supported API methods as array

codebird.es7.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
*/
6464
this._endpoint_media = `${this._endpoint_base_media}1.1/`;
6565

66+
/**
67+
* The publish API endpoint to use
68+
*/
69+
this._endpoint_publish = "https://publish.twitter.com/";
70+
6671
/**
6772
* The API endpoint base to use
6873
*/
@@ -1171,6 +1176,8 @@
11711176
url = this._endpoint_oauth + method;
11721177
} else if (this._detectMedia(method)) {
11731178
url = this._endpoint_media + method + ".json";
1179+
} else if (method === "statuses/oembed") {
1180+
url = this._endpoint_publish + "oembed";
11741181
} else {
11751182
url = this._endpoint + method + ".json";
11761183
}

codebird.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
7575
*/
7676
this._endpoint_media = this._endpoint_base_media + "1.1/";
7777

78+
/**
79+
* The publish API endpoint to use
80+
*/
81+
this._endpoint_publish = "https://publish.twitter.com/";
82+
7883
/**
7984
* The API endpoint base to use
8085
*/
@@ -989,7 +994,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
989994
}, {
990995
key: "_time",
991996
value: function _time() {
992-
return Math.round(new Date().getTime() / 1000);
997+
Math.round(new Date().getTime() / 1000);
993998
}
994999

9951000
/**
@@ -1151,6 +1156,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
11511156
url = this._endpoint_oauth + method;
11521157
} else if (this._detectMedia(method)) {
11531158
url = this._endpoint_media + method + ".json";
1159+
} else if (method === "statuses/oembed") {
1160+
url = this._endpoint_publish + "oembed";
11541161
} else {
11551162
url = this._endpoint + method + ".json";
11561163
}

test/detection_tests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ test("Tests _getEndpoint", function (t) {
8888
cb.call("_getEndpoint", ["media/upload", "media/upload"]),
8989
"https://upload.twitter.com/1.1/media/upload.json"
9090
);
91+
t.equal(
92+
cb.call("_getEndpoint", ["statuses/oembed", "statuses/oembed"]),
93+
"https://publish.twitter.com/oembed"
94+
);
9195

9296
t.end();
9397
});

0 commit comments

Comments
 (0)
0