Class: TSPScraper::Client
- Inherits:
-
Object
- Object
- TSPScraper::Client
- Includes:
- HTTParty
- Defined in:
- lib/tsp_scraper/client.rb
Class Method Summary collapse
- .scrape(start_date = Date.today.prev_month, end_date = Date.today, options = {}) ⇒ Object
- .scrape_raw(start_date = Date.today.prev_month, end_date = Date.today, options = {}) ⇒ Object
Class Method Details
.scrape(start_date = Date.today.prev_month, end_date = Date.today, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/tsp_scraper/client.rb', line 26 def self.scrape(start_date = Date.today.prev_month, end_date = Date.today, = {}) raw = self.scrape_raw(start_date, end_date, = {}) TSPScraper::Converter.raw_csv_to_hash(raw) end |
.scrape_raw(start_date = Date.today.prev_month, end_date = Date.today, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tsp_scraper/client.rb', line 9 def self.scrape_raw(start_date = Date.today.prev_month, end_date = Date.today, = {}) funds = ["Linc", "L2010", "L2020", "L2030", "L2040", "L2050", "G", "F", "C", "S", "I"] = { query: { reloaded: 1, startdate: start_date.strftime("%m/%d/%Y"), enddate: end_date.strftime("%m/%d/%Y"), whichButton: "CSV", fundgroup: funds } } = .merge() response = self.get("/index.html", ) response.body.strip end |