Class: Html2rss::RequestService::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/request_service/response.rb

Overview

To be used by strategies to provide their response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body:, headers: {}) ⇒ Response

Returns a new instance of Response.

Parameters:

  • body (String)

    the body of the response

  • headers (Hash) (defaults to: {})

    the headers of the response



11
12
13
14
15
16
17
18
# File 'lib/html2rss/request_service/response.rb', line 11

def initialize(body:, headers: {})
  @body = body

  headers = headers.dup
  headers.transform_keys!(&:to_s)

  @headers = headers
end

Instance Attribute Details

#bodyString (readonly)

Returns the body of the response.

Returns:

  • (String)

    the body of the response



21
22
23
# File 'lib/html2rss/request_service/response.rb', line 21

def body
  @body
end

#headersHash<String, Object> (readonly)

Returns the headers of the response.

Returns:

  • (Hash<String, Object>)

    the headers of the response



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

def headers
  @headers
end