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
25 26 27 28 |
# File 'lib/tsp_scraper/client.rb', line 25 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 |
# File 'lib/tsp_scraper/client.rb', line 9 def self.scrape_raw(start_date = Date.today.prev_month, end_date = Date.today, = {}) = { query: { download: 1, startdate: start_date.strftime("%Y%m%d"), enddate: end_date.strftime("%Y%m%d"), format: "CSV", Lfunds: 1, InvFunds: 1 } } = .merge() response = self.get("/getSharePrices.html", ) response.body.strip end |