restify 0.1.0 → 0.1.0.1.b15
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 +13 -5
- data/README.md +1 -1
- data/lib/restify/relation.rb +4 -4
- data/lib/restify/resource.rb +14 -6
- data/restify.gemspec +7 -2
- data/spec/restify/resource_spec.rb +24 -2
- data/spec/restify_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +22 -25
- data/doc/file.README.html +0 -107
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDNiMDAwMTIzZGNkYzM4ZmNiOTZjNzdkZDU2ZjhlZThmMmU2OWE1ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDZlOTI1YjAwNjdmNzc3OGYyNzMxYzQ0MDc5OTFmNDY4Zjc2NmM1OA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Zjc0OGY3MzNiOTU3Zjc1MmVmZDJjNTNjYjk3NGM2N2Y1ZmM4MWI2ZTQxMWRl
|
10
|
+
MjgzM2M0NmQ4NDMzYTE2MTAxYTY0MTE0ZjI3NDgzZTRkYTc4Y2I0ZGRkOGM0
|
11
|
+
OThmODZlNjUzNzZlM2Q5OGMyMGQ0MjBmYzZhZjRlYTgwNDMzNDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGU0Mzk5Mzk1NmY4MTZhYjViY2M4ZjE1NTNlNzMwMDUyMGFlMjJhZDU3MzRk
|
14
|
+
ZDliMDdkNmFhM2RhZjMxMTZiZDQyN2ZiM2YyYmY3YWI3NTM1YjNkMTIzYWY0
|
15
|
+
NzhiMDY4MzM2ZDY1OGZhYzgzY2NlNjcxZmI4NThlNjM5OGI1MTA=
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ See commented example in main spec [`spec/restify_spec.rb`](https://github.com/j
|
|
78
78
|
|
79
79
|
## Contributing
|
80
80
|
|
81
|
-
1. Fork it
|
81
|
+
1. [Fork it](http://github.com/jgraichen/restify/fork)
|
82
82
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
83
83
|
3. Commit specs for your feature so that I do not break it later
|
84
84
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
data/lib/restify/relation.rb
CHANGED
@@ -10,12 +10,12 @@ module Restify
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def get(
|
14
|
-
request :get,
|
13
|
+
def get(params = {})
|
14
|
+
request :get, params
|
15
15
|
end
|
16
16
|
|
17
|
-
def post(
|
18
|
-
request :post,
|
17
|
+
def post(data = {}, params = {})
|
18
|
+
request :post, params.merge(data: data)
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
data/lib/restify/resource.rb
CHANGED
@@ -17,6 +17,14 @@ module Restify
|
|
17
17
|
#
|
18
18
|
delegate :[], to: :attributes
|
19
19
|
|
20
|
+
# @!method []=(key, value)
|
21
|
+
# Set value for given key.
|
22
|
+
#
|
23
|
+
# @param key [String, Symbol] Data key.
|
24
|
+
# @param key [String, Fixnum, Object] Data value.
|
25
|
+
#
|
26
|
+
delegate :[]=, to: :attributes
|
27
|
+
|
20
28
|
# @!method key?(name)
|
21
29
|
# Check if resource has given key.
|
22
30
|
#
|
@@ -99,12 +107,12 @@ module Restify
|
|
99
107
|
if data
|
100
108
|
data.each do |key, value|
|
101
109
|
hash[key] = case value
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
110
|
+
when Array
|
111
|
+
Collection.create(client, value, nil)
|
112
|
+
when Hash
|
113
|
+
Resource.create(client, value, nil)
|
114
|
+
else
|
115
|
+
value
|
108
116
|
end
|
109
117
|
end
|
110
118
|
|
data/restify.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Restify::VERSION
|
9
9
|
spec.authors = ['Jan Graichen']
|
10
10
|
spec.email = ['jg@altimos.de']
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = 'An experimental hypermedia REST client.'
|
12
|
+
spec.description = 'An experimental hypermedia REST client that uses parallel, keep-alive and pipelined requests by default.'
|
13
13
|
spec.homepage = 'https://github.com/jgraichen/restify'
|
14
14
|
spec.license = 'LGPLv3'
|
15
15
|
|
@@ -26,4 +26,9 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency 'rack'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
29
|
+
|
30
|
+
if ENV['TRAVIS_BUILD_NUMBER']
|
31
|
+
# Append travis build number for auto-releases
|
32
|
+
spec.version = "#{spec.version}.1.b#{ENV['TRAVIS_BUILD_NUMBER']}"
|
33
|
+
end
|
29
34
|
end
|
@@ -84,8 +84,8 @@ describe Restify::Resource do
|
|
84
84
|
let(:attributes) { {a: 0, b: 1} }
|
85
85
|
|
86
86
|
it 'should yield' do
|
87
|
-
expect
|
88
|
-
expect
|
87
|
+
expect{|cb| res.each(&cb) }.to yield_control.twice
|
88
|
+
expect{|cb| res.each(&cb) }.to yield_successive_args ['a', 0], ['b', 1]
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'should return enumerator' do
|
@@ -93,4 +93,26 @@ describe Restify::Resource do
|
|
93
93
|
expect(res.each.to_a).to eq [['a', 0], ['b', 1]]
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
describe '#[]' do
|
98
|
+
let(:attributes) { {a: 0, b: 1} }
|
99
|
+
|
100
|
+
it 'should return attributes' do
|
101
|
+
expect(res[:a]).to eq 0
|
102
|
+
expect(res[:b]).to eq 1
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#[]=' do
|
107
|
+
let(:attributes) { {a: 0, b: 1} }
|
108
|
+
|
109
|
+
it 'should return attributes' do
|
110
|
+
res[:a] = 5
|
111
|
+
res[:c] = 15
|
112
|
+
|
113
|
+
expect(res[:a]).to eq 5
|
114
|
+
expect(res[:b]).to eq 1
|
115
|
+
expect(res[:c]).to eq 15
|
116
|
+
end
|
117
|
+
end
|
96
118
|
end
|
data/spec/restify_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,117 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0.1.b15
|
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-
|
11
|
+
date: 2014-06-03 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: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.2'
|
62
|
-
- -
|
62
|
+
- - <
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '5'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '3.2'
|
72
|
-
- -
|
72
|
+
- - <
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '5'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: multi_json
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ! '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ! '>='
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rack
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ! '>='
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ! '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: bundler
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '1.5'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ~>
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '1.5'
|
117
117
|
description: An experimental hypermedia REST client that uses parallel, keep-alive
|
@@ -124,7 +124,6 @@ extra_rdoc_files: []
|
|
124
124
|
files:
|
125
125
|
- LICENSE.txt
|
126
126
|
- README.md
|
127
|
-
- doc/file.README.html
|
128
127
|
- lib/restify.rb
|
129
128
|
- lib/restify/adapter.rb
|
130
129
|
- lib/restify/client.rb
|
@@ -152,24 +151,22 @@ require_paths:
|
|
152
151
|
- lib
|
153
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
153
|
requirements:
|
155
|
-
- -
|
154
|
+
- - ! '>='
|
156
155
|
- !ruby/object:Gem::Version
|
157
156
|
version: '0'
|
158
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
158
|
requirements:
|
160
|
-
- -
|
159
|
+
- - ! '>'
|
161
160
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
161
|
+
version: 1.3.1
|
163
162
|
requirements: []
|
164
163
|
rubyforge_project:
|
165
164
|
rubygems_version: 2.2.2
|
166
165
|
signing_key:
|
167
166
|
specification_version: 4
|
168
|
-
summary: An experimental hypermedia REST client
|
169
|
-
pipelined requests by default.
|
167
|
+
summary: An experimental hypermedia REST client.
|
170
168
|
test_files:
|
171
169
|
- spec/restify/link_spec.rb
|
172
170
|
- spec/restify/resource_spec.rb
|
173
171
|
- spec/restify_spec.rb
|
174
172
|
- spec/spec_helper.rb
|
175
|
-
has_rdoc:
|
data/doc/file.README.html
DELETED
@@ -1,107 +0,0 @@
|
|
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.4
|
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>TODO: Write a gem description</p>
|
67
|
-
|
68
|
-
<h2>Installation</h2>
|
69
|
-
|
70
|
-
<p>Add this line to your application's Gemfile:</p>
|
71
|
-
|
72
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>restify</span><span class='tstring_end'>'</span></span>
|
73
|
-
</code></pre>
|
74
|
-
|
75
|
-
<p>And then execute:</p>
|
76
|
-
|
77
|
-
<pre class="code ruby"><code class="ruby">$ bundle
|
78
|
-
</code></pre>
|
79
|
-
|
80
|
-
<p>Or install it yourself as:</p>
|
81
|
-
|
82
|
-
<pre class="code ruby"><code class="ruby">$ gem install restify
|
83
|
-
</code></pre>
|
84
|
-
|
85
|
-
<h2>Usage</h2>
|
86
|
-
|
87
|
-
<p>TODO: Write usage instructions here</p>
|
88
|
-
|
89
|
-
<h2>Contributing</h2>
|
90
|
-
|
91
|
-
<ol>
|
92
|
-
<li>Fork it ( <a href="http://github.com/">http://github.com/</a><my-github-username>/restify/fork )</li>
|
93
|
-
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
|
94
|
-
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
|
95
|
-
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
|
96
|
-
<li>Create new Pull Request</li>
|
97
|
-
</ol>
|
98
|
-
</div></div>
|
99
|
-
|
100
|
-
<div id="footer">
|
101
|
-
Generated on Wed May 7 13:45:16 2014 by
|
102
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
|
-
0.8.7.4 (ruby-2.1.1).
|
104
|
-
</div>
|
105
|
-
|
106
|
-
</body>
|
107
|
-
</html>
|