@@ -15,13 +15,32 @@ def root_response
1515 }'
1616 end
1717
18+ def authors_response
19+ '{
20+ "_links": {
21+ "self": { "href": "/authors" }
22+ },
23+ "_embedded": {
24+ "api:authors": [
25+ {
26+ "name": "Lorem Ipsum",
27+ "_links": {
28+ "self": { "href": "/authors/1" }
29+ }
30+ }
31+ ]
32+ }
33+ }'
34+ end
35+
1836 def posts_response
1937 '{
2038 "_links": {
2139 "self": { "href": "/posts" },
40+ "next": {"href": "/posts?page=2"},
2241 "last_post": {"href": "/posts/1"}
2342 },
24- "total_posts": "2 ",
43+ "total_posts": "4 ",
2544 "_embedded": {
2645 "posts": [
2746 {
@@ -43,7 +62,48 @@ def posts_response
4362 }'
4463 end
4564
46- def post_response
65+ def posts_page2_response
66+ '{
67+ "_links": {
68+ "self": { "href": "/posts?page=2" },
69+ "next": { "href": "/posts?page=3" }
70+ },
71+ "total_posts": "4",
72+ "_embedded": {
73+ "posts": [
74+ {
75+ "title": "My third blog post",
76+ "body": "Lorem ipsum dolor sit amet",
77+ "_links": {
78+ "self": { "href": "/posts/3" }
79+ }
80+ }
81+ ]
82+ }
83+ }'
84+ end
85+
86+ def posts_page3_response
87+ '{
88+ "_links": {
89+ "self": { "href": "/posts?page=3" }
90+ },
91+ "total_posts": "4",
92+ "_embedded": {
93+ "posts": [
94+ {
95+ "title": "My third blog post",
96+ "body": "Lorem ipsum dolor sit amet",
97+ "_links": {
98+ "self": { "href": "/posts/4" }
99+ }
100+ }
101+ ]
102+ }
103+ }'
104+ end
105+
106+ def post1_response
47107 '{
48108 "_links": {
49109 "self": { "href": "/posts/1" }
@@ -60,6 +120,40 @@ def post_response
60120 }'
61121 end
62122
123+ def post2_response
124+ '{
125+ "_links": {
126+ "self": { "href": "/posts/2" }
127+ },
128+ "title": "My first blog post",
129+ "body": "Lorem ipsum dolor sit amet",
130+ "_embedded": {
131+ "comments": [
132+ {
133+ "title": "Some comment"
134+ }
135+ ]
136+ }
137+ }'
138+ end
139+
140+ def post3_response
141+ '{
142+ "_links": {
143+ "self": { "href": "/posts/3" }
144+ },
145+ "title": "My first blog post",
146+ "body": "Lorem ipsum dolor sit amet",
147+ "_embedded": {
148+ "comments": [
149+ {
150+ "title": "Some comment"
151+ }
152+ ]
153+ }
154+ }'
155+ end
156+
63157 def page2_response
64158 '{
65159 "_links": {
0 commit comments