Class: GovKit::FollowTheMoney::Business

Inherits:
GovKit::FollowTheMoneyResource show all
Defined in:
lib/gov_kit/follow_the_money.rb

Overview

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #raw_response

Class Method Summary collapse

Methods inherited from GovKit::FollowTheMoneyResource

get_xml, stringify_values_of

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

.listBusiness

Return a list of all business, industry, and sector categories. See the FollowTheMoney API.

Returns:

  • (Business)

    A list of Business objects.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/gov_kit/follow_the_money.rb', line 67

def self.list
  next_page, result, page_num = "yes", [], 0

  until next_page != "yes"
    # puts "Getting batch number #{page_num}"

    doc = get_xml("/base_level.industries.list.php", :query => {:page => page_num})

    next_page = doc.children.first.attributes['next_page'].value

    page_num += 1

    result += doc.search('//business_detail').collect { |x| x.attributes }
  end

  stringify_values_of(result)
  parse(result)
end