restify 0.1.2.1.b41 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/doc/file.README.html +176 -0
- data/lib/restify/version.rb +2 -2
- metadata +22 -20
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDcyMTAxMzdlMjFjOGNiOGYzMGRjYzQ5ZmQyOTc2MTllMDg2ZGY3Ng==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9dd0953087898c84bff94bad4919c1300671ff56
|
4
|
+
data.tar.gz: 4495f8f879c0b2f3965149a35d6abd6a866ae002
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWQ1MjZiMTg2NGJkYTFiZjJhZDQwODExNGFmOTZhMjFiMGJkOTM4ZjAzMWIy
|
11
|
-
MDNkMWM2MTk0YjAyYzdmMzc0YjFkZWI5MGU1YTdmNzU5ZTIyNmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTYxMGJkYWRjZjMzOWQ5NGQ0N2U5ZDdmZDRmNTExMWIwYWJjNTY0ZjA0ZGIw
|
14
|
-
ODdlMzRhZTI1MDFjZWYyYTE4YmU1MjMzOTViMmIyNzRmNDk3NWU3NjMzMGZi
|
15
|
-
ODVjMzJmZjIyODdlMGYzNmZmYWJkYWVhNGViMGM4MWMwODU1MWU=
|
6
|
+
metadata.gz: aa7c8d7bd11e8f63623ac722602e72a7760c4b1e2726845fc0d6c22b015ef57e4bff0c5863db2506b5f24700e6cc21579528f5635c13f0573b3b35118cd2e19c
|
7
|
+
data.tar.gz: 653d79b26d22ad85f2a20fed2f0ef2cae5a6f0739452db6e118205ab5a915d5ad8fee3676581f5dca1febca9e953d1b94514f7103a0d76620508ef3a459d1ab9
|
@@ -0,0 +1,176 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'><h1>Restify</h1>
|
65
|
+
|
66
|
+
<p>Restify is an experimental hypermedia REST client that uses parallel, keep-alive and pipelined requests by default.</p>
|
67
|
+
|
68
|
+
<p>Restify scans Link headers and returned resource for links and relations to other resources, represented as RFC6570 URI Templates, and exposes those to the developer.</p>
|
69
|
+
|
70
|
+
<p>Restify can be used to consume hypermedia REST APIs (like GitHubs), to build a site-specific library or to use within your own backend services.</p>
|
71
|
+
|
72
|
+
<p>Restify is build upon</p>
|
73
|
+
|
74
|
+
<ul>
|
75
|
+
<li><a href="https://github.com/jgraichen/obligation">obligation</a></li>
|
76
|
+
<li><a href="https://github.com/sporkmonger/addressable">addressable</a></li>
|
77
|
+
</ul>
|
78
|
+
|
79
|
+
<p>provided HTTP adapters for</p>
|
80
|
+
|
81
|
+
<ul>
|
82
|
+
<li><a href="https://github.com/igrigorik/em-http-request">em-http-request</a></li>
|
83
|
+
</ul>
|
84
|
+
|
85
|
+
<p>and can decode and encode</p>
|
86
|
+
|
87
|
+
<ul>
|
88
|
+
<li><a href="https://github.com/intridea/multi_json">JSON</a></li>
|
89
|
+
</ul>
|
90
|
+
|
91
|
+
<h2>Restify is still under development</h2>
|
92
|
+
|
93
|
+
<ul>
|
94
|
+
<li>It is build on experimental obligation library.</li>
|
95
|
+
<li>It's missing a extensive test suite</li>
|
96
|
+
<li>It's not used in high-volume production environments but for remote API usage in testing and CI.</li>
|
97
|
+
</ul>
|
98
|
+
|
99
|
+
<p>Planned features:</p>
|
100
|
+
|
101
|
+
<ul>
|
102
|
+
<li>API versions via header/URI</li>
|
103
|
+
<li>Content-Type and Language negotiation</li>
|
104
|
+
<li>Encode and decode MessagePack</li>
|
105
|
+
<li>ZeroMQ FLP backend</li>
|
106
|
+
<li>Eventmachine integration (see obligation library)</li>
|
107
|
+
<li>Alternative HTTP backends</li>
|
108
|
+
</ul>
|
109
|
+
|
110
|
+
<h2>Installation</h2>
|
111
|
+
|
112
|
+
<p>Add it to your Gemfile or install it manually: <code>$ gem install restify</code></p>
|
113
|
+
|
114
|
+
<h2>Usage</h2>
|
115
|
+
|
116
|
+
<p>Create new Restify object (actually returns '/' resource):</p>
|
117
|
+
|
118
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_client'>client</span> <span class='op'>=</span> <span class='const'>Restify</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http://api.github.com</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
<p>The <code>value</code> call resolves the returned <code>Obligation</code> (like a Future object) by blocking the thread until the resource is there.</p>
|
122
|
+
|
123
|
+
<p>Get a relation described by the root resource. Restify supports Link headers as well as JSON encoded relations (<code>*_url</code> fields).</p>
|
124
|
+
|
125
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_repositories'>repositories</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_rel'>rel</span><span class='lparen'>(</span><span class='symbol'>:repository</span><span class='rparen'>)</span>
|
126
|
+
</code></pre>
|
127
|
+
|
128
|
+
<p>Send a GET request for a specific repository using given parameters. They will be used to expand the URI template behind the <code>repositories</code> relation.</p>
|
129
|
+
|
130
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_repo'>repo</span> <span class='op'>=</span> <span class='id identifier rubyid_repositories'>repositories</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='label'>owner:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>jgraichen</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>repo:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>restify</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
131
|
+
</code></pre>
|
132
|
+
|
133
|
+
<p>Now fetch a list of commits for this repo and get this first one:</p>
|
134
|
+
|
135
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_commit'>commit</span> <span class='op'>=</span> <span class='id identifier rubyid_repo'>repo</span><span class='period'>.</span><span class='id identifier rubyid_rel'>rel</span><span class='lparen'>(</span><span class='symbol'>:commits</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
136
|
+
</code></pre>
|
137
|
+
|
138
|
+
<p>And print it:</p>
|
139
|
+
|
140
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Last commit: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_commit'>commit</span><span class='lbracket'>[</span><span class='symbol'>:sha</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
141
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>By </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_commit'>commit</span><span class='lbracket'>[</span><span class='symbol'>:commit</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:author</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> <</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_commit'>commit</span><span class='lbracket'>[</span><span class='symbol'>:commit</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:author</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:email</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
142
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_commit'>commit</span><span class='lbracket'>[</span><span class='symbol'>:commit</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:message</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
143
|
+
</code></pre>
|
144
|
+
|
145
|
+
<p>See commented example in main spec <a href="https://github.com/jgraichen/restify/blob/master/spec/restify_spec.rb#L100"><code>spec/restify_spec.rb</code></a> or in the <code>examples</code> directory.</p>
|
146
|
+
|
147
|
+
<h2>Contributing</h2>
|
148
|
+
|
149
|
+
<ol>
|
150
|
+
<li><a href="http://github.com/jgraichen/restify/fork">Fork it</a></li>
|
151
|
+
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
|
152
|
+
<li>Commit specs for your feature so that I do not break it later</li>
|
153
|
+
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
|
154
|
+
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
|
155
|
+
<li>Create new Pull Request</li>
|
156
|
+
</ol>
|
157
|
+
|
158
|
+
<h2>License</h2>
|
159
|
+
|
160
|
+
<p>Copyright (C) 2014 Jan Graichen</p>
|
161
|
+
|
162
|
+
<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
|
163
|
+
|
164
|
+
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
|
165
|
+
|
166
|
+
<p>You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>
|
167
|
+
</div></div>
|
168
|
+
|
169
|
+
<div id="footer">
|
170
|
+
Generated on Sun Dec 14 12:14:35 2014 by
|
171
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
172
|
+
0.8.7.6 (ruby-2.1.5).
|
173
|
+
</div>
|
174
|
+
|
175
|
+
</body>
|
176
|
+
</html>
|
data/lib/restify/version.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: obligation
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: em-http-request
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hashie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: multi_json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.5'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.5'
|
111
111
|
description: An experimental hypermedia REST client that uses parallel, keep-alive
|
@@ -118,6 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- LICENSE.txt
|
120
120
|
- README.md
|
121
|
+
- doc/file.README.html
|
121
122
|
- lib/restify.rb
|
122
123
|
- lib/restify/adapter.rb
|
123
124
|
- lib/restify/collection.rb
|
@@ -150,17 +151,17 @@ require_paths:
|
|
150
151
|
- lib
|
151
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
152
153
|
requirements:
|
153
|
-
- -
|
154
|
+
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
156
|
version: '0'
|
156
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
158
|
requirements:
|
158
|
-
- -
|
159
|
+
- - ">="
|
159
160
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
161
|
+
version: '0'
|
161
162
|
requirements: []
|
162
163
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.2.2
|
164
165
|
signing_key:
|
165
166
|
specification_version: 4
|
166
167
|
summary: An experimental hypermedia REST client.
|
@@ -171,3 +172,4 @@ test_files:
|
|
171
172
|
- spec/restify/resource_spec.rb
|
172
173
|
- spec/restify_spec.rb
|
173
174
|
- spec/spec_helper.rb
|
175
|
+
has_rdoc:
|