Module: Wayback::API::Archive

Includes:
Utils
Included in:
Client
Defined in:
lib/wayback/api/archive.rb

Instance Method Summary collapse

Instance Method Details

#list(url, options = {}) ⇒ Wayback::Archive

Return a list of archived pages

Examples:

Return the list of available archives for a web page.

Wayback.list('http://gleu.ch')

Parameters:

  • url (String)

    The page that of which was archived.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:



17
18
19
# File 'lib/wayback/api/archive.rb', line 17

def list(url, options={})
  object_from_response(Wayback::Archive, :get, "/list/timemap/link/#{url}", options)
end

#page(url, date = 0, options = {}) ⇒ Wayback::Page

Returns the HTML contents of an archive page, fetched by date

Examples:

Return the HTML archive for the page.

Wayback.page('http://gleu.ch')
Wayback.page('http://gleu.ch', 'Tue, 17 Jan 2012 07:33:06 GMT')
Wayback.page('http://gleu.ch', '20130113125339')
Wayback.page('http://gleu.ch', :first)
Wayback.page('http://gleu.ch', :last)

Parameters:

  • url (String)

    The page that of which was archived.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:



33
34
35
36
37
38
# File 'lib/wayback/api/archive.rb', line 33

def page(url, date=0, options={})
  date = 0 if date == :first
  date = Time.now if date == :last
  date = Time.parse(date).to_i unless [Fixnum,Time,Integer].include?(date.class)
  object_from_response(Wayback::Page, :get, "/memento/#{date.to_i}/#{url}", options)
end