pluct 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pluct/helpers/request.rb +3 -5
- data/lib/pluct/resource.rb +6 -5
- data/lib/pluct/version.rb +1 -1
- data/spec/integration/delete_spec.rb +31 -0
- data/spec/integration/patch_spec.rb +33 -0
- data/spec/integration/post_spec.rb +24 -0
- data/spec/integration/put_spec.rb +33 -0
- data/spec/integration/resource_spec.rb +4 -4
- data/spec/pluct/resource_spec.rb +8 -8
- data/spec/support/vcr/integration/delete.yml +464 -0
- data/spec/support/vcr/integration/patch.yml +520 -0
- data/spec/support/vcr/integration/post.yml +308 -0
- data/spec/support/vcr/integration/put.yml +520 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e0d2697300c668b76a34d715f6a20302ad6f046
|
4
|
+
data.tar.gz: f05f5f50e876679f8a8b75585f263e841a71ec12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97f59fc8883884a6100a0ede1c5849a9b40630059e8cfc2de18229bfc6f1f28cfe3524c32b9d2b3bdee69734443e643f96de0461d2ea0cf8d064b877e0e0bb1
|
7
|
+
data.tar.gz: 844edaabc38109569704c17f26a9d7726231e38d35a7c597ee50a88e14e704cd9f13cd2e6ac6734e6f1f476d57c26ba07b823494e656568ea367a6f478214997
|
@@ -27,11 +27,9 @@ module Pluct
|
|
27
27
|
raise_exception(url, e)
|
28
28
|
end
|
29
29
|
|
30
|
-
def delete(url,
|
31
|
-
|
32
|
-
|
33
|
-
options = (options ? DEFAULT_HEADERS.merge(options) : DEFAULT_HEADERS)
|
34
|
-
resource.delete(options)
|
30
|
+
def delete(url, headers = nil)
|
31
|
+
headers = (headers ? DEFAULT_HEADERS.merge(headers) : DEFAULT_HEADERS)
|
32
|
+
RestClient.delete(url, headers)
|
35
33
|
rescue RestClient::Exception => e
|
36
34
|
raise_exception(url, e)
|
37
35
|
end
|
data/lib/pluct/resource.rb
CHANGED
@@ -23,17 +23,18 @@ module Pluct
|
|
23
23
|
links.each do |link|
|
24
24
|
ldo = Pluct::LinkDescriptionObject.new(link)
|
25
25
|
|
26
|
-
define_method link["rel"] do |*args|
|
26
|
+
define_method "rel_#{link["rel"]}" do |*args|
|
27
27
|
params, *options = *args
|
28
|
+
params ||= {}
|
28
29
|
|
29
30
|
method = link["method"] || "GET"
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
end
|
32
|
+
mapping = params.dup
|
33
|
+
mapping.merge!(@data)
|
34
34
|
|
35
|
-
uri = ldo.expand_href(
|
35
|
+
uri = ldo.expand_href(mapping)
|
36
36
|
payload = ldo.unused_mapping(params)
|
37
|
+
|
37
38
|
options.unshift(payload)
|
38
39
|
|
39
40
|
response = send(method.downcase, uri, *options)
|
data/lib/pluct/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "following a link with DELETE method", :vcr, cassette_name: "integration/delete" do
|
4
|
+
it "should DELETE resource" do
|
5
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
6
|
+
resource = root.rel_collection({
|
7
|
+
context_name: "pluct",
|
8
|
+
collection_name: "people"
|
9
|
+
}).rel_add({name: "Alice"})
|
10
|
+
|
11
|
+
expect(resource.response.code).to eq(201)
|
12
|
+
|
13
|
+
location = Addressable::URI.parse(resource.response.headers[:location])
|
14
|
+
resource_id = location.path.split("/")[3]
|
15
|
+
|
16
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
17
|
+
resource = root.rel_resource({
|
18
|
+
context_name: "pluct",
|
19
|
+
collection_name: "people",
|
20
|
+
resource_id: resource_id
|
21
|
+
}).rel_delete
|
22
|
+
|
23
|
+
expect(resource.response.code).to eq(204)
|
24
|
+
|
25
|
+
expect { root.rel_resource({
|
26
|
+
context_name: "pluct",
|
27
|
+
collection_name: "people",
|
28
|
+
resource_id: resource_id
|
29
|
+
}) }.to raise_error(Pluct::Errors::UrlNotFound)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "following a link with PATCH method", :vcr, cassette_name: "integration/patch" do
|
4
|
+
it "should PATCH resource" do
|
5
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
6
|
+
resource = root.rel_collection({
|
7
|
+
context_name: "pluct",
|
8
|
+
collection_name: "people"
|
9
|
+
}).rel_add({name: "Alice"})
|
10
|
+
|
11
|
+
expect(resource.response.code).to eq(201)
|
12
|
+
|
13
|
+
location = Addressable::URI.parse(resource.response.headers[:location])
|
14
|
+
resource_id = location.path.split("/")[3]
|
15
|
+
|
16
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
17
|
+
resource = root.rel_resource({
|
18
|
+
context_name: "pluct",
|
19
|
+
collection_name: "people",
|
20
|
+
resource_id: resource_id
|
21
|
+
}).rel_update({name: "Alice PATCH"})
|
22
|
+
|
23
|
+
expect(resource.response.code).to eq(204)
|
24
|
+
|
25
|
+
resource = root.rel_resource({
|
26
|
+
context_name: "pluct",
|
27
|
+
collection_name: "people",
|
28
|
+
resource_id: resource_id
|
29
|
+
})
|
30
|
+
|
31
|
+
expect(resource.data[:name]).to eq("Alice PATCH")
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "following a link with POST method", :vcr, cassette_name: "integration/post" do
|
4
|
+
it "should POST resource" do
|
5
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
6
|
+
resource = root.rel_collection({
|
7
|
+
context_name: "pluct",
|
8
|
+
collection_name: "people"
|
9
|
+
}).rel_add({name: "Alice"})
|
10
|
+
|
11
|
+
expect(resource.response.code).to eq(201)
|
12
|
+
|
13
|
+
location = Addressable::URI.parse(resource.response.headers[:location])
|
14
|
+
resource_id = location.path.split("/")[3]
|
15
|
+
|
16
|
+
resource = root.rel_resource({
|
17
|
+
context_name: "pluct",
|
18
|
+
collection_name: "people",
|
19
|
+
resource_id: resource_id
|
20
|
+
})
|
21
|
+
|
22
|
+
expect(resource.data[:name]).to eq("Alice")
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "following a link with PUT method", :vcr, cassette_name: "integration/put" do
|
4
|
+
it "should PUT resource" do
|
5
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
6
|
+
resource = root.rel_collection({
|
7
|
+
context_name: "pluct",
|
8
|
+
collection_name: "people"
|
9
|
+
}).rel_add({name: "Alice"})
|
10
|
+
|
11
|
+
expect(resource.response.code).to eq(201)
|
12
|
+
|
13
|
+
location = Addressable::URI.parse(resource.response.headers[:location])
|
14
|
+
resource_id = location.path.split("/")[3]
|
15
|
+
|
16
|
+
root = Pluct::Resource.new("http://localhost:8888")
|
17
|
+
resource = root.rel_resource({
|
18
|
+
context_name: "pluct",
|
19
|
+
collection_name: "people",
|
20
|
+
resource_id: resource_id
|
21
|
+
}).rel_replace({name: "Alice PUT"})
|
22
|
+
|
23
|
+
expect(resource.response.code).to eq(204)
|
24
|
+
|
25
|
+
resource = root.rel_resource({
|
26
|
+
context_name: "pluct",
|
27
|
+
collection_name: "people",
|
28
|
+
resource_id: resource_id
|
29
|
+
})
|
30
|
+
|
31
|
+
expect(resource.data[:name]).to eq("Alice PUT")
|
32
|
+
end
|
33
|
+
end
|
@@ -5,7 +5,7 @@ describe Pluct::Resource, :integration do
|
|
5
5
|
let(:resource){ Pluct::Resource.new('http://localhost:8888') }
|
6
6
|
|
7
7
|
it 'creates a new instance', :vcr, cassette_name: 'integration/creates_new_app' do
|
8
|
-
app = resource.
|
8
|
+
app = resource.rel_collection({context_name: 'baas', collection_name: 'apps'}).rel_create({name: 'my_app', description: 'app_desc'})
|
9
9
|
|
10
10
|
expect(app.response.code).to eq 201
|
11
11
|
expect(app.response.headers[:location]).to_not be_nil
|
@@ -13,16 +13,16 @@ describe Pluct::Resource, :integration do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'expands uri template', :vcr, cassette_name: 'integration/expands_uri' do
|
16
|
-
collection = resource.
|
16
|
+
collection = resource.rel_collection({context_name: 'baas', collection_name: 'apps'})
|
17
17
|
expect(collection.uri).to eq 'http://localhost:8888/baas/apps'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'raises 404 for url not found', :vcr, cassette_name: 'integration/page_not_found' do
|
21
|
-
expect {resource.
|
21
|
+
expect {resource.rel_resource({context_name: 'baas', collection_name: 'apps', resource_id: 'invalid'}) }.to raise_error(Pluct::Errors::UrlNotFound)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'reads instance info', :vcr, cassette_name: 'integration/instance_info' do
|
25
|
-
app = resource.
|
25
|
+
app = resource.rel_resource({context_name: 'baas', collection_name: 'apps', resource_id: '9b0d0333302a42d3bc8ee00b0afa2121'})
|
26
26
|
|
27
27
|
expect(app.data).to_not be_empty
|
28
28
|
expect(app.name).to eq 'New App'
|
data/spec/pluct/resource_spec.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Pluct::Resource do
|
4
|
-
let(:schema) { mock(Pluct::Schema) }
|
4
|
+
let(:schema) { mock(Pluct::Schema) }
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
stub_request(:get, 'www.example.com/users/1').to_return(body: File.read('spec/assets/user.json'),
|
8
|
-
status: 200,
|
7
|
+
stub_request(:get, 'www.example.com/users/1').to_return(body: File.read('spec/assets/user.json'),
|
8
|
+
status: 200,
|
9
9
|
headers: {'content-type' => 'application/json; charset=utf-8; profile=http://www.example.com/schemas/user'})
|
10
10
|
|
11
11
|
|
12
|
-
stub_request(:get, 'www.example.com/users/2').to_return(body: File.read('spec/assets/user.json'),
|
12
|
+
stub_request(:get, 'www.example.com/users/2').to_return(body: File.read('spec/assets/user.json'),
|
13
13
|
status: 200)
|
14
|
-
|
15
|
-
stub_request(:get, 'www.example.com/users/3').to_return(body: File.read('spec/assets/user.json'),
|
14
|
+
|
15
|
+
stub_request(:get, 'www.example.com/users/3').to_return(body: File.read('spec/assets/user.json'),
|
16
16
|
status: 200,
|
17
17
|
headers: {'content-type' => 'application/json; charset=utf-8;'})
|
18
18
|
|
@@ -38,7 +38,7 @@ describe Pluct::Resource do
|
|
38
38
|
it 'adds methods dynamically' do
|
39
39
|
resource = Pluct::Resource.new('www.example.com/users/1')
|
40
40
|
|
41
|
-
methods = [:
|
41
|
+
methods = [:rel_edit, :rel_replace, :rel_self, :rel_delete, :rel_create]
|
42
42
|
methods.each do |method|
|
43
43
|
expect(resource.class.instance_methods(false)).to include(method)
|
44
44
|
end
|
@@ -59,6 +59,6 @@ describe Pluct::Resource do
|
|
59
59
|
|
60
60
|
expect(resource.data).to_not be_nil
|
61
61
|
expect(resource.schema).to be_nil
|
62
|
-
end
|
62
|
+
end
|
63
63
|
end
|
64
64
|
end
|
@@ -0,0 +1,464 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:8888/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Params:
|
17
|
+
- ''
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Content-Length:
|
26
|
+
- '2'
|
27
|
+
Server:
|
28
|
+
- TornadoServer/2.4.1
|
29
|
+
Etag:
|
30
|
+
- '"bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"'
|
31
|
+
Link:
|
32
|
+
- <http://localhost:8888/root/schemas/root>; rel=describedby
|
33
|
+
Cache-Control:
|
34
|
+
- max-age=0
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- '*'
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=UTF-8; profile=http://localhost:8888/root/schemas/root
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
44
|
+
- request:
|
45
|
+
method: get
|
46
|
+
uri: http://localhost:8888/root/schemas/root
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ''
|
50
|
+
headers:
|
51
|
+
Accept:
|
52
|
+
- '*/*; q=0.5, application/xml'
|
53
|
+
Accept-Encoding:
|
54
|
+
- gzip, deflate
|
55
|
+
Content-Type:
|
56
|
+
- application/json
|
57
|
+
Params:
|
58
|
+
- ''
|
59
|
+
User-Agent:
|
60
|
+
- Ruby
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
Content-Length:
|
67
|
+
- '414'
|
68
|
+
Server:
|
69
|
+
- TornadoServer/2.4.1
|
70
|
+
Etag:
|
71
|
+
- '"26c5b90764472752bd035a39e9a521f804374711"'
|
72
|
+
Cache-Control:
|
73
|
+
- max-age=0
|
74
|
+
Access-Control-Allow-Origin:
|
75
|
+
- '*'
|
76
|
+
Content-Type:
|
77
|
+
- application/json; charset=UTF-8
|
78
|
+
body:
|
79
|
+
encoding: UTF-8
|
80
|
+
string: '{"$schema": "http://json-schema.org/draft-04/hyper-schema#", "type":
|
81
|
+
"object", "links": [{"href": "http://localhost:8888", "rel": "self"}, {"href":
|
82
|
+
"http://localhost:8888/{context_name}", "rel": "context"}, {"href": "http://localhost:8888/{context_name}/{collection_name}",
|
83
|
+
"rel": "collection"}, {"href": "http://localhost:8888/{context_name}/{collection_name}/{resource_id}",
|
84
|
+
"rel": "resource"}], "title": "Root"}'
|
85
|
+
http_version:
|
86
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
87
|
+
- request:
|
88
|
+
method: get
|
89
|
+
uri: http://localhost:8888/pluct/people
|
90
|
+
body:
|
91
|
+
encoding: US-ASCII
|
92
|
+
string: ''
|
93
|
+
headers:
|
94
|
+
Accept:
|
95
|
+
- '*/*; q=0.5, application/xml'
|
96
|
+
Accept-Encoding:
|
97
|
+
- gzip, deflate
|
98
|
+
Content-Type:
|
99
|
+
- application/json
|
100
|
+
User-Agent:
|
101
|
+
- Ruby
|
102
|
+
response:
|
103
|
+
status:
|
104
|
+
code: 200
|
105
|
+
message: OK
|
106
|
+
headers:
|
107
|
+
Content-Length:
|
108
|
+
- '833'
|
109
|
+
Server:
|
110
|
+
- TornadoServer/2.4.1
|
111
|
+
Etag:
|
112
|
+
- '"04454419fcbeda377685b63b67e2079fc682853c"'
|
113
|
+
Link:
|
114
|
+
- <http://localhost:8888/pluct/schemas/person-collection>; rel=describedby
|
115
|
+
Cache-Control:
|
116
|
+
- max-age=0
|
117
|
+
Access-Control-Allow-Origin:
|
118
|
+
- '*'
|
119
|
+
Content-Type:
|
120
|
+
- application/json; charset=UTF-8; profile=http://localhost:8888/pluct/schemas/person-collection
|
121
|
+
body:
|
122
|
+
encoding: UTF-8
|
123
|
+
string: '{"items": [{"name": "Alice", "resource_id": "c5a9f68fdd164b16b0a98b7fe1d92a45"},
|
124
|
+
{"name": "Alice", "resource_id": "e16f26dc099b490ab6500e76da8dd4a3"}, {"name":
|
125
|
+
"Alice", "resource_id": "e8f4b3bded62440d8260f96541143cb4"}, {"name": "Alice",
|
126
|
+
"resource_id": "2efaddd96b634a3481390a783aa4f9a2"}, {"name": "Alice", "resource_id":
|
127
|
+
"45a2f8d827a842ab8133e611dfc3963d"}, {"name": "Alice", "resource_id": "736d623fde46421ea3f98a35774cfbdc"},
|
128
|
+
{"name": "Alice", "resource_id": "112987725871472a9471d38cd9d03f75"}, {"name":
|
129
|
+
"Alice", "resource_id": "b5ee73d3ca0f44cf8a7a364ec46cbae8"}, {"name": "Alice",
|
130
|
+
"resource_id": "81d12d7b038f4f28b6d0abe80e694931"}, {"_resource_uri": "http://localhost:8888/pluct/people/ce9456e69884453e9870d47633a49716",
|
131
|
+
"name": "Alice", "resource_id": "ce9456e69884453e9870d47633a49716"}], "next_page":
|
132
|
+
2, "item_count": 21}'
|
133
|
+
http_version:
|
134
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
135
|
+
- request:
|
136
|
+
method: get
|
137
|
+
uri: http://localhost:8888/pluct/schemas/person-collection
|
138
|
+
body:
|
139
|
+
encoding: US-ASCII
|
140
|
+
string: ''
|
141
|
+
headers:
|
142
|
+
Accept:
|
143
|
+
- '*/*; q=0.5, application/xml'
|
144
|
+
Accept-Encoding:
|
145
|
+
- gzip, deflate
|
146
|
+
Content-Type:
|
147
|
+
- application/json
|
148
|
+
Params:
|
149
|
+
- ''
|
150
|
+
User-Agent:
|
151
|
+
- Ruby
|
152
|
+
response:
|
153
|
+
status:
|
154
|
+
code: 200
|
155
|
+
message: OK
|
156
|
+
headers:
|
157
|
+
Content-Length:
|
158
|
+
- '732'
|
159
|
+
Server:
|
160
|
+
- TornadoServer/2.4.1
|
161
|
+
Etag:
|
162
|
+
- '"46465f1efd5fa543dd173c5b8eb61b6304d7aa71"'
|
163
|
+
Cache-Control:
|
164
|
+
- max-age=0
|
165
|
+
Access-Control-Allow-Origin:
|
166
|
+
- '*'
|
167
|
+
Content-Type:
|
168
|
+
- application/json; charset=UTF-8
|
169
|
+
body:
|
170
|
+
encoding: UTF-8
|
171
|
+
string: '{"links": [{"href": "http://localhost:8888/pluct/people", "rel": "self"},
|
172
|
+
{"href": "http://localhost:8888/pluct/people", "method": "POST", "rel": "add",
|
173
|
+
"schema": {"$ref": "http://localhost:8888/pluct/schemas/person-new"}}, {"href":
|
174
|
+
"http://localhost:8888/pluct/people?page={previous_page}", "rel": "previous"},
|
175
|
+
{"href": "http://localhost:8888/pluct/people?page={next_page}", "rel": "next"}],
|
176
|
+
"title": "Collection", "required": ["items"], "$schema": "http://json-schema.org/draft-04/hyper-schema#",
|
177
|
+
"type": "object", "properties": {"items": {"items": {"$ref": "http://localhost:8888/pluct/schemas/person"},
|
178
|
+
"type": "array"}, "previous_page": {"type": "integer"}, "next_page": {"type":
|
179
|
+
"integer"}, "item_count": {"type": "integer"}}}'
|
180
|
+
http_version:
|
181
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
182
|
+
- request:
|
183
|
+
method: post
|
184
|
+
uri: http://localhost:8888/pluct/people
|
185
|
+
body:
|
186
|
+
encoding: UTF-8
|
187
|
+
string: '{"name":"Alice"}'
|
188
|
+
headers:
|
189
|
+
Accept:
|
190
|
+
- '*/*; q=0.5, application/xml'
|
191
|
+
Accept-Encoding:
|
192
|
+
- gzip, deflate
|
193
|
+
Content-Type:
|
194
|
+
- application/json
|
195
|
+
Content-Length:
|
196
|
+
- '16'
|
197
|
+
User-Agent:
|
198
|
+
- Ruby
|
199
|
+
response:
|
200
|
+
status:
|
201
|
+
code: 201
|
202
|
+
message: Created
|
203
|
+
headers:
|
204
|
+
Content-Length:
|
205
|
+
- '0'
|
206
|
+
Server:
|
207
|
+
- TornadoServer/2.4.1
|
208
|
+
Location:
|
209
|
+
- http://localhost:8888/pluct/people/27bfe86dfb2e48abb509f3a8559436e3
|
210
|
+
Cache-Control:
|
211
|
+
- max-age=0
|
212
|
+
Access-Control-Allow-Origin:
|
213
|
+
- '*'
|
214
|
+
Content-Type:
|
215
|
+
- text/html; charset=UTF-8
|
216
|
+
body:
|
217
|
+
encoding: UTF-8
|
218
|
+
string: ''
|
219
|
+
http_version:
|
220
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
221
|
+
- request:
|
222
|
+
method: get
|
223
|
+
uri: http://localhost:8888/
|
224
|
+
body:
|
225
|
+
encoding: US-ASCII
|
226
|
+
string: ''
|
227
|
+
headers:
|
228
|
+
Accept:
|
229
|
+
- '*/*; q=0.5, application/xml'
|
230
|
+
Accept-Encoding:
|
231
|
+
- gzip, deflate
|
232
|
+
Content-Type:
|
233
|
+
- application/json
|
234
|
+
Params:
|
235
|
+
- ''
|
236
|
+
User-Agent:
|
237
|
+
- Ruby
|
238
|
+
response:
|
239
|
+
status:
|
240
|
+
code: 200
|
241
|
+
message: OK
|
242
|
+
headers:
|
243
|
+
Content-Length:
|
244
|
+
- '2'
|
245
|
+
Server:
|
246
|
+
- TornadoServer/2.4.1
|
247
|
+
Etag:
|
248
|
+
- '"bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"'
|
249
|
+
Link:
|
250
|
+
- <http://localhost:8888/root/schemas/root>; rel=describedby
|
251
|
+
Cache-Control:
|
252
|
+
- max-age=0
|
253
|
+
Access-Control-Allow-Origin:
|
254
|
+
- '*'
|
255
|
+
Content-Type:
|
256
|
+
- application/json; charset=UTF-8; profile=http://localhost:8888/root/schemas/root
|
257
|
+
body:
|
258
|
+
encoding: UTF-8
|
259
|
+
string: '{}'
|
260
|
+
http_version:
|
261
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
262
|
+
- request:
|
263
|
+
method: get
|
264
|
+
uri: http://localhost:8888/root/schemas/root
|
265
|
+
body:
|
266
|
+
encoding: US-ASCII
|
267
|
+
string: ''
|
268
|
+
headers:
|
269
|
+
Accept:
|
270
|
+
- '*/*; q=0.5, application/xml'
|
271
|
+
Accept-Encoding:
|
272
|
+
- gzip, deflate
|
273
|
+
Content-Type:
|
274
|
+
- application/json
|
275
|
+
Params:
|
276
|
+
- ''
|
277
|
+
User-Agent:
|
278
|
+
- Ruby
|
279
|
+
response:
|
280
|
+
status:
|
281
|
+
code: 200
|
282
|
+
message: OK
|
283
|
+
headers:
|
284
|
+
Content-Length:
|
285
|
+
- '414'
|
286
|
+
Server:
|
287
|
+
- TornadoServer/2.4.1
|
288
|
+
Etag:
|
289
|
+
- '"26c5b90764472752bd035a39e9a521f804374711"'
|
290
|
+
Cache-Control:
|
291
|
+
- max-age=0
|
292
|
+
Access-Control-Allow-Origin:
|
293
|
+
- '*'
|
294
|
+
Content-Type:
|
295
|
+
- application/json; charset=UTF-8
|
296
|
+
body:
|
297
|
+
encoding: UTF-8
|
298
|
+
string: '{"$schema": "http://json-schema.org/draft-04/hyper-schema#", "type":
|
299
|
+
"object", "links": [{"href": "http://localhost:8888", "rel": "self"}, {"href":
|
300
|
+
"http://localhost:8888/{context_name}", "rel": "context"}, {"href": "http://localhost:8888/{context_name}/{collection_name}",
|
301
|
+
"rel": "collection"}, {"href": "http://localhost:8888/{context_name}/{collection_name}/{resource_id}",
|
302
|
+
"rel": "resource"}], "title": "Root"}'
|
303
|
+
http_version:
|
304
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
305
|
+
- request:
|
306
|
+
method: get
|
307
|
+
uri: http://localhost:8888/pluct/people/27bfe86dfb2e48abb509f3a8559436e3
|
308
|
+
body:
|
309
|
+
encoding: US-ASCII
|
310
|
+
string: ''
|
311
|
+
headers:
|
312
|
+
Accept:
|
313
|
+
- '*/*; q=0.5, application/xml'
|
314
|
+
Accept-Encoding:
|
315
|
+
- gzip, deflate
|
316
|
+
Content-Type:
|
317
|
+
- application/json
|
318
|
+
User-Agent:
|
319
|
+
- Ruby
|
320
|
+
response:
|
321
|
+
status:
|
322
|
+
code: 200
|
323
|
+
message: OK
|
324
|
+
headers:
|
325
|
+
Content-Length:
|
326
|
+
- '156'
|
327
|
+
Server:
|
328
|
+
- TornadoServer/2.4.1
|
329
|
+
Etag:
|
330
|
+
- '"5460e148eb9b7d0ce4924d04298c0e8139a3c466"'
|
331
|
+
Link:
|
332
|
+
- <http://localhost:8888/pluct/schemas/person>; rel=describedby
|
333
|
+
Cache-Control:
|
334
|
+
- max-age=0
|
335
|
+
Access-Control-Allow-Origin:
|
336
|
+
- '*'
|
337
|
+
Content-Type:
|
338
|
+
- application/json; charset=UTF-8; profile=http://localhost:8888/pluct/schemas/person
|
339
|
+
body:
|
340
|
+
encoding: UTF-8
|
341
|
+
string: '{"_resource_uri": "http://localhost:8888/pluct/people/27bfe86dfb2e48abb509f3a8559436e3",
|
342
|
+
"name": "Alice", "resource_id": "27bfe86dfb2e48abb509f3a8559436e3"}'
|
343
|
+
http_version:
|
344
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
345
|
+
- request:
|
346
|
+
method: get
|
347
|
+
uri: http://localhost:8888/pluct/schemas/person
|
348
|
+
body:
|
349
|
+
encoding: US-ASCII
|
350
|
+
string: ''
|
351
|
+
headers:
|
352
|
+
Accept:
|
353
|
+
- '*/*; q=0.5, application/xml'
|
354
|
+
Accept-Encoding:
|
355
|
+
- gzip, deflate
|
356
|
+
Content-Type:
|
357
|
+
- application/json
|
358
|
+
Params:
|
359
|
+
- ''
|
360
|
+
User-Agent:
|
361
|
+
- Ruby
|
362
|
+
response:
|
363
|
+
status:
|
364
|
+
code: 200
|
365
|
+
message: OK
|
366
|
+
headers:
|
367
|
+
Content-Length:
|
368
|
+
- '869'
|
369
|
+
Server:
|
370
|
+
- TornadoServer/2.4.1
|
371
|
+
Etag:
|
372
|
+
- '"4bd0cf12c29e056e89ec5a6d5513825098dceb8d"'
|
373
|
+
Cache-Control:
|
374
|
+
- max-age=0
|
375
|
+
Access-Control-Allow-Origin:
|
376
|
+
- '*'
|
377
|
+
Content-Type:
|
378
|
+
- application/json; charset=UTF-8
|
379
|
+
body:
|
380
|
+
encoding: UTF-8
|
381
|
+
string: '{"links": [{"href": "http://localhost:8888/pluct/people/{resource_id}",
|
382
|
+
"rel": "self"}, {"href": "http://localhost:8888/pluct/people/{resource_id}",
|
383
|
+
"rel": "item"}, {"href": "http://localhost:8888/pluct/people/{resource_id}",
|
384
|
+
"method": "PATCH", "rel": "update", "schema": {"$ref": "http://localhost:8888/pluct/schemas/person"}},
|
385
|
+
{"href": "http://localhost:8888/pluct/people/{resource_id}", "method": "PUT",
|
386
|
+
"rel": "replace", "schema": {"$ref": "http://localhost:8888/pluct/schemas/person"}},
|
387
|
+
{"href": "http://localhost:8888/pluct/people/{resource_id}", "method": "DELETE",
|
388
|
+
"rel": "delete", "schema": {"$ref": "http://localhost:8888/pluct/schemas/person"}}],
|
389
|
+
"title": "Person", "collection_name": "people", "resource_id": "person", "$schema":
|
390
|
+
"http://json-schema.org/draft-04/hyper-schema#", "type": "object", "properties":
|
391
|
+
{"name": {"type": "string", "title": "Name"}}}'
|
392
|
+
http_version:
|
393
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
394
|
+
- request:
|
395
|
+
method: delete
|
396
|
+
uri: http://localhost:8888/pluct/people/27bfe86dfb2e48abb509f3a8559436e3
|
397
|
+
body:
|
398
|
+
encoding: US-ASCII
|
399
|
+
string: ''
|
400
|
+
headers:
|
401
|
+
Accept:
|
402
|
+
- '*/*; q=0.5, application/xml'
|
403
|
+
Accept-Encoding:
|
404
|
+
- gzip, deflate
|
405
|
+
Content-Type:
|
406
|
+
- application/json
|
407
|
+
User-Agent:
|
408
|
+
- Ruby
|
409
|
+
response:
|
410
|
+
status:
|
411
|
+
code: 204
|
412
|
+
message: No Content
|
413
|
+
headers:
|
414
|
+
Access-Control-Allow-Origin:
|
415
|
+
- '*'
|
416
|
+
Cache-Control:
|
417
|
+
- max-age=0
|
418
|
+
Content-Type:
|
419
|
+
- text/html; charset=UTF-8
|
420
|
+
Content-Length:
|
421
|
+
- '0'
|
422
|
+
Server:
|
423
|
+
- TornadoServer/2.4.1
|
424
|
+
body:
|
425
|
+
encoding: UTF-8
|
426
|
+
string: ''
|
427
|
+
http_version:
|
428
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
429
|
+
- request:
|
430
|
+
method: get
|
431
|
+
uri: http://localhost:8888/pluct/people/27bfe86dfb2e48abb509f3a8559436e3
|
432
|
+
body:
|
433
|
+
encoding: US-ASCII
|
434
|
+
string: ''
|
435
|
+
headers:
|
436
|
+
Accept:
|
437
|
+
- '*/*; q=0.5, application/xml'
|
438
|
+
Accept-Encoding:
|
439
|
+
- gzip, deflate
|
440
|
+
Content-Type:
|
441
|
+
- application/json
|
442
|
+
User-Agent:
|
443
|
+
- Ruby
|
444
|
+
response:
|
445
|
+
status:
|
446
|
+
code: 404
|
447
|
+
message: Not Found
|
448
|
+
headers:
|
449
|
+
Access-Control-Allow-Origin:
|
450
|
+
- '*'
|
451
|
+
Cache-Control:
|
452
|
+
- max-age=0
|
453
|
+
Content-Type:
|
454
|
+
- text/html; charset=UTF-8
|
455
|
+
Content-Length:
|
456
|
+
- '0'
|
457
|
+
Server:
|
458
|
+
- TornadoServer/2.4.1
|
459
|
+
body:
|
460
|
+
encoding: UTF-8
|
461
|
+
string: ''
|
462
|
+
http_version:
|
463
|
+
recorded_at: Wed, 07 Aug 2013 03:42:32 GMT
|
464
|
+
recorded_with: VCR 2.5.0
|