Class: Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/myfitnesspal_stats/scraper.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Scraper

Returns a new instance of Scraper.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/myfitnesspal_stats/scraper.rb', line 6

def initialize(username, password)
  @username = username
  @password = password

  @date = Date.today

  @account = Account.new(username, password)
  @login_page = @account.

  @web_crawler = Mechanize.new do |web_crawler|
    web_crawler.cookie_jar.load('cookies.yml')
    web_crawler.follow_meta_refresh = true
  end
end

Instance Method Details

#get_date(year = @date.year, month = @date.month, day = @date.day) ⇒ Object

—- initialize



21
22
23
# File 'lib/myfitnesspal_stats/scraper.rb', line 21

def get_date(year = @date.year, month = @date.month, day = @date.day)
  day = Day.new(year, month, day)
end