You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add table of contents to readme and add note asking users to add their projects to the wiki (#125)
* Add table of contents to README
Generated using gh-md-toc.
* Add note to README asking users to add their projects to our wiki
Closes#71
* Update changelog
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
### 0.8.6 (Next)
2
2
3
3
*[#122](https://github.com/codegram/hyperclient/pull/122): Improve error message when server returns invalid data - [@ivoanjo](https://github.com/ivoanjo).
4
+
*[#125](https://github.com/codegram/hyperclient/pull/125): Add table of contents to readme and add note asking users to add their projects to the wiki - [@ivoanjo](https://github.com/ivoanjo).
Copy file name to clipboardExpand all lines: README.md
+35-13
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,29 @@
8
8
9
9
Hyperclient is a Hypermedia API client written in Ruby. It fully supports [JSON HAL](http://stateless.co/hal_specification.html).
10
10
11
-
## Usage
11
+
*[Hyperclient](#hyperclient)
12
+
*[Usage](#usage)
13
+
*[API Client](#api-client)
14
+
*[Resources and Attributes](#resources-and-attributes)
15
+
*[Links and Embedded Resources](#links-and-embedded-resources)
16
+
*[Templated Links](#templated-links)
17
+
*[Curies](#curies)
18
+
*[Attributes](#attributes)
19
+
*[HTTP](#http)
20
+
*[Asynchronous requests](#asynchronous-requests)
21
+
*[Testing Using Hyperclient](#testing-using-hyperclient)
22
+
*[Reference](#reference)
23
+
*[Hyperclient Users](#hyperclient-users)
24
+
*[Contributing](#contributing)
25
+
*[License](#license)
26
+
27
+
<sub><sup>ToC created with [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)</sup></sub>
28
+
29
+
# Usage
12
30
13
31
The examples in this README use the [Splines Demo API](https://github.com/ruby-grape/grape-with-roar) running [here](https://grape-with-roar.herokuapp.com/api). If you're upgrading from a previous version, please make sure to read [UPGRADING](UPGRADING.md).
14
32
15
-
###API Client
33
+
## API Client
16
34
17
35
Create an API client.
18
36
@@ -85,7 +103,7 @@ api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api')
85
103
api.connection.use :http_cache
86
104
```
87
105
88
-
###Resources and Attributes
106
+
## Resources and Attributes
89
107
90
108
Hyperclient will fetch and discover the resources from your API.
91
109
@@ -104,15 +122,15 @@ api.splines.each do |spline|
104
122
end
105
123
```
106
124
107
-
###Links and Embedded Resources
125
+
## Links and Embedded Resources
108
126
109
127
The splines example above followed a link called "splines". While you can, you do not need to specify the HAL navigational structure, including links or embedded resources. Hyperclient will resolve these for you. If you prefer, you can explicitly navigate the link structure via `_links`. In the following example the "splines" link leads to a collection of embedded splines. Invoking `api.splines` is equivalent to `api._links.splines._embedded.splines`.
110
128
111
129
```ruby
112
130
api._links.splines
113
131
```
114
132
115
-
###Templated Links
133
+
## Templated Links
116
134
117
135
Templated links require variables to be expanded. For example, the demo API has a link called "spline" that requires a spline "uuid".
118
136
@@ -125,7 +143,7 @@ Invoking `api.spline(uuid: 'uuid').reticulated` is equivalent to `api._links.spl
125
143
126
144
The client is responsible for supplying all the necessary parameters. Templated links don't do any strict parameter name checking and don't support required vs. optional parameters. Parameters not declared by the API will be dropped and will not have any effect when passed to `_expand`.
127
145
128
-
###Curies
146
+
## Curies
129
147
130
148
Curies are a suggested means by which to link documentation of a given resource. For example, the demo API contains very long links to images that use an "images" curie.
The above is equivalent to `spline._attributes.to_h`.
146
164
147
-
###HTTP
165
+
## HTTP
148
166
149
167
Hyperclient uses [Faraday](http://github.com/lostisland/faraday) under the hood to perform HTTP calls. You can call any valid HTTP method on any resource.
150
168
@@ -187,7 +205,7 @@ spline._delete
187
205
188
206
HTTP methods always return a new instance of Resource.
189
207
190
-
###Asynchronous requests
208
+
## Asynchronous requests
191
209
192
210
By default, Hyperclient requests are performed asynchronously in a background thread pool via the [Futuroscope](https://github.com/codegram/futuroscope) gem. You can control the size of this pool by setting the `min_workers` and `max_workers` settings:
193
211
@@ -204,7 +222,7 @@ api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
204
222
end
205
223
```
206
224
207
-
##Testing Using Hyperclient
225
+
# Testing Using Hyperclient
208
226
209
227
You can combine RSpec, Faraday::Adapter::Rack and Hyperclient to test your HAL API without having to ever examine the raw JSON response.
210
228
@@ -233,14 +251,18 @@ end
233
251
234
252
For a complete example refer to [this Splines Demo API test](https://github.com/ruby-grape/grape-with-roar/blob/master/spec/api/splines_endpoint_with_hyperclient_spec.rb).
235
253
236
-
##Reference
254
+
# Reference
237
255
238
256
[Hyperclient API Reference](http://rubydoc.org/github/codegram/hyperclient/master/frames).
239
257
240
-
## Contributing
258
+
# Hyperclient Users
259
+
260
+
Using Hyperclient? Add your project to our wiki, please: <https://github.com/codegram/hyperclient/wiki>.
261
+
262
+
# Contributing
241
263
242
264
Hyperclient is work of [many people](https://github.com/codegram/hyperclient/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/codegram/hyperclient/pulls), [propose features and discuss issues](https://github.com/codegram/hyperclient/issues). See [CONTRIBUTING](CONTRIBUTING.md) for details.
243
265
244
-
##License
266
+
# License
245
267
246
268
MIT License, see [LICENSE](LICENSE) for details. Copyright 2012-2014 [Codegram Technologies](http://codegram.com).
0 commit comments