dribbble 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 38b05fd4e701e3a67fef5820cac8784340814a53
4
- data.tar.gz: 70486f820ed27332c1131e3a570125c9c7ceb495
2
+ SHA256:
3
+ metadata.gz: bee28704e42f6f0932347653155182935007a586e3e8504cdca499bb4fafed00
4
+ data.tar.gz: 1b380afdd195c440c19e7943e662ce84b37f2ce38333098c0f18ca127cbbf9be
5
5
  SHA512:
6
- metadata.gz: 4a432227a8ac1326d4f3697df90a8d43e2cacadc6c94180763899bcda4c8f3d3e489e4d205ac728a3080c2e91a36ea2c0f04825d17d0de54563e2796994b5b2e
7
- data.tar.gz: 33386e321f6e072b20b822cf4e389ec8c70af810c37aacac00f1341e90b63acaebc78eb27da7e187e431c91796fccdfc941c2629cf8ad7a6e526d3121d023036
6
+ metadata.gz: 86270dfe6c4b1eb0d879d29767e54f3e8c95235ab0851b8cb3edb5d490451a5bd9bb5d180e4471bac0ebf0eb627708cb8a06c6a5fb19f9757518d300e911d699
7
+ data.tar.gz: 8e1fc5d5f9a77037a9af731d46a508577aa780496e6d5a33cebbca2e23a538be3324e0e79cfe00823f00a206b0485c30de1b75b6a5dd014a3c93e8910702e11a
data/.rubocop.yml ADDED
@@ -0,0 +1,33 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+
8
+ Gemspec/RequiredRubyVersion:
9
+ Enabled: false
10
+
11
+ Layout/LineLength:
12
+ Max: 240
13
+
14
+ RSpec/ExampleLength:
15
+ Max: 15
16
+
17
+ RSpec/NamedSubject:
18
+ Enabled: false
19
+
20
+ RSpec/InstanceVariable:
21
+ Enabled: false
22
+
23
+ RSpec/NestedGroups:
24
+ Enabled: false
25
+
26
+ RSpec/MultipleExpectations:
27
+ Enabled: false
28
+
29
+ Metrics/BlockLength:
30
+ Enabled: false
31
+
32
+ Style/Documentation:
33
+ Enabled: false
data/.travis.yml CHANGED
@@ -3,9 +3,9 @@ language: ruby
3
3
 
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.2.6
7
- - 2.3.3
8
- - 2.4.0
6
+ - 2.5.0
7
+ - 2.6.6
8
+ - 2.7.3
9
9
 
10
10
  matrix:
11
11
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,30 +1,58 @@
1
- ## Unreleased
2
- [Full changelog](https://github.com/Calyhre/dribbble/compare/v1.1.0...master)
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.0] - 2021-04-29
11
+ ### Added
12
+ - Added rubocop gems
13
+ ### Changed
14
+ - Removed any specs that did not make sense
15
+ - Removed any dribbble endpoints that are not supported
16
+ ### Fixed
17
+ - All of the specs
18
+
19
+
20
+ ## [1.2.0] - 2017-03-01
21
+ #### Changed
3
22
  - Bump rest-client from `~> 1.7` to `~> 2.0`, [see changes](https://github.com/rest-client/rest-client/blob/master/history.md#200)
4
23
  - Bump supported Ruby versions
5
24
 
6
25
 
7
- ## [1.1.0](https://github.com/Calyhre/dribbble/releases/tag/v1.1.0)
8
- [Full changelog](https://github.com/Calyhre/dribbble/compare/v1.0.4...v1.1.0)
26
+ ## [1.1.0] - 2016-11-17
27
+ #### Added
9
28
  - Add low_profile to shots
29
+
30
+ #### Changed
10
31
  - Bump minimal Ruby version required to `2.2.5`
11
32
 
12
33
 
13
- ### [1.0.4](https://github.com/Calyhre/dribbble/releases/tag/v1.0.4)
14
- [Full changelog](https://github.com/Calyhre/dribbble/compare/v1.0.2...v1.0.4)
34
+ ## [1.0.4] - 2015-11-28
35
+ #### Fixed
15
36
  - Fix wrong constant name
16
- - `v1.0.3` never existed
17
37
 
18
38
 
19
- ### [1.0.2](https://github.com/Calyhre/dribbble/releases/tag/v1.0.2)
20
- [Full changelog](https://github.com/Calyhre/dribbble/compare/v1.0.1...v1.0.2)
39
+ ## [1.0.2] - 2015-11-22
40
+ #### Fixed
21
41
  - Fix wrong API parsing for user's followers
22
42
 
23
43
 
24
- ### [1.0.1](https://github.com/Calyhre/dribbble/releases/tag/v1.0.1)
25
- [Full changelog](https://github.com/Calyhre/dribbble/compare/v1.0.0...v1.0.1)
44
+ ## [1.0.1] - 2015-11-22
45
+ #### Fixed
26
46
  - Fix missing token
27
47
 
28
48
 
29
- # [1.0.0](https://github.com/Calyhre/dribbble/releases/tag/v1.0.0)
49
+ ## 1.0.0 - 2015-11-21
50
+ #### Added
30
51
  - First version!
52
+
53
+ [Unreleased]: https://github.com/Calyhre/dribbble/compare/v1.2.0...master
54
+ [1.2.0]: https://github.com/Calyhre/dribbble/compare/v1.1.0...v1.2.0
55
+ [1.1.0]: https://github.com/Calyhre/dribbble/compare/v1.0.4...v1.1.0
56
+ [1.0.4]: https://github.com/Calyhre/dribbble/compare/v1.0.2...v1.0.4
57
+ [1.0.2]: https://github.com/Calyhre/dribbble/compare/v1.0.1...v1.0.2
58
+ [1.0.1]: https://github.com/Calyhre/dribbble/compare/v1.0.0...v1.0.1
data/Gemfile CHANGED
@@ -1,2 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
4
+
5
+ group :development do
6
+ gem 'rubocop'
7
+ gem 'rubocop-performance'
8
+ gem 'rubocop-rake'
9
+ gem 'rubocop-rspec'
10
+ end
11
+
2
12
  gemspec
data/Guardfile CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard :rspec, cmd: 'bundle exec rspec' do
2
- watch(/^spec\/.+_spec\.rb$/)
3
- watch(/^lib\/(.+)\.rb$/) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch(%r{^spec/.+_spec\.rb$})
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
6
  watch('spec/spec_helper.rb') { :rspec }
5
7
  end
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Dribbble API wrapper Gem
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/dribbble.svg)](http://rubygems.org/gems/dribbble)
4
- [![Build Status](https://travis-ci.org/Calyhre/dribbble.svg?branch=master)](https://travis-ci.org/Calyhre/dribbble)
3
+ [![Gem Version]][on rubygems] [![Build Status]][on travis]
5
4
 
6
- Calyhre/dribbble is an unofficial API wrapper ruby gem for [Dribbble.com's API](http://developer.dribbble.com/).
5
+ Calyhre/dribbble is an unofficial API wrapper ruby gem for [Dribbble.com's API].
6
+
7
+ [But, what is Dribbble?]
7
8
 
8
- [But, what is Dribbble?](https://dribbble.com/about)
9
9
  > What are you working on? Dribbble is a community of designers answering that question each day. Web designers, graphic designers, illustrators, icon artists, typographers, logo designers, and other creative types share small screenshots (shots) that show their work, process, and current projects.
10
10
 
11
11
  ## Installation
@@ -28,9 +28,6 @@ gem install dribbble
28
28
 
29
29
  ---
30
30
 
31
-
32
-
33
-
34
31
  ## Usage
35
32
 
36
33
  Lets assume you have your token set:
@@ -45,83 +42,36 @@ Some calls are through a client:
45
42
  client = Dribbble::Client.new(token)
46
43
  ```
47
44
 
45
+ ### Projects
48
46
 
47
+ ##### Find a Projects
49
48
 
50
-
51
- ### Buckets
52
-
53
- ##### Find a bucket
54
- ```ruby
55
- bucket = Dribbble::Bucket.find(token, '2754')
56
- ```
57
-
58
- ##### Create a bucket
59
- ```ruby
60
- bucket = Dribbble::Bucket.create(token, name: 'A new bucket', description: 'A description')
61
- ```
62
-
63
- ##### Update a bucket
64
- ```ruby
65
- bucket.update name: 'An updated bucket name'
66
- ```
67
-
68
- ##### Delete a bucket
69
- ```ruby
70
- bucket.delete
71
- ```
72
-
73
- #### Bucket shots
74
-
75
- ##### List bucket shots
76
49
  ```ruby
77
- shots = bucket.shots
50
+ project = Dribbble::Project.find(token, 1234)
78
51
  ```
79
52
 
80
- ##### Add shot to a bucket
81
- ```ruby
82
- bucket.add_shot(329335)
83
- # or
84
- bucket.add_shot(shot) # shot is a Dribbble::Shot
85
- ```
53
+ ##### Update a Project
86
54
 
87
- ##### Remove shot from a bucket
88
55
  ```ruby
89
- bucket.remove_shot(329335)
90
- # or
91
- bucket.remove_shot(shot) # shot is a Dribbble::Shot
56
+ project.update(name: 'Some project', description: 'Some description');
92
57
  ```
93
58
 
59
+ ##### Delete a Project
94
60
 
95
-
96
-
97
- ### Projects
98
-
99
- ##### Find a Projects
100
61
  ```ruby
101
- project = Dribbble::Project.find(token, 3)
62
+ project.delete
102
63
  ```
103
64
 
104
- #### Project shots
105
- ```ruby
106
- shots = project.shots
107
- ```
108
-
109
-
110
-
111
-
112
65
  ### Shots
113
66
 
114
- ##### List shots
115
- ```ruby
116
- shots = Dribbble::Shot.all(token)
117
- ```
118
-
119
67
  ##### Find a shot
68
+
120
69
  ```ruby
121
70
  shot = Dribbble::Shot.find(token, 1971500)
122
71
  ```
123
72
 
124
73
  ##### Create a shot
74
+
125
75
  ```ruby
126
76
  params = {
127
77
  title: 'A new shot',
@@ -135,6 +85,7 @@ shot = Dribbble::Shot.create(token, params)
135
85
  ```
136
86
 
137
87
  ##### Update a shot
88
+
138
89
  ```ruby
139
90
  params = {
140
91
  title: 'A new shot',
@@ -146,269 +97,63 @@ shot.update(params)
146
97
  ```
147
98
 
148
99
  ##### Delete a shot
100
+
149
101
  ```ruby
150
102
  shot.delete
151
103
  ```
152
104
 
153
105
  #### Shot attachments
154
106
 
155
- ##### List attachments for a shot
156
- ```ruby
157
- shot.attachments
158
- ```
159
-
160
107
  ##### Create an attachment
161
- ```ruby
162
- shot.create_attachment(file: File.open('attachment_path'))
163
- ```
164
108
 
165
- ##### Get a single attachment
166
109
  ```ruby
167
- shot.find_attachment(206165)
110
+ shot.create_attachment(file: File.open('attachment_path'))
168
111
  ```
169
112
 
170
113
  ##### Delete an attachment
171
- ```ruby
172
- shot.delete_attachment(206165)
173
- ```
174
-
175
-
176
- #### Shot buckets
177
- ##### List buckets for a shot
178
- ```ruby
179
- shot.buckets
180
- ```
181
-
182
-
183
- #### Shot comments
184
- ##### List comments for a shot
185
- ```ruby
186
- shot.comments
187
- ```
188
-
189
- ##### Create a comment
190
- ```ruby
191
- comment = shot.create_comment(body: 'A comment')
192
- ```
193
-
194
- ##### Get a single comment
195
- ```ruby
196
- comment = shot.find_comment(1145736)
197
- ```
198
-
199
- ##### Update a comment
200
- ```ruby
201
- comment = shot.update_comment(1145736, body: 'Comment body')
202
- ```
203
-
204
- ##### Delete a comment
205
- ```ruby
206
- shot.delete_comment(1145736)
207
- ```
208
-
209
- ##### List likes for a comment
210
- ```ruby
211
- comment.likes
212
- ```
213
-
214
- ##### Check if you like a comment
215
- ```ruby
216
- comment.like?
217
- ```
218
114
 
219
- ##### Like a comment
220
115
  ```ruby
221
- comment.like!
222
- ```
223
-
224
- ##### Unlike a comment
225
- ```ruby
226
- comment.unlike!
227
- ```
228
-
229
- #### Shot likes
230
- ##### List the likes for a shot
231
- ```ruby
232
- shot.likes
233
- ```
234
-
235
- ##### Check if you like a shot
236
- ```ruby
237
- shot.like?
238
- ```
239
-
240
- ##### Like a shot
241
- ```ruby
242
- shot.like!
243
- ```
244
-
245
- ##### Unlike a shot
246
- ```ruby
247
- shot.unlike!
116
+ shot.delete_attachment(206165)
248
117
  ```
249
118
 
250
119
  #### Shot projects
251
- ##### List projects for a shot
252
- ```ruby
253
- projects = shot.projects
254
- ```
255
-
256
- #### Shot rebounds
257
- ##### List rebounds for a shot
258
- ```ruby
259
- shots = shot.rebounds
260
- ```
261
-
262
-
263
-
264
-
265
- ### Teams
266
-
267
- Let's assume you have a team:
268
- ```ruby
269
- user = Dribbble::User.find(token, 483195)
270
- team = user.teams.first
271
- ```
272
-
273
- #### Team members
274
- ##### List a team’s members
275
- ```ruby
276
- users = team.members
277
- ```
278
120
 
121
+ ##### List projects for a shot
279
122
 
280
- #### Team shots
281
- ##### List shots for a team
282
123
  ```ruby
283
- shots = team.shots
124
+ projects = shot.projects
284
125
  ```
285
126
 
286
-
287
-
288
-
289
127
  ### Users
290
- ##### Get a single user
291
- ```ruby
292
- user = Dribbble::User.find(token, 483195)
293
- ```
294
128
 
295
129
  ##### Get the authenticated user
296
- ```ruby
297
- user = client.user
298
- ```
299
-
300
130
 
301
- #### User buckets
302
- ##### List a user’s buckets
303
131
  ```ruby
304
- user.buckets
305
- ```
306
-
307
- ##### List authenticated user’s buckets
308
- ```ruby
309
- buckets = client.buckets
310
- ```
311
-
312
-
313
- #### User followers
314
- ##### List followers of a user
315
- ```ruby
316
- users = user.followers
317
- ```
318
-
319
- ##### List followers of authenticated user
320
- ```ruby
321
- users = client.followers
322
- ```
323
-
324
- ##### List users followed by a user
325
- ```ruby
326
- users = user.following
327
- ```
328
-
329
- ##### List shots for users followed by a authenticated user
330
- ```ruby
331
- shots = client.following_shots
332
- ```
333
-
334
- ##### Check if you are following a user
335
- ```ruby
336
- user.following?
337
- ```
338
-
339
- ##### Check if one user is following another
340
- ```ruby
341
- user.following?(483195)
342
- ```
343
-
344
- ##### Follow a user
345
- ```ruby
346
- user.follow!
347
- ```
348
-
349
- ##### Unfollow a user
350
- ```ruby
351
- user.unfollow!
352
- ```
353
-
354
-
355
- #### User likes
356
- ##### List shot likes for a user
357
- ```ruby
358
- shots = user.likes
359
- ```
360
-
361
- ##### List shot likes for authenticated user
362
- ```ruby
363
- shots = client.likes
364
- ```
365
-
366
-
367
- #### User projects
368
- ##### List a user’s projects
369
- ```ruby
370
- projects = user.projects
132
+ user = client.user
371
133
  ```
372
134
 
373
135
  ##### List authenticated user’s projects
136
+
374
137
  ```ruby
375
138
  projects = client.projects
376
139
  ```
377
140
 
378
-
379
141
  #### User shots
380
- ##### List shots for a user
381
- ```ruby
382
- shots = user.shots
383
- ```
384
142
 
385
143
  ##### List shots for authenticated user
386
- ```ruby
387
- shots = client.shots
388
- ```
389
-
390
-
391
- #### User teams
392
- ##### List a user’s teams
393
- ```ruby
394
- teams = user.teams
395
- ```
396
144
 
397
- ##### List authenticated user’s teams
398
145
  ```ruby
399
- teams = client.teams
146
+ shots = client.shots
400
147
  ```
401
148
 
402
-
403
-
404
149
  ### Pagination & parameters
405
150
 
406
151
  All requests are paginated, defaults params are :
407
152
 
408
- | Param | Default |
409
- |---------|--------:|
410
- |page | 1|
411
- |per_page | 100|
153
+ | Param | Default |
154
+ | -------- | ------: |
155
+ | page | 1 |
156
+ | per_page | 100 |
412
157
 
413
158
  You override them or adding some by passing a `Hash` to every request :
414
159
 
@@ -420,8 +165,18 @@ user.shots page: 2, custom_param: 'My param'
420
165
 
421
166
  Feel free to help me make this gem awesome !
422
167
 
423
- [Contributors](https://github.com/Calyhre/dribbble/graphs/contributors) and [CONTRIBUTING](https://github.com/Calyhre/dribbble/blob/master/CONTRIBUTING.md)
168
+ [Contributors] and [CONTRIBUTING]
424
169
 
425
170
  ## Licence
426
171
 
427
- Released under the MIT License. See the [LICENSE](https://github.com/Calyhre/dribbble/blob/master/LICENSE.md) file for further details.
172
+ Released under the MIT License. See the [LICENSE] file for further details.
173
+
174
+ [gem version]: https://badge.fury.io/rb/dribbble.svg
175
+ [build status]: https://travis-ci.org/Calyhre/dribbble.svg?branch=master
176
+ [on rubygems]: http://rubygems.org/gems/dribbble
177
+ [on travis]: https://travis-ci.org/Calyhre/dribbble
178
+ [dribbble.com's api]: http://developer.dribbble.com/
179
+ [but, what is dribbble?]: https://dribbble.com/about
180
+ [license]: LICENSE.md
181
+ [contributors]: https://github.com/Calyhre/dribbble/graphs/contributors
182
+ [contributing]: CONTRIBUTING.md