Class: OpenSecrets::Member

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

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from OpenSecrets::Base

Instance Method Details

#get_legislators(options = {}) ⇒ Object

Provides a list of Congressional legislators and associated attributes for specified subset (state, district or specific CID).

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

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :id (String) — default: ""

    two character state code, or 4 character district or specific CID

Raises:

  • (ArgumentError)


35
36
37
38
39
# File 'lib/opensecrets.rb', line 35

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

#pfd(options = {}) ⇒ Object

Returns Personal Financial Disclosure (PFD) information for a member of Congress.

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

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :cid (String) — default: ""

    a CRP CandidateID

  • :year (String) — default: ""

    Get data for specified year.

Raises:

  • (ArgumentError)


48
49
50
51
52
53
# File 'lib/opensecrets.rb', line 48

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