badgeapi 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +31 -0
  6. data/Rakefile +15 -0
  7. data/badgeapi.gemspec +33 -0
  8. data/lib/badgeapi/badge.rb +29 -0
  9. data/lib/badgeapi/badgeapi_object.rb +149 -0
  10. data/lib/badgeapi/collection.rb +10 -0
  11. data/lib/badgeapi/errors/api_error.rb +5 -0
  12. data/lib/badgeapi/errors/badgeapi_error.rb +18 -0
  13. data/lib/badgeapi/errors/invalid_request_error.rb +5 -0
  14. data/lib/badgeapi/recipient.rb +18 -0
  15. data/lib/badgeapi/version.rb +3 -0
  16. data/lib/badgeapi.rb +36 -0
  17. data/test/badge/badge_test.rb +469 -0
  18. data/test/badgeapi_test.rb +20 -0
  19. data/test/collection/collection_test.rb +275 -0
  20. data/test/fixtures/all_badges.yml +121 -0
  21. data/test/fixtures/all_badges_bad_user.yml +138 -0
  22. data/test/fixtures/all_badges_expanded.yml +196 -0
  23. data/test/fixtures/all_badges_from_collection.yml +52 -0
  24. data/test/fixtures/all_badges_issued.yml +430 -0
  25. data/test/fixtures/all_badges_limited.yml +49 -0
  26. data/test/fixtures/all_collection.yml +50 -0
  27. data/test/fixtures/all_collection_expanded.yml +131 -0
  28. data/test/fixtures/all_collection_limit.yml +49 -0
  29. data/test/fixtures/bad_Recipient.yml +183 -0
  30. data/test/fixtures/bad_Recipietn_request.yml +93 -0
  31. data/test/fixtures/bad_api_key.yml +49 -0
  32. data/test/fixtures/badge_error.yml +47 -0
  33. data/test/fixtures/badge_requirements.yml +351 -0
  34. data/test/fixtures/collection_error.yml +91 -0
  35. data/test/fixtures/create_badge.yml +97 -0
  36. data/test/fixtures/create_collection.yml +97 -0
  37. data/test/fixtures/create_new_badge_failure.yml +143 -0
  38. data/test/fixtures/create_new_collection_failure.yml +189 -0
  39. data/test/fixtures/destroy_badge.yml +277 -0
  40. data/test/fixtures/destroy_badge_error.yml +231 -0
  41. data/test/fixtures/destroy_collection.yml +185 -0
  42. data/test/fixtures/destroy_collection_error.yml +185 -0
  43. data/test/fixtures/issue_already_owned_badge.yml +49 -0
  44. data/test/fixtures/issue_badge_to_bad_user.yml +50 -0
  45. data/test/fixtures/issue_badge_to_user.yml +199 -0
  46. data/test/fixtures/issue_badge_to_user_with_library_card.yml +103 -0
  47. data/test/fixtures/one_badge.yml +49 -0
  48. data/test/fixtures/one_badge_expanded.yml +50 -0
  49. data/test/fixtures/one_collection.yml +49 -0
  50. data/test/fixtures/one_collection_expanded.yml +104 -0
  51. data/test/fixtures/recipient_with_badges.yml +187 -0
  52. data/test/fixtures/recipient_with_badges_unicard.yml +50 -0
  53. data/test/fixtures/revoke_badge_from_user.yml +199 -0
  54. data/test/fixtures/revoke_badge_not_issued.yml +49 -0
  55. data/test/fixtures/update_badge_via_update.yml +145 -0
  56. data/test/fixtures/update_badge_via_update_slug_history.yml +191 -0
  57. data/test/fixtures/update_collection.yml +191 -0
  58. data/test/fixtures/update_collection_via_update.yml +145 -0
  59. data/test/recipient/recipient_test.rb +108 -0
  60. data/test/test_helper.rb +11 -0
  61. metadata +274 -0
@@ -0,0 +1,275 @@
1
+ #test/collection/collection_test.rb
2
+ require './test/test_helper'
3
+
4
+ class BadgeapiCollectionTest < MiniTest::Test
5
+
6
+ def self.test_order
7
+ :alpha
8
+ end
9
+
10
+ def test_exists
11
+ assert Badgeapi::Collection
12
+ end
13
+
14
+ def test_object_path
15
+ assert_equal "collections", Badgeapi::Collection.collection_path
16
+ end
17
+
18
+ def test_object_name
19
+ assert_equal "collection", Badgeapi::Collection.member_name
20
+ end
21
+
22
+ def test_it_returns_back_a_single_collection
23
+ VCR.use_cassette('one_collection', :record => :all) do
24
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
25
+
26
+ collection = Badgeapi::Collection.find(1)
27
+ assert_equal Badgeapi::Collection, collection.class
28
+
29
+ assert_equal "library", collection.id
30
+ assert_equal "Library", collection.name
31
+ assert_equal 125, collection.total_points_available
32
+ assert_equal 4, collection.badge_count
33
+ assert_equal "Use your library and earn badges", collection.description
34
+ end
35
+ end
36
+
37
+ def test_it_returns_back_a_single_collection_expanded
38
+ VCR.use_cassette('one_collection_expanded', :record => :all) do
39
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
40
+
41
+ collection = Badgeapi::Collection.find(1, expand: "badges")
42
+
43
+ assert_equal Badgeapi::Collection, collection.class
44
+
45
+ assert_equal "library", collection.id
46
+ assert_equal "Library", collection.name
47
+ assert_equal 125, collection.total_points_available
48
+ assert_equal "Use your library and earn badges", collection.description
49
+
50
+ assert_equal Badgeapi::Badge, collection.badges[1].required_badges.first.class
51
+
52
+ assert_equal Badgeapi::Badge, collection.badges[0].class
53
+ assert_equal 4, collection.badges.length
54
+ assert_equal "Book Worm", collection.badges[0].name
55
+ assert_equal "bronze", collection.badges.first.level
56
+ assert_equal 25, collection.badges.first.points
57
+ end
58
+ end
59
+
60
+ def test_it_returns_back_all_collections
61
+ VCR.use_cassette('all_collection', :record => :all) do
62
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
63
+
64
+ result = Badgeapi::Collection.all
65
+
66
+ # Make sure we got all the badges
67
+ assert_equal 2, result.length
68
+
69
+ # Make sure that the JSON was parsed
70
+ assert result.kind_of?(Array)
71
+ assert result.first.kind_of?(Badgeapi::Collection)
72
+ end
73
+ end
74
+
75
+ def test_it_returns_back_all_collections_expanded
76
+ VCR.use_cassette('all_collection_expanded', :record => :all) do
77
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
78
+
79
+ result = Badgeapi::Collection.all(expand: "badges")
80
+
81
+ # Make sure we got all the badges
82
+ assert_equal 2, result.length
83
+
84
+ # Make sure that the JSON was parsed
85
+ assert result.kind_of?(Array)
86
+ assert result.first.kind_of?(Badgeapi::Collection)
87
+ assert result.first.badges.first.kind_of?(Badgeapi::Badge)
88
+ assert_equal "Book Worm", result.first.badges.first.name
89
+ assert_equal "bronze", result.first.badges.first.level
90
+ assert_equal 25, result.first.badges.first.points
91
+
92
+
93
+ result.first.badges.each do |badge|
94
+ assert_equal Badgeapi::Badge, badge.class
95
+ end
96
+ end
97
+ end
98
+
99
+ def test_all_limit
100
+ VCR.use_cassette('all_collection_limit', :record => :all) do
101
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
102
+
103
+ result = Badgeapi::Collection.all(limit: 1)
104
+
105
+ # Make sure we got all the badges
106
+ assert_equal 1, result.length
107
+
108
+ # Make sure that the JSON was parsed
109
+ assert result.kind_of?(Array)
110
+ assert result.first.kind_of?(Badgeapi::Collection)
111
+ end
112
+ end
113
+
114
+ def test_collections_raise_errors
115
+ VCR.use_cassette('collection_error', :record => :all) do
116
+ Badgeapi.api_key= 'c9cde524238644fa93393159e5e9ad87'
117
+
118
+ assert_raises(Badgeapi::InvalidRequestError) { Badgeapi::Collection.find(27) }
119
+
120
+ begin
121
+ Badgeapi::Collection.find(27)
122
+ rescue Badgeapi::InvalidRequestError => e
123
+ assert_equal(404, e.http_status)
124
+ refute_empty e.message
125
+ assert_equal(true, e.json_body.kind_of?(Hash))
126
+ end
127
+ end
128
+ end
129
+
130
+ def test_create_a_new_collection
131
+ VCR.use_cassette('create_collection', :record => :all) do
132
+
133
+ Badgeapi.api_key = 'c9cde524238644fa93393159e5e9ad87'
134
+
135
+ collection = Badgeapi::Collection.create(
136
+ name: "Create Collection Test",
137
+ description: "This is a new collection"
138
+ )
139
+
140
+ assert_equal Badgeapi::Collection, collection.class
141
+ assert_equal "Create Collection Test", collection.name
142
+ assert_equal "This is a new collection", collection.description
143
+
144
+ Badgeapi::Collection.destroy(collection.id)
145
+ end
146
+ end
147
+
148
+ def test_create_new_collection_failure
149
+ VCR.use_cassette('create_new_collection_failure', :record => :all) do
150
+
151
+ Badgeapi.api_key = 'c9cde524238644fa93393159e5e9ad87'
152
+
153
+ collection = Badgeapi::Collection.create(
154
+ name: "Create Collection Test Destroy",
155
+ description: "This is a new badge"
156
+ )
157
+
158
+ assert_raises(Badgeapi::InvalidRequestError) {
159
+ Badgeapi::Collection.create(
160
+ name: "Create Collection Test Destroy",
161
+ description: "This is a new badge"
162
+ )
163
+ }
164
+
165
+ begin
166
+ Badgeapi::Collection.create(
167
+ name: "Create Collection Test Destroy",
168
+ description: "This is a new badge"
169
+ )
170
+ rescue Badgeapi::InvalidRequestError => e
171
+ assert_equal(422, e.http_status)
172
+ refute_empty e.message
173
+ assert_equal(true, e.json_body.kind_of?(Hash))
174
+ end
175
+
176
+ Badgeapi::Collection.destroy(collection.id)
177
+ end
178
+ end
179
+
180
+ def test_collection_destroy
181
+ VCR.use_cassette('destroy_collection', :record => :all) do
182
+
183
+ Badgeapi.api_key = 'c9cde524238644fa93393159e5e9ad87'
184
+
185
+ collection = Badgeapi::Collection.create(
186
+ name: "Create Collection for Destroy",
187
+ description: "This is a new badge",
188
+ )
189
+
190
+ destroyed_collection = Badgeapi::Collection.destroy(collection.id)
191
+
192
+ assert_equal Badgeapi::Collection, destroyed_collection.class
193
+
194
+ assert_raises(Badgeapi::InvalidRequestError) { Badgeapi::Collection.find(destroyed_collection.id) }
195
+
196
+ begin
197
+ Badgeapi::Collection.find(destroyed_collection.id)
198
+ rescue Badgeapi::InvalidRequestError => e
199
+ assert_equal(404, e.http_status)
200
+ refute_empty e.message
201
+ assert_equal(true, e.json_body.kind_of?(Hash))
202
+ end
203
+ end
204
+ end
205
+
206
+ def test_collection_destroy_error
207
+ VCR.use_cassette('destroy_collection_error', :record => :all) do
208
+
209
+ Badgeapi.api_key = 'c9cde524238644fa93393159e5e9ad87'
210
+
211
+ collection = Badgeapi::Collection.create(
212
+ name: "Create Collection for Destroy",
213
+ description: "This is a new badge"
214
+ )
215
+
216
+ destroyed_collection = Badgeapi::Collection.destroy(collection.id)
217
+
218
+ assert_raises(Badgeapi::InvalidRequestError) { Badgeapi::Collection.destroy(collection.id) }
219
+
220
+ begin
221
+ Badgeapi::Collection.destroy(collection.id)
222
+ rescue Badgeapi::InvalidRequestError => e
223
+ assert_equal(404, e.http_status)
224
+ refute_empty e.message
225
+ assert_equal(true, e.json_body.kind_of?(Hash))
226
+ end
227
+ end
228
+ end
229
+
230
+ def test_update_collection
231
+ VCR.use_cassette('update_collection', :record => :all) do
232
+
233
+ Badgeapi.api_key= 'c9cde524238644fa93393159e5e9ad87'
234
+
235
+ collection = Badgeapi::Collection.create(
236
+ name: "Create Collection for update",
237
+ description: "This is a new collection",
238
+ )
239
+
240
+ collection.name = "Updated Collection"
241
+ collection.description = "Updated Collection"
242
+
243
+ collection.save
244
+
245
+ updated_collection = Badgeapi::Collection.find(collection.id)
246
+
247
+ assert_equal "Updated Collection", updated_collection.name
248
+ assert_equal "Updated Collection", updated_collection.description
249
+
250
+ Badgeapi::Collection.destroy(collection.id)
251
+ end
252
+ end
253
+
254
+ def test_update_collection_via_update
255
+ VCR.use_cassette('update_collection_via_update', :record => :all) do
256
+
257
+ Badgeapi.api_key= 'c9cde524238644fa93393159e5e9ad87'
258
+
259
+ collection = Badgeapi::Collection.create(
260
+ name: "Create Collection for update",
261
+ description: "This is a new collection",
262
+ )
263
+
264
+ updated_collection = Badgeapi::Collection.update(collection.id,
265
+ name: "Updated Badge",
266
+ description: "Updated Description",
267
+ )
268
+
269
+ assert_equal "Updated Badge", updated_collection.name
270
+ assert_equal "Updated Description", updated_collection.description
271
+
272
+ Badgeapi::Collection.destroy(collection.id)
273
+ end
274
+ end
275
+ end
@@ -0,0 +1,121 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/badges
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
+ - '"77ec5b377e795c568ad37937b979e76d"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ X-Request-Id:
36
+ - c565e004-c267-4e38-89b2-bd93428dd115
37
+ X-Runtime:
38
+ - '0.025329'
39
+ Date:
40
+ - Thu, 03 Sep 2015 10:55:57 GMT
41
+ Connection:
42
+ - close
43
+ body:
44
+ encoding: ASCII-8BIT
45
+ string: !binary |-
46
+ W3sibmFtZSI6IkJvb2sgV29ybSIsImRlc2NyaXB0aW9uIjoiWW91IGhhdmUg
47
+ bG9hbmVkIG91dCBvdmVyIDI1IGJvb2tzLiBOaWNlIGdvaW5nISIsInJlcXVp
48
+ cmVtZW50cyI6IkxvYW4gb3V0IDI1IGJvb2tzIiwiaGludCI6IllvdSBtdXN0
49
+ IGxpa2UgYm9va3MuLi4iLCJpbWFnZSI6Imh0dHA6Ly9nYW1pZmljYXRpb24t
50
+ YXBpLmRldi9iYWRnZV9pbWFnZXMvYm9vay13b3JtL2JhZGdlLnBuZyIsImNv
51
+ bGxlY3Rpb25faWQiOiJsaWJyYXJ5IiwiY3JlYXRlZF9hdCI6IjIwMTUtMDkt
52
+ MDNUMTA6NTE6MDcuODMxWiIsInVwZGF0ZWRfYXQiOiIyMDE1LTA5LTAzVDEw
53
+ OjUxOjA3LjgzMVoiLCJsZXZlbCI6ImJyb256ZSIsImF1dG9faXNzdWUiOmZh
54
+ bHNlLCJzdGF0dXMiOiJsaXZlIiwicmVxdWlyZWRfYmFkZ2VzIjpbXSwicG9p
55
+ bnRzIjoyNSwib2JqZWN0IjoiYmFkZ2UiLCJpZCI6ImJvb2std29ybSJ9LHsi
56
+ bmFtZSI6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NTE6MDguMDc3
105
+ WiIsImxldmVsIjoiYnJvbnplIiwiYXV0b19pc3N1ZSI6ZmFsc2UsInN0YXR1
106
+ cyI6ImxpdmUiLCJyZXF1aXJlZF9iYWRnZXMiOltdLCJwb2ludHMiOjI1LCJv
107
+ YmplY3QiOiJiYWRnZSIsImlkIjoieW91LXRyaW0tdHJhaWxlZCJ9LHsibmFt
108
+ ZSI6Ik1hcmF0aG9uIE1hbiIsImRlc2NyaXB0aW9uIjoiWW91IGhhdmUgcnVu
109
+ IDEwIGxhcHMgb2YgdGhlIHRyaXBzIHRyYWlsIHRoYXQgaXMgNDcga2lsb21l
110
+ dGVycyIsInJlcXVpcmVtZW50cyI6IkNvbXBsZXRlIDEwIGxhcHMgb2YgdGhl
111
+ IHRyaW0gdHJhaWwgb3ZlciBhbnkgdGltZSIsImhpbnQiOiJLZWVwIGdvaW5n
112
+ Li4uIiwiaW1hZ2UiOiJodHRwOi8vZ2FtaWZpY2F0aW9uLWFwaS5kZXYvYmFk
113
+ Z2VfaW1hZ2VzL21hcmF0aG9uLW1hbi9iYWRnZS5wbmciLCJjb2xsZWN0aW9u
114
+ X2lkIjoidHJpbS10cmFpbCIsImNyZWF0ZWRfYXQiOiIyMDE1LTA5LTAzVDEw
115
+ OjUxOjA4LjE1MFoiLCJ1cGRhdGVkX2F0IjoiMjAxNS0wOS0wM1QxMDo1MTow
116
+ OC4xNTBaIiwibGV2ZWwiOiJnb2xkIiwiYXV0b19pc3N1ZSI6ZmFsc2UsInN0
117
+ YXR1cyI6ImxpdmUiLCJyZXF1aXJlZF9iYWRnZXMiOltdLCJwb2ludHMiOjc1
118
+ LCJvYmplY3QiOiJiYWRnZSIsImlkIjoibWFyYXRob24tbWFuIn1d
119
+ http_version:
120
+ recorded_at: Thu, 03 Sep 2015 10:55:57 GMT
121
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,138 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/badges?user=t.skarbek-wazynski
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: 404
21
+ message: Not Found
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
+ - db1f2728-a172-467b-8339-16cb17a2ec11
35
+ X-Runtime:
36
+ - '0.015889'
37
+ Date:
38
+ - Thu, 03 Sep 2015 10:55:56 GMT
39
+ Connection:
40
+ - close
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
44
+ user with specified data t.skarbek-wazynski. Recipient data must be a university
45
+ email address, university card number or username.","status":404}}'
46
+ http_version:
47
+ recorded_at: Thu, 03 Sep 2015 10:55:56 GMT
48
+ - request:
49
+ method: get
50
+ uri: http://gamification-api.dev/v1/badges?user=t.skarbek-wazynsky@lancaster.ac.uk
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: 404
66
+ message: Not Found
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
+ - 74d8df1b-c7aa-43f6-b7d5-812ab3bc175d
80
+ X-Runtime:
81
+ - '0.018328'
82
+ Date:
83
+ - Thu, 03 Sep 2015 10:55:56 GMT
84
+ Connection:
85
+ - close
86
+ body:
87
+ encoding: UTF-8
88
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
89
+ user with specified data t.skarbek-wazynsky@lancaster.ac.uk. Recipient data
90
+ must be a university email address, university card number or username.","status":404}}'
91
+ http_version:
92
+ recorded_at: Thu, 03 Sep 2015 10:55:56 GMT
93
+ - request:
94
+ method: get
95
+ uri: http://gamification-api.dev/v1/badges?user=081897144451
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: 404
111
+ message: Not Found
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
+ Cache-Control:
122
+ - no-cache
123
+ X-Request-Id:
124
+ - 11d59226-2cfe-4384-9e34-d9c2e29b9b57
125
+ X-Runtime:
126
+ - '0.981996'
127
+ Date:
128
+ - Thu, 03 Sep 2015 10:55:57 GMT
129
+ Connection:
130
+ - close
131
+ body:
132
+ encoding: UTF-8
133
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
134
+ user with specified data 081897144451. Recipient data must be a university
135
+ email address, university card number or username.","status":404}}'
136
+ http_version:
137
+ recorded_at: Thu, 03 Sep 2015 10:55:57 GMT
138
+ recorded_with: VCR 2.9.3