Class: WhosGotDirt::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- WhosGotDirt::Response
- Defined in:
- lib/whos_got_dirt/response.rb
Overview
Accepts a response and returns the results in a consistent format.
Direct Known Subclasses
WhosGotDirt::Responses::Entity::CorpWatch, WhosGotDirt::Responses::Entity::OpenDuka, WhosGotDirt::Responses::Entity::Poderopedia, WhosGotDirt::Responses::Helpers::LittleSisHelper, WhosGotDirt::Responses::Helpers::OpenCorporatesHelper, WhosGotDirt::Responses::Relation::OpenOil
Class Attribute Summary collapse
-
.template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#body ⇒ String
Returns the response body.
-
#env ⇒ #url, #request_headers
Returns the response's internals.
-
#headers ⇒ #[]
Returns the response headers.
-
#initialize(response) ⇒ Object
constructor
Sets the response's response.
- #parse_body ⇒ Object abstract
-
#parsed_body ⇒ Object
Returns the parsed response body.
-
#renderer ⇒ Object
Returns the result renderer.
-
#status ⇒ Fixnum
Returns the HTTP status code.
- #to_a ⇒ Object abstract
Constructor Details
#initialize(response) ⇒ Object
Sets the response's response.
|
# File 'lib/whos_got_dirt/response.rb', line 59
|
Class Attribute Details
.template ⇒ Object (readonly)
Returns the value of attribute template.
31 32 33 |
# File 'lib/whos_got_dirt/response.rb', line 31 def template @template end |
Instance Method Details
#body ⇒ String
Returns the response body.
|
# File 'lib/whos_got_dirt/response.rb', line 63
|
#env ⇒ #url, #request_headers
Returns the response's internals.
|
# File 'lib/whos_got_dirt/response.rb', line 67
|
#headers ⇒ #[]
Returns the response headers.
|
# File 'lib/whos_got_dirt/response.rb', line 71
|
#parse_body ⇒ Object
Subclass and override #parse_body to parse the response body
49 50 51 |
# File 'lib/whos_got_dirt/response.rb', line 49 def parse_body raise NotImplementedError end |
#parsed_body ⇒ Object
Returns the parsed response body.
44 45 46 |
# File 'lib/whos_got_dirt/response.rb', line 44 def parsed_body @parsed_body ||= parse_body end |
#renderer ⇒ Object
Returns the result renderer.
37 38 39 |
# File 'lib/whos_got_dirt/response.rb', line 37 def renderer @renderer ||= Renderer.new(self.class.template) end |
#status ⇒ Fixnum
Returns the HTTP status code.
|
# File 'lib/whos_got_dirt/response.rb', line 75
|
#to_a ⇒ Object
Subclass and override #to_a to transform the parsed response body into results
55 56 57 |
# File 'lib/whos_got_dirt/response.rb', line 55 def to_a raise NotImplementedError end |