dribbble 1.2.0 → 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 -3
  4. data/CHANGELOG.md +40 -12
  5. data/Gemfile +10 -0
  6. data/Guardfile +4 -2
  7. data/README.md +38 -283
  8. data/Rakefile +2 -0
  9. data/dribbble.gemspec +9 -7
  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 +4 -29
  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 -28
  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 +10 -6
  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 -176
  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 +28 -66
  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,25 +1,36 @@
1
1
  {
2
- "id" : 483195,
3
- "name" : "Charley D.",
4
- "username" : "Calyhre",
5
- "html_url" : "https://dribbble.com/Calyhre",
6
- "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/483195/avatars/normal/493064787.png?1390292526",
7
- "bio" : "",
8
- "location" : null,
9
- "links" : {},
10
- "followers_count" : 1,
11
- "followings_count" : 4,
12
- "likes_count" : 4,
13
- "shots_count" : 0,
14
- "type" : "Player",
15
- "pro" : false,
16
- "buckets_url" : "https://api.dribbble.com/v1/users/483195/buckets",
17
- "followers_url" : "https://api.dribbble.com/v1/users/483195/followers",
18
- "following_url" : "https://api.dribbble.com/v1/users/483195/following",
19
- "likes_url" : "https://api.dribbble.com/v1/users/483195/likes",
20
- "projects_url" : "https://api.dribbble.com/v1/users/483195/projects",
21
- "shots_url" : "https://api.dribbble.com/v1/users/483195/shots",
22
- "teams_url" : "https://api.dribbble.com/v1/users/483195/teams",
23
- "created_at" : "2014-01-21T08:22:06Z",
24
- "updated_at" : "2014-09-29T19:39:00Z"
25
- }
2
+ "id" : 1,
3
+ "name" : "Dan Cederholm",
4
+ "login" : "simplebits",
5
+ "html_url" : "https://dribbble.com/simplebits",
6
+ "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/1/avatars/normal/dc.jpg?1371679243",
7
+ "bio" : "Co-founder &amp; designer of <a href=\"https://dribbble.com/dribbble\">@Dribbble</a>. Principal of SimpleBits. Aspiring clawhammer banjoist.",
8
+ "location" : "Salem, MA",
9
+ "links" : {
10
+ "web" : "http://simplebits.com",
11
+ "twitter" : "https://twitter.com/simplebits"
12
+ },
13
+ "can_upload_shot" : true,
14
+ "pro" : true,
15
+ "followers_count" : 66557,
16
+ "created_at" : "2009-07-08T02:51:22Z",
17
+ "type" : "User",
18
+ "teams" : [
19
+ {
20
+ "id" : 39,
21
+ "name" : "Dribbble",
22
+ "login" : "dribbble",
23
+ "html_url" : "https://dribbble.com/dribbble",
24
+ "avatar_url" : "https://d13yacurqjgara.cloudfront.net/users/39/avatars/normal/apple-flat-precomposed.png?1388527574",
25
+ "bio" : "Show and tell for designers. This is Dribbble on Dribbble.",
26
+ "location" : "Salem, MA",
27
+ "links" : {
28
+ "web" : "http://dribbble.com",
29
+ "twitter" : "https://twitter.com/dribbble"
30
+ },
31
+ "type" : "Team",
32
+ "created_at" : "2009-08-18T18:34:31Z",
33
+ "updated_at" : "2014-02-14T22:32:11Z"
34
+ }
35
+ ]
36
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dribbble
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calyhre
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2021-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -25,75 +25,75 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: guard-rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.3'
33
+ version: '4.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.3'
40
+ version: '4.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.14'
47
+ version: 12.3.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.14'
54
+ version: 12.3.3
55
55
  - !ruby/object:Gem::Dependency
56
- name: guard-rspec
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.3'
61
+ version: '3.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.3'
68
+ version: '3.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.4'
75
+ version: '2.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.4'
82
+ version: '2.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.3'
89
+ version: '3.13'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.3'
96
+ version: '3.13'
97
97
  description: Simple gem to make shots and list stuff from Dribbble
98
98
  email:
99
99
  - contact@calyh.re
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
+ - ".rubocop.yml"
105
106
  - ".travis.yml"
106
107
  - CHANGELOG.md
107
108
  - CONTRIBUTING.md
@@ -114,14 +115,10 @@ files:
114
115
  - lib/dribbble.rb
115
116
  - lib/dribbble/attachment.rb
116
117
  - lib/dribbble/base.rb
117
- - lib/dribbble/bucket.rb
118
118
  - lib/dribbble/client.rb
119
- - lib/dribbble/comment.rb
120
119
  - lib/dribbble/errors.rb
121
- - lib/dribbble/like.rb
122
120
  - lib/dribbble/project.rb
123
121
  - lib/dribbble/shot.rb
124
- - lib/dribbble/team.rb
125
122
  - lib/dribbble/user.rb
126
123
  - lib/dribbble/utils.rb
127
124
  - lib/dribbble/utils/creatable.rb
@@ -131,48 +128,31 @@ files:
131
128
  - lib/dribbble/utils/updatable.rb
132
129
  - lib/dribbble/version.rb
133
130
  - spec/lib/dribbble/base_spec.rb
134
- - spec/lib/dribbble/bucket_spec.rb
135
131
  - spec/lib/dribbble/client_spec.rb
136
- - spec/lib/dribbble/comment_spec.rb
137
132
  - spec/lib/dribbble/project_spec.rb
138
133
  - spec/lib/dribbble/shot_spec.rb
139
- - spec/lib/dribbble/team_spec.rb
140
134
  - spec/lib/dribbble/user_spec.rb
141
135
  - spec/spec_helper.rb
142
136
  - spec/support/dribbble_api.rb
143
137
  - spec/support/fixtures/attachment_success.json
144
- - spec/support/fixtures/attachments_success.json
145
- - spec/support/fixtures/bucket_created.json
146
- - spec/support/fixtures/bucket_success.json
147
- - spec/support/fixtures/bucket_updated.json
148
- - spec/support/fixtures/buckets_success.json
149
- - spec/support/fixtures/comment_created.json
150
- - spec/support/fixtures/comment_likes_success.json
151
- - spec/support/fixtures/comment_success.json
152
- - spec/support/fixtures/comment_updated.json
153
- - spec/support/fixtures/comments_success.json
154
138
  - spec/support/fixtures/current_user_success.json
155
- - spec/support/fixtures/followers_success.json
156
- - spec/support/fixtures/following_success.json
157
139
  - spec/support/fixtures/image.jpg
158
140
  - spec/support/fixtures/not_found.json
159
141
  - spec/support/fixtures/project_success.json
142
+ - spec/support/fixtures/projects_accepted.json
143
+ - spec/support/fixtures/projects_deleted.json
160
144
  - spec/support/fixtures/projects_success.json
161
- - spec/support/fixtures/shot_likes_success.json
145
+ - spec/support/fixtures/projects_updated.json
162
146
  - spec/support/fixtures/shot_success.json
163
147
  - spec/support/fixtures/shot_updated.json
164
148
  - spec/support/fixtures/shots_success.json
165
- - spec/support/fixtures/team_success.json
166
- - spec/support/fixtures/teams_success.json
167
149
  - spec/support/fixtures/unauthorized.json
168
- - spec/support/fixtures/user_likes_success.json
169
150
  - spec/support/fixtures/user_success.json
170
- - spec/support/fixtures/users_success.json
171
151
  homepage: http://github.com/Calyhre/dribbble
172
152
  licenses:
173
153
  - MIT
174
154
  metadata: {}
175
- post_install_message:
155
+ post_install_message:
176
156
  rdoc_options: []
177
157
  require_paths:
178
158
  - lib
@@ -180,57 +160,39 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
160
  requirements:
181
161
  - - ">="
182
162
  - !ruby/object:Gem::Version
183
- version: 2.2.0
163
+ version: 2.5.0
184
164
  - - "<"
185
165
  - !ruby/object:Gem::Version
186
- version: 2.5.0
166
+ version: '3.0'
187
167
  required_rubygems_version: !ruby/object:Gem::Requirement
188
168
  requirements:
189
169
  - - ">="
190
170
  - !ruby/object:Gem::Version
191
171
  version: '0'
192
172
  requirements: []
193
- rubyforge_project:
194
- rubygems_version: 2.6.8
195
- signing_key:
173
+ rubygems_version: 3.1.4
174
+ signing_key:
196
175
  specification_version: 4
197
176
  summary: Dribbble API ruby wrapper
198
177
  test_files:
199
178
  - spec/lib/dribbble/base_spec.rb
200
- - spec/lib/dribbble/bucket_spec.rb
201
179
  - spec/lib/dribbble/client_spec.rb
202
- - spec/lib/dribbble/comment_spec.rb
203
180
  - spec/lib/dribbble/project_spec.rb
204
181
  - spec/lib/dribbble/shot_spec.rb
205
- - spec/lib/dribbble/team_spec.rb
206
182
  - spec/lib/dribbble/user_spec.rb
207
183
  - spec/spec_helper.rb
208
184
  - spec/support/dribbble_api.rb
209
185
  - spec/support/fixtures/attachment_success.json
210
- - spec/support/fixtures/attachments_success.json
211
- - spec/support/fixtures/bucket_created.json
212
- - spec/support/fixtures/bucket_success.json
213
- - spec/support/fixtures/bucket_updated.json
214
- - spec/support/fixtures/buckets_success.json
215
- - spec/support/fixtures/comment_created.json
216
- - spec/support/fixtures/comment_likes_success.json
217
- - spec/support/fixtures/comment_success.json
218
- - spec/support/fixtures/comment_updated.json
219
- - spec/support/fixtures/comments_success.json
220
186
  - spec/support/fixtures/current_user_success.json
221
- - spec/support/fixtures/followers_success.json
222
- - spec/support/fixtures/following_success.json
223
187
  - spec/support/fixtures/image.jpg
224
188
  - spec/support/fixtures/not_found.json
225
189
  - spec/support/fixtures/project_success.json
190
+ - spec/support/fixtures/projects_accepted.json
191
+ - spec/support/fixtures/projects_deleted.json
226
192
  - spec/support/fixtures/projects_success.json
227
- - spec/support/fixtures/shot_likes_success.json
193
+ - spec/support/fixtures/projects_updated.json
228
194
  - spec/support/fixtures/shot_success.json
229
195
  - spec/support/fixtures/shot_updated.json
230
196
  - spec/support/fixtures/shots_success.json
231
- - spec/support/fixtures/team_success.json
232
- - spec/support/fixtures/teams_success.json
233
197
  - spec/support/fixtures/unauthorized.json
234
- - spec/support/fixtures/user_likes_success.json
235
198
  - spec/support/fixtures/user_success.json
236
- - spec/support/fixtures/users_success.json
@@ -1,33 +0,0 @@
1
- require 'dribbble/utils/findable'
2
- require 'dribbble/utils/creatable'
3
- require 'dribbble/utils/updatable'
4
- require 'dribbble/utils/deletable'
5
-
6
- module Dribbble
7
- class Bucket < Dribbble::Base
8
- include Dribbble::Utils::Findable
9
- include Dribbble::Utils::Creatable
10
- include Dribbble::Utils::Updatable
11
- include Dribbble::Utils::Deletable
12
-
13
- has_many :shots
14
-
15
- def add_shot(shot)
16
- shot_id = shot.is_a?(Dribbble::Shot) ? shot.id : shot
17
- res = html_put("/buckets/#{id}/shots") do |payload|
18
- payload[:shot_id] = shot_id
19
- end
20
- res.code == 204 ? true : false
21
- end
22
-
23
- def remove_shot(shot)
24
- shot_id = shot.is_a?(Dribbble::Shot) ? shot.id : shot
25
- res = html_delete "/buckets/#{id}/shots", shot_id: shot_id
26
- res.code == 204 ? true : false
27
- end
28
-
29
- def self.available_fields
30
- %i(name description)
31
- end
32
- end
33
- end
@@ -1,29 +0,0 @@
1
- module Dribbble
2
- class Comment < Dribbble::Base
3
- def self.available_fields
4
- %i(body)
5
- end
6
-
7
- def likes
8
- url = "#{dribbble_url}/likes"
9
- Dribbble::Like.batch_new token, html_get(url), nil, url
10
- end
11
-
12
- def like?
13
- html_get "#{dribbble_url}/like"
14
- true
15
- rescue RestClient::ResourceNotFound
16
- false
17
- end
18
-
19
- def like!
20
- res = html_post "#{dribbble_url}/like"
21
- res.code == 201 ? true : false
22
- end
23
-
24
- def unlike!
25
- res = html_delete "#{dribbble_url}/like"
26
- res.code == 204 ? true : false
27
- end
28
- end
29
- end
data/lib/dribbble/like.rb DELETED
@@ -1,7 +0,0 @@
1
- module Dribbble
2
- class Like < Dribbble::Base
3
- def user
4
- @user ||= Dribbble::User.new token, @raw['user']
5
- end
6
- end
7
- end
data/lib/dribbble/team.rb DELETED
@@ -1,6 +0,0 @@
1
- module Dribbble
2
- class Team < Dribbble::Base
3
- has_many :members, as: Dribbble::User
4
- has_many :shots
5
- end
6
- end
@@ -1,136 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RAW_BUCKET = data_from_json 'bucket_success.json'
4
-
5
- describe Dribbble::Bucket do
6
- describe 'on instance' do
7
- before :all do
8
- @bucket = Dribbble::Bucket.new 'valid_token', RAW_BUCKET
9
- end
10
-
11
- describe 'after initialization' do
12
- RAW_BUCKET.each do |field, value|
13
- it "respond to #{field}" do
14
- expect(@bucket.send field).to eq(value)
15
- end
16
- end
17
- end
18
-
19
- describe 'on #update' do
20
- subject do
21
- stub_dribbble :put, '/buckets/2754', DribbbleAPI::BucketUpdated
22
- new_bucket = {
23
- name: 'Bucket title',
24
- description: 'Bucket description'
25
- }
26
- @bucket.update new_bucket
27
- end
28
-
29
- it 'update bucket' do
30
- expect(subject.name).to eq('Bucket title')
31
- end
32
- end
33
-
34
- describe 'on #delete' do
35
- subject do
36
- stub_dribbble :delete, '/buckets/2754', DribbbleAPI::BucketDeleted
37
- @bucket.delete
38
- end
39
-
40
- it 'return true' do
41
- expect(subject).to eq(true)
42
- end
43
- end
44
-
45
- describe 'on #shots' do
46
- subject do
47
- stub_dribbble :get, '/buckets/2754/shots', DribbbleAPI::ShotsSuccess
48
- @bucket.shots
49
- end
50
-
51
- it 'responds with shots' do
52
- expect(subject.size).to eq 2
53
- expect(subject.first).to be_a Dribbble::Shot
54
- end
55
- end
56
-
57
- describe 'on #add_shot' do
58
- subject do
59
- stub_dribbble :put, '/buckets/2754/shots', DribbbleAPI::NoContent
60
- @bucket.add_shot '471756'
61
- end
62
-
63
- it 'add shot' do
64
- expect(subject).to eq(true)
65
- end
66
- end
67
-
68
- describe 'on #remove_shot' do
69
- subject do
70
- stub_dribbble :delete, '/buckets/2754/shots?shot_id=471756', DribbbleAPI::NoContent
71
- @bucket.remove_shot '471756'
72
- end
73
-
74
- it 'remove shot' do
75
- expect(subject).to eq(true)
76
- end
77
- end
78
- end
79
-
80
- describe 'on class' do
81
- describe 'on #create' do
82
- subject do
83
- stub_dribbble :post, '/buckets', DribbbleAPI::BucketCreated
84
- bucket = {
85
- name: 'Bucket title',
86
- description: 'Bucket description'
87
- }
88
- Dribbble::Bucket.create 'valid_token', bucket
89
- end
90
-
91
- it 'create the shot' do
92
- expect(subject).to be_a Dribbble::Bucket
93
- end
94
- end
95
-
96
- describe 'on #update' do
97
- subject do
98
- stub_dribbble :get, '/buckets/2754', DribbbleAPI::BucketSuccess
99
- stub_dribbble :put, '/buckets/2754', DribbbleAPI::BucketUpdated
100
- bucket = {
101
- name: 'Bucket title',
102
- description: 'Bucket description'
103
- }
104
- Dribbble::Bucket.update 'valid_token', 2754, bucket
105
- end
106
-
107
- it 'update bucket' do
108
- expect(subject.name).to eq('Bucket title')
109
- end
110
- end
111
-
112
- describe 'on #delete' do
113
- subject do
114
- stub_dribbble :get, '/buckets/2754', DribbbleAPI::BucketSuccess
115
- stub_dribbble :delete, '/buckets/2754', DribbbleAPI::BucketDeleted
116
- Dribbble::Bucket.delete 'valid_token', 2754
117
- end
118
-
119
- it 'return true' do
120
- expect(subject).to eq(true)
121
- end
122
- end
123
-
124
- describe 'on #find' do
125
- subject do
126
- stub_dribbble :get, '/buckets/2754', DribbbleAPI::BucketSuccess
127
- Dribbble::Bucket.find 'valid_token', 2754
128
- end
129
-
130
- it 'return a bucket' do
131
- expect(subject).to be_a Dribbble::Bucket
132
- expect(subject.id).to eq(2754)
133
- end
134
- end
135
- end
136
- end