Class: Html2rss::CLI::ProbeView

Inherits:
Data
  • Object
show all
Defined in:
lib/html2rss/cli/probe_view.rb

Overview

Display-only probe facts for inspect and recon text cards.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#alternate_feedsObject (readonly)

Returns the value of attribute alternate_feeds

Returns:

  • (Object)

    the current value of alternate_feeds



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def alternate_feeds
  @alternate_feeds
end

#articles_countObject (readonly)

Returns the value of attribute articles_count

Returns:

  • (Object)

    the current value of articles_count



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def articles_count
  @articles_count
end

#finalObject (readonly)

Returns the value of attribute final

Returns:

  • (Object)

    the current value of final



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def final
  @final
end

#native_feedObject (readonly)

Returns the value of attribute native_feed

Returns:

  • (Object)

    the current value of native_feed



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def native_feed
  @native_feed
end

#notesObject (readonly)

Returns the value of attribute notes

Returns:

  • (Object)

    the current value of notes



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def notes
  @notes
end

#requestedObject (readonly)

Returns the value of attribute requested

Returns:

  • (Object)

    the current value of requested



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def requested
  @requested
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def status
  @status
end

#strategyObject (readonly)

Returns the value of attribute strategy

Returns:

  • (Object)

    the current value of strategy



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def strategy
  @strategy
end

#surfaceObject (readonly)

Returns the value of attribute surface

Returns:

  • (Object)

    the current value of surface



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def surface
  @surface
end

#verdictObject (readonly)

Returns the value of attribute verdict

Returns:

  • (Object)

    the current value of verdict



7
8
9
# File 'lib/html2rss/cli/probe_view.rb', line 7

def verdict
  @verdict
end

Class Method Details

.from_recon(result) ⇒ ProbeView

Parameters:

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/html2rss/cli/probe_view.rb', line 41

def from_recon(result) # rubocop:disable Metrics/MethodLength
  new(
    requested: result.requested_url.to_s,
    final: result.final_url.to_s,
    status: result.status,
    surface: result.surface_category,
    articles_count: result.articles_count,
    verdict: result.verdict,
    native_feed: result.native_feed&.to_s,
    alternate_feeds: [],
    notes: result.notes,
    strategy: nil
  )
end

.from_wire(data) ⇒ ProbeView

Parameters:

  • data (Hash)

    inspect wire payload

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/html2rss/cli/probe_view.rb', line 23

def from_wire(data) # rubocop:disable Metrics/MethodLength
  new(
    requested: wire_val(data, :requested_url),
    final: wire_val(data, :final_url),
    status: wire_val(data, :status),
    surface: wire_val(data, :surface_category),
    articles_count: wire_val(data, :articles_count),
    verdict: nil,
    native_feed: nil,
    alternate_feeds: wire_val(data, :alternate_feeds) || [],
    notes: [],
    strategy: wire_val(data, :strategy)
  )
end

.wire_val(data, key) ⇒ Object?

Parameters:

  • data (Hash)
  • key (Symbol)

Returns:

  • (Object, nil)


60
61
62
# File 'lib/html2rss/cli/probe_view.rb', line 60

def wire_val(data, key)
  data[key] || data[key.to_s]
end