Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a1bd553
Rename the project to just votesmart, and add my details to the jewel…
Empact Nov 21, 2009
5ec8e4d
Update json spec cache
Empact Nov 21, 2009
0d8d71d
Specs pass
Empact Nov 21, 2009
8c6a66a
access officeParties for Official objects. electionParties seems to b…
JeffLtz Jul 30, 2009
d3f9ce3
Fix & spec Official#party brought in via db7bd12dd7d; it's not blank …
Empact Mar 21, 2010
bf8dfcf
Fix Rating.get_sig_list categoryId parameter
Empact Mar 22, 2010
bcf4dbb
Switch gemspect to just votesmart
Empact Mar 22, 2010
fd5b06d
Ignore built gems
Empact Mar 22, 2010
ae603ee
Terse it up
Empact Mar 22, 2010
f529ae6
Use patron for http
Empact Mar 22, 2010
82ee461
First attempt at retry logic
Empact Mar 23, 2010
3361fa6
Add some back-off logic to the retries
Empact Mar 23, 2010
f85b079
Use ensure to reset json retry count
Empact Mar 25, 2010
128ea72
VoteSmart seems to be translating punctuation into unicode control ch…
Empact Mar 25, 2010
fbfd07d
Don't allow leading and trailing quotes in sig description
Empact Mar 25, 2010
5b4b72e
Bump to 0.3.0
Empact Mar 25, 2010
be5b5b4
added getByZip responses
dwillis Jun 3, 2010
ce9461a
Expose Officials.getStatewide
Empact Jun 19, 2010
a3cc2f4
Version bump to 0.3.1
Empact Jun 19, 2010
3fae5c9
Bump up the patron timeouts as the response is sometimes slow...
Empact Jun 20, 2010
82d61b5
Move Commmon self. methods into class << self
Empact Sep 18, 2010
37a8813
Allow running parallel requests via Typhoeus, currently only setup fo…
Empact Sep 19, 2010
d6c2406
Include CandiateBio.get_bio in the parallelizable requests
Empact Sep 20, 2010
02a9f53
Fix for error: A JSON text must at least contain two octets, on parra…
Empact Sep 30, 2010
6a89c36
Version bump to 0.3.2
Empact Oct 5, 2010
c675804
Set a max rate limit for concurrent requests, at PVS' request. Sorry…
Empact Oct 6, 2010
d7da4dd
Version bump to 0.3.3
Empact Oct 6, 2010
075b202
Don't include Ym4r::GoogleMaps into the global namespace
Empact Nov 10, 2010
ca42667
Don't assume rubygems - the provision of libraries is the job of the …
Empact Nov 10, 2010
94a7565
Drop some '.rb's from the require paths
Empact Nov 10, 2010
ee3dc0f
Move mcll4r out of the default inclusion (this will prob have to chan…
Empact Nov 18, 2010
21bd630
Comment out SpecTask use for now, given that it isn't present in rspe…
Empact Nov 18, 2010
a0dd4a3
Version bump to 0.4.0
Empact Nov 18, 2010
8e463aa
Stop using a deprecated rdoc task
Empact Feb 9, 2012
53c0cb7
:check_dependencies doesn't seem to be a part of Jeweler now, as it's…
Empact Feb 9, 2012
2c73849
Add some basic development dependencies to the gemspec
Empact Feb 9, 2012
566a3f3
Update the gemspec
Empact Feb 9, 2012
beab0e2
Use a gemfile to manage development
Empact Feb 9, 2012
b4ab5d6
Add jeweler as a dependency
Empact Feb 9, 2012
0d7ceba
Return spec tasks to their former glory
Empact Feb 9, 2012
650e5f9
Simplify the 'spec_helper' requires so they work…
Empact Feb 9, 2012
dbc675a
Get the spec ruby 1.9.3 compatible
Empact Feb 9, 2012
498457c
Add Ym4r as a development dependency as it's optional for runtime use.
Empact Feb 9, 2012
d375620
Move to managing gems in the gem file, as expected by Jeweler
Empact Feb 9, 2012
bb7a2b5
Ditch rcov as it's failing install on 1.9.3, and we don't really make…
Empact Feb 9, 2012
54217bd
Rely on newly gemified mcll4r
Empact Feb 9, 2012
6935411
We don't appear to be needing active_support, at least in 1.9.3
Empact Feb 9, 2012
37c9305
#first and #last aren't on String in 1.9
Empact Feb 9, 2012
5826c33
explicitly add dependency on older version of rspec
dleavitt Mar 19, 2012
6dded7f
Add a missing require for mcll4r
Empact Mar 26, 2012
139e11a
fix incorrectly named parameters and methods for offices
dleavitt Mar 19, 2012
b063722
Correct another incorrect param name to officeTypeId
Empact Mar 26, 2012
569e0cb
Split the Office::Type spec out from the Office spec
Empact Mar 26, 2012
455cc24
Version bump to 0.4.1
Empact Mar 26, 2012
0c8ff17
updated .get_bills_by_official_year
Aug 29, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg/
Gemfile.lock
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source "http://www.rubygems.org"

gem 'patron', '>=0.4.6'

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "< 2"
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.8.3"

# optional runtime dependencies, required for tests
gem 'ym4r'
gem 'mcll4r'
end
32 changes: 32 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
== 0.3.3 2010-10-06

* 1 minor enhancement:
* Rate-limit parallel requests to 20/second. Note that higher rates is acceptable for off hours, as per Clinton Adams, 2010-10-06: "Could you lower that to 20/second if it's occurring between 8AM-8PM EST? In the off hours 200/second is fine."

== 0.3.2 2010-10-05

* 1 major enhancement
* Add support for parallel requests via Typhoeus. Currently only available on Candiate.get_bio and Rating.get_candidate_rating

== 0.3.1 2010-06-19

* 2 major enhancements:
* Add Candidate.get_by_zip, District.get_by_zip, Election.get_by_zip and Official.get_by_zip (dwillis)
* Add Official.get_statewide (empact)

== 0.3.0 2010-03-25

* 3 major enhancement:
* Rename the project/gem to just 'votesmart'
* Move http access to Patron for performance
* Add retry logic on HTTP failure, with exponential backoff

* 2 minor enhancements:
* Add Official#party to reflect the PVS officeParties data
* Sig descriptions:
* sometimes included UTF control characters for punctuation, which are now translated to ascii
* often started and ended in a quote, which is now avoided

* 1 bug fix:
* Fix that Rating.get_sig_list would blow up on a bad parameter

== 0.0.1 2009-02-10

* 1 major enhancement:
Expand Down
48 changes: 30 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
%w[rubygems rake rake/clean fileutils].each { |f| require f }
require 'spec'
require 'spec/rake/spectask'
require File.dirname(__FILE__) + '/lib/ruby-votesmart'

begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "ruby-votesmart"
s.summary = "A wrapper for the Project Vote Smart API"
s.email = "dancunning@gmail.com"
s.homepage = "http://github.com/netroots/ruby-votesmart"
s.description = "A wrapper for the Project Vote Smart API"
s.authors = ["Dan Cunning"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "votesmart"
s.summary = "A wrapper for the Project Vote Smart API"
s.email = "ben.woosley@gmail.com"
s.homepage = "http://github.com/Empact/votesmart"
s.description = "A wrapper for the Project Vote Smart API"
s.authors = ["Dan Cunning", "Ben Woosley"]
end
Jeweler::GemcutterTasks.new

Dir['tasks/**/*.rake'].each { |t| load t }

Spec::Rake::SpecTask.new
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
end

#Cucumber::Rake::Task.new
Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end

#task :default => [:features]
task :default => :spec

require 'rdoc/task'
RDoc::Task.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "votesmart #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
7 changes: 4 additions & 3 deletions VERSION.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
---
:major: 0
:minor: 2
:patch: 4
:minor: 4
:patch: 1
:build:
20 changes: 0 additions & 20 deletions lib/mcll4r/MIT-LICENSE

This file was deleted.

19 changes: 0 additions & 19 deletions lib/mcll4r/README

This file was deleted.

24 changes: 0 additions & 24 deletions lib/mcll4r/mcll4r.rb

This file was deleted.

35 changes: 0 additions & 35 deletions lib/mcll4r/mcll4r_test.rb

This file was deleted.

22 changes: 0 additions & 22 deletions lib/ruby-votesmart.rb

This file was deleted.

18 changes: 18 additions & 0 deletions lib/vote_smart.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module VoteSmart
API_URL = "http://api.votesmart.org/"
API_FORMAT = "JSON"

class << self
attr_accessor :api_key
end

class RequestFailed < StandardError; end
end

VoteSmart.api_key = "key"

require "#{File.dirname(__FILE__)}/vote_smart/common"

Dir["#{File.dirname(__FILE__)}/vote_smart/*.rb"].each do |source_file|
require source_file unless source_file == "#{File.dirname(__FILE__)}/vote_smart/common.rb"
end
7 changes: 5 additions & 2 deletions lib/vote_smart/candidate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def self.get_by_election election_id
def self.get_by_district district_id, election_year = nil
request("Candidates.getByDistrict", "districtId" => district_id, "electionYear" => election_year)
end


# Returns candidates in the provided zip code, with optional zip+4 and stage
def self.get_by_zip zip5, election_year=nil, zip4=nil, stage_id=nil
request("Candidates.getByZip", "zip5" => zip5, "electionYear" => election_year, "zip4" => zip4, "stageId" => stage_id)
end
end

end
4 changes: 2 additions & 2 deletions lib/vote_smart/candidate_bio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module VoteSmart
class CandidateBio < Common

# Returns basic bio details on a candidate
def self.get_bio can_id
request("CandidateBio.getBio", "candidateId" => can_id)
def self.get_bio can_id, &block
request("CandidateBio.getBio", {"candidateId" => can_id}, &block)
end

#
Expand Down
Loading