dribbble 1.0.0.beta2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/README.md +340 -32
- data/lib/dribbble/base.rb +0 -60
- data/lib/dribbble/bucket.rb +1 -3
- data/lib/dribbble/client.rb +43 -1
- data/lib/dribbble/utils/findable.rb +1 -3
- data/lib/dribbble/version.rb +1 -1
- data/spec/lib/dribbble/base_spec.rb +0 -139
- data/spec/lib/dribbble/bucket_spec.rb +1 -1
- data/spec/lib/dribbble/client_spec.rb +96 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18cd848202fc891ab28292a51dc036f64125d085
|
4
|
+
data.tar.gz: d913356962f8e04f18370d311dfe1dc3db316976
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f884da43284d7c6cf7bf988b2af6f748ebd10daccfbfbdbd4fe1705c79cf18f17dea38ed4dc6be7b9035a7db301ab96c394b3513374f513ee9f6b970dc74312
|
7
|
+
data.tar.gz: 1a5ccdecd5ca1d38ff301ce9e3cdca166705bd2e15a357121b83fef7bcf4cd7322a94012261bb1e56302ddcf8e0034dae88d620e6bc5c9389278a385125781b6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -23,70 +23,380 @@ gem 'dribbble'
|
|
23
23
|
gem install dribbble
|
24
24
|
```
|
25
25
|
|
26
|
+
---
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
26
31
|
## Usage
|
27
32
|
|
28
|
-
|
33
|
+
Lets assume you have your token set:
|
29
34
|
|
30
35
|
```ruby
|
31
|
-
|
36
|
+
token = 'my_access_token'
|
32
37
|
```
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
You can get the current user logged in by calling `client.user`
|
39
|
+
Some calls are through a client:
|
37
40
|
|
38
41
|
```ruby
|
39
|
-
client.
|
40
|
-
#=> #<Dribbble::User ...>
|
42
|
+
client = Dribbble::Client.new(token)
|
41
43
|
```
|
42
44
|
|
43
|
-
Or you can get a specific user by knowing his ID
|
44
45
|
|
46
|
+
|
47
|
+
|
48
|
+
### Buckets
|
49
|
+
|
50
|
+
##### Find a bucket
|
51
|
+
```ruby
|
52
|
+
bucket = Dribbble::Bucket.find(token, '2754')
|
53
|
+
```
|
54
|
+
|
55
|
+
##### Create a bucket
|
45
56
|
```ruby
|
46
|
-
|
47
|
-
#=> #<Dribbble::User id=1 ...>
|
57
|
+
bucket = Dribbble::Bucket.create(token, name: 'A new bucket', description: 'A description')
|
48
58
|
```
|
49
59
|
|
50
|
-
|
60
|
+
##### Update a bucket
|
61
|
+
```ruby
|
62
|
+
bucket.update name: 'An updated bucket name'
|
63
|
+
```
|
51
64
|
|
65
|
+
##### Delete a bucket
|
52
66
|
```ruby
|
53
|
-
|
54
|
-
|
67
|
+
bucket.delete
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Bucket shots
|
55
71
|
|
56
|
-
|
57
|
-
|
72
|
+
##### List bucket shots
|
73
|
+
```ruby
|
74
|
+
shots = bucket.shots
|
58
75
|
```
|
59
76
|
|
60
|
-
|
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
|
+
```
|
61
83
|
|
84
|
+
##### Remove shot from a bucket
|
62
85
|
```ruby
|
63
|
-
|
64
|
-
|
86
|
+
bucket.remove_shot(329335)
|
87
|
+
# or
|
88
|
+
bucket.remove_shot(shot) # shot is a Dribbble::Shot
|
65
89
|
```
|
66
90
|
|
67
|
-
... And shots :
|
68
91
|
|
92
|
+
|
93
|
+
|
94
|
+
### Projects
|
95
|
+
|
96
|
+
##### Find a Projects
|
97
|
+
```ruby
|
98
|
+
project = Dribbble::Project.find(token, 3)
|
99
|
+
```
|
100
|
+
|
101
|
+
#### Project shots
|
69
102
|
```ruby
|
70
|
-
|
71
|
-
#=> [#<Dribbble::Shot ...>, #<Dribbble::Shot ...>]
|
103
|
+
shots = project.shots
|
72
104
|
```
|
73
105
|
|
106
|
+
|
107
|
+
|
108
|
+
|
74
109
|
### Shots
|
75
110
|
|
76
|
-
|
111
|
+
##### List shots
|
112
|
+
```ruby
|
113
|
+
shots = Dribbble::Shot.all(token)
|
114
|
+
```
|
115
|
+
|
116
|
+
##### Find a shot
|
117
|
+
```ruby
|
118
|
+
shot = Dribbble::Shot.find(token, 1971500)
|
119
|
+
```
|
120
|
+
|
121
|
+
##### Create a shot
|
122
|
+
```ruby
|
123
|
+
params = {
|
124
|
+
title: 'A new shot',
|
125
|
+
description: 'Shot description',
|
126
|
+
tags: %w(tag1 tag2),
|
127
|
+
team_id: 1234,
|
128
|
+
rebound_source_id: 1234,
|
129
|
+
}
|
130
|
+
shot = Dribbble::Shot.create(token, params)
|
131
|
+
```
|
77
132
|
|
133
|
+
##### Update a shot
|
78
134
|
```ruby
|
79
|
-
|
80
|
-
title: '
|
81
|
-
|
82
|
-
|
83
|
-
|
135
|
+
params = {
|
136
|
+
title: 'A new shot',
|
137
|
+
description: 'Shot description',
|
138
|
+
tags: %w(tag1 tag2),
|
139
|
+
team_id: 1234
|
84
140
|
}
|
141
|
+
shot.update(params)
|
142
|
+
```
|
143
|
+
|
144
|
+
##### Delete a shot
|
145
|
+
```ruby
|
146
|
+
shot.delete
|
147
|
+
```
|
148
|
+
|
149
|
+
#### Shot attachments
|
85
150
|
|
86
|
-
|
87
|
-
|
151
|
+
##### List attachments for a shot
|
152
|
+
```ruby
|
153
|
+
shot.attachments
|
154
|
+
```
|
155
|
+
|
156
|
+
##### Create an attachment
|
157
|
+
```ruby
|
158
|
+
shot.create_attachment(file: File.open('attachment_path'))
|
88
159
|
```
|
89
160
|
|
161
|
+
##### Get a single attachment
|
162
|
+
```ruby
|
163
|
+
shot.find_attachment(206165)
|
164
|
+
```
|
165
|
+
|
166
|
+
##### 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
|
+
|
241
|
+
##### Unlike a shot
|
242
|
+
```ruby
|
243
|
+
shot.unlike!
|
244
|
+
```
|
245
|
+
|
246
|
+
#### 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
|
+
|
275
|
+
|
276
|
+
#### Team shots
|
277
|
+
##### List shots for a team
|
278
|
+
```ruby
|
279
|
+
shots = team.shots
|
280
|
+
```
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
### Users
|
286
|
+
##### Get a single user
|
287
|
+
```ruby
|
288
|
+
user = Dribbble::User.find(token, 483195)
|
289
|
+
```
|
290
|
+
|
291
|
+
##### 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
|
+
|
315
|
+
##### List followers of authenticated user
|
316
|
+
```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
|
367
|
+
```
|
368
|
+
|
369
|
+
##### List authenticated user’s projects
|
370
|
+
```ruby
|
371
|
+
projects = client.projects
|
372
|
+
```
|
373
|
+
|
374
|
+
|
375
|
+
#### User shots
|
376
|
+
##### List shots for a user
|
377
|
+
```ruby
|
378
|
+
shots = user.shots
|
379
|
+
```
|
380
|
+
|
381
|
+
##### List shots for authenticated user
|
382
|
+
```ruby
|
383
|
+
shots = client.shots
|
384
|
+
```
|
385
|
+
|
386
|
+
|
387
|
+
#### User teams
|
388
|
+
##### List a user’s teams
|
389
|
+
```ruby
|
390
|
+
teams = user.teams
|
391
|
+
```
|
392
|
+
|
393
|
+
##### List authenticated user’s teams
|
394
|
+
```ruby
|
395
|
+
teams = client.teams
|
396
|
+
```
|
397
|
+
|
398
|
+
|
399
|
+
|
90
400
|
### Pagination & parameters
|
91
401
|
|
92
402
|
All requests are paginated, defaults params are :
|
@@ -99,13 +409,11 @@ All requests are paginated, defaults params are :
|
|
99
409
|
You override them or adding some by passing a `Hash` to every request :
|
100
410
|
|
101
411
|
```ruby
|
102
|
-
|
412
|
+
user.shots page: 2, custom_param: 'My param'
|
103
413
|
```
|
104
414
|
|
105
415
|
## Contributing
|
106
416
|
|
107
|
-
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Calyhre/dribbble?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
108
|
-
|
109
417
|
Feel free to help me make this gem awesome !
|
110
418
|
|
111
419
|
[Contributors](https://github.com/Calyhre/dribbble/graphs/contributors) and [CONTRIBUTING](https://github.com/Calyhre/dribbble/blob/master/CONTRIBUTING.md)
|
data/lib/dribbble/base.rb
CHANGED
@@ -32,66 +32,6 @@ module Dribbble
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
# Get a single bucket
|
36
|
-
def get_bucket(id)
|
37
|
-
Dribbble::Bucket.new @token, html_get("/buckets/#{id}")
|
38
|
-
end
|
39
|
-
|
40
|
-
# Get authenticated user's buckets
|
41
|
-
def get_buckets(attrs = {})
|
42
|
-
Dribbble::Bucket.batch_new token, html_get('/user/buckets', attrs)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Get authenticated user's followers
|
46
|
-
def get_followers(attrs = {})
|
47
|
-
Dribbble::User.batch_new token, html_get('/user/followers', attrs)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Get authenticated user's likes
|
51
|
-
def get_likes(attrs = {})
|
52
|
-
Dribbble::Shot.batch_new token, html_get('/user/likes', attrs), 'shot'
|
53
|
-
end
|
54
|
-
|
55
|
-
# Get a single project
|
56
|
-
def get_project(id)
|
57
|
-
Dribbble::Project.new @token, html_get("/projects/#{id}")
|
58
|
-
end
|
59
|
-
|
60
|
-
# Get authenticated user's followers
|
61
|
-
def get_projects(attrs = {})
|
62
|
-
Dribbble::Project.batch_new token, html_get('/user/projects', attrs)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Get a single Shot
|
66
|
-
def get_shot(id)
|
67
|
-
Dribbble::Shot.new @token, html_get("/shots/#{id}")
|
68
|
-
end
|
69
|
-
|
70
|
-
# Get authenticated user's shots
|
71
|
-
def get_shots(attrs = {})
|
72
|
-
Dribbble::Shot.batch_new token, html_get('/user/shots', attrs)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Get authenticated user's followees shots
|
76
|
-
# Limited to first 600 shots regardless of the pagination
|
77
|
-
def get_following_shots(attrs = {})
|
78
|
-
Dribbble::Shot.batch_new token, html_get('/user/following/shots', attrs)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Get authenticated user's teams
|
82
|
-
def get_teams(attrs = {})
|
83
|
-
Dribbble::Team.batch_new token, html_get('/user/teams', attrs)
|
84
|
-
end
|
85
|
-
|
86
|
-
# Get a single User or the authenticated one
|
87
|
-
def get_user(id = nil)
|
88
|
-
if id
|
89
|
-
Dribbble::User.new @token, html_get("/users/#{id}")
|
90
|
-
else
|
91
|
-
Dribbble::User.new @token, html_get('/user')
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
35
|
private
|
96
36
|
|
97
37
|
def build_dribbble_url(id, dribbble_url)
|
data/lib/dribbble/bucket.rb
CHANGED
@@ -10,9 +10,7 @@ module Dribbble
|
|
10
10
|
include Dribbble::Utils::Updatable
|
11
11
|
include Dribbble::Utils::Deletable
|
12
12
|
|
13
|
-
|
14
|
-
Dribbble::Shot.batch_new token, html_get("/bucket/#{id}/shots", attrs)
|
15
|
-
end
|
13
|
+
has_many :shots
|
16
14
|
|
17
15
|
def add_shot(shot)
|
18
16
|
shot_id = shot.is_a?(Dribbble::Shot) ? shot.id : shot
|
data/lib/dribbble/client.rb
CHANGED
@@ -13,9 +13,51 @@ module Dribbble
|
|
13
13
|
class Client < Dribbble::Base
|
14
14
|
include Dribbble::Utils
|
15
15
|
|
16
|
-
def initialize(token
|
16
|
+
def initialize(token = nil)
|
17
|
+
token = token.is_a?(Hash) ? token[:token] : token
|
17
18
|
@token = token
|
18
19
|
fail Dribbble::Error::MissingToken if @token.nil?
|
19
20
|
end
|
21
|
+
|
22
|
+
# Get authenticated user's buckets
|
23
|
+
def buckets(attrs = {})
|
24
|
+
Dribbble::Bucket.batch_new token, html_get('/user/buckets', attrs)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get authenticated user's followers
|
28
|
+
def followers(attrs = {})
|
29
|
+
Dribbble::User.batch_new token, html_get('/user/followers', attrs)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get authenticated user's likes
|
33
|
+
def likes(attrs = {})
|
34
|
+
Dribbble::Shot.batch_new token, html_get('/user/likes', attrs), 'shot'
|
35
|
+
end
|
36
|
+
|
37
|
+
# Get authenticated user's followers
|
38
|
+
def projects(attrs = {})
|
39
|
+
Dribbble::Project.batch_new token, html_get('/user/projects', attrs)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get authenticated user's shots
|
43
|
+
def shots(attrs = {})
|
44
|
+
Dribbble::Shot.batch_new token, html_get('/user/shots', attrs)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get authenticated user's followees shots
|
48
|
+
# Limited to first 600 shots regardless of the pagination
|
49
|
+
def following_shots(attrs = {})
|
50
|
+
Dribbble::Shot.batch_new token, html_get('/user/following/shots', attrs)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get authenticated user's teams
|
54
|
+
def teams(attrs = {})
|
55
|
+
Dribbble::Team.batch_new token, html_get('/user/teams', attrs)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get a single User or the authenticated one
|
59
|
+
def user
|
60
|
+
Dribbble::User.new @token, html_get('/user')
|
61
|
+
end
|
20
62
|
end
|
21
63
|
end
|
@@ -3,9 +3,7 @@ module Dribbble
|
|
3
3
|
module Findable
|
4
4
|
module ClassMethods
|
5
5
|
def find(token, id)
|
6
|
-
|
7
|
-
@client = Dribbble::Client.new token: @token
|
8
|
-
@client.send "get_#{name.split('::').last.downcase}", id
|
6
|
+
new token, html_get("/#{pluralized_class_name}/#{id}")
|
9
7
|
end
|
10
8
|
end
|
11
9
|
|
data/lib/dribbble/version.rb
CHANGED
@@ -48,143 +48,4 @@ describe Dribbble::Client do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
52
|
-
describe 'on #get_bucket' do
|
53
|
-
subject do
|
54
|
-
stub_dribbble :get, '/buckets/2754', DribbbleAPI::BucketSuccess
|
55
|
-
@base.get_bucket 2754
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'return a bucket' do
|
59
|
-
expect(subject).to be_a Dribbble::Bucket
|
60
|
-
expect(subject.id).to eq(2754)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe 'on #get_buckets' do
|
65
|
-
subject do
|
66
|
-
stub_dribbble :get, '/user/buckets', DribbbleAPI::BucketsSuccess
|
67
|
-
@base.get_buckets
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'return buckets' do
|
71
|
-
expect(subject.first).to be_a Dribbble::Bucket
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe 'on #get_followers' do
|
76
|
-
subject do
|
77
|
-
stub_dribbble :get, '/user/followers', DribbbleAPI::FollowersSuccess
|
78
|
-
@base.get_followers
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'return users' do
|
82
|
-
expect(subject.first).to be_a Dribbble::User
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'on #get_likes' do
|
87
|
-
subject do
|
88
|
-
stub_dribbble :get, '/user/likes', DribbbleAPI::UserLikesSuccess
|
89
|
-
@base.get_likes
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'return shots' do
|
93
|
-
expect(subject.first).to be_a Dribbble::Shot
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe 'on #get_project' do
|
98
|
-
subject do
|
99
|
-
stub_dribbble :get, '/projects/3', DribbbleAPI::ProjectSuccess
|
100
|
-
@base.get_project 3
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'return a project' do
|
104
|
-
expect(subject).to be_a Dribbble::Project
|
105
|
-
expect(subject.id).to eq(3)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe 'on #get_projects' do
|
110
|
-
subject do
|
111
|
-
stub_dribbble :get, '/user/projects', DribbbleAPI::ProjectsSuccess
|
112
|
-
@base.get_projects
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'return projects' do
|
116
|
-
expect(subject.first).to be_a Dribbble::Project
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'on #get_shot' do
|
121
|
-
subject do
|
122
|
-
stub_dribbble :get, '/shots/471756', DribbbleAPI::ShotSuccess
|
123
|
-
@base.get_shot 471_756
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'return a shot' do
|
127
|
-
expect(subject).to be_a Dribbble::Shot
|
128
|
-
expect(subject.id).to eq(471_756)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe 'on #get_shots' do
|
133
|
-
subject do
|
134
|
-
stub_dribbble :get, '/user/shots', DribbbleAPI::ShotsSuccess
|
135
|
-
@base.get_shots
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'return shots' do
|
139
|
-
expect(subject.first).to be_a Dribbble::Shot
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe 'on #get_following_shots' do
|
144
|
-
subject do
|
145
|
-
stub_dribbble :get, '/user/following/shots', DribbbleAPI::ShotsSuccess
|
146
|
-
@base.get_following_shots
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'return shots' do
|
150
|
-
expect(subject.first).to be_a Dribbble::Shot
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
describe 'on #get_teams' do
|
155
|
-
subject do
|
156
|
-
stub_dribbble :get, '/user/teams', DribbbleAPI::TeamsSuccess
|
157
|
-
@base.get_teams
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'return teams' do
|
161
|
-
expect(subject.first).to be_a Dribbble::Team
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe 'on #get_user' do
|
166
|
-
describe 'without id' do
|
167
|
-
subject do
|
168
|
-
stub_dribbble :get, '/user', DribbbleAPI::CurrentUserSuccess
|
169
|
-
@base.get_user
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'return current user' do
|
173
|
-
expect(subject).to be_a Dribbble::User
|
174
|
-
expect(subject.id).to eq(8_008_135)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe 'with id' do
|
179
|
-
subject do
|
180
|
-
stub_dribbble :get, '/users/483195', DribbbleAPI::UserSuccess
|
181
|
-
@base.get_user 483_195
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'return current user' do
|
185
|
-
expect(subject).to be_a Dribbble::User
|
186
|
-
expect(subject.id).to eq(483_195)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
51
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Dribbble::Client do
|
4
|
+
before :all do
|
5
|
+
@client = Dribbble::Client.new 'valid_token'
|
6
|
+
end
|
7
|
+
|
4
8
|
describe 'without token' do
|
5
9
|
it 'raises Dribbble::Error::MissingToken' do
|
6
10
|
expect do
|
@@ -18,7 +22,7 @@ describe Dribbble::Client do
|
|
18
22
|
|
19
23
|
it 'raise Dribbble::Error::Unauthorized' do
|
20
24
|
expect do
|
21
|
-
subject.
|
25
|
+
subject.user
|
22
26
|
end.to raise_error(Dribbble::Error::Unauthorized)
|
23
27
|
end
|
24
28
|
end
|
@@ -30,9 +34,98 @@ describe Dribbble::Client do
|
|
30
34
|
end
|
31
35
|
|
32
36
|
it 'return a Dribbble::User' do
|
33
|
-
expect(subject.
|
34
|
-
expect(subject.
|
37
|
+
expect(subject.user).to be_a Dribbble::User
|
38
|
+
expect(subject.user.name).to be_a String
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
42
|
+
|
43
|
+
describe 'on #buckets' do
|
44
|
+
subject do
|
45
|
+
stub_dribbble :get, '/user/buckets', DribbbleAPI::BucketsSuccess
|
46
|
+
@client.buckets
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'return buckets' do
|
50
|
+
expect(subject.first).to be_a Dribbble::Bucket
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'on #followers' do
|
55
|
+
subject do
|
56
|
+
stub_dribbble :get, '/user/followers', DribbbleAPI::FollowersSuccess
|
57
|
+
@client.followers
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'return users' do
|
61
|
+
expect(subject.first).to be_a Dribbble::User
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'on #likes' do
|
66
|
+
subject do
|
67
|
+
stub_dribbble :get, '/user/likes', DribbbleAPI::UserLikesSuccess
|
68
|
+
@client.likes
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'return shots' do
|
72
|
+
expect(subject.first).to be_a Dribbble::Shot
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'on #projects' do
|
77
|
+
subject do
|
78
|
+
stub_dribbble :get, '/user/projects', DribbbleAPI::ProjectsSuccess
|
79
|
+
@client.projects
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'return projects' do
|
83
|
+
expect(subject.first).to be_a Dribbble::Project
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'on #shots' do
|
88
|
+
subject do
|
89
|
+
stub_dribbble :get, '/user/shots', DribbbleAPI::ShotsSuccess
|
90
|
+
@client.shots
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'return shots' do
|
94
|
+
expect(subject.first).to be_a Dribbble::Shot
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'on #following_shots' do
|
99
|
+
subject do
|
100
|
+
stub_dribbble :get, '/user/following/shots', DribbbleAPI::ShotsSuccess
|
101
|
+
@client.following_shots
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'return shots' do
|
105
|
+
expect(subject.first).to be_a Dribbble::Shot
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe 'on #teams' do
|
110
|
+
subject do
|
111
|
+
stub_dribbble :get, '/user/teams', DribbbleAPI::TeamsSuccess
|
112
|
+
@client.teams
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'return teams' do
|
116
|
+
expect(subject.first).to be_a Dribbble::Team
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'on #user' do
|
121
|
+
subject do
|
122
|
+
stub_dribbble :get, '/user', DribbbleAPI::CurrentUserSuccess
|
123
|
+
@client.user
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'return current user' do
|
127
|
+
expect(subject).to be_a Dribbble::User
|
128
|
+
expect(subject.id).to eq(8_008_135)
|
129
|
+
end
|
130
|
+
end
|
38
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dribbble
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Calyhre
|
@@ -182,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: 2.0.0
|
183
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
190
|
rubygems_version: 2.2.2
|