stackconnect 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec96ac681199f9efea3ac10d99fbf8a0825dde2a
4
- data.tar.gz: 1fcf637c793352def3c8419f37b46ae8f1715315
3
+ metadata.gz: 78a2c20cf03921bc1c14b0ec1b5a611e481537de
4
+ data.tar.gz: 3161bccf9aea327ca6649c4d92a5134c81598d10
5
5
  SHA512:
6
- metadata.gz: ccce69a92ff89671e5b9b838ec6b3132259d4a7329f679204bcb953e9c9a2bd6b62f764e914b359b72ff1dddbaf81d6696871ae11ad93f2b74f4c240ddda2b88
7
- data.tar.gz: 66aa66ac90139c2acf00b5f99f40b664490bdf3562ca1bfe8c52ed568eb054c9f031ef0e1f470a1032f69f6cf19371ace1e278e43e7191b79df227baf9d29d12
6
+ metadata.gz: 639f14f913a53042bcbaaeb1ddd3ab6f364b9b4cc2c45d828e67f328f7cb903c747406d6c7ae99cc6fa778a3525588af28b3eb525509cfbaf89e7fecb20a4fe7
7
+ data.tar.gz: c58765db774f55aca1180344bc0ea42da8cca83b6872e197c49fc3497b0f8f40e349306e99171b3338e6ae0370504c401970e5d7318c67abfa103532575c35b3
data/README.md CHANGED
@@ -21,8 +21,10 @@ Or install it yourself as:
21
21
  These methods are quota restricted. The Stack Exchange API only allows a quota of 10000 without an API key: http://api.stackexchange.com/docs/authentication. Once you get over that quota without a key, your IP address will be throttled from making any more requests until the next day.
22
22
 
23
23
  ### Retrieve Total Number of Questions
24
-
25
- `total = StackConnect.retrieve_total_questions(from_date)`
24
+ ```
25
+ sc = StackConnect.new
26
+ total = sc.retrieve_total_questions(from_date)
27
+ ```
26
28
 
27
29
  This will return an number.
28
30
 
@@ -30,12 +32,12 @@ From date has to be in Unix date format. So for example, to retrieve the total n
30
32
 
31
33
  ```
32
34
  date = Date.today.to_time.to_i
33
- total = StackConnect.retrieve_total_questions(from_date)
35
+ total = sc.retrieve_total_questions(from_date)
34
36
  ```
35
37
 
36
38
  ### Retrieve Most Popular Tags of All Time
37
39
 
38
- `data = StackConnect.retrieve_most_popular_tags`
40
+ `data = sc.retrieve_most_popular_tags`
39
41
 
40
42
  This will return a JSON data object which you can then parse. An example:
41
43
 
@@ -5,7 +5,7 @@ require 'uri'
5
5
  class StackConnect
6
6
  attr_accessor :api, :site, :uri
7
7
 
8
- @@VERSION = "0.0.7"
8
+ @@VERSION = "0.0.8"
9
9
  @@api = 'http://api.stackexchange.com/'
10
10
  @@site = 'stackoverflow'
11
11
  @@uri = URI(@@api)
@@ -29,6 +29,12 @@ class StackConnect
29
29
  data = JSON.parse(@@uri.open.read)
30
30
  end
31
31
 
32
+ def retrieve_hot_questions(from_date)
33
+ @@uri.path = '/2.1/questions'
34
+ @@uri.query = ({ :fromdate=>from_date, :site=>'stackoverflow', :sort=>'hot', :order=>'desc'}).to_query
35
+ data = JSON.parse(@@uri.open.read)
36
+ end
37
+
32
38
  def self.return_version
33
39
  @@VERSION
34
40
  end
@@ -11,13 +11,18 @@ describe StackConnect do
11
11
  @connect.retrieve_total_questions(date).to_i.should be_a(Fixnum)
12
12
  end
13
13
 
14
- it "retrieve popular tags should return array" do
14
+ it "retrieve popular tags should return json object" do
15
15
  @connect.retrieve_most_popular_tags.should be_a(Hash)
16
16
  end
17
17
 
18
- it "retrieve popular tags of the days returns array" do
18
+ it "retrieve popular tags of the days returns json object" do
19
19
  date = Date.today.to_time.to_i
20
20
  @connect.retrieve_day_popular_tags(date).should be_a(Hash)
21
21
  end
22
+
23
+ it "retrieve hot questions returns json object" do
24
+ date = Date.today.to_time.to_i
25
+ @connect.retrieve_hot_questions(date).should be_a(Hash)
26
+ end
22
27
  end
23
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - amirtcheva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber