Class: Archaeo::AvailabilityResult
- Inherits:
-
Object
- Object
- Archaeo::AvailabilityResult
- Defined in:
- lib/archaeo/availability_result.rb
Overview
Model representing the result of an availability query.
Indicates whether a URL is archived and, if so, provides the closest snapshot’s archive URL and timestamp.
Instance Attribute Summary collapse
-
#archive_url ⇒ Object
readonly
Returns the value of attribute archive_url.
-
#archived_status ⇒ Object
readonly
Returns the value of attribute archived_status.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(url:, available:, archive_url: nil, timestamp: nil, archived_status: nil) ⇒ AvailabilityResult
constructor
A new instance of AvailabilityResult.
- #to_s ⇒ Object
- #unavailable? ⇒ Boolean
Constructor Details
#initialize(url:, available:, archive_url: nil, timestamp: nil, archived_status: nil) ⇒ AvailabilityResult
Returns a new instance of AvailabilityResult.
11 12 13 14 15 16 17 18 |
# File 'lib/archaeo/availability_result.rb', line 11 def initialize(url:, available:, archive_url: nil, timestamp: nil, archived_status: nil) @url = url @available = available @archive_url = archive_url @timestamp = @archived_status = archived_status end |
Instance Attribute Details
#archive_url ⇒ Object (readonly)
Returns the value of attribute archive_url.
9 10 11 |
# File 'lib/archaeo/availability_result.rb', line 9 def archive_url @archive_url end |
#archived_status ⇒ Object (readonly)
Returns the value of attribute archived_status.
9 10 11 |
# File 'lib/archaeo/availability_result.rb', line 9 def archived_status @archived_status end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
9 10 11 |
# File 'lib/archaeo/availability_result.rb', line 9 def @timestamp end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/archaeo/availability_result.rb', line 9 def url @url end |
Instance Method Details
#available? ⇒ Boolean
20 21 22 |
# File 'lib/archaeo/availability_result.rb', line 20 def available? @available end |
#to_s ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/archaeo/availability_result.rb', line 28 def to_s if available? "#{url} -> #{archive_url} (#{})" else "#{url} -> not available" end end |
#unavailable? ⇒ Boolean
24 25 26 |
# File 'lib/archaeo/availability_result.rb', line 24 def unavailable? !@available end |