Class: PointmdComments::Aggregators::Posts

Inherits:
Object
  • Object
show all
Defined in:
lib/pointmd_comments/aggregators/posts.rb

Constant Summary collapse

ALLOWED_SOURCES =

NOTE: This array may be populated with other website sections in the future.

%i[news today].freeze
DEFAULT_SOURCE =
:news
MAIN_PAGE =
'https://point.md/ru/'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, path:) ⇒ Posts

Returns a new instance of Posts.



11
12
13
14
# File 'lib/pointmd_comments/aggregators/posts.rb', line 11

def initialize(source:, path:)
  @source = source
  @path   = path
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/pointmd_comments/aggregators/posts.rb', line 9

def source
  @source
end

#urlsObject (readonly)

Returns the value of attribute urls.



9
10
11
# File 'lib/pointmd_comments/aggregators/posts.rb', line 9

def urls
  @urls
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
# File 'lib/pointmd_comments/aggregators/posts.rb', line 16

def call
  validate_source
  fetch_posts
  puts "Found #{urls.count} links in the #{source} section.."

  @urls
end