stackconnect 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stackconnect.rb +7 -1
- data/spec/stack_spec.rb +6 -2
- 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: 584521866f19a44852be42c2b887bc195a1a6b4c
|
4
|
+
data.tar.gz: 62ac6e796de6db00704ddbdea97346ca9a909f8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7b8cd77e17362026ecf66d7ef953382bdf89c164ddbb5ce6cb95d98e5cc588ea5f755a467fd3500d99da127d6cc74ff77aa42e10f7c41a27df82fc748f5bef
|
7
|
+
data.tar.gz: 8ac1331b3d950d7e76fb822baeb2d30873b31b666ec3aff5d7f7cf0689e1bb897dc4b45a933c91ea4208eca096a757ed54573aca42ba3e5d48da114db3998bdc
|
data/lib/stackconnect.rb
CHANGED
@@ -5,7 +5,7 @@ require 'uri'
|
|
5
5
|
class StackConnect
|
6
6
|
attr_accessor :api, :site, :uri
|
7
7
|
|
8
|
-
@@VERSION = "0.0.
|
8
|
+
@@VERSION = "0.0.2"
|
9
9
|
@@api = 'http://api.stackexchange.com/'
|
10
10
|
@@site = 'stackoverflow'
|
11
11
|
@@uri = URI(@@api)
|
@@ -17,6 +17,12 @@ class StackConnect
|
|
17
17
|
count = data["total"]
|
18
18
|
end
|
19
19
|
|
20
|
+
def retrieve_most_popular_tags
|
21
|
+
@@uri.path = '/2.1/tags'
|
22
|
+
@@uri.query = ({ :order=>'desc', :sort=>'popular', :site=>@@site}).to_query
|
23
|
+
data = JSON.parse(@@uri.open.read)
|
24
|
+
end
|
25
|
+
|
20
26
|
def self.return_version
|
21
27
|
@@VERSION
|
22
28
|
end
|
data/spec/stack_spec.rb
CHANGED
@@ -6,10 +6,14 @@ describe StackConnect do
|
|
6
6
|
puts @connect.api
|
7
7
|
end
|
8
8
|
|
9
|
-
it "should return an integer " do
|
9
|
+
it "retrieve questions should return an integer " do
|
10
10
|
date = Date.today.to_time.to_i
|
11
|
-
|
11
|
+
@connect.retrieve_total_questions(date).to_i.should be_a(Fixnum)
|
12
12
|
end
|
13
|
+
|
14
|
+
it "retrieve popular tags should return array" do
|
15
|
+
@connect.retrieve_most_popular_tags.should be_a(Hash)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
|