influence_explorer 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjdiZWZhMDQ0YTc2ZTA3ZjdmOWFkYTAyZWMyZWRhZDdlMTFlNzEzOA==
5
+ data.tar.gz: !binary |-
6
+ NTc2NjAxYWUyYjczOGQyNTYyNGVjZGQ4ZjcyNjY2YzJhZmQ2ZTIyZQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjVjYWY5YWIxMzMzY2Y2YjExYTY5ZDkxYWI5ZmJkOWE2MWVmYjhkMWZkZjhj
10
+ MTlmN2MwNjY3ZTk1YzExY2E5YjhjNDAyNzcwM2QwOTk3ZTNlNWZkODM3MTEx
11
+ YzUyMTliMmM0ZmJlNTZmMTBlZWQzYjZmMTBiMzkzYWFiNDBlNzY=
12
+ data.tar.gz: !binary |-
13
+ MzEwNjk3NGI2OWI0NGE3ZjUxOTEwNzhkYmYzZWY5ODExOGJkYjkxMWNlODEx
14
+ MmJjNTg2NmRkNDZhMWMwMDZmYWIyNDZmNDYxZmM5YTUzOWUyZDBhNjkwNTkx
15
+ YjI0ZjQ1MjQ4Y2MzODUxMDIzOWE3ODAyODMwZjQ5MzYyMmExZWM=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in influence_explorer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Scott Ballantyne
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # InfluenceExplorer
2
+
3
+ A quick api wrapper for the Sunlight Foundation Influence Explorer api. I couldn't get the other one to work because of dependencies.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'influence_explorer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install influence_explorer
18
+
19
+ ## Usage
20
+
21
+ require 'rubygems'
22
+ require 'influence_explorer'
23
+ InfluenceExplorer::Config.api_key = SUNLIGHT_FOUNDATION_KEY
24
+
25
+ InfluenceExplorer::Contributions.new(:contributor_ft => 'Thomas Steyer')
26
+
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'influence_explorer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "influence_explorer"
8
+ spec.version = InfluenceExplorer::VERSION
9
+ spec.authors = ["Scott Ballantyne"]
10
+ spec.email = ["ussballantyne@gmail.com"]
11
+ spec.description = %q{api wrapper for sunlight influence explorer}
12
+ spec.summary = %q{api wrapper for sunlight influence explorer}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency 'hashie'
24
+ spec.add_dependency 'rest-client'
25
+ spec.add_dependency 'json'
26
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Aggregates
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('aggregates.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module InfluenceExplorer
2
+ module Config
3
+
4
+ def self.api_key=(val)
5
+ @@api_key = val
6
+ end
7
+
8
+ def self.api_key
9
+ @@api_key
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Contracts
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('contracts.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Contributions
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('contributions.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Entities
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('entities.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Grants
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('grants.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module InfluenceExplorer
2
+ class Lobbying
3
+ def initialize(options)
4
+ @data = InfluenceExplorer.request('lobbying.json', options)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module InfluenceExplorer
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ require "influence_explorer/version"
2
+ require 'rest_client'
3
+ require 'erb'
4
+ require 'hashie'
5
+ require 'json'
6
+
7
+ module InfluenceExplorer
8
+ def self.base_url
9
+ 'http://transparencydata.com/api/1.0/'
10
+ end
11
+
12
+ def self.request(endpoint, options)
13
+ opts = options.merge('apikey' => InfluenceExplorer::Config.api_key)
14
+ url = base_url + endpoint + "?" + opts.to_query
15
+ # puts url
16
+ response = JSON.parse(RestClient.get(url).to_str).collect {|i| Hashie::Mash.new(i) }
17
+ response
18
+ end
19
+ end
20
+
21
+ class Hash
22
+ def to_query
23
+ self.map{|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v)}"}.join("&")
24
+ end
25
+ end
26
+
27
+
28
+ Dir.glob(File.dirname(__FILE__) + '/influence_explorer/*.rb').each { |f| require f }
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: influence_explorer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scott Ballantyne
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hashie
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: api wrapper for sunlight influence explorer
84
+ email:
85
+ - ussballantyne@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - influence_explorer.gemspec
96
+ - lib/influence_explorer.rb
97
+ - lib/influence_explorer/aggregates.rb
98
+ - lib/influence_explorer/config.rb
99
+ - lib/influence_explorer/contracts.rb
100
+ - lib/influence_explorer/contributions.rb
101
+ - lib/influence_explorer/entities.rb
102
+ - lib/influence_explorer/grants.rb
103
+ - lib/influence_explorer/lobbying.rb
104
+ - lib/influence_explorer/version.rb
105
+ homepage: ''
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.0.6
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: api wrapper for sunlight influence explorer
129
+ test_files: []