Class: Archaeo::ContentChangeReport

Inherits:
Struct
  • Object
show all
Defined in:
lib/archaeo/content_tracker.rb

Overview

Value object summarizing content changes for a URL over a time range.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#changed_urlsObject

Returns the value of attribute changed_urls

Returns:

  • (Object)

    the current value of changed_urls



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

def changed_urls
  @changed_urls
end

#content_frequencyObject

Returns the value of attribute content_frequency

Returns:

  • (Object)

    the current value of content_frequency



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

def content_frequency
  @content_frequency
end

#fromObject

Returns the value of attribute from

Returns:

  • (Object)

    the current value of from



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

def from
  @from
end

#new_urlsObject

Returns the value of attribute new_urls

Returns:

  • (Object)

    the current value of new_urls



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

def new_urls
  @new_urls
end

#removed_urlsObject

Returns the value of attribute removed_urls

Returns:

  • (Object)

    the current value of removed_urls



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

def removed_urls
  @removed_urls
end

#toObject

Returns the value of attribute to

Returns:

  • (Object)

    the current value of to



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

def to
  @to
end

#total_snapshotsObject

Returns the value of attribute total_snapshots

Returns:

  • (Object)

    the current value of total_snapshots



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

def total_snapshots
  @total_snapshots
end

#unique_digestsObject

Returns the value of attribute unique_digests

Returns:

  • (Object)

    the current value of unique_digests



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

def unique_digests
  @unique_digests
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



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

def url
  @url
end

Instance Method Details

#any_changes?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/archaeo/content_tracker.rb', line 14

def any_changes?
  !changed_urls.empty? || !new_urls.empty? || !removed_urls.empty?
end

#as_jsonObject



32
33
34
# File 'lib/archaeo/content_tracker.rb', line 32

def as_json(*)
  to_h
end

#to_hObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/archaeo/content_tracker.rb', line 18

def to_h
  {
    url: url,
    from: from.to_s,
    to: to.to_s,
    changed_urls: changed_urls,
    new_urls: new_urls,
    removed_urls: removed_urls,
    content_frequency: content_frequency,
    total_snapshots: total_snapshots,
    unique_digests: unique_digests,
  }
end