Class: Html2rss::RequestService::Context

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(url:, headers: {}) ⇒ 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

#headersHash (readonly)



27
28
29
# File 'lib/html2rss/request_service/context.rb', line 27

def headers
  @headers
end

#urlAddressable::URI (readonly)



24
25
26
# File 'lib/html2rss/request_service/context.rb', line 24

def url
  @url
end