Class: ThetvdbApi::Response
- Inherits:
-
Object
- Object
- ThetvdbApi::Response
- Defined in:
- lib/thetvdb_api/response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #env ⇒ Object
- #headers ⇒ Object
-
#initialize(faraday_response, mapper = nil) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #mapper ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(faraday_response, mapper = nil) ⇒ Response
Returns a new instance of Response.
2 3 4 5 |
# File 'lib/thetvdb_api/response.rb', line 2 def initialize(faraday_response, mapper = nil) @faraday_response = faraday_response @mapper = mapper end |
Instance Method Details
#body ⇒ Object
23 24 25 |
# File 'lib/thetvdb_api/response.rb', line 23 def body @body ||= @mapper ? @mapper.parse(@faraday_response.body) : @faraday_response.body end |
#env ⇒ Object
11 12 13 |
# File 'lib/thetvdb_api/response.rb', line 11 def env @faraday_response.env end |
#headers ⇒ Object
19 20 21 |
# File 'lib/thetvdb_api/response.rb', line 19 def headers @faraday_response.headers end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/thetvdb_api/response.rb', line 27 def inspect "<ThetvdbApi::Response body=#{body.inspect}, mapper=#{mapper.inspect}>" end |
#mapper ⇒ Object
7 8 9 |
# File 'lib/thetvdb_api/response.rb', line 7 def mapper @mapper end |
#status ⇒ Object
15 16 17 |
# File 'lib/thetvdb_api/response.rb', line 15 def status @faraday_response.status end |