pilha 0.1.2 → 0.1.3

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.
@@ -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
- users = response['users'].map { |user| User.new(user) }
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.2"
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."
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dalto Curvelano Junior