Skip to content

Commit 742eb37

Browse files
committed
make the conf changeable and prepare oauth1
1 parent e5075be commit 742eb37

File tree

11 files changed

+55
-11
lines changed

11 files changed

+55
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ node_modules
2828
.lock-wscript
2929

3030
www/
31+
config.json

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,39 @@ AngularJS services to consume [WP-API v2](http://v2.wp-api.org/)
77

88
<http://shprink.github.io/wp-api-angularjs/>
99

10+
## oAuth1
11+
12+
<http://v2.wp-api.org/guide/authentication/>
13+
14+
### Install OAuth1 plugin
15+
16+
Export <https://github.com/WP-API/OAuth1> zip and upload it into your WP instance.
17+
18+
### Install WP-CLI
19+
20+
```
21+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
22+
chmod +x wp-cli.phar
23+
sudo mv wp-cli.phar /usr/local/bin/wp
24+
```
25+
26+
More info: <http://wp-cli.org/>
27+
28+
### Create a consumer:
29+
30+
```
31+
$ wp oauth1 add
32+
33+
ID: 4
34+
Key: sDc51JgH2mFu
35+
Secret: LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW
36+
```
37+
1038
## Contribute
1139

1240
```
1341
npm install
42+
cp config.dist.json config.json
1443
1544
# Open two terminals
1645
# and run watch to build on the lib files changes

config.dist.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"baseUrl": "http://sandbox.YourDomain.com/wp-json",
3+
"oauth1": {
4+
"enabled": false,
5+
"ID": "4",
6+
"Key": "sDc51JgH2mFu",
7+
"Secret": "LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW"
8+
}
9+
}

dist/wp-api-angularjs.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/wp-api-angularjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/docs-setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ NG_DOCS={
6464
"type": "service",
6565
"moduleName": "wp-api-angularjs",
6666
"shortDescription": "Posts entity",
67-
"keywords": "$http $wpapiterms api appended category data entity function functions getcategory getcategorylist getlist gettag gettaglist headers http list map message objects optional order orderby parameters params parent per_page posts promise public representing request return search service specific strings tag term termid wp-api-angularjs wpapi"
67+
"keywords": "$http $wpapiterms api appended category data entity function functions getcategory getcategorylist gettag gettaglist headers http list map message objects optional order orderby parameters params parent per_page posts promise public representing request return search service specific strings tag term termid wp-api-angularjs wpapi"
6868
},
6969
{
7070
"section": "api",

docs/partials/api/wp-api-angularjs.$wpApiTerms.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2 id="dependencies">Dependencies</h2>
2929
</div></td></tr><tr><td>headers</td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="wp-api-angularjs-wpapiterms-getcategorylist-page"><p>Optional: {Object} – Map of strings or functions which return strings representing HTTP headers</p>
3030
</div></td></tr></tbody></table><h5 id="methods_getcategorylist_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="wp-api-angularjs-wpapiterms-getcategorylist-page"><p>Promise</p>
3131
</div></td></tr></table><h4 id="methods_getcategorylist_example">Example</h4>
32-
<div class="example"><div class="wp-api-angularjs-wpapiterms-getcategorylist-page"><p>$wpApiTerms.getList({
32+
<div class="example"><div class="wp-api-angularjs-wpapiterms-getcategorylist-page"><p>$wpApiTerms.getCategoryList({
3333
page: 1,
3434
per_page: 10,
3535
search: &#39;&#39;,
@@ -56,7 +56,7 @@ <h2 id="dependencies">Dependencies</h2>
5656
</div></td></tr><tr><td>headers</td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="wp-api-angularjs-wpapiterms-gettaglist-page"><p>Optional: {Object} – Map of strings or functions which return strings representing HTTP headers</p>
5757
</div></td></tr></tbody></table><h5 id="methods_gettaglist_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="wp-api-angularjs-wpapiterms-gettaglist-page"><p>Promise</p>
5858
</div></td></tr></table><h4 id="methods_gettaglist_example">Example</h4>
59-
<div class="example"><div class="wp-api-angularjs-wpapiterms-gettaglist-page"><p>$wpApiTerms.getList({
59+
<div class="example"><div class="wp-api-angularjs-wpapiterms-gettaglist-page"><p>$wpApiTerms.getTagList({
6060
page: 1,
6161
per_page: 10,
6262
search: &#39;&#39;,

lib/terms.service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class extends Parent {
2222
* @param {object} data Optional: {string|Object} – Data to be sent as the request message data.
2323
* @param {object} headers Optional: {Object} – Map of strings or functions which return strings representing HTTP headers
2424
* @example
25-
* $wpApiTerms.getList({
25+
* $wpApiTerms.getCategoryList({
2626
* page: 1,
2727
* per_page: 10,
2828
* search: '',
@@ -48,7 +48,7 @@ export default class extends Parent {
4848
* @param {object} data Optional: {string|Object} – Data to be sent as the request message data.
4949
* @param {object} headers Optional: {Object} – Map of strings or functions which return strings representing HTTP headers
5050
* @example
51-
* $wpApiTerms.getList({
51+
* $wpApiTerms.getTagList({
5252
* page: 1,
5353
* per_page: 10,
5454
* search: '',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"gulp": "^3.9.0",
4040
"gulp-ngdocs": "^0.2.13",
4141
"html-webpack-plugin": "^1.6.1",
42+
"json-loader": "^0.5.2",
4243
"ng-annotate-loader": "~0.0.6",
4344
"path": "^0.4.9",
4445
"util": "^0.10.3",

test/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import config from '../config.json';
2+
13
export default function(WpApiProvider) {
24
'ngInject';
3-
4-
WpApiProvider.setBaseUrl('http://shprinkone.julienrenaux.fr/wp-json')
5+
WpApiProvider.setBaseUrl(config.baseUrl);
56
}

0 commit comments

Comments
 (0)