votesmart 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,17 +18,17 @@ end
18
18
 
19
19
  Dir['tasks/**/*.rake'].each { |t| load t }
20
20
 
21
- require 'spec/rake/spectask'
22
- Spec::Rake::SpecTask.new(:spec) do |spec|
23
- spec.libs << 'lib' << 'spec'
24
- spec.spec_files = FileList['spec/**/*_spec.rb']
25
- end
26
-
27
- Spec::Rake::SpecTask.new(:rcov) do |spec|
28
- spec.libs << 'lib' << 'spec'
29
- spec.pattern = 'spec/**/*_spec.rb'
30
- spec.rcov = true
31
- end
21
+ # require 'spec/rake/spectask'
22
+ # Spec::Rake::SpecTask.new(:spec) do |spec|
23
+ # spec.libs << 'lib' << 'spec'
24
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ # end
26
+ #
27
+ # Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ # spec.libs << 'lib' << 'spec'
29
+ # spec.pattern = 'spec/**/*_spec.rb'
30
+ # spec.rcov = true
31
+ # end
32
32
 
33
33
  task :spec => :check_dependencies
34
34
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 3
3
- :build:
4
2
  :major: 0
5
- :minor: 3
3
+ :minor: 4
4
+ :patch: 0
5
+ :build:
@@ -1,21 +1,19 @@
1
- require 'rubygems'
2
- require 'ym4r/google_maps/geocoding'
3
1
  require 'active_support'
4
- include Ym4r::GoogleMaps
5
2
 
6
3
  module VoteSmart
7
4
  API_URL = "http://api.votesmart.org/"
8
5
  API_FORMAT = "JSON"
9
-
10
- mattr_accessor :api_key
11
-
12
- class RequestFailed < Exception; end
6
+
7
+ class << self
8
+ attr_accessor :api_key
9
+ end
10
+
11
+ class RequestFailed < StandardError; end
13
12
  end
14
13
 
15
14
  VoteSmart.api_key = "key"
16
15
 
17
- require "#{File.dirname(__FILE__)}/mcll4r/mcll4r.rb"
18
- require "#{File.dirname(__FILE__)}/vote_smart/common.rb"
16
+ require "#{File.dirname(__FILE__)}/vote_smart/common"
19
17
 
20
18
  Dir["#{File.dirname(__FILE__)}/vote_smart/*.rb"].each do |source_file|
21
19
  require source_file unless source_file == "#{File.dirname(__FILE__)}/vote_smart/common.rb"
@@ -1,7 +1,6 @@
1
1
  require 'json'
2
2
  require 'cgi'
3
3
  require 'patron'
4
- require 'ym4r/google_maps/geocoding'
5
4
 
6
5
  module VoteSmart
7
6
  module ParallelQueries
@@ -48,7 +48,9 @@ module VoteSmart
48
48
  end
49
49
 
50
50
  def self.find_all_by_address address, city, state, zip
51
- placemark = Geocoding.get("#{address} #{city}, #{state} #{zip}").first
51
+ require 'ym4r/google_maps/geocoding'
52
+
53
+ placemark = Ym4r::GoogleMaps::Geocoding.get("#{address} #{city}, #{state} #{zip}").first
52
54
 
53
55
  return [] unless placemark
54
56
 
@@ -58,6 +60,8 @@ module VoteSmart
58
60
  end
59
61
 
60
62
  def self.find_all_by_state_and_latitude_and_longitude state, latitude, longitude
63
+ require "#{File.dirname(__FILE__)}/../mcll4r/mcll4r"
64
+
61
65
  response = Mcll4r.new.district_lookup(latitude, longitude)
62
66
  response = response["response"] if response
63
67
 
@@ -41,7 +41,7 @@ module VoteSmart
41
41
  describe "find by address" do
42
42
  before :each do
43
43
  mcll4r = {"response" => {"state_lower" => {"district" => "1"}, "state_upper" => {"district" => "2"}}}
44
- Geocoding.should_receive(:get).once.and_return([mock("placemark", :latitude => 2, :longitude => 10)])
44
+ Ym4r::GoogleMaps::Geocoding.should_receive(:get).once.and_return([mock("placemark", :latitude => 2, :longitude => 10)])
45
45
  Mcll4r.should_receive(:new).once.and_return(mock("mcll4r", :district_lookup => mcll4r))
46
46
  end
47
47
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: votesmart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Dan Cunning
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-10-06 00:00:00 -07:00
18
+ date: 2010-11-17 00:00:00 -08:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,7 +26,6 @@ dependencies:
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- hash: 3
31
29
  segments:
32
30
  - 0
33
31
  - 4
@@ -44,7 +42,6 @@ extensions: []
44
42
  extra_rdoc_files:
45
43
  - README.rdoc
46
44
  files:
47
- - .gitignore
48
45
  - History.txt
49
46
  - README.rdoc
50
47
  - Rakefile
@@ -118,8 +115,8 @@ homepage: http://github.com/Empact/votesmart
118
115
  licenses: []
119
116
 
120
117
  post_install_message:
121
- rdoc_options:
122
- - --charset=UTF-8
118
+ rdoc_options: []
119
+
123
120
  require_paths:
124
121
  - lib
125
122
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -127,7 +124,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
124
  requirements:
128
125
  - - ">="
129
126
  - !ruby/object:Gem::Version
130
- hash: 3
131
127
  segments:
132
128
  - 0
133
129
  version: "0"
@@ -136,7 +132,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
132
  requirements:
137
133
  - - ">="
138
134
  - !ruby/object:Gem::Version
139
- hash: 3
140
135
  segments:
141
136
  - 0
142
137
  version: "0"
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg/