badgeapi 0.3.10 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.rubocop.yml +147 -0
  4. data/README.md +44 -12
  5. data/Rakefile +24 -11
  6. data/badgeapi.gemspec +23 -22
  7. data/lib/badgeapi/badge.rb +24 -27
  8. data/lib/badgeapi/badgeapi_object.rb +160 -147
  9. data/lib/badgeapi/collection.rb +6 -9
  10. data/lib/badgeapi/errors/api_error.rb +3 -4
  11. data/lib/badgeapi/errors/badgeapi_error.rb +15 -15
  12. data/lib/badgeapi/errors/invalid_request_error.rb +3 -4
  13. data/lib/badgeapi/recipient.rb +13 -16
  14. data/lib/badgeapi/version.rb +1 -1
  15. data/lib/badgeapi.rb +13 -15
  16. data/test/badge/badge_test.rb +71 -150
  17. data/test/badgeapi_test.rb +4 -0
  18. data/test/collection/collection_test.rb +43 -77
  19. data/test/fixtures/badge_all.yml +113 -0
  20. data/test/fixtures/{bad_api_key.yml → badge_all_bad_user.yml} +14 -13
  21. data/test/fixtures/{all_badges_bad_user.yml → badge_all_badges_bad_user.yml} +16 -57
  22. data/test/fixtures/badge_all_expanded.yml +184 -0
  23. data/test/fixtures/badge_all_from_collection.yml +52 -0
  24. data/test/fixtures/badge_all_issued.yml +99 -0
  25. data/test/fixtures/{all_badges_limited.yml → badge_all_limited.yml} +10 -8
  26. data/test/fixtures/{create_badge.yml → badge_create.yml} +20 -16
  27. data/test/fixtures/{create_new_badge_failure.yml → badge_create_new.yml} +28 -22
  28. data/test/fixtures/badge_destroy.yml +147 -0
  29. data/test/fixtures/badge_destroy_error.yml +147 -0
  30. data/test/fixtures/badge_error.yml +54 -6
  31. data/test/fixtures/{issue_badge_to_bad_user.yml → badge_issue_to_bad_user.yml} +8 -6
  32. data/test/fixtures/badge_issue_to_user.yml +107 -0
  33. data/test/fixtures/{issue_badge_to_user_with_library_card.yml → badge_issue_to_user_with_library_card.yml} +21 -17
  34. data/test/fixtures/{one_badge.yml → badge_one.yml} +10 -8
  35. data/test/fixtures/{one_badge_expanded.yml → badge_one_expanded.yml} +11 -9
  36. data/test/fixtures/badge_requirements.yml +150 -105
  37. data/test/fixtures/badge_revoke_from_user.yml +107 -0
  38. data/test/fixtures/{update_badge_via_update.yml → badge_update_via_update.yml} +31 -25
  39. data/test/fixtures/{update_badge_via_update_slug_history.yml → badge_update_via_update_slug_history.yml} +41 -33
  40. data/test/fixtures/{all_collection.yml → collection_all.yml} +11 -9
  41. data/test/fixtures/collection_all_expanded.yml +123 -0
  42. data/test/fixtures/{all_collection_limit.yml → collection_all_limit.yml} +10 -8
  43. data/test/fixtures/{create_collection.yml → collection_create.yml} +20 -16
  44. data/test/fixtures/{create_new_collection_failure.yml → collection_create_new_failure.yml} +36 -28
  45. data/test/fixtures/{destroy_collection.yml → collection_destroy.yml} +36 -28
  46. data/test/fixtures/{destroy_collection_error.yml → collection_destroy_error.yml} +36 -28
  47. data/test/fixtures/collection_error.yml +108 -12
  48. data/test/fixtures/{one_collection.yml → collection_one.yml} +10 -8
  49. data/test/fixtures/collection_one_expanded.yml +106 -0
  50. data/test/fixtures/{update_collection.yml → collection_update.yml} +40 -32
  51. data/test/fixtures/{update_collection_via_update.yml → collection_update_via_update.yml} +30 -24
  52. data/test/fixtures/{bad_Recipietn_request.yml → recipient_bad_user_data.yml} +26 -22
  53. data/test/fixtures/recipient_with_badges.yml +20 -108
  54. data/test/fixtures/recipient_with_badges_unicard.yml +151 -8
  55. data/test/recipient/recipient_test.rb +11 -29
  56. metadata +69 -73
  57. data/test/fixtures/all_badges.yml +0 -121
  58. data/test/fixtures/all_badges_expanded.yml +0 -196
  59. data/test/fixtures/all_badges_from_collection.yml +0 -52
  60. data/test/fixtures/all_badges_issued.yml +0 -430
  61. data/test/fixtures/all_collection_expanded.yml +0 -131
  62. data/test/fixtures/bad_Recipient.yml +0 -183
  63. data/test/fixtures/destroy_badge.yml +0 -277
  64. data/test/fixtures/destroy_badge_error.yml +0 -231
  65. data/test/fixtures/issue_already_owned_badge.yml +0 -49
  66. data/test/fixtures/issue_badge_to_user.yml +0 -199
  67. data/test/fixtures/one_collection_expanded.yml +0 -104
  68. data/test/fixtures/revoke_badge_from_user.yml +0 -199
  69. data/test/fixtures/revoke_badge_not_issued.yml +0 -49
@@ -2,13 +2,154 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://gamification-api.dev/v1/recipients?user=0043181
5
+ uri: https://gamification-api.dev/v1/recipients?user=j.stennet.lancaster.ac.uk
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - Faraday v0.9.1
11
+ - Faraday v0.9.2
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
+ Strict-Transport-Security:
24
+ - max-age=31536000
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
+ - 7f7345e0-2b0a-4ab7-9ad1-ad4fef250fb6
37
+ X-Runtime:
38
+ - '0.016789'
39
+ Date:
40
+ - Thu, 19 Nov 2015 14:14:46 GMT
41
+ Connection:
42
+ - close
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
46
+ user with specified data j.stennet.lancaster.ac.uk. Recipient data must be
47
+ a university email address, university card number or username.","status":404}}'
48
+ http_version:
49
+ recorded_at: Thu, 19 Nov 2015 14:14:46 GMT
50
+ - request:
51
+ method: get
52
+ uri: https://gamification-api.dev/v1/recipients?user=j.stennet@lancaster.ac.uk
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ''
56
+ headers:
57
+ User-Agent:
58
+ - Faraday v0.9.2
59
+ Authorization:
60
+ - Token token="c9cde524238644fa93393159e5e9ad87"
61
+ Accept-Encoding:
62
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
63
+ Accept:
64
+ - "*/*"
65
+ response:
66
+ status:
67
+ code: 404
68
+ message: Not Found
69
+ headers:
70
+ Strict-Transport-Security:
71
+ - max-age=31536000
72
+ X-Frame-Options:
73
+ - SAMEORIGIN
74
+ X-Xss-Protection:
75
+ - 1; mode=block
76
+ X-Content-Type-Options:
77
+ - nosniff
78
+ Content-Type:
79
+ - application/json; charset=utf-8
80
+ Cache-Control:
81
+ - no-cache
82
+ X-Request-Id:
83
+ - f6b6500f-5db3-4ab4-ad24-7cc2b793a7d4
84
+ X-Runtime:
85
+ - '0.018203'
86
+ Date:
87
+ - Thu, 19 Nov 2015 14:14:56 GMT
88
+ Connection:
89
+ - close
90
+ body:
91
+ encoding: UTF-8
92
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
93
+ user with specified data j.stennet@lancaster.ac.uk. Recipient data must be
94
+ a university email address, university card number or username.","status":404}}'
95
+ http_version:
96
+ recorded_at: Thu, 19 Nov 2015 14:14:56 GMT
97
+ - request:
98
+ method: get
99
+ uri: https://gamification-api.dev/v1/recipients?user=j.stennett@lancaster.ac.uk
100
+ body:
101
+ encoding: US-ASCII
102
+ string: ''
103
+ headers:
104
+ User-Agent:
105
+ - Faraday v0.9.2
106
+ Authorization:
107
+ - Token token="c9cde524238644fa93393159e5e9ad87"
108
+ Accept-Encoding:
109
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
110
+ Accept:
111
+ - "*/*"
112
+ response:
113
+ status:
114
+ code: 200
115
+ message: OK
116
+ headers:
117
+ Strict-Transport-Security:
118
+ - max-age=31536000
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
+ - '"142264d94121989e7f083bdc1e6d7bda"'
129
+ Cache-Control:
130
+ - max-age=0, private, must-revalidate
131
+ X-Request-Id:
132
+ - fa40b11f-c83c-4d18-8bb1-77d001832126
133
+ X-Runtime:
134
+ - '0.025618'
135
+ Date:
136
+ - Thu, 19 Nov 2015 14:15:22 GMT
137
+ Connection:
138
+ - close
139
+ body:
140
+ encoding: UTF-8
141
+ string: '{"total_score":0,"badges_total":0,"bronze_count":0,"silver_count":0,"gold_count":0,"platinum_count":0,"object":"recipient","badges":[]}'
142
+ http_version:
143
+ recorded_at: Thu, 19 Nov 2015 14:15:22 GMT
144
+ - request:
145
+ method: get
146
+ uri: https://gamification-api.dev/v1/recipients?user=0043181
147
+ body:
148
+ encoding: US-ASCII
149
+ string: ''
150
+ headers:
151
+ User-Agent:
152
+ - Faraday v0.9.2
12
153
  Authorization:
13
154
  - Token token="c9cde524238644fa93393159e5e9ad87"
14
155
  Accept-Encoding:
@@ -20,6 +161,8 @@ http_interactions:
20
161
  code: 200
21
162
  message: OK
22
163
  headers:
164
+ Strict-Transport-Security:
165
+ - max-age=31536000
23
166
  X-Frame-Options:
24
167
  - SAMEORIGIN
25
168
  X-Xss-Protection:
@@ -29,22 +172,22 @@ http_interactions:
29
172
  Content-Type:
30
173
  - application/json; charset=utf-8
31
174
  Etag:
32
- - '"b580cf4171303fd650475e570ec9458a"'
175
+ - '"365681d5132a5e92b7946178e30b2356"'
33
176
  Cache-Control:
34
177
  - max-age=0, private, must-revalidate
35
178
  X-Request-Id:
36
- - 4805e85a-ca91-4769-8ad8-fdf643350c9a
179
+ - 7497ac36-d439-4f8a-96fc-2994172f47cf
37
180
  X-Runtime:
38
- - '0.948147'
181
+ - '1.336922'
39
182
  Date:
40
- - Thu, 03 Sep 2015 10:56:10 GMT
183
+ - Thu, 19 Nov 2015 14:15:36 GMT
41
184
  Connection:
42
185
  - close
43
186
  body:
44
187
  encoding: UTF-8
45
188
  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
189
  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"}]}'
190
+ out 25 books","hint":"You must like books...","image":"https://gamification-api.dev/badge_images/book-worm/badge.png","collection_id":"library","created_at":"2015-11-18T11:39:58.956Z","updated_at":"2015-11-18T11:39:58.956Z","level":"bronze","auto_issue":false,"status":"live","points":25,"object":"badge","issued_at":"2015-11-18T11:40:26.379Z","id":"book-worm"}]}'
48
191
  http_version:
49
- recorded_at: Thu, 03 Sep 2015 10:56:10 GMT
192
+ recorded_at: Thu, 19 Nov 2015 14:15:36 GMT
50
193
  recorded_with: VCR 2.9.3
@@ -3,6 +3,10 @@ require './test/test_helper'
3
3
 
4
4
  class BadgeapiCollectionTest < MiniTest::Test
5
5
 
6
+ Badgeapi.api_base = 'https://gamification-api.dev/v1'
7
+ Badgeapi.ssl_ca_cert='/Users/tomskarbek/.tunnelss/ca/cert.pem'
8
+ Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
9
+
6
10
  def self.test_order
7
11
  :alpha
8
12
  end
@@ -20,8 +24,7 @@ class BadgeapiCollectionTest < MiniTest::Test
20
24
  end
21
25
 
22
26
  def test_it_return_back_recipient_stats
23
- VCR.use_cassette('recipient_with_badges', :record => :all) do
24
- Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
27
+ VCR.use_cassette('recipient_with_badges') do
25
28
 
26
29
  recipient = Badgeapi::Recipient.find(recipient: "t.skarbek-wazynski@lancaster.ac.uk")
27
30
 
@@ -34,14 +37,12 @@ class BadgeapiCollectionTest < MiniTest::Test
34
37
  assert_kind_of Integer, recipient.gold_count
35
38
  assert_kind_of Integer, recipient.platinum_count
36
39
 
37
- assert_equal Badgeapi::Badge, recipient.badges.first.class
40
+ assert_equal Array, recipient.badges.class
38
41
  end
39
42
  end
40
43
 
41
44
  def test_it_return_back_recipient_stats_with_unicard
42
- VCR.use_cassette('recipient_with_badges_unicard', :record => :all) do
43
- Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
44
-
45
+ VCR.use_cassette('recipient_with_badges_unicard') do
45
46
  recipient = Badgeapi::Recipient.find(user: "0043181")
46
47
 
47
48
  assert_equal recipient.class, Badgeapi::Recipient
@@ -53,13 +54,12 @@ class BadgeapiCollectionTest < MiniTest::Test
53
54
  assert_kind_of Integer, recipient.gold_count
54
55
  assert_kind_of Integer, recipient.platinum_count
55
56
 
56
- assert_equal Badgeapi::Badge, recipient.badges.first.class
57
+ assert_equal Array, recipient.badges.class
57
58
  end
58
59
  end
59
60
 
60
61
  def test_it_raise_issue_if_bad_user
61
- VCR.use_cassette('bad_Recipient', :record => :all) do
62
- Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
62
+ VCR.use_cassette('recipient_bad_user_data') do
63
63
 
64
64
  assert_raises(Badgeapi::InvalidRequestError) { Badgeapi::Recipient.find(user: "dfsgsdgg") }
65
65
 
@@ -73,26 +73,8 @@ class BadgeapiCollectionTest < MiniTest::Test
73
73
  end
74
74
  end
75
75
 
76
- def test_it_raise_issue_if_bad_user_does_not_yet_exist
77
- VCR.use_cassette('bad_Recipient', :record => :all) do
78
- Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
79
-
80
- assert_raises(Badgeapi::InvalidRequestError) { Badgeapi::Recipient.find(user: "j.stennet@lancaster.ac.uk") }
81
-
82
- begin
83
- Badgeapi::Recipient.find(user: "j.stennet@lancaster.ac.uk")
84
- rescue Badgeapi::InvalidRequestError => e
85
- assert_equal(404, e.http_status)
86
- refute_empty e.message
87
- assert_equal(true, e.json_body.kind_of?(Hash))
88
- end
89
- end
90
- end
91
-
92
-
93
76
  def test_you_cannot_request_any_other_function_on_recipients
94
- VCR.use_cassette('bad_recipient_request', :record => :all) do
95
- Badgeapi.api_key = "c9cde524238644fa93393159e5e9ad87"
77
+ VCR.use_cassette('recipient_other_request') do
96
78
 
97
79
  assert_raises(NoMethodError) { Badgeapi::Recipient.all }
98
80
 
@@ -105,4 +87,4 @@ class BadgeapiCollectionTest < MiniTest::Test
105
87
  assert_raises(NoMethodError) { Badgeapi::Recipient.destroy(1) }
106
88
  end
107
89
  end
108
- end
90
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: badgeapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Skarbek Wazynski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -136,8 +136,9 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '10.0'
139
- description: Allows you to connect to Lancaster University's Badge API to manipulate
140
- badges, issue badges and display badges.
139
+ description: |-
140
+ Allows you to connect to Lancaster University's Badge API
141
+ to manipulate badges, issue badges and display badges.
141
142
  email:
142
143
  - wazynski@gmail.com
143
144
  executables: []
@@ -145,6 +146,7 @@ extensions: []
145
146
  extra_rdoc_files: []
146
147
  files:
147
148
  - ".gitignore"
149
+ - ".rubocop.yml"
148
150
  - Gemfile
149
151
  - LICENSE.txt
150
152
  - README.md
@@ -162,45 +164,42 @@ files:
162
164
  - test/badge/badge_test.rb
163
165
  - test/badgeapi_test.rb
164
166
  - test/collection/collection_test.rb
165
- - test/fixtures/all_badges.yml
166
- - test/fixtures/all_badges_bad_user.yml
167
- - test/fixtures/all_badges_expanded.yml
168
- - test/fixtures/all_badges_from_collection.yml
169
- - test/fixtures/all_badges_issued.yml
170
- - test/fixtures/all_badges_limited.yml
171
- - test/fixtures/all_collection.yml
172
- - test/fixtures/all_collection_expanded.yml
173
- - test/fixtures/all_collection_limit.yml
174
- - test/fixtures/bad_Recipient.yml
175
- - test/fixtures/bad_Recipietn_request.yml
176
- - test/fixtures/bad_api_key.yml
167
+ - test/fixtures/badge_all.yml
168
+ - test/fixtures/badge_all_bad_user.yml
169
+ - test/fixtures/badge_all_badges_bad_user.yml
170
+ - test/fixtures/badge_all_expanded.yml
171
+ - test/fixtures/badge_all_from_collection.yml
172
+ - test/fixtures/badge_all_issued.yml
173
+ - test/fixtures/badge_all_limited.yml
174
+ - test/fixtures/badge_create.yml
175
+ - test/fixtures/badge_create_new.yml
176
+ - test/fixtures/badge_destroy.yml
177
+ - test/fixtures/badge_destroy_error.yml
177
178
  - test/fixtures/badge_error.yml
179
+ - test/fixtures/badge_issue_to_bad_user.yml
180
+ - test/fixtures/badge_issue_to_user.yml
181
+ - test/fixtures/badge_issue_to_user_with_library_card.yml
182
+ - test/fixtures/badge_one.yml
183
+ - test/fixtures/badge_one_expanded.yml
178
184
  - test/fixtures/badge_requirements.yml
185
+ - test/fixtures/badge_revoke_from_user.yml
186
+ - test/fixtures/badge_update_via_update.yml
187
+ - test/fixtures/badge_update_via_update_slug_history.yml
188
+ - test/fixtures/collection_all.yml
189
+ - test/fixtures/collection_all_expanded.yml
190
+ - test/fixtures/collection_all_limit.yml
191
+ - test/fixtures/collection_create.yml
192
+ - test/fixtures/collection_create_new_failure.yml
193
+ - test/fixtures/collection_destroy.yml
194
+ - test/fixtures/collection_destroy_error.yml
179
195
  - test/fixtures/collection_error.yml
180
- - test/fixtures/create_badge.yml
181
- - test/fixtures/create_collection.yml
182
- - test/fixtures/create_new_badge_failure.yml
183
- - test/fixtures/create_new_collection_failure.yml
184
- - test/fixtures/destroy_badge.yml
185
- - test/fixtures/destroy_badge_error.yml
186
- - test/fixtures/destroy_collection.yml
187
- - test/fixtures/destroy_collection_error.yml
188
- - test/fixtures/issue_already_owned_badge.yml
189
- - test/fixtures/issue_badge_to_bad_user.yml
190
- - test/fixtures/issue_badge_to_user.yml
191
- - test/fixtures/issue_badge_to_user_with_library_card.yml
192
- - test/fixtures/one_badge.yml
193
- - test/fixtures/one_badge_expanded.yml
194
- - test/fixtures/one_collection.yml
195
- - test/fixtures/one_collection_expanded.yml
196
+ - test/fixtures/collection_one.yml
197
+ - test/fixtures/collection_one_expanded.yml
198
+ - test/fixtures/collection_update.yml
199
+ - test/fixtures/collection_update_via_update.yml
200
+ - test/fixtures/recipient_bad_user_data.yml
196
201
  - test/fixtures/recipient_with_badges.yml
197
202
  - test/fixtures/recipient_with_badges_unicard.yml
198
- - test/fixtures/revoke_badge_from_user.yml
199
- - test/fixtures/revoke_badge_not_issued.yml
200
- - test/fixtures/update_badge_via_update.yml
201
- - test/fixtures/update_badge_via_update_slug_history.yml
202
- - test/fixtures/update_collection.yml
203
- - test/fixtures/update_collection_via_update.yml
204
203
  - test/recipient/recipient_test.rb
205
204
  - test/test_helper.rb
206
205
  homepage: http://innovationhub.lancaster.ac.uk
@@ -226,49 +225,46 @@ rubyforge_project:
226
225
  rubygems_version: 2.4.5
227
226
  signing_key:
228
227
  specification_version: 4
229
- summary: A basic API wrapper for Lancaster University's Badge API.
228
+ summary: A basic API wrapper for Lancaster University's Badge API
230
229
  test_files:
231
230
  - test/badge/badge_test.rb
232
231
  - test/badgeapi_test.rb
233
232
  - test/collection/collection_test.rb
234
- - test/fixtures/all_badges.yml
235
- - test/fixtures/all_badges_bad_user.yml
236
- - test/fixtures/all_badges_expanded.yml
237
- - test/fixtures/all_badges_from_collection.yml
238
- - test/fixtures/all_badges_issued.yml
239
- - test/fixtures/all_badges_limited.yml
240
- - test/fixtures/all_collection.yml
241
- - test/fixtures/all_collection_expanded.yml
242
- - test/fixtures/all_collection_limit.yml
243
- - test/fixtures/bad_Recipient.yml
244
- - test/fixtures/bad_Recipietn_request.yml
245
- - test/fixtures/bad_api_key.yml
233
+ - test/fixtures/badge_all.yml
234
+ - test/fixtures/badge_all_bad_user.yml
235
+ - test/fixtures/badge_all_badges_bad_user.yml
236
+ - test/fixtures/badge_all_expanded.yml
237
+ - test/fixtures/badge_all_from_collection.yml
238
+ - test/fixtures/badge_all_issued.yml
239
+ - test/fixtures/badge_all_limited.yml
240
+ - test/fixtures/badge_create.yml
241
+ - test/fixtures/badge_create_new.yml
242
+ - test/fixtures/badge_destroy.yml
243
+ - test/fixtures/badge_destroy_error.yml
246
244
  - test/fixtures/badge_error.yml
245
+ - test/fixtures/badge_issue_to_bad_user.yml
246
+ - test/fixtures/badge_issue_to_user.yml
247
+ - test/fixtures/badge_issue_to_user_with_library_card.yml
248
+ - test/fixtures/badge_one.yml
249
+ - test/fixtures/badge_one_expanded.yml
247
250
  - test/fixtures/badge_requirements.yml
251
+ - test/fixtures/badge_revoke_from_user.yml
252
+ - test/fixtures/badge_update_via_update.yml
253
+ - test/fixtures/badge_update_via_update_slug_history.yml
254
+ - test/fixtures/collection_all.yml
255
+ - test/fixtures/collection_all_expanded.yml
256
+ - test/fixtures/collection_all_limit.yml
257
+ - test/fixtures/collection_create.yml
258
+ - test/fixtures/collection_create_new_failure.yml
259
+ - test/fixtures/collection_destroy.yml
260
+ - test/fixtures/collection_destroy_error.yml
248
261
  - test/fixtures/collection_error.yml
249
- - test/fixtures/create_badge.yml
250
- - test/fixtures/create_collection.yml
251
- - test/fixtures/create_new_badge_failure.yml
252
- - test/fixtures/create_new_collection_failure.yml
253
- - test/fixtures/destroy_badge.yml
254
- - test/fixtures/destroy_badge_error.yml
255
- - test/fixtures/destroy_collection.yml
256
- - test/fixtures/destroy_collection_error.yml
257
- - test/fixtures/issue_already_owned_badge.yml
258
- - test/fixtures/issue_badge_to_bad_user.yml
259
- - test/fixtures/issue_badge_to_user.yml
260
- - test/fixtures/issue_badge_to_user_with_library_card.yml
261
- - test/fixtures/one_badge.yml
262
- - test/fixtures/one_badge_expanded.yml
263
- - test/fixtures/one_collection.yml
264
- - test/fixtures/one_collection_expanded.yml
262
+ - test/fixtures/collection_one.yml
263
+ - test/fixtures/collection_one_expanded.yml
264
+ - test/fixtures/collection_update.yml
265
+ - test/fixtures/collection_update_via_update.yml
266
+ - test/fixtures/recipient_bad_user_data.yml
265
267
  - test/fixtures/recipient_with_badges.yml
266
268
  - test/fixtures/recipient_with_badges_unicard.yml
267
- - test/fixtures/revoke_badge_from_user.yml
268
- - test/fixtures/revoke_badge_not_issued.yml
269
- - test/fixtures/update_badge_via_update.yml
270
- - test/fixtures/update_badge_via_update_slug_history.yml
271
- - test/fixtures/update_collection.yml
272
- - test/fixtures/update_collection_via_update.yml
273
269
  - test/recipient/recipient_test.rb
274
270
  - test/test_helper.rb
@@ -1,121 +0,0 @@
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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
- 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