dribbble 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/lib/dribbble/client.rb +1 -1
- data/lib/dribbble/user.rb +4 -27
- data/lib/dribbble/utils/has_children.rb +3 -3
- data/lib/dribbble/version.rb +1 -1
- data/spec/lib/dribbble/user_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eff1aac4c30a7dec57c39acd452c29a3bdb9c49
|
4
|
+
data.tar.gz: 29797d5b150718aaa47e541d9704770d5150c9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f958d7451b211dc2898b1b8e682941d35811a72f6f9b681c4d22942271eb9463a2fb9dbc5279f26c8012a8251135ecf6b3f9dbf2f68f31ddaeb5e437a8ee19
|
7
|
+
data.tar.gz: 74a7d86be3ad9b76bcf3b9a4f79f14311f8dd00c74dd7d1bed5e3b3ae6dd4ff93f7bf6dc3e75ab0d92ced017d9b8c96d7d3d1435a6237367272236f05f4fa0a9
|
data/lib/dribbble/client.rb
CHANGED
data/lib/dribbble/user.rb
CHANGED
@@ -4,17 +4,10 @@ module Dribbble
|
|
4
4
|
class User < Dribbble::Base
|
5
5
|
include Dribbble::Utils::Findable
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def followers(attrs = {})
|
12
|
-
Dribbble::User.batch_new token, html_get("/users/#{id}/followers", attrs)
|
13
|
-
end
|
14
|
-
|
15
|
-
def following(attrs = {})
|
16
|
-
Dribbble::User.batch_new token, html_get("/users/#{id}/following", attrs), 'followee'
|
17
|
-
end
|
7
|
+
has_many :buckets, :projects, :shots, :teams
|
8
|
+
has_many :likes, as: Dribbble::Shot, key: 'shot'
|
9
|
+
has_many :followers, as: Dribbble::User, key: 'follower'
|
10
|
+
has_many :following, as: Dribbble::User, key: 'followee'
|
18
11
|
|
19
12
|
def following?(other_user_id = nil)
|
20
13
|
if other_user_id
|
@@ -36,21 +29,5 @@ module Dribbble
|
|
36
29
|
res = html_delete "/users/#{id}/follow"
|
37
30
|
res.code == 204 ? true : false
|
38
31
|
end
|
39
|
-
|
40
|
-
def likes(attrs = {})
|
41
|
-
Dribbble::Shot.batch_new token, html_get("/users/#{id}/likes", attrs), 'shot'
|
42
|
-
end
|
43
|
-
|
44
|
-
def projects(attrs = {})
|
45
|
-
Dribbble::Project.batch_new token, html_get("/users/#{id}/projects", attrs)
|
46
|
-
end
|
47
|
-
|
48
|
-
def shots(attrs = {})
|
49
|
-
Dribbble::Shot.batch_new token, html_get("/users/#{id}/shots", attrs)
|
50
|
-
end
|
51
|
-
|
52
|
-
def teams(attrs = {})
|
53
|
-
Dribbble::Team.batch_new token, html_get("/users/#{id}/teams", attrs)
|
54
|
-
end
|
55
32
|
end
|
56
33
|
end
|
@@ -4,7 +4,7 @@ module Dribbble
|
|
4
4
|
module ClassMethods
|
5
5
|
def has_many(*fields)
|
6
6
|
if fields[1].is_a? Hash
|
7
|
-
generate_methods fields[0], fields[1][:as]
|
7
|
+
generate_methods fields[0], fields[1][:as], fields[1][:key]
|
8
8
|
else
|
9
9
|
fields.each do |field|
|
10
10
|
generate_methods field
|
@@ -12,13 +12,13 @@ module Dribbble
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def generate_methods(field, klass = nil)
|
15
|
+
def generate_methods(field, klass = nil, key = nil)
|
16
16
|
singularized_field = field[0...-1]
|
17
17
|
|
18
18
|
define_method field do |attrs = {}|
|
19
19
|
klass ||= Object.const_get "Dribbble::#{__method__[0...-1].capitalize}"
|
20
20
|
url = "/#{pluralized_class_name}/#{id}/#{field}"
|
21
|
-
klass.batch_new token, html_get(url, attrs),
|
21
|
+
klass.batch_new token, html_get(url, attrs), key, url
|
22
22
|
end
|
23
23
|
|
24
24
|
define_method "find_#{singularized_field}" do |child_id|
|
data/lib/dribbble/version.rb
CHANGED