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

  • :indcode (String) — default: ""

    a a 3-character industry code

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

    2010, 2008 allowed. leave blank for latest cycle.

Raises:

  • (ArgumentError)


108
109
110
111
112
113
# File 'lib/opensecrets.rb', line 108

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 :indcode option' if options[:indcode].nil? || options[:indcode].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)


81
82
83
84
85
# File 'lib/opensecrets.rb', line 81

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)


94
95
96
97
98
# File 'lib/opensecrets.rb', line 94

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)


122
123
124
125
126
# File 'lib/opensecrets.rb', line 122

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)


68
69
70
71
72
# File 'lib/opensecrets.rb', line 68

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