Class: OpenSecrets::Candidate

Inherits:
Base
  • Object
show all
Defined in:
lib/opensecrets.rb

Overview

member

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from OpenSecrets::Base

Instance Method Details

#contributions_by_industry(options = {}) ⇒ Object

Provides total contributed to specified candidate from specified industry for specified cycle.

See : www.opensecrets.org/api/?method=candIndByInd&output=doc

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :ind (String) — default: ""

    a a 3-character industry code

  • :cycle (optional, String) — default: ""

    2012, 2014 available. leave blank for latest cycle

Raises:

  • (ArgumentError)


106
107
108
109
110
111
# File 'lib/opensecrets.rb', line 106

def contributions_by_industry(options = {})
  raise ArgumentError, 'You must provide a :cid option' if options[:cid].nil? || options[:cid].empty?
  raise ArgumentError, 'You must provide a :ind option' if options[:ind].nil? || options[:ind].empty?
  options.merge!({:method => 'CandIndByInd'})
  self.class.get("/", :query => options)
end

#contributors(options = {}) ⇒ Object

Provides the top organizations contributing to specified politician.

See : www.opensecrets.org/api/?method=candContrib&output=doc

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :cycle (optional, String) — default: ""

    2008 or 2010.

Raises:

  • (ArgumentError)


79
80
81
82
83
# File 'lib/opensecrets.rb', line 79

def contributors(options = {})
  raise ArgumentError, 'You must provide a :cid option' if options[:cid].nil? || options[:cid].empty?
  options.merge!({:method => 'candContrib'})
  self.class.get("/", :query => options)
end

#industries(options = {}) ⇒ Object

Provides the top industries contributing to a specified politician.

See : www.opensecrets.org/api/?method=candIndustry&output=doc

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :cycle (optional, String) — default: ""

    blank values returns current cycle.

Raises:

  • (ArgumentError)


92
93
94
95
96
# File 'lib/opensecrets.rb', line 92

def industries(options = {})
  raise ArgumentError, 'You must provide a :cid option' if options[:cid].nil? || options[:cid].empty?
  options.merge!({:method => 'candIndustry'})
  self.class.get("/", :query => options)
end

#sector(options = {}) ⇒ Object

Provides sector total of specified politician’s receipts.

See : www.opensecrets.org/api/?method=candSector&output=doc

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :cycle (optional, String) — default: ""

    blank values returns current cycle.

Raises:

  • (ArgumentError)


120
121
122
123
124
# File 'lib/opensecrets.rb', line 120

def sector(options = {})
  raise ArgumentError, 'You must provide a :cid option' if options[:cid].nil? || options[:cid].empty?
  options.merge!({:method => 'candSector'})
  self.class.get("/", :query => options)
end

#summary(options = {}) ⇒ Object

Provides summary fundraising information for specified politician.

See : www.opensecrets.org/api/?method=candSummary&output=doc

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :cycle (optional, String) — default: ""

    blank values returns current cycle.

Raises:

  • (ArgumentError)


66
67
68
69
70
# File 'lib/opensecrets.rb', line 66

def summary(options = {})
  raise ArgumentError, 'You must provide a :cid option' if options[:cid].nil? || options[:cid].empty?
  options.merge!({:method => 'candSummary'})
  self.class.get("/", :query => options)
end