Class: SourceMonitor::Fetching::FeedFetcher::SuccessOutcome

Inherits:
Object
  • Object
show all
Defined in:
lib/source_monitor/fetching/feed_fetcher/success_outcome.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response:, body:, feed:, item_processing:, feed_signature:, content_changed:, entries_digest:) ⇒ SuccessOutcome

Returns a new instance of SuccessOutcome.



7
8
9
10
11
12
13
14
15
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 7

def initialize(response:, body:, feed:, item_processing:, feed_signature:, content_changed:, entries_digest:)
  @response = response
  @body = body
  @feed = feed
  @item_processing = item_processing
  @feed_signature = feed_signature
  @content_changed = content_changed
  @entries_digest = entries_digest
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def body
  @body
end

#content_changedObject (readonly)

Returns the value of attribute content_changed.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def content_changed
  @content_changed
end

#entries_digestObject (readonly)

Returns the value of attribute entries_digest.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def entries_digest
  @entries_digest
end

#feedObject (readonly)

Returns the value of attribute feed.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def feed
  @feed
end

#feed_signatureObject (readonly)

Returns the value of attribute feed_signature.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def feed_signature
  @feed_signature
end

#item_processingObject (readonly)

Returns the value of attribute item_processing.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def item_processing
  @item_processing
end

#responseObject (readonly)

Returns the value of attribute response.



17
18
19
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 17

def response
  @response
end

Instance Method Details

#apply(source_updater:, started_at:, instrumentation_payload:) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 19

def apply(source_updater:, started_at:, instrumentation_payload:)
  duration_ms = source_updater.elapsed_ms(started_at)
  update_source(source_updater, duration_ms)
  create_fetch_log(source_updater, duration_ms, started_at)
  apply_instrumentation(instrumentation_payload)
  result
end

#errorObject



31
32
33
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 31

def error
  nil
end

#resultObject



39
40
41
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 39

def result
  Result.new(status: status, feed: feed, response: response, body: body, item_processing: item_processing, outcome: self)
end

#retry_decisionObject



35
36
37
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 35

def retry_decision
  nil
end

#statusObject



27
28
29
# File 'lib/source_monitor/fetching/feed_fetcher/success_outcome.rb', line 27

def status
  :fetched
end