pilha 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pilha/stack_overflow/user.rb +21 -11
- data/pilha.gemspec +1 -1
- metadata +2 -2
@@ -13,25 +13,35 @@ module StackExchange
|
|
13
13
|
:user_mentioned_url, :user_comments_url, :user_reputation_url,
|
14
14
|
:badge_counts
|
15
15
|
|
16
|
-
def initialize(hash)
|
17
|
-
@struct = OpenStruct.new hash
|
18
|
-
end
|
19
|
-
|
20
|
-
def id
|
21
|
-
@struct.user_id
|
22
|
-
end
|
23
|
-
|
24
16
|
class << self
|
25
17
|
|
26
18
|
attr_reader :client
|
27
19
|
|
20
|
+
def all(options = {})
|
21
|
+
response = client.request('/users', options)
|
22
|
+
OpenStruct.new(parse response)
|
23
|
+
end
|
24
|
+
|
28
25
|
def find_by_badge_id(id, options = {})
|
29
26
|
options.merge! :id => id
|
30
27
|
response = client.request('/badges/:id', options)
|
31
|
-
|
32
|
-
response['users'] = users
|
33
|
-
OpenStruct.new response
|
28
|
+
OpenStruct.new(parse response)
|
34
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def parse(response)
|
33
|
+
users = response['users'].map { |user| User.new(user) }
|
34
|
+
response['users'] = users
|
35
|
+
response
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(hash)
|
40
|
+
@struct = OpenStruct.new hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def id
|
44
|
+
@struct.user_id
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
data/pilha.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "pilha"
|
3
|
-
gem.version = "0.1.
|
3
|
+
gem.version = "0.1.3"
|
4
4
|
gem.authors = ["Dalto Curvelano Junior"]
|
5
5
|
gem.description = "A ruby wrapper to the Stack Exchange (Stack Overflow and friends) API."
|
6
6
|
gem.summary = "A ruby wrapper to the Stack Exchange (Stack Overflow and friends) API."
|