dribbble 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +33 -0
  3. data/.travis.yml +3 -6
  4. data/CHANGELOG.md +58 -0
  5. data/Gemfile +10 -0
  6. data/Guardfile +4 -2
  7. data/README.md +44 -285
  8. data/Rakefile +2 -0
  9. data/dribbble.gemspec +10 -8
  10. data/lib/dribbble.rb +3 -1
  11. data/lib/dribbble/attachment.rb +9 -1
  12. data/lib/dribbble/base.rb +3 -1
  13. data/lib/dribbble/client.rb +5 -30
  14. data/lib/dribbble/errors.rb +3 -3
  15. data/lib/dribbble/project.rb +10 -2
  16. data/lib/dribbble/shot.rb +3 -33
  17. data/lib/dribbble/user.rb +1 -51
  18. data/lib/dribbble/utils.rb +5 -3
  19. data/lib/dribbble/utils/creatable.rb +3 -1
  20. data/lib/dribbble/utils/deletable.rb +3 -1
  21. data/lib/dribbble/utils/findable.rb +2 -0
  22. data/lib/dribbble/utils/has_children.rb +16 -12
  23. data/lib/dribbble/utils/updatable.rb +2 -0
  24. data/lib/dribbble/version.rb +3 -1
  25. data/spec/lib/dribbble/base_spec.rb +10 -8
  26. data/spec/lib/dribbble/client_spec.rb +16 -69
  27. data/spec/lib/dribbble/project_spec.rb +52 -16
  28. data/spec/lib/dribbble/shot_spec.rb +14 -197
  29. data/spec/lib/dribbble/user_spec.rb +5 -175
  30. data/spec/spec_helper.rb +5 -3
  31. data/spec/support/dribbble_api.rb +17 -88
  32. data/spec/support/fixtures/current_user_success.json +35 -24
  33. data/spec/support/fixtures/project_success.json +1 -1
  34. data/spec/support/fixtures/projects_accepted.json +8 -0
  35. data/spec/support/fixtures/projects_deleted.json +8 -0
  36. data/spec/support/fixtures/projects_success.json +1 -1
  37. data/spec/support/fixtures/projects_updated.json +8 -0
  38. data/spec/support/fixtures/shot_success.json +16 -16
  39. data/spec/support/fixtures/shot_updated.json +78 -78
  40. data/spec/support/fixtures/shots_success.json +81 -103
  41. data/spec/support/fixtures/user_success.json +35 -24
  42. metadata +33 -67
  43. data/lib/dribbble/bucket.rb +0 -33
  44. data/lib/dribbble/comment.rb +0 -29
  45. data/lib/dribbble/like.rb +0 -7
  46. data/lib/dribbble/team.rb +0 -6
  47. data/spec/lib/dribbble/bucket_spec.rb +0 -136
  48. data/spec/lib/dribbble/comment_spec.rb +0 -77
  49. data/spec/lib/dribbble/team_spec.rb +0 -43
  50. data/spec/support/fixtures/attachments_success.json +0 -11
  51. data/spec/support/fixtures/bucket_created.json +0 -8
  52. data/spec/support/fixtures/bucket_success.json +0 -8
  53. data/spec/support/fixtures/bucket_updated.json +0 -8
  54. data/spec/support/fixtures/buckets_success.json +0 -10
  55. data/spec/support/fixtures/comment_created.json +0 -38
  56. data/spec/support/fixtures/comment_likes_success.json +0 -40
  57. data/spec/support/fixtures/comment_success.json +0 -38
  58. data/spec/support/fixtures/comment_updated.json +0 -38
  59. data/spec/support/fixtures/comments_success.json +0 -37
  60. data/spec/support/fixtures/followers_success.json +0 -33
  61. data/spec/support/fixtures/following_success.json +0 -33
  62. data/spec/support/fixtures/shot_likes_success.json +0 -33
  63. data/spec/support/fixtures/team_success.json +0 -26
  64. data/spec/support/fixtures/teams_success.json +0 -28
  65. data/spec/support/fixtures/user_likes_success.json +0 -91
  66. data/spec/support/fixtures/users_success.json +0 -27
@@ -1,77 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RAW_COMMENT = data_from_json 'comment_success.json'
4
-
5
- describe Dribbble::Comment do
6
- describe 'on instance' do
7
- before :all do
8
- @comment = Dribbble::Comment.new 'valid_token', RAW_COMMENT, '/shots/471756/comments'
9
- end
10
-
11
- describe 'after initialization' do
12
- RAW_COMMENT.each do |field, value|
13
- it "respond to #{field}" do
14
- expect(@comment.send field).to eq(value)
15
- end
16
- end
17
- end
18
-
19
- describe 'on #likes' do
20
- subject do
21
- stub_dribbble :get, '/shots/471756/comments/1145736/likes', DribbbleAPI::CommentLikesSuccess
22
- @comment.likes
23
- end
24
-
25
- it 'return a user' do
26
- expect(subject.first).to be_a Dribbble::Like
27
- expect(subject.first.user).to be_a Dribbble::User
28
- end
29
- end
30
-
31
- describe 'on #like?' do
32
- describe 'on a not liked shot' do
33
- subject do
34
- stub_dribbble :get, '/shots/471756/comments/1145736/like', DribbbleAPI::CommentLikeNotFound
35
- @comment.like?
36
- end
37
-
38
- it 'return a user' do
39
- expect(subject).to be_falsy
40
- end
41
- end
42
-
43
- describe 'on a liked shot' do
44
- subject do
45
- stub_dribbble :get, '/shots/471756/comments/1145736/like', DribbbleAPI::CommentLikeSuccess
46
- @comment.like?
47
- end
48
-
49
- it 'return a user' do
50
- expect(subject).to be_truthy
51
- end
52
- end
53
- end
54
-
55
- describe 'on #like!' do
56
- subject do
57
- stub_dribbble :post, '/shots/471756/comments/1145736/like', DribbbleAPI::CommentLikeCreated
58
- @comment.like!
59
- end
60
-
61
- it 'return true' do
62
- expect(subject).to be_truthy
63
- end
64
- end
65
-
66
- describe 'on #unlike!' do
67
- subject do
68
- stub_dribbble :delete, '/shots/471756/comments/1145736/like', DribbbleAPI::CommentLikeDeleted
69
- @comment.unlike!
70
- end
71
-
72
- it 'return true' do
73
- expect(subject).to be_truthy
74
- end
75
- end
76
- end
77
- end
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RAW_TEAM = data_from_json 'team_success.json'
4
-
5
- describe Dribbble::Team do
6
- describe 'on instance' do
7
- before :all do
8
- @team = Dribbble::Team.new 'valid_token', RAW_TEAM, '/teams/39'
9
- end
10
-
11
- describe 'after initialization' do
12
- RAW_TEAM.each do |field, value|
13
- it "respond to #{field}" do
14
- expect(@team.send field).to eq(value)
15
- end
16
- end
17
- end
18
-
19
- describe 'on #shots' do
20
- subject do
21
- stub_dribbble :get, '/teams/39/shots', DribbbleAPI::ShotsSuccess
22
- @team.shots
23
- end
24
-
25
- it 'responds with shots' do
26
- expect(subject.size).to eq 2
27
- expect(subject.first).to be_a Dribbble::Shot
28
- end
29
- end
30
-
31
- describe 'on #members' do
32
- subject do
33
- stub_dribbble :get, '/teams/39/members', DribbbleAPI::UsersSuccess
34
- @team.members
35
- end
36
-
37
- it 'responds with members' do
38
- expect(subject.size).to eq 1
39
- expect(subject.first).to be_a Dribbble::User
40
- end
41
- end
42
- end
43
- end
@@ -1,11 +0,0 @@
1
- [
2
- {
3
- "id" : 206165,
4
- "url" : "https://d13yacurqjgara.cloudfront.net/users/1/screenshots/1412410/attachments/206165/weathered-ball-detail.jpg",
5
- "thumbnail_url" : "https://d13yacurqjgara.cloudfront.net/users/1/screenshots/1412410/attachments/206165/thumbnail/weathered-ball-detail.jpg",
6
- "size" : 116375,
7
- "content_type" : "image/jpeg",
8
- "views_count" : 325,
9
- "created_at" : "2014-02-07T16:35:09Z"
10
- }
11
- ]
@@ -1,8 +0,0 @@
1
- {
2
- "id" : 2754,
3
- "name" : "Great Marks",
4
- "description" : "Collecting superb brand marks from the <a href=\"https://dribbble.com\">Dribbbleverse</a>.",
5
- "shots_count" : 251,
6
- "created_at" : "2011-05-20T21:05:55Z",
7
- "updated_at" : "2014-02-21T16:37:12Z"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "id" : 2754,
3
- "name" : "Great Marks",
4
- "description" : "Collecting superb brand marks from the <a href=\"https://dribbble.com\">Dribbbleverse</a>.",
5
- "shots_count" : 251,
6
- "created_at" : "2011-05-20T21:05:55Z",
7
- "updated_at" : "2014-02-21T16:37:12Z"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "id" : 2754,
3
- "name" : "Bucket title",
4
- "description" : "Bucket description",
5
- "shots_count" : 251,
6
- "created_at" : "2011-05-20T21:05:55Z",
7
- "updated_at" : "2014-02-21T16:37:12Z"
8
- }
@@ -1,10 +0,0 @@
1
- [
2
- {
3
- "id" : 2754,
4
- "name" : "Great Marks",
5
- "description" : "Collecting superb brand marks from the <a href=\"https://dribbble.com\">Dribbbleverse</a>.",
6
- "shots_count" : 251,
7
- "created_at" : "2011-05-20T21:05:55Z",
8
- "updated_at" : "2014-02-21T16:37:12Z"
9
- }
10
- ]
@@ -1,38 +0,0 @@
1
- {
2
- "id" : 1145736,
3
- "body" : "<p>Could he somehow make the shape of an \"S\" with his arms? I feel like i see potential for some hidden shapes in here...</p>\n\n<p>Looks fun!\n</p>",
4
- "likes_count" : 1,
5
- "likes_url" : "https://api.dribbble.com/v1/shots/471756/comments/1145736/likes",
6
- "created_at" : "2012-03-15T04:24:39Z",
7
- "updated_at" : "2012-03-15T04:24:39Z",
8
- "user" : {
9
- "id" : 1,
10
- "name" : "Dan Cederholm",
11
- "username" : "simplebits",
12
- "html_url" : "https://dribbble.com/simplebits",
13
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
14
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
15
- "location" : "Salem, MA",
16
- "links" : {
17
- "web" : "http://simplebits.com",
18
- "twitter" : "https://twitter.com/simplebits"
19
- },
20
- "buckets_count" : 10,
21
- "followers_count" : 29262,
22
- "followings_count" : 1728,
23
- "likes_count" : 34954,
24
- "projects_count" : 8,
25
- "shots_count" : 214,
26
- "teams_count" : 1,
27
- "type" : "User",
28
- "pro" : true,
29
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
30
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
31
- "following_url" : "https://dribbble.com/v1/users/1/following",
32
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
33
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
34
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
35
- "created_at" : "2009-07-08T02:51:22Z",
36
- "updated_at" : "2014-02-22T17:10:33Z"
37
- }
38
- }
@@ -1,40 +0,0 @@
1
- [
2
- {
3
- "id" : 24400091,
4
- "created_at" : "2014-01-06T17:19:59Z",
5
- "user" : {
6
- "id" : 1,
7
- "name" : "Dan Cederholm",
8
- "username" : "simplebits",
9
- "html_url" : "https://dribbble.com/simplebits",
10
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
11
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
12
- "location" : "Salem, MA",
13
- "links" : {
14
- "web" : "http://simplebits.com",
15
- "twitter" : "https://twitter.com/simplebits"
16
- },
17
- "buckets_count" : 10,
18
- "comments_received_count" : 3395,
19
- "followers_count" : 29262,
20
- "followings_count" : 1728,
21
- "likes_count" : 34954,
22
- "likes_received_count" : 27568,
23
- "projects_count" : 8,
24
- "rebounds_received_count" : 504,
25
- "shots_count" : 214,
26
- "teams_count" : 1,
27
- "can_upload_shot" : true,
28
- "type" : "Player",
29
- "pro" : true,
30
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
31
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
32
- "following_url" : "https://dribbble.com/v1/users/1/following",
33
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
34
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
35
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
36
- "created_at" : "2009-07-08T02:51:22Z",
37
- "updated_at" : "2014-02-22T17:10:33Z"
38
- }
39
- }
40
- ]
@@ -1,38 +0,0 @@
1
- {
2
- "id" : 1145736,
3
- "body" : "<p>Could he somehow make the shape of an \"S\" with his arms? I feel like i see potential for some hidden shapes in here...</p>\n\n<p>Looks fun!\n</p>",
4
- "likes_count" : 1,
5
- "likes_url" : "https://api.dribbble.com/v1/shots/471756/comments/1145736/likes",
6
- "created_at" : "2012-03-15T04:24:39Z",
7
- "updated_at" : "2012-03-15T04:24:39Z",
8
- "user" : {
9
- "id" : 1,
10
- "name" : "Dan Cederholm",
11
- "username" : "simplebits",
12
- "html_url" : "https://dribbble.com/simplebits",
13
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
14
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
15
- "location" : "Salem, MA",
16
- "links" : {
17
- "web" : "http://simplebits.com",
18
- "twitter" : "https://twitter.com/simplebits"
19
- },
20
- "buckets_count" : 10,
21
- "followers_count" : 29262,
22
- "followings_count" : 1728,
23
- "likes_count" : 34954,
24
- "projects_count" : 8,
25
- "shots_count" : 214,
26
- "teams_count" : 1,
27
- "type" : "User",
28
- "pro" : true,
29
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
30
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
31
- "following_url" : "https://dribbble.com/v1/users/1/following",
32
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
33
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
34
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
35
- "created_at" : "2009-07-08T02:51:22Z",
36
- "updated_at" : "2014-02-22T17:10:33Z"
37
- }
38
- }
@@ -1,38 +0,0 @@
1
- {
2
- "id" : 1145736,
3
- "body" : "New body",
4
- "likes_count" : 1,
5
- "likes_url" : "https://api.dribbble.com/v1/shots/471756/comments/1145736/likes",
6
- "created_at" : "2012-03-15T04:24:39Z",
7
- "updated_at" : "2012-03-15T04:24:39Z",
8
- "user" : {
9
- "id" : 1,
10
- "name" : "Dan Cederholm",
11
- "username" : "simplebits",
12
- "html_url" : "https://dribbble.com/simplebits",
13
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
14
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
15
- "location" : "Salem, MA",
16
- "links" : {
17
- "web" : "http://simplebits.com",
18
- "twitter" : "https://twitter.com/simplebits"
19
- },
20
- "buckets_count" : 10,
21
- "followers_count" : 29262,
22
- "followings_count" : 1728,
23
- "likes_count" : 34954,
24
- "projects_count" : 8,
25
- "shots_count" : 214,
26
- "teams_count" : 1,
27
- "type" : "User",
28
- "pro" : true,
29
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
30
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
31
- "following_url" : "https://dribbble.com/v1/users/1/following",
32
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
33
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
34
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
35
- "created_at" : "2009-07-08T02:51:22Z",
36
- "updated_at" : "2014-02-22T17:10:33Z"
37
- }
38
- }
@@ -1,37 +0,0 @@
1
- [
2
- {
3
- "id" : 1145736,
4
- "body" : "<p>Could he somehow make the shape of an \"S\" with his arms? I feel like i see potential for some hidden shapes in here...</p>\n\n<p>Looks fun!\n</p>",
5
- "likes_count" : 1,
6
- "likes_url" : "https://api.dribbble.com/v1/shots/471756/comments/1145736/likes",
7
- "created_at" : "2012-03-15T04:24:39Z",
8
- "updated_at" : "2012-03-15T04:24:39Z",
9
- "user" : {
10
- "id" : 1,
11
- "name" : "Dan Cederholm",
12
- "username" : "simplebits",
13
- "html_url" : "https://dribbble.com/simplebits",
14
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
15
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
16
- "location" : "Salem, MA",
17
- "links" : {
18
- "web" : "http://simplebits.com",
19
- "twitter" : "https://twitter.com/simplebits"
20
- },
21
- "followers_count" : 29262,
22
- "followings_count" : 1728,
23
- "likes_count" : 34954,
24
- "shots_count" : 214,
25
- "type" : "User",
26
- "pro" : true,
27
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
28
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
29
- "following_url" : "https://dribbble.com/v1/users/1/following",
30
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
31
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
32
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
33
- "created_at" : "2009-07-08T02:51:22Z",
34
- "updated_at" : "2014-02-22T17:10:33Z"
35
- }
36
- }
37
- ]
@@ -1,33 +0,0 @@
1
- [
2
- {
3
- "id" : 9843830,
4
- "created_at" : "2014-02-21T15:41:14Z",
5
- "follower" : {
6
- "id" : 1,
7
- "name" : "Dan Cederholm",
8
- "username" : "simplebits",
9
- "html_url" : "https://dribbble.com/simplebits",
10
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
11
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
12
- "location" : "Salem, MA",
13
- "links" : {
14
- "web" : "http://simplebits.com",
15
- "twitter" : "https://twitter.com/simplebits"
16
- },
17
- "followers_count" : 29262,
18
- "followings_count" : 1728,
19
- "likes_count" : 34954,
20
- "shots_count" : 214,
21
- "type" : "User",
22
- "pro" : true,
23
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
24
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
25
- "following_url" : "https://dribbble.com/v1/users/1/following",
26
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
27
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
28
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
29
- "created_at" : "2009-07-08T02:51:22Z",
30
- "updated_at" : "2014-02-22T17:10:33Z"
31
- }
32
- }
33
- ]
@@ -1,33 +0,0 @@
1
- [
2
- {
3
- "id" : 9843830,
4
- "created_at" : "2014-02-21T15:41:14Z",
5
- "followee" : {
6
- "id" : 1,
7
- "name" : "Dan Cederholm",
8
- "username" : "simplebits",
9
- "html_url" : "https://dribbble.com/simplebits",
10
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
11
- "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
12
- "location" : "Salem, MA",
13
- "links" : {
14
- "web" : "http://simplebits.com",
15
- "twitter" : "https://twitter.com/simplebits"
16
- },
17
- "followers_count" : 29262,
18
- "followings_count" : 1728,
19
- "likes_count" : 34954,
20
- "shots_count" : 214,
21
- "type" : "User",
22
- "pro" : true,
23
- "buckets_url" : "https://dribbble.com/v1/users/1/buckets",
24
- "followers_url" : "https://dribbble.com/v1/users/1/followers",
25
- "following_url" : "https://dribbble.com/v1/users/1/following",
26
- "likes_url" : "https://dribbble.com/v1/users/1/likes",
27
- "shots_url" : "https://dribbble.com/v1/users/1/shots",
28
- "teams_url" : "https://dribbble.com/v1/users/1/teams",
29
- "created_at" : "2009-07-08T02:51:22Z",
30
- "updated_at" : "2014-02-22T17:10:33Z"
31
- }
32
- }
33
- ]