stack_overflow 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in stack_overflow.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stack_overflow (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ crack (0.1.8)
10
+ diff-lcs (1.1.2)
11
+ httparty (0.6.1)
12
+ crack (= 0.1.8)
13
+ rspec (2.4.0)
14
+ rspec-core (~> 2.4.0)
15
+ rspec-expectations (~> 2.4.0)
16
+ rspec-mocks (~> 2.4.0)
17
+ rspec-core (2.4.0)
18
+ rspec-expectations (2.4.0)
19
+ diff-lcs (~> 1.1.2)
20
+ rspec-mocks (2.4.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ httparty
27
+ rspec
28
+ stack_overflow!
data/README.rdoc ADDED
@@ -0,0 +1,21 @@
1
+ = Stack Overflow
2
+
3
+ This is a simple gem that utilizes HTTParty and the StackOverflow API.
4
+
5
+ gem install stack_overflow
6
+
7
+ == Set API Key
8
+
9
+ Be sure to set the API Key.
10
+
11
+ StackOverflow.API_KEY = YOUR_KEY_GOES_HERE
12
+
13
+ You can get your key from StackOverflow by going here : http://stackapps.com/apps/register
14
+
15
+ == Get Flair
16
+
17
+ StackOverflow.get_flair(#user_id)
18
+
19
+ == Work in progress
20
+
21
+ This is a work in progress as I use the API for my application.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module StackOverflow
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'httparty'
2
+
3
+ class StackOverflow
4
+ include HTTParty
5
+ @@API_KEY = nil
6
+
7
+ def self.API_KEY=(value)
8
+ @@API_KEY = value
9
+ end
10
+
11
+ def self.get_flair(user_id)
12
+ get("http://stackoverflow.com/users/flair/#{user_id}.json?key=#{@@API_KEY}")
13
+ end
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'stack_overflow')
2
+ require 'httparty'
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe StackOverflow do
4
+ before(:each) do
5
+ StackOverflow.API_KEY = ENV["SO_API_KEY"]
6
+ end
7
+
8
+ describe "get flair" do
9
+ before(:each) do
10
+ @flair = StackOverflow.get_flair(60336)
11
+ end
12
+ it { @flair.should_not be_nil }
13
+ it { @flair["displayName"].should == "JB"}
14
+ end
15
+
16
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "stack_overflow/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "stack_overflow"
7
+ s.version = StackOverflow::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Jonathan Birkholz"]
10
+ s.email = ["rookieone@gmail.com"]
11
+ s.homepage = "http://rubygems.org/gems/stack_overflow"
12
+ s.summary = %q{HTTParty over the StackOverflow API}
13
+ s.description = %q{HTTParty over the StackOverflow API}
14
+
15
+ s.rubyforge_project = "stack_overflow"
16
+
17
+ s.add_development_dependency "rspec"
18
+ s.add_development_dependency "httparty"
19
+
20
+ s.files = `git ls-files`.split("\n")
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stack_overflow
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Jonathan Birkholz
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-11 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: httparty
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
46
+ description: HTTParty over the StackOverflow API
47
+ email:
48
+ - rookieone@gmail.com
49
+ executables: []
50
+
51
+ extensions: []
52
+
53
+ extra_rdoc_files: []
54
+
55
+ files:
56
+ - .gitignore
57
+ - Gemfile
58
+ - Gemfile.lock
59
+ - README.rdoc
60
+ - Rakefile
61
+ - lib/stack_overflow.rb
62
+ - lib/stack_overflow/version.rb
63
+ - spec/spec_helper.rb
64
+ - spec/stack_overflow_spec.rb
65
+ - stack_overflow.gemspec
66
+ has_rdoc: true
67
+ homepage: http://rubygems.org/gems/stack_overflow
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project: stack_overflow
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: HTTParty over the StackOverflow API
98
+ test_files:
99
+ - spec/spec_helper.rb
100
+ - spec/stack_overflow_spec.rb