Skip to content

Commit 1c31b28

Browse files
committed
docs(): some refactoring
1 parent e4a13ba commit 1c31b28

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

docs/guides/integration.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The primary key is just a model configuration property and by default is set to
2020
To change it for a particular model use the configuration property:
2121

2222
```javascript
23-
restmod.model('/bikes', {
23+
restmod.model('/bikes').$mix({
2424
PRIMARY_KEY: '_id'
2525
});
2626
```
@@ -81,10 +81,10 @@ Will expect:
8181
}
8282
```
8383

84-
The resoure's name is extracted from the resource url, if no url is given (anonymous resource) or if url does not match the resource's name, then you can change it's name and plural name by setting the `NAME` and `PLURAL` configuration variables:
84+
The resoure's name is extracted from the resource url, if no url is given (nested resource) or if url does not match the resource's name, then you can change it's name and plural name by setting the `NAME` and `PLURAL` configuration variables:
8585

8686
```javascript
87-
restmod.model(null, function() {
87+
restmod.model().$mix(function() {
8888
NAME: 'mouse', // if you only set NAME, then plural is infered from it using the inflector.
8989
PLURAL: 'mice'
9090
});
@@ -128,7 +128,7 @@ To change the property from where the packer extracts the metadata set the `JSON
128128
```
129129

130130
```javascript
131-
var Bike = restmod.model('/api/bikes', {
131+
var Bike = restmod.model('/api/bikes').$mix({
132132
PACKER: 'default',
133133
JSON_META: '.'
134134
});
@@ -176,10 +176,10 @@ var Base = restmod.mixin({
176176
PACKER: 'default' // remember to enable the default packer.
177177
});
178178
179-
var User = restmod.model('/api/users', Base);
180-
var Part = restmod.model('/api/parts', Base);
179+
var User = restmod.model('/api/users').$mix(Base);
180+
var Part = restmod.model('/api/parts').$mix(Base);
181181
182-
var Bike = restmod.model('/api/bikes', Base, {
182+
var Bike = restmod.model('/api/bikes').$mix(Base, {
183183
user: { belongsTo: User },
184184
parts: { belongsToMany: Part }
185185
})
@@ -203,7 +203,7 @@ module.config(function(restmodProvider) {
203203
Take a look at the default naming stardards, inlined resources are expected to use the **pluralized** names for their respective model names. See. By default the name is extracted from the url, you can change a model's name and plural name by setting the `NAME` and `PLURAL` configuration variables:
204204

205205
```javascript
206-
restmod.model(null, function() {
206+
restmod.model().$mix(function() {
207207
NAME: 'mouse', // if you only set NAME, then plural is infered from it.
208208
PLURAL: 'mice'
209209
});
@@ -256,7 +256,7 @@ To handle API's that require '$' prefixed properies you have two posibilities:
256256
2. if there are only a couple of properties you need to let through, assign a special mapping to those properties:
257257

258258
```javascript
259-
restmod.model(null {
259+
restmod.model().$mix({
260260
myType: { map: '$type' },
261261
myName: { map: '$name' }
262262
})
@@ -329,6 +329,6 @@ module.config(function(restmodProvider) {
329329
});
330330
```
331331

332-
To see available styles checkout the [Style listing](https://github.com/platanus/angular-restmod/blob/master/docs/guides/styles.md).
332+
To see available styles or colaborate with a new one, take a look at the [Style listing](https://github.com/platanus/angular-restmod/blob/master/docs/guides/styles.md).
333333

334334

docs/guides/styles.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ the undelying backend, so for example, since rails is usually programmed in snak
77
the active_model_serializer style will enable the property renaming to convert every
88
property to camelcase on arrival.
99

10-
**Api styles contributions are welcomed!!, some ideas:**
11-
* django style APIs
12-
* .NET style APIs
13-
1410
To use a style first make sure style script file is being loaded:
1511

1612
```html
@@ -44,3 +40,17 @@ Mixin Name: `AMSApi`
4440
* Json metadata expected in 'meta' property
4541
* Json links expected in 'links' property
4642
* Default primary key: id
43+
44+
## Contributions
45+
46+
**Api styles contributions are welcomed!!, some ideas:**
47+
* django style APIs
48+
* .NET style APIs
49+
50+
To contribute with a new style just:Pcom
51+
* Clone restmod repo
52+
* Create new style mixin file in the `src/styles` dir
53+
* Add tests for additional components (like packers, renamers, etc)
54+
* Make sure the build process generates the new style script
55+
* Add it to this listing, with some reference to where the style is described.
56+
* PR it!

0 commit comments

Comments
 (0)