stack_overflow 0.0.3 → 0.0.4

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.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
+ *.swp
5
+ **/*.swp
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@ This is a simple gem that utilizes HTTParty and the StackOverflow API.
4
4
 
5
5
  gem install stack_overflow
6
6
 
7
- The StackOverflow API help can be found at http://api.stackoverflow.com/1.0/help
7
+ The StackOverflow API help can be found at http://api.stackoverflow.com/1.1/usage
8
8
 
9
9
  == Set API Key
10
10
 
@@ -16,7 +16,7 @@ You can get your key from StackOverflow by going here : http://stackapps.com/app
16
16
 
17
17
  == Get User(s)
18
18
 
19
- API documentation can be found at http://api.stackoverflow.com/1.0/help/method?method=users/{id}
19
+ API documentation can be found at http://api.stackoverflow.com/1.1/usage/methods/users-by-ids
20
20
 
21
21
  StackOverflow.get_user(#user_id)
22
22
 
@@ -26,10 +26,22 @@ You can also get a group of users by using
26
26
 
27
27
  == Get User's Tags
28
28
 
29
- API documentation can be found at http://api.stackoverflow.com/1.0/help/method?method=users/{id}/tags
29
+ API documentation can be found at http://api.stackoverflow.com/1.1/usage/methods/user-tags
30
30
 
31
31
  StackOverflow.get_user_tags(#user_id)
32
32
 
33
+ == Get Tags
34
+
35
+ API documentation can be found at http://api.stackoverflow.com/1.1/usage/methods/tags
36
+
37
+ StackOverflow.get_tags
38
+
39
+ == Get Tags Synonyms
40
+
41
+ API documentation can be found at http://api.stackoverflow.com/1.1/usage/methods/tag-synonyms
42
+
43
+ StackOverflow.get_tags_synonyms
44
+
33
45
  == Work in progress
34
46
 
35
- This is a work in progress as I use the API for my application.
47
+ This is a work in progress as I use the API for my application.
Binary file
@@ -1,3 +1,3 @@
1
1
  module StackOverflow
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -3,23 +3,33 @@ require 'httparty'
3
3
  class StackOverflow
4
4
  include HTTParty
5
5
  @@API_KEY = nil
6
-
6
+ @@URL = "http://api.stackoverflow.com/1.1/"
7
+
7
8
  def self.API_KEY=(value)
8
9
  @@API_KEY = value
9
10
  end
10
11
 
11
12
  def self.get_user(user_id)
12
- result = get("http://api.stackoverflow.com/1.0/users/#{user_id}?key=#{@@API_KEY}")
13
+ result = get(@@URL + "users/#{user_id}?key=#{@@API_KEY}")
13
14
  result["users"].first
14
15
  end
15
16
 
16
17
  def self.get_users(user_ids)
17
18
  user_id = user_ids.join(";").to_s
18
- result = get("http://api.stackoverflow.com/1.0/users/#{user_id}?key=#{@@API_KEY}")
19
+ result = get(@@URL + "users/#{user_id}?key=#{@@API_KEY}")
19
20
  result["users"]
20
21
  end
21
22
 
22
23
  def self.get_user_tags(user_id)
23
- get("http://api.stackoverflow.com/1.0/users/#{user_id}/tags?key=#{@@API_KEY}")
24
+ get(@@URL + "users/#{user_id}/tags?key=#{@@API_KEY}")
25
+ end
26
+
27
+ def self.get_tags
28
+ get(@@URL + "tags?key=#{@@API_KEY}")
24
29
  end
25
- end
30
+
31
+ def self.get_tags_synonyms
32
+ get(@@URL + "tags/synonyms?key=#{@@API_KEY}")
33
+ end
34
+
35
+ end
@@ -29,4 +29,21 @@ describe StackOverflow do
29
29
  it { @tags.should_not be_nil }
30
30
  it { @tags["tags"].count.should > 0 }
31
31
  end
32
- end
32
+
33
+ describe "get tags" do
34
+ before(:each) do
35
+ @tags = StackOverflow.get_tags
36
+ end
37
+ it { @tags.should_not be_nil }
38
+ it { @tags["tags"].count.should > 0 }
39
+ end
40
+
41
+ describe "get tags synonyms" do
42
+ before(:each) do
43
+ @tags_synonyms = StackOverflow.get_tags_synonyms
44
+ end
45
+ it { @tags_synonyms.should_not be_nil }
46
+ it { @tags_synonyms["tag_synonyms"].count.should > 0 }
47
+ end
48
+
49
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Birkholz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-13 00:00:00 -06:00
17
+ date: 2011-02-15 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,7 @@ files:
58
58
  - Gemfile.lock
59
59
  - README.rdoc
60
60
  - Rakefile
61
+ - lib/.stack_overflow.rb.swp
61
62
  - lib/stack_overflow.rb
62
63
  - lib/stack_overflow/version.rb
63
64
  - spec/spec_helper.rb