dribbble 1.0.1 → 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 -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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: eebd1d875d2a246c82abe992c30399b86bc926fa
4
- data.tar.gz: 7702399ef09cb5399581a8311503d6a50909027f
2
+ SHA256:
3
+ metadata.gz: bee28704e42f6f0932347653155182935007a586e3e8504cdca499bb4fafed00
4
+ data.tar.gz: 1b380afdd195c440c19e7943e662ce84b37f2ce38333098c0f18ca127cbbf9be
5
5
  SHA512:
6
- metadata.gz: d53fa391316e9d29ccfb7c18c9cca8c9dc4cfccc7652c6e8e9c9daa6d64b17f812970dcd8403d38945b2b2838dff873b463aa7173db5f7f3f07d0648060bd1d8
7
- data.tar.gz: a678ba5dc4bb8e43e702602179c7abc7534d493295ac6536f9d31830b5bdf04c5a5b96468c037dbd2b5c5efe9badce3ad33feb475ac0d4eeed4c7ef21dae3088
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,12 +3,9 @@ language: ruby
3
3
 
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.0.0
7
- - 2.1.7
8
- - 2.2.3
9
- - 2.3.0-dev
6
+ - 2.5.0
7
+ - 2.6.6
8
+ - 2.7.3
10
9
 
11
10
  matrix:
12
11
  fast_finish: true
13
- allow_failures:
14
- - rvm: 2.3.0-dev
data/CHANGELOG.md ADDED
@@ -0,0 +1,58 @@
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
22
+ - Bump rest-client from `~> 1.7` to `~> 2.0`, [see changes](https://github.com/rest-client/rest-client/blob/master/history.md#200)
23
+ - Bump supported Ruby versions
24
+
25
+
26
+ ## [1.1.0] - 2016-11-17
27
+ #### Added
28
+ - Add low_profile to shots
29
+
30
+ #### Changed
31
+ - Bump minimal Ruby version required to `2.2.5`
32
+
33
+
34
+ ## [1.0.4] - 2015-11-28
35
+ #### Fixed
36
+ - Fix wrong constant name
37
+
38
+
39
+ ## [1.0.2] - 2015-11-22
40
+ #### Fixed
41
+ - Fix wrong API parsing for user's followers
42
+
43
+
44
+ ## [1.0.1] - 2015-11-22
45
+ #### Fixed
46
+ - Fix missing token
47
+
48
+
49
+ ## 1.0.0 - 2015-11-21
50
+ #### Added
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,15 +1,18 @@
1
- # DribbbleAPI
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
- _Dribbble API wrapper gem_
5
+ Calyhre/dribbble is an unofficial API wrapper ruby gem for [Dribbble.com's API].
6
+
7
+ [But, what is Dribbble?]
8
+
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.
7
10
 
8
11
  ## Installation
9
12
 
10
13
  ### Requirements
11
14
 
12
- * Ruby `~> 2.0`
15
+ * Ruby `~> 2.2.5`, use `v1.0.4` for previous Ruby versions.
13
16
 
14
17
  ### In a Gemfile
15
18
 
@@ -25,9 +28,6 @@ gem install dribbble
25
28
 
26
29
  ---
27
30
 
28
-
29
-
30
-
31
31
  ## Usage
32
32
 
33
33
  Lets assume you have your token set:
@@ -42,95 +42,50 @@ Some calls are through a client:
42
42
  client = Dribbble::Client.new(token)
43
43
  ```
44
44
 
45
+ ### Projects
45
46
 
47
+ ##### Find a Projects
46
48
 
47
-
48
- ### Buckets
49
-
50
- ##### Find a bucket
51
- ```ruby
52
- bucket = Dribbble::Bucket.find(token, '2754')
53
- ```
54
-
55
- ##### Create a bucket
56
- ```ruby
57
- bucket = Dribbble::Bucket.create(token, name: 'A new bucket', description: 'A description')
58
- ```
59
-
60
- ##### Update a bucket
61
- ```ruby
62
- bucket.update name: 'An updated bucket name'
63
- ```
64
-
65
- ##### Delete a bucket
66
- ```ruby
67
- bucket.delete
68
- ```
69
-
70
- #### Bucket shots
71
-
72
- ##### List bucket shots
73
49
  ```ruby
74
- shots = bucket.shots
50
+ project = Dribbble::Project.find(token, 1234)
75
51
  ```
76
52
 
77
- ##### Add shot to a bucket
78
- ```ruby
79
- bucket.add_shot(329335)
80
- # or
81
- bucket.add_shot(shot) # shot is a Dribbble::Shot
82
- ```
53
+ ##### Update a Project
83
54
 
84
- ##### Remove shot from a bucket
85
55
  ```ruby
86
- bucket.remove_shot(329335)
87
- # or
88
- bucket.remove_shot(shot) # shot is a Dribbble::Shot
56
+ project.update(name: 'Some project', description: 'Some description');
89
57
  ```
90
58
 
59
+ ##### Delete a Project
91
60
 
92
-
93
-
94
- ### Projects
95
-
96
- ##### Find a Projects
97
61
  ```ruby
98
- project = Dribbble::Project.find(token, 3)
62
+ project.delete
99
63
  ```
100
64
 
101
- #### Project shots
102
- ```ruby
103
- shots = project.shots
104
- ```
105
-
106
-
107
-
108
-
109
65
  ### Shots
110
66
 
111
- ##### List shots
112
- ```ruby
113
- shots = Dribbble::Shot.all(token)
114
- ```
115
-
116
67
  ##### Find a shot
68
+
117
69
  ```ruby
118
70
  shot = Dribbble::Shot.find(token, 1971500)
119
71
  ```
120
72
 
121
73
  ##### Create a shot
74
+
122
75
  ```ruby
123
76
  params = {
124
77
  title: 'A new shot',
125
78
  description: 'Shot description',
79
+ image: File.open('/path/to/image.png'),
126
80
  tags: %w(tag1 tag2),
127
81
  team_id: 1234,
128
- rebound_source_id: 1234,
82
+ rebound_source_id: 1234
129
83
  }
130
84
  shot = Dribbble::Shot.create(token, params)
131
85
  ```
132
86
 
133
87
  ##### Update a shot
88
+
134
89
  ```ruby
135
90
  params = {
136
91
  title: 'A new shot',
@@ -142,269 +97,63 @@ shot.update(params)
142
97
  ```
143
98
 
144
99
  ##### Delete a shot
100
+
145
101
  ```ruby
146
102
  shot.delete
147
103
  ```
148
104
 
149
105
  #### Shot attachments
150
106
 
151
- ##### List attachments for a shot
152
- ```ruby
153
- shot.attachments
154
- ```
155
-
156
107
  ##### Create an attachment
157
- ```ruby
158
- shot.create_attachment(file: File.open('attachment_path'))
159
- ```
160
108
 
161
- ##### Get a single attachment
162
109
  ```ruby
163
- shot.find_attachment(206165)
110
+ shot.create_attachment(file: File.open('attachment_path'))
164
111
  ```
165
112
 
166
113
  ##### Delete an attachment
167
- ```ruby
168
- shot.delete_attachment(206165)
169
- ```
170
-
171
-
172
- #### Shot buckets
173
- ##### List buckets for a shot
174
- ```ruby
175
- shot.buckets
176
- ```
177
-
178
-
179
- #### Shot comments
180
- ##### List comments for a shot
181
- ```ruby
182
- shot.comments
183
- ```
184
-
185
- ##### Create a comment
186
- ```ruby
187
- comment = shot.create_comment(body: 'A comment')
188
- ```
189
-
190
- ##### Get a single comment
191
- ```ruby
192
- comment = shot.find_comment(1145736)
193
- ```
194
-
195
- ##### Update a comment
196
- ```ruby
197
- comment = shot.update_comment(1145736, body: 'Comment body')
198
- ```
199
-
200
- ##### Delete a comment
201
- ```ruby
202
- shot.delete_comment(1145736)
203
- ```
204
-
205
- ##### List likes for a comment
206
- ```ruby
207
- comment.likes
208
- ```
209
-
210
- ##### Check if you like a comment
211
- ```ruby
212
- comment.like?
213
- ```
214
-
215
- ##### Like a comment
216
- ```ruby
217
- comment.like!
218
- ```
219
-
220
- ##### Unlike a comment
221
- ```ruby
222
- comment.unlike!
223
- ```
224
-
225
- #### Shot likes
226
- ##### List the likes for a shot
227
- ```ruby
228
- shot.likes
229
- ```
230
-
231
- ##### Check if you like a shot
232
- ```ruby
233
- shot.like?
234
- ```
235
-
236
- ##### Like a shot
237
- ```ruby
238
- shot.like!
239
- ```
240
114
 
241
- ##### Unlike a shot
242
115
  ```ruby
243
- shot.unlike!
116
+ shot.delete_attachment(206165)
244
117
  ```
245
118
 
246
119
  #### Shot projects
247
- ##### List projects for a shot
248
- ```ruby
249
- projects = shot.projects
250
- ```
251
-
252
- #### Shot rebounds
253
- ##### List rebounds for a shot
254
- ```ruby
255
- shots = shot.rebounds
256
- ```
257
-
258
-
259
-
260
-
261
- ### Teams
262
-
263
- Let's assume you have a team:
264
- ```ruby
265
- user = Dribbble::User.find(token, 483195)
266
- team = user.teams.first
267
- ```
268
-
269
- #### Team members
270
- ##### List a team’s members
271
- ```ruby
272
- users = team.members
273
- ```
274
120
 
121
+ ##### List projects for a shot
275
122
 
276
- #### Team shots
277
- ##### List shots for a team
278
123
  ```ruby
279
- shots = team.shots
124
+ projects = shot.projects
280
125
  ```
281
126
 
282
-
283
-
284
-
285
127
  ### Users
286
- ##### Get a single user
287
- ```ruby
288
- user = Dribbble::User.find(token, 483195)
289
- ```
290
128
 
291
129
  ##### Get the authenticated user
292
- ```ruby
293
- user = client.user
294
- ```
295
-
296
-
297
- #### User buckets
298
- ##### List a user’s buckets
299
- ```ruby
300
- user.buckets
301
- ```
302
-
303
- ##### List authenticated user’s buckets
304
- ```ruby
305
- buckets = client.buckets
306
- ```
307
-
308
-
309
- #### User followers
310
- ##### List followers of a user
311
- ```ruby
312
- users = user.followers
313
- ```
314
130
 
315
- ##### List followers of authenticated user
316
131
  ```ruby
317
- users = client.followers
318
- ```
319
-
320
- ##### List users followed by a user
321
- ```ruby
322
- users = user.following
323
- ```
324
-
325
- ##### List shots for users followed by a authenticated user
326
- ```ruby
327
- shots = client.following_shots
328
- ```
329
-
330
- ##### Check if you are following a user
331
- ```ruby
332
- user.following?
333
- ```
334
-
335
- ##### Check if one user is following another
336
- ```ruby
337
- user.following?(483195)
338
- ```
339
-
340
- ##### Follow a user
341
- ```ruby
342
- user.follow!
343
- ```
344
-
345
- ##### Unfollow a user
346
- ```ruby
347
- user.unfollow!
348
- ```
349
-
350
-
351
- #### User likes
352
- ##### List shot likes for a user
353
- ```ruby
354
- shots = user.likes
355
- ```
356
-
357
- ##### List shot likes for authenticated user
358
- ```ruby
359
- shots = client.likes
360
- ```
361
-
362
-
363
- #### User projects
364
- ##### List a user’s projects
365
- ```ruby
366
- projects = user.projects
132
+ user = client.user
367
133
  ```
368
134
 
369
135
  ##### List authenticated user’s projects
136
+
370
137
  ```ruby
371
138
  projects = client.projects
372
139
  ```
373
140
 
374
-
375
141
  #### User shots
376
- ##### List shots for a user
377
- ```ruby
378
- shots = user.shots
379
- ```
380
142
 
381
143
  ##### List shots for authenticated user
382
- ```ruby
383
- shots = client.shots
384
- ```
385
-
386
144
 
387
- #### User teams
388
- ##### List a user’s teams
389
145
  ```ruby
390
- teams = user.teams
391
- ```
392
-
393
- ##### List authenticated user’s teams
394
- ```ruby
395
- teams = client.teams
146
+ shots = client.shots
396
147
  ```
397
148
 
398
-
399
-
400
149
  ### Pagination & parameters
401
150
 
402
151
  All requests are paginated, defaults params are :
403
152
 
404
- | Param | Default |
405
- |---------|--------:|
406
- |page | 1|
407
- |per_page | 100|
153
+ | Param | Default |
154
+ | -------- | ------: |
155
+ | page | 1 |
156
+ | per_page | 100 |
408
157
 
409
158
  You override them or adding some by passing a `Hash` to every request :
410
159
 
@@ -416,8 +165,18 @@ user.shots page: 2, custom_param: 'My param'
416
165
 
417
166
  Feel free to help me make this gem awesome !
418
167
 
419
- [Contributors](https://github.com/Calyhre/dribbble/graphs/contributors) and [CONTRIBUTING](https://github.com/Calyhre/dribbble/blob/master/CONTRIBUTING.md)
168
+ [Contributors] and [CONTRIBUTING]
420
169
 
421
170
  ## Licence
422
171
 
423
- 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