Class: Html2rss::AutoSource::Scraper::WordpressApi::PageScope
- Inherits:
-
Object
- Object
- Html2rss::AutoSource::Scraper::WordpressApi::PageScope
- Defined in:
- lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb
Overview
Determines whether a WordPress page can safely be mapped to a posts query.
Defined Under Namespace
Classes: Resolver
Constant Summary collapse
- CATEGORY_SEGMENT =
Canonical path segment for category archives.
'category'- TAG_SEGMENT =
Canonical path segment for tag archives.
'tag'- AUTHOR_SEGMENT =
Canonical path segment for author archives.
'author'- PAGE_SEGMENT =
Canonical path segment for paginated archives.
'page'- PAGED_QUERY_KEY =
Canonical query key used for paginated archives.
'paged'
Instance Attribute Summary collapse
-
#query ⇒ Hash{String => String}
readonly
Query params to apply to the posts request.
-
#reason ⇒ Symbol
readonly
Classification of the resolved page scope.
Class Method Summary collapse
-
.from(parsed_body:, url:) ⇒ PageScope
Derived page scope.
Instance Method Summary collapse
-
#fetchable? ⇒ Boolean
Whether the page may safely use the posts API follow-up.
-
#initialize(query:, fetchable:, reason:) ⇒ PageScope
constructor
A new instance of PageScope.
Constructor Details
#initialize(query:, fetchable:, reason:) ⇒ PageScope
Returns a new instance of PageScope.
33 34 35 36 37 38 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 33 def initialize(query:, fetchable:, reason:) @query = query.freeze @fetchable = fetchable @reason = reason freeze end |
Instance Attribute Details
#query ⇒ Hash{String => String} (readonly)
Returns query params to apply to the posts request.
42 43 44 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 42 def query @query end |
#reason ⇒ Symbol (readonly)
Returns classification of the resolved page scope.
52 53 54 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 52 def reason @reason end |
Class Method Details
Instance Method Details
#fetchable? ⇒ Boolean
Returns whether the page may safely use the posts API follow-up.
46 47 48 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 46 def fetchable? @fetchable end |