Class: GovKit::TransparencyData::Entity

Inherits:
GovKit::TransparencyDataResource show all
Defined in:
lib/gov_kit/transparency_data.rb

Overview

Represents entities – politicians, individuals, or organizations.

See transparencydata.com/api/aggregates/contributions/ for complete query options.

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #raw_response

Class Method Summary collapse

Methods inherited from GovKit::TransparencyDataResource

from_response, search_for

Methods inherited from Resource

#initialize, instantiate, instantiate_collection, parse, #to_md5, #unload

Constructor Details

This class inherits a constructor from GovKit::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GovKit::Resource

Class Method Details

.find(id) ⇒ Object

Find an entity by id.



76
77
78
79
# File 'lib/gov_kit/transparency_data.rb', line 76

def self.find(id)
  response = get("/entities/#{id}.json")
  parse(response)
end

.find_by_id(id) ⇒ Object

Deprecated for consistency of naming. Use find(id) instead.



69
70
71
72
73
# File 'lib/gov_kit/transparency_data.rb', line 69

def self.find_by_id(id)
  puts "GovKit::TransparencyData::Entity.find_by_id is deprecated. Use Entity.find(id) instead."
  response = get("/entities/#{id}.json")
  parse(response)
end

.search(search_string) ⇒ Object

Search for contract records.

Example query:

entities = GovKit::TransparencyData::Entity.search('nancy+pelosi')


85
86
87
# File 'lib/gov_kit/transparency_data.rb', line 85

def self.search(search_string)
  search_for("/entities.json", { :search => search_string } )
end