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,131 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/collections?expand=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
+ - '"ab54e2eea620634dfc96de2a8b876073"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ X-Request-Id:
36
+ - 78d7f0c5-989d-4fee-a9ba-aede25aac18e
37
+ X-Runtime:
38
+ - '0.028199'
39
+ Date:
40
+ - Thu, 03 Sep 2015 10:59:41 GMT
41
+ Connection:
42
+ - close
43
+ body:
44
+ encoding: ASCII-8BIT
45
+ string: !binary |-
46
+ W3siaWQiOiJsaWJyYXJ5IiwibmFtZSI6IkxpYnJhcnkiLCJkZXNjcmlwdGlv
47
+ biI6IlVzZSB5b3VyIGxpYnJhcnkgYW5kIGVhcm4gYmFkZ2VzIiwiY3JlYXRl
48
+ ZF9hdCI6IjIwMTUtMDktMDNUMTA6NTE6MDcuNzQ3WiIsInVwZGF0ZWRfYXQi
49
+ OiIyMDE1LTA5LTAzVDEwOjUxOjA3Ljc0N1oiLCJ0b3RhbF9wb2ludHNfYXZh
50
+ aWxhYmxlIjoxMjUsImJhZGdlX2NvdW50Ijo0LCJvYmplY3QiOiJjb2xsZWN0
51
+ aW9uIiwiYmFkZ2VzIjpbeyJuYW1lIjoiQm9vayBXb3JtIiwiZGVzY3JpcHRp
52
+ b24iOiJZb3UgaGF2ZSBsb2FuZWQgb3V0IG92ZXIgMjUgYm9va3MuIE5pY2Ug
53
+ Z29pbmchIiwicmVxdWlyZW1lbnRzIjoiTG9hbiBvdXQgMjUgYm9va3MiLCJo
54
+ aW50IjoiWW91IG11c3QgbGlrZSBib29rcy4uLiIsImltYWdlIjoiaHR0cDov
55
+ L2dhbWlmaWNhdGlvbi1hcGkuZGV2L2JhZGdlX2ltYWdlcy9ib29rLXdvcm0v
56
+ YmFkZ2UucG5nIiwiY29sbGVjdGlvbl9pZCI6MSwiY3JlYXRlZF9hdCI6IjIw
57
+ MTUtMDktMDNUMTA6NTE6MDcuODMxWiIsInVwZGF0ZWRfYXQiOiIyMDE1LTA5
58
+ LTAzVDEwOjUxO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cGkuZGV2L2Jh
123
+ ZGdlX2ltYWdlcy9tYXJhdGhvbi1tYW4vYmFkZ2UucG5nIiwiY29sbGVjdGlv
124
+ bl9pZCI6MiwiY3JlYXRlZF9hdCI6IjIwMTUtMDktMDNUMTA6NTE6MDguMTUw
125
+ WiIsInVwZGF0ZWRfYXQiOiIyMDE1LTA5LTAzVDEwOjUxOjA4LjE1MFoiLCJs
126
+ ZXZlbCI6ImdvbGQiLCJhdXRvX2lzc3VlIjpmYWxzZSwic3RhdHVzIjoibGl2
127
+ ZSIsInJlcXVpcmVkX2JhZGdlcyI6W10sInBvaW50cyI6NzUsIm9iamVjdCI6
128
+ ImJhZGdlIiwiaWQiOiJtYXJhdGhvbi1tYW4ifV19XQ==
129
+ http_version:
130
+ recorded_at: Thu, 03 Sep 2015 10:59:41 GMT
131
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/collections?limit=1
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
+ - '"7c478ae81f6e9077684027d0c5fa401d"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ X-Request-Id:
36
+ - 9074100a-22e4-407d-a0f1-6af11d21f039
37
+ X-Runtime:
38
+ - '0.012320'
39
+ Date:
40
+ - Thu, 03 Sep 2015 10:59:40 GMT
41
+ Connection:
42
+ - close
43
+ body:
44
+ encoding: UTF-8
45
+ string: '[{"id":"library","name":"Library","description":"Use your library and
46
+ earn badges","created_at":"2015-09-03T10:51:07.747Z","updated_at":"2015-09-03T10:51:07.747Z","total_points_available":125,"badge_count":4,"object":"collection"}]'
47
+ http_version:
48
+ recorded_at: Thu, 03 Sep 2015 10:59:40 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,183 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/recipients?user=dfsgsdgg
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
+ - f5eadd51-1671-4c29-add5-0509508fd460
35
+ X-Runtime:
36
+ - '0.023088'
37
+ Date:
38
+ - Thu, 03 Sep 2015 10:56:09 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 dfsgsdgg. Recipient data must be a university email
45
+ address, university card number or username.","status":404}}'
46
+ http_version:
47
+ recorded_at: Thu, 03 Sep 2015 10:56:09 GMT
48
+ - request:
49
+ method: get
50
+ uri: http://gamification-api.dev/v1/recipients?user=dfsgsdgg
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
+ - 76d57c2a-2efa-4a2f-80fd-bd9a98808b37
80
+ X-Runtime:
81
+ - '0.015357'
82
+ Date:
83
+ - Thu, 03 Sep 2015 10:56:09 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 dfsgsdgg. Recipient data must be a university email
90
+ address, university card number or username.","status":404}}'
91
+ http_version:
92
+ recorded_at: Thu, 03 Sep 2015 10:56:09 GMT
93
+ - request:
94
+ method: get
95
+ uri: http://gamification-api.dev/v1/recipients?user=j.stennet@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: 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
+ - 4a861db8-1465-4398-8dae-b6383618f6f5
125
+ X-Runtime:
126
+ - '0.017613'
127
+ Date:
128
+ - Thu, 03 Sep 2015 10:56:09 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 j.stennet@lancaster.ac.uk. Recipient data must be
135
+ a university email address, university card number or username.","status":404}}'
136
+ http_version:
137
+ recorded_at: Thu, 03 Sep 2015 10:56:09 GMT
138
+ - request:
139
+ method: get
140
+ uri: http://gamification-api.dev/v1/recipients?user=j.stennet@lancaster.ac.uk
141
+ body:
142
+ encoding: US-ASCII
143
+ string: ''
144
+ headers:
145
+ User-Agent:
146
+ - Faraday v0.9.1
147
+ Authorization:
148
+ - Token token="c9cde524238644fa93393159e5e9ad87"
149
+ Accept-Encoding:
150
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
151
+ Accept:
152
+ - "*/*"
153
+ response:
154
+ status:
155
+ code: 404
156
+ message: Not Found
157
+ headers:
158
+ X-Frame-Options:
159
+ - SAMEORIGIN
160
+ X-Xss-Protection:
161
+ - 1; mode=block
162
+ X-Content-Type-Options:
163
+ - nosniff
164
+ Content-Type:
165
+ - application/json; charset=utf-8
166
+ Cache-Control:
167
+ - no-cache
168
+ X-Request-Id:
169
+ - 13e3d08b-605a-4bae-8250-4f5397724585
170
+ X-Runtime:
171
+ - '0.015878'
172
+ Date:
173
+ - Thu, 03 Sep 2015 10:56:09 GMT
174
+ Connection:
175
+ - close
176
+ body:
177
+ encoding: UTF-8
178
+ string: '{"error":{"type":"invalid_request_error","message":"Unable to find
179
+ user with specified data j.stennet@lancaster.ac.uk. Recipient data must be
180
+ a university email address, university card number or username.","status":404}}'
181
+ http_version:
182
+ recorded_at: Thu, 03 Sep 2015 10:56:09 GMT
183
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,93 @@
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
+ - 2c089825-3419-4c89-81f7-9957a9c13faf
35
+ X-Runtime:
36
+ - '0.011890'
37
+ Date:
38
+ - Fri, 17 Jul 2015 15:20:17 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:20:17 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
+ - f5ff496b-d4d6-401b-8300-6f71893789cb
80
+ X-Runtime:
81
+ - '0.011752'
82
+ Date:
83
+ - Fri, 17 Jul 2015 15:20:17 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:20:17 GMT
93
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
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="foo"
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: 401
21
+ message: Unauthorized
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ Www-Authenticate:
30
+ - Token realm="Application"
31
+ Content-Type:
32
+ - application/json; charset=utf-8
33
+ Cache-Control:
34
+ - no-cache
35
+ X-Request-Id:
36
+ - c4135b29-488b-4c1e-b35c-85743e8e435e
37
+ X-Runtime:
38
+ - '0.010614'
39
+ Date:
40
+ - Thu, 16 Jul 2015 10:39:45 GMT
41
+ Connection:
42
+ - close
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"error":{"type":"invalid_request_error","message":"The API key is
46
+ missing or invalid","status":401}}'
47
+ http_version:
48
+ recorded_at: Thu, 16 Jul 2015 10:39:45 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://gamification-api.dev/v1/badges/27
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
+ - a6fe0e79-e41c-422c-b64e-6605eb61b852
35
+ X-Runtime:
36
+ - '0.012001'
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":"No badge exists
44
+ with id: 27","status":404}}'
45
+ http_version:
46
+ recorded_at: Thu, 03 Sep 2015 10:55:56 GMT
47
+ recorded_with: VCR 2.9.3