Module: DasCatalog

Defined in:
lib/das_catalog.rb,
lib/das_catalog/feed.rb,
lib/das_catalog/store.rb,
lib/das_catalog/version.rb,
lib/das_catalog/downloader.rb,
lib/das_catalog/screencast.rb,
lib/das_catalog/std_logger.rb,
lib/das_catalog/screencast_data.rb

Defined Under Namespace

Modules: LoggerAccess, Store Classes: Downloader, Feed, Screencast, ScreencastData, StdLogger

Constant Summary collapse

SIGN_IN_URL =
"https://www.destroyallsoftware.com/screencasts/users/sign_in"
VERSION =
"0.1.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.downloads_directoryObject

Returns the value of attribute downloads_directory.



10
11
12
# File 'lib/das_catalog.rb', line 10

def downloads_directory
  @downloads_directory
end

.loggerObject



13
14
15
# File 'lib/das_catalog.rb', line 13

def logger
  @logger ||= StdLogger.new
end

.passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/das_catalog.rb', line 9

def password
  @password
end

.tracker_fileObject



18
19
20
# File 'lib/das_catalog.rb', line 18

def tracker_file
  @tracker_file ||= File.expand_path("~/.das_tracker.pstore")
end

.usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/das_catalog.rb', line 8

def username
  @username
end

Class Method Details

.agentObject

TODO spec this



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/das_catalog.rb', line 28

def self.agent
  @agent ||= begin
    agent = Mechanize.new
    page = agent.get SIGN_IN_URL
    form = page.forms.first
    form['user[email]'] = username
    form['user[password]'] = password
    agent.submit form
    agent
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (DasCatalog)

    the object that the method was called on



23
24
25
# File 'lib/das_catalog.rb', line 23

def self.configure
  yield self
end

.syncObject

TODO spec this



41
42
43
44
45
46
47
# File 'lib/das_catalog.rb', line 41

def self.sync
  feed = Feed.get
  feed.entries.each do |entry|
    sc = Screencast.for_link(entry.url)
    sc.download
  end
end