Class: Html2rss::RequestService::Context
- Inherits:
-
Object
- Object
- Html2rss::RequestService::Context
- Defined in:
- lib/html2rss/request_service/context.rb
Overview
Holds information needed to send requests to websites. To be passed down to the RequestService’s strategies.
Constant Summary collapse
- SUPPORTED_URL_SCHEMES =
%w[http https].to_set.freeze
Instance Attribute Summary collapse
-
#headers ⇒ Hash
readonly
The HTTP request headers.
-
#url ⇒ Addressable::URI
readonly
The parsed URL.
Instance Method Summary collapse
-
#initialize(url:, headers: {}) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(url:, headers: {}) ⇒ Context
Returns a new instance of Context.
16 17 18 19 20 21 |
# File 'lib/html2rss/request_service/context.rb', line 16 def initialize(url:, headers: {}) @url = Addressable::URI.parse(url) assert_valid_url! @headers = headers end |
Instance Attribute Details
#headers ⇒ Hash (readonly)
Returns the HTTP request headers.
27 28 29 |
# File 'lib/html2rss/request_service/context.rb', line 27 def headers @headers end |
#url ⇒ Addressable::URI (readonly)
Returns the parsed URL.
24 25 26 |
# File 'lib/html2rss/request_service/context.rb', line 24 def url @url end |