badgeapi 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +15 -0
- data/badgeapi.gemspec +33 -0
- data/lib/badgeapi/badge.rb +29 -0
- data/lib/badgeapi/badgeapi_object.rb +149 -0
- data/lib/badgeapi/collection.rb +10 -0
- data/lib/badgeapi/errors/api_error.rb +5 -0
- data/lib/badgeapi/errors/badgeapi_error.rb +18 -0
- data/lib/badgeapi/errors/invalid_request_error.rb +5 -0
- data/lib/badgeapi/recipient.rb +18 -0
- data/lib/badgeapi/version.rb +3 -0
- data/lib/badgeapi.rb +36 -0
- data/test/badge/badge_test.rb +469 -0
- data/test/badgeapi_test.rb +20 -0
- data/test/collection/collection_test.rb +275 -0
- data/test/fixtures/all_badges.yml +121 -0
- data/test/fixtures/all_badges_bad_user.yml +138 -0
- data/test/fixtures/all_badges_expanded.yml +196 -0
- data/test/fixtures/all_badges_from_collection.yml +52 -0
- data/test/fixtures/all_badges_issued.yml +430 -0
- data/test/fixtures/all_badges_limited.yml +49 -0
- data/test/fixtures/all_collection.yml +50 -0
- data/test/fixtures/all_collection_expanded.yml +131 -0
- data/test/fixtures/all_collection_limit.yml +49 -0
- data/test/fixtures/bad_Recipient.yml +183 -0
- data/test/fixtures/bad_Recipietn_request.yml +93 -0
- data/test/fixtures/bad_api_key.yml +49 -0
- data/test/fixtures/badge_error.yml +47 -0
- data/test/fixtures/badge_requirements.yml +351 -0
- data/test/fixtures/collection_error.yml +91 -0
- data/test/fixtures/create_badge.yml +97 -0
- data/test/fixtures/create_collection.yml +97 -0
- data/test/fixtures/create_new_badge_failure.yml +143 -0
- data/test/fixtures/create_new_collection_failure.yml +189 -0
- data/test/fixtures/destroy_badge.yml +277 -0
- data/test/fixtures/destroy_badge_error.yml +231 -0
- data/test/fixtures/destroy_collection.yml +185 -0
- data/test/fixtures/destroy_collection_error.yml +185 -0
- data/test/fixtures/issue_already_owned_badge.yml +49 -0
- data/test/fixtures/issue_badge_to_bad_user.yml +50 -0
- data/test/fixtures/issue_badge_to_user.yml +199 -0
- data/test/fixtures/issue_badge_to_user_with_library_card.yml +103 -0
- data/test/fixtures/one_badge.yml +49 -0
- data/test/fixtures/one_badge_expanded.yml +50 -0
- data/test/fixtures/one_collection.yml +49 -0
- data/test/fixtures/one_collection_expanded.yml +104 -0
- data/test/fixtures/recipient_with_badges.yml +187 -0
- data/test/fixtures/recipient_with_badges_unicard.yml +50 -0
- data/test/fixtures/revoke_badge_from_user.yml +199 -0
- data/test/fixtures/revoke_badge_not_issued.yml +49 -0
- data/test/fixtures/update_badge_via_update.yml +145 -0
- data/test/fixtures/update_badge_via_update_slug_history.yml +191 -0
- data/test/fixtures/update_collection.yml +191 -0
- data/test/fixtures/update_collection_via_update.yml +145 -0
- data/test/recipient/recipient_test.rb +108 -0
- data/test/test_helper.rb +11 -0
- metadata +274 -0
@@ -0,0 +1,187 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://gamification-api.dev/v1/recipients
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Authorization:
|
13
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 422
|
21
|
+
message: Unprocessable Entity
|
22
|
+
headers:
|
23
|
+
X-Frame-Options:
|
24
|
+
- SAMEORIGIN
|
25
|
+
X-Xss-Protection:
|
26
|
+
- 1; mode=block
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache
|
33
|
+
X-Request-Id:
|
34
|
+
- 2c447f68-f9f4-4065-b334-eec868997103
|
35
|
+
X-Runtime:
|
36
|
+
- '0.008719'
|
37
|
+
Date:
|
38
|
+
- Fri, 17 Jul 2015 15:18:44 GMT
|
39
|
+
Connection:
|
40
|
+
- close
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"error":{"type":"invalid_request_error","message":"No user specified.
|
44
|
+
Please specify user as a param using either university email or university
|
45
|
+
card. e.g user=user@lancaster.ac.uk","status":422}}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Fri, 17 Jul 2015 15:18:44 GMT
|
48
|
+
- request:
|
49
|
+
method: get
|
50
|
+
uri: http://gamification-api.dev/v1/recipients
|
51
|
+
body:
|
52
|
+
encoding: US-ASCII
|
53
|
+
string: ''
|
54
|
+
headers:
|
55
|
+
User-Agent:
|
56
|
+
- Faraday v0.9.1
|
57
|
+
Authorization:
|
58
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
59
|
+
Accept-Encoding:
|
60
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
61
|
+
Accept:
|
62
|
+
- "*/*"
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 422
|
66
|
+
message: Unprocessable Entity
|
67
|
+
headers:
|
68
|
+
X-Frame-Options:
|
69
|
+
- SAMEORIGIN
|
70
|
+
X-Xss-Protection:
|
71
|
+
- 1; mode=block
|
72
|
+
X-Content-Type-Options:
|
73
|
+
- nosniff
|
74
|
+
Content-Type:
|
75
|
+
- application/json; charset=utf-8
|
76
|
+
Cache-Control:
|
77
|
+
- no-cache
|
78
|
+
X-Request-Id:
|
79
|
+
- 5fb4a26b-1995-4a93-a3d4-f02c145361ed
|
80
|
+
X-Runtime:
|
81
|
+
- '0.007406'
|
82
|
+
Date:
|
83
|
+
- Fri, 17 Jul 2015 15:18:44 GMT
|
84
|
+
Connection:
|
85
|
+
- close
|
86
|
+
body:
|
87
|
+
encoding: UTF-8
|
88
|
+
string: '{"error":{"type":"invalid_request_error","message":"No user specified.
|
89
|
+
Please specify user as a param using either university email or university
|
90
|
+
card. e.g user=user@lancaster.ac.uk","status":422}}'
|
91
|
+
http_version:
|
92
|
+
recorded_at: Fri, 17 Jul 2015 15:18:44 GMT
|
93
|
+
- request:
|
94
|
+
method: get
|
95
|
+
uri: http://gamification-api.dev/v1/recipients?user=t.skarbek-wazynski@lancaster.ac.uk
|
96
|
+
body:
|
97
|
+
encoding: US-ASCII
|
98
|
+
string: ''
|
99
|
+
headers:
|
100
|
+
User-Agent:
|
101
|
+
- Faraday v0.9.1
|
102
|
+
Authorization:
|
103
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
104
|
+
Accept-Encoding:
|
105
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
106
|
+
Accept:
|
107
|
+
- "*/*"
|
108
|
+
response:
|
109
|
+
status:
|
110
|
+
code: 200
|
111
|
+
message: OK
|
112
|
+
headers:
|
113
|
+
X-Frame-Options:
|
114
|
+
- SAMEORIGIN
|
115
|
+
X-Xss-Protection:
|
116
|
+
- 1; mode=block
|
117
|
+
X-Content-Type-Options:
|
118
|
+
- nosniff
|
119
|
+
Content-Type:
|
120
|
+
- application/json; charset=utf-8
|
121
|
+
Etag:
|
122
|
+
- '"acde49a57ebc9ba795f6d09daff4d02a"'
|
123
|
+
Cache-Control:
|
124
|
+
- max-age=0, private, must-revalidate
|
125
|
+
X-Request-Id:
|
126
|
+
- e3e548f6-1f53-47e2-9cee-9838cf5ee4ce
|
127
|
+
X-Runtime:
|
128
|
+
- '0.023360'
|
129
|
+
Date:
|
130
|
+
- Tue, 21 Jul 2015 08:25:51 GMT
|
131
|
+
Connection:
|
132
|
+
- close
|
133
|
+
body:
|
134
|
+
encoding: UTF-8
|
135
|
+
string: '{"total_score":25,"badges_total":1,"bronze_count":1,"silver_count":0,"gold_count":0,"platinum_count":0,"badges":[{"name":"Book
|
136
|
+
Worm","description":"You have loaned out over 25 books. Nice going!","requirements":"Loan
|
137
|
+
out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/uploads/badge/image/1/seed.png","collection_id":1,"created_at":"2015-07-16T09:21:22.448Z","updated_at":"2015-07-16T09:21:22.448Z","slug":"book-worm","level":"bronze","image_greyscale":"http://gamification-api.dev/uploads/badge/image/1/grey_seed.png","points":25}]}'
|
138
|
+
http_version:
|
139
|
+
recorded_at: Tue, 21 Jul 2015 08:25:51 GMT
|
140
|
+
- request:
|
141
|
+
method: get
|
142
|
+
uri: http://gamification-api.dev/v1/recipients?recipient=t.skarbek-wazynski@lancaster.ac.uk
|
143
|
+
body:
|
144
|
+
encoding: US-ASCII
|
145
|
+
string: ''
|
146
|
+
headers:
|
147
|
+
User-Agent:
|
148
|
+
- Faraday v0.9.1
|
149
|
+
Authorization:
|
150
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
151
|
+
Accept-Encoding:
|
152
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
153
|
+
Accept:
|
154
|
+
- "*/*"
|
155
|
+
response:
|
156
|
+
status:
|
157
|
+
code: 200
|
158
|
+
message: OK
|
159
|
+
headers:
|
160
|
+
X-Frame-Options:
|
161
|
+
- SAMEORIGIN
|
162
|
+
X-Xss-Protection:
|
163
|
+
- 1; mode=block
|
164
|
+
X-Content-Type-Options:
|
165
|
+
- nosniff
|
166
|
+
Content-Type:
|
167
|
+
- application/json; charset=utf-8
|
168
|
+
Etag:
|
169
|
+
- '"b580cf4171303fd650475e570ec9458a"'
|
170
|
+
Cache-Control:
|
171
|
+
- max-age=0, private, must-revalidate
|
172
|
+
X-Request-Id:
|
173
|
+
- b460f226-7fbf-42bd-9ef2-0bef98ad2521
|
174
|
+
X-Runtime:
|
175
|
+
- '0.026877'
|
176
|
+
Date:
|
177
|
+
- Thu, 03 Sep 2015 10:56:09 GMT
|
178
|
+
Connection:
|
179
|
+
- close
|
180
|
+
body:
|
181
|
+
encoding: UTF-8
|
182
|
+
string: '{"total_score":25,"badges_total":1,"bronze_count":1,"silver_count":0,"gold_count":0,"platinum_count":0,"object":"recipient","badges":[{"name":"Book
|
183
|
+
Worm","description":"You have loaned out over 25 books. Nice going!","requirements":"Loan
|
184
|
+
out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/badge_images/book-worm/badge.png","collection_id":"library","created_at":"2015-09-03T10:51:07.831Z","updated_at":"2015-09-03T10:51:07.831Z","level":"bronze","auto_issue":false,"status":"live","points":25,"object":"badge","issued_at":"2015-09-03T10:51:08.232Z","id":"book-worm"}]}'
|
185
|
+
http_version:
|
186
|
+
recorded_at: Thu, 03 Sep 2015 10:56:09 GMT
|
187
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://gamification-api.dev/v1/recipients?user=0043181
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Authorization:
|
13
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
X-Frame-Options:
|
24
|
+
- SAMEORIGIN
|
25
|
+
X-Xss-Protection:
|
26
|
+
- 1; mode=block
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Etag:
|
32
|
+
- '"b580cf4171303fd650475e570ec9458a"'
|
33
|
+
Cache-Control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
X-Request-Id:
|
36
|
+
- 4805e85a-ca91-4769-8ad8-fdf643350c9a
|
37
|
+
X-Runtime:
|
38
|
+
- '0.948147'
|
39
|
+
Date:
|
40
|
+
- Thu, 03 Sep 2015 10:56:10 GMT
|
41
|
+
Connection:
|
42
|
+
- close
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: '{"total_score":25,"badges_total":1,"bronze_count":1,"silver_count":0,"gold_count":0,"platinum_count":0,"object":"recipient","badges":[{"name":"Book
|
46
|
+
Worm","description":"You have loaned out over 25 books. Nice going!","requirements":"Loan
|
47
|
+
out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/badge_images/book-worm/badge.png","collection_id":"library","created_at":"2015-09-03T10:51:07.831Z","updated_at":"2015-09-03T10:51:07.831Z","level":"bronze","auto_issue":false,"status":"live","points":25,"object":"badge","issued_at":"2015-09-03T10:51:08.232Z","id":"book-worm"}]}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Thu, 03 Sep 2015 10:56:10 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,199 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://gamification-api.dev/v1/badges/2/revoke
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: recipient=t.skarbek-wazynski%40lancaster.ac.uk
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Authorization:
|
13
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
Etag:
|
34
|
+
- '"3514db33f344216321fef093b35aabe2"'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- 291de80f-0b4f-4029-ba3e-639aae1ce8e4
|
39
|
+
X-Runtime:
|
40
|
+
- '0.032299'
|
41
|
+
Date:
|
42
|
+
- Thu, 16 Jul 2015 09:30:12 GMT
|
43
|
+
Connection:
|
44
|
+
- close
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '[{"name":"Book Worm","description":"You have loaned out over 25 books.
|
48
|
+
Nice going!","requirements":"Loan out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/uploads/badge/image/1/seed.png","collection_id":"library","created_at":"2015-07-16T09:21:22.448Z","updated_at":"2015-07-16T09:21:22.448Z","level":"bronze","image_greyscale":"http://gamification-api.dev/uploads/badge/image/1/grey_seed.png","required_badges":[],"points":25,"id":"book-worm"},{"name":"Night
|
49
|
+
Owl","description":"You loaned a book out between Midnight and 5 o''clock","requirements":"Loan
|
50
|
+
out a book between 00:00 - 5:00","hint":"It must be late...","image":"http://gamification-api.dev/uploads/badge/image/3/seed.png","collection_id":"library","created_at":"2015-07-16T09:21:22.605Z","updated_at":"2015-07-16T09:21:22.605Z","level":"bronze","image_greyscale":"http://gamification-api.dev/uploads/badge/image/3/grey_seed.png","required_badges":[],"points":25,"id":"night-owl"}]'
|
51
|
+
http_version:
|
52
|
+
recorded_at: Thu, 16 Jul 2015 09:30:12 GMT
|
53
|
+
- request:
|
54
|
+
method: post
|
55
|
+
uri: http://gamification-api.dev/v1/badges/2/issue
|
56
|
+
body:
|
57
|
+
encoding: UTF-8
|
58
|
+
string: recipient=t.skarbek-wazynski%40lancaster.ac.uk
|
59
|
+
headers:
|
60
|
+
User-Agent:
|
61
|
+
- Faraday v0.9.1
|
62
|
+
Authorization:
|
63
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
64
|
+
Content-Type:
|
65
|
+
- application/x-www-form-urlencoded
|
66
|
+
Accept-Encoding:
|
67
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
68
|
+
Accept:
|
69
|
+
- "*/*"
|
70
|
+
response:
|
71
|
+
status:
|
72
|
+
code: 400
|
73
|
+
message: Bad Request
|
74
|
+
headers:
|
75
|
+
X-Frame-Options:
|
76
|
+
- SAMEORIGIN
|
77
|
+
X-Xss-Protection:
|
78
|
+
- 1; mode=block
|
79
|
+
X-Content-Type-Options:
|
80
|
+
- nosniff
|
81
|
+
Content-Type:
|
82
|
+
- application/json; charset=utf-8
|
83
|
+
Cache-Control:
|
84
|
+
- no-cache
|
85
|
+
X-Request-Id:
|
86
|
+
- 9b2037e2-e370-417a-880e-06e07a73db19
|
87
|
+
X-Runtime:
|
88
|
+
- '0.020210'
|
89
|
+
Date:
|
90
|
+
- Thu, 16 Jul 2015 09:42:11 GMT
|
91
|
+
Connection:
|
92
|
+
- close
|
93
|
+
body:
|
94
|
+
encoding: UTF-8
|
95
|
+
string: '{"error":{"type":"invalid_request_error","message":"Cannot issue badge:
|
96
|
+
Mega Book Worm. The user has already been issued this badge","status":400}}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Thu, 16 Jul 2015 09:42:11 GMT
|
99
|
+
- request:
|
100
|
+
method: post
|
101
|
+
uri: http://gamification-api.dev/v1/badges/mega-book-worm/issue
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: recipient=t.skarbek-wazynski%40lancaster.ac.uk
|
105
|
+
headers:
|
106
|
+
User-Agent:
|
107
|
+
- Faraday v0.9.1
|
108
|
+
Authorization:
|
109
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
110
|
+
Content-Type:
|
111
|
+
- application/x-www-form-urlencoded
|
112
|
+
Accept-Encoding:
|
113
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
114
|
+
Accept:
|
115
|
+
- "*/*"
|
116
|
+
response:
|
117
|
+
status:
|
118
|
+
code: 200
|
119
|
+
message: OK
|
120
|
+
headers:
|
121
|
+
X-Frame-Options:
|
122
|
+
- SAMEORIGIN
|
123
|
+
X-Xss-Protection:
|
124
|
+
- 1; mode=block
|
125
|
+
X-Content-Type-Options:
|
126
|
+
- nosniff
|
127
|
+
Content-Type:
|
128
|
+
- application/json; charset=utf-8
|
129
|
+
Etag:
|
130
|
+
- '"645fdcd9ef4b502bd16d080088875170"'
|
131
|
+
Cache-Control:
|
132
|
+
- max-age=0, private, must-revalidate
|
133
|
+
X-Request-Id:
|
134
|
+
- a53e3dec-5855-4690-9e0a-3c4483663786
|
135
|
+
X-Runtime:
|
136
|
+
- '0.044444'
|
137
|
+
Date:
|
138
|
+
- Thu, 03 Sep 2015 10:56:00 GMT
|
139
|
+
Connection:
|
140
|
+
- close
|
141
|
+
body:
|
142
|
+
encoding: UTF-8
|
143
|
+
string: '{"total_score":75,"badges_total":2,"bronze_count":1,"silver_count":1,"gold_count":0,"platinum_count":0,"object":"recipient","badges":[{"name":"Book
|
144
|
+
Worm","description":"You have loaned out over 25 books. Nice going!","requirements":"Loan
|
145
|
+
out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/badge_images/book-worm/badge.png","collection_id":"library","created_at":"2015-09-03T10:51:07.831Z","updated_at":"2015-09-03T10:51:07.831Z","level":"bronze","auto_issue":false,"status":"live","points":25,"object":"badge","issued_at":"2015-09-03T10:51:08.232Z","id":"book-worm"},{"name":"Mega
|
146
|
+
Book Worm","description":"You have loaned out 50 books.","requirements":"Loan
|
147
|
+
out 50 books","hint":"You must really like books...","image":"http://gamification-api.dev/badge_images/mega-book-worm/badge.png","collection_id":"library","created_at":"2015-09-03T10:51:07.899Z","updated_at":"2015-09-03T10:51:07.899Z","level":"silver","auto_issue":false,"status":"live","points":50,"object":"badge","issued_at":"2015-09-03T10:56:00.871Z","id":"mega-book-worm"}]}'
|
148
|
+
http_version:
|
149
|
+
recorded_at: Thu, 03 Sep 2015 10:56:00 GMT
|
150
|
+
- request:
|
151
|
+
method: post
|
152
|
+
uri: http://gamification-api.dev/v1/badges/mega-book-worm/revoke
|
153
|
+
body:
|
154
|
+
encoding: UTF-8
|
155
|
+
string: recipient=t.skarbek-wazynski%40lancaster.ac.uk
|
156
|
+
headers:
|
157
|
+
User-Agent:
|
158
|
+
- Faraday v0.9.1
|
159
|
+
Authorization:
|
160
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
161
|
+
Content-Type:
|
162
|
+
- application/x-www-form-urlencoded
|
163
|
+
Accept-Encoding:
|
164
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
165
|
+
Accept:
|
166
|
+
- "*/*"
|
167
|
+
response:
|
168
|
+
status:
|
169
|
+
code: 200
|
170
|
+
message: OK
|
171
|
+
headers:
|
172
|
+
X-Frame-Options:
|
173
|
+
- SAMEORIGIN
|
174
|
+
X-Xss-Protection:
|
175
|
+
- 1; mode=block
|
176
|
+
X-Content-Type-Options:
|
177
|
+
- nosniff
|
178
|
+
Content-Type:
|
179
|
+
- application/json; charset=utf-8
|
180
|
+
Etag:
|
181
|
+
- '"b580cf4171303fd650475e570ec9458a"'
|
182
|
+
Cache-Control:
|
183
|
+
- max-age=0, private, must-revalidate
|
184
|
+
X-Request-Id:
|
185
|
+
- 81a6812c-712d-485d-8fba-6ad8679735a8
|
186
|
+
X-Runtime:
|
187
|
+
- '0.031274'
|
188
|
+
Date:
|
189
|
+
- Thu, 03 Sep 2015 10:56:00 GMT
|
190
|
+
Connection:
|
191
|
+
- close
|
192
|
+
body:
|
193
|
+
encoding: UTF-8
|
194
|
+
string: '{"total_score":25,"badges_total":1,"bronze_count":1,"silver_count":0,"gold_count":0,"platinum_count":0,"object":"recipient","badges":[{"name":"Book
|
195
|
+
Worm","description":"You have loaned out over 25 books. Nice going!","requirements":"Loan
|
196
|
+
out 25 books","hint":"You must like books...","image":"http://gamification-api.dev/badge_images/book-worm/badge.png","collection_id":"library","created_at":"2015-09-03T10:51:07.831Z","updated_at":"2015-09-03T10:51:07.831Z","level":"bronze","auto_issue":false,"status":"live","points":25,"object":"badge","issued_at":"2015-09-03T10:51:08.232Z","id":"book-worm"}]}'
|
197
|
+
http_version:
|
198
|
+
recorded_at: Thu, 03 Sep 2015 10:56:00 GMT
|
199
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://gamification-api.dev/v1/badges/3/revoke
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: recipient=t.skarbek-wazynski%40lancaster.ac.uk
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Authorization:
|
13
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 400
|
23
|
+
message: Bad Request
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Request-Id:
|
36
|
+
- 5c042623-58e2-4cac-aea0-a2cf291e16ba
|
37
|
+
X-Runtime:
|
38
|
+
- '0.025164'
|
39
|
+
Date:
|
40
|
+
- Thu, 03 Sep 2015 10:55:58 GMT
|
41
|
+
Connection:
|
42
|
+
- close
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: '{"error":{"type":"invalid_request_error","message":"Cannot revoke badge:
|
46
|
+
Night Owl. The user has not previously been issued this badge.","status":400}}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Thu, 03 Sep 2015 10:55:58 GMT
|
49
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,145 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://gamification-api.dev/v1/badges
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: badge%5Bcollection_id%5D=1&badge%5Bdescription%5D=This+is+a+new+badge&badge%5Bhint%5D=Love+us..&badge%5Blevel%5D=bronze&badge%5Bname%5D=Create+Badge+for+update&badge%5Brequirements%5D=You+need+to+love+the+Badge+API
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Authorization:
|
13
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
Etag:
|
34
|
+
- '"64cc3bfe4fa457cb1f24f998fb9cc877"'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- 6a97fd1a-3cad-4a71-931d-96196fd3a68d
|
39
|
+
X-Runtime:
|
40
|
+
- '0.072552'
|
41
|
+
Date:
|
42
|
+
- Thu, 03 Sep 2015 10:56:01 GMT
|
43
|
+
Connection:
|
44
|
+
- close
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"name":"Create Badge for update","description":"This is a new badge","requirements":"You
|
48
|
+
need to love the Badge API","hint":"Love us..","image":"http://gamification-api.dev/badge_images/create-badge-for-update/badge.png","collection_id":"library","created_at":"2015-09-03T10:56:00.983Z","updated_at":"2015-09-03T10:56:00.983Z","level":"bronze","auto_issue":false,"status":"draft","required_badges":[],"points":25,"object":"badge","id":"create-badge-for-update"}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Thu, 03 Sep 2015 10:56:01 GMT
|
51
|
+
- request:
|
52
|
+
method: patch
|
53
|
+
uri: http://gamification-api.dev/v1/badges/create-badge-for-update
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
string: badge%5Bcollection_id%5D=trim-trail&badge%5Bdescription%5D=Updated+Description&badge%5Bhint%5D=Updated+Hint&badge%5Bname%5D=Updated+Badge&badge%5Brequirements%5D=Updated+Requirements&badge%5Bstatus%5D=live
|
57
|
+
headers:
|
58
|
+
User-Agent:
|
59
|
+
- Faraday v0.9.1
|
60
|
+
Authorization:
|
61
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
62
|
+
Content-Type:
|
63
|
+
- application/x-www-form-urlencoded
|
64
|
+
Accept-Encoding:
|
65
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
66
|
+
Accept:
|
67
|
+
- "*/*"
|
68
|
+
response:
|
69
|
+
status:
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
X-Frame-Options:
|
74
|
+
- SAMEORIGIN
|
75
|
+
X-Xss-Protection:
|
76
|
+
- 1; mode=block
|
77
|
+
X-Content-Type-Options:
|
78
|
+
- nosniff
|
79
|
+
Content-Type:
|
80
|
+
- application/json; charset=utf-8
|
81
|
+
Etag:
|
82
|
+
- '"3ae1e3fd1bba522ad11c1d983e8e7b5d"'
|
83
|
+
Cache-Control:
|
84
|
+
- max-age=0, private, must-revalidate
|
85
|
+
X-Request-Id:
|
86
|
+
- 47698c58-428c-4ecd-993e-36695a45a5c4
|
87
|
+
X-Runtime:
|
88
|
+
- '0.069377'
|
89
|
+
Date:
|
90
|
+
- Thu, 03 Sep 2015 10:56:01 GMT
|
91
|
+
Connection:
|
92
|
+
- close
|
93
|
+
body:
|
94
|
+
encoding: UTF-8
|
95
|
+
string: '{"name":"Updated Badge","description":"Updated Description","requirements":"Updated
|
96
|
+
Requirements","hint":"Updated Hint","image":"http://gamification-api.dev/badge_images/updated-badge/badge.png","collection_id":"trim-trail","created_at":"2015-09-03T10:56:00.983Z","updated_at":"2015-09-03T10:56:01.070Z","level":"bronze","auto_issue":false,"status":"live","required_badges":[],"points":25,"object":"badge","id":"updated-badge"}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Thu, 03 Sep 2015 10:56:01 GMT
|
99
|
+
- request:
|
100
|
+
method: delete
|
101
|
+
uri: http://gamification-api.dev/v1/badges/create-badge-for-update
|
102
|
+
body:
|
103
|
+
encoding: US-ASCII
|
104
|
+
string: ''
|
105
|
+
headers:
|
106
|
+
User-Agent:
|
107
|
+
- Faraday v0.9.1
|
108
|
+
Authorization:
|
109
|
+
- Token token="c9cde524238644fa93393159e5e9ad87"
|
110
|
+
Accept-Encoding:
|
111
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
112
|
+
Accept:
|
113
|
+
- "*/*"
|
114
|
+
response:
|
115
|
+
status:
|
116
|
+
code: 200
|
117
|
+
message: OK
|
118
|
+
headers:
|
119
|
+
X-Frame-Options:
|
120
|
+
- SAMEORIGIN
|
121
|
+
X-Xss-Protection:
|
122
|
+
- 1; mode=block
|
123
|
+
X-Content-Type-Options:
|
124
|
+
- nosniff
|
125
|
+
Content-Type:
|
126
|
+
- application/json; charset=utf-8
|
127
|
+
Etag:
|
128
|
+
- '"3ae1e3fd1bba522ad11c1d983e8e7b5d"'
|
129
|
+
Cache-Control:
|
130
|
+
- max-age=0, private, must-revalidate
|
131
|
+
X-Request-Id:
|
132
|
+
- a1f67856-4738-4f27-bf2c-a9f58f70ce3d
|
133
|
+
X-Runtime:
|
134
|
+
- '0.028471'
|
135
|
+
Date:
|
136
|
+
- Thu, 03 Sep 2015 10:56:01 GMT
|
137
|
+
Connection:
|
138
|
+
- close
|
139
|
+
body:
|
140
|
+
encoding: UTF-8
|
141
|
+
string: '{"name":"Updated Badge","description":"Updated Description","requirements":"Updated
|
142
|
+
Requirements","hint":"Updated Hint","image":"http://gamification-api.dev/badge_images/updated-badge/badge.png","collection_id":"trim-trail","created_at":"2015-09-03T10:56:00.983Z","updated_at":"2015-09-03T10:56:01.070Z","level":"bronze","auto_issue":false,"status":"live","required_badges":[],"points":25,"object":"badge","id":"updated-badge"}'
|
143
|
+
http_version:
|
144
|
+
recorded_at: Thu, 03 Sep 2015 10:56:01 GMT
|
145
|
+
recorded_with: VCR 2.9.3
|