Class: ThetvdbApi::Response

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

Instance Method Summary collapse

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

#bodyObject



23
24
25
# File 'lib/thetvdb_api/response.rb', line 23

def body
  @body ||= @mapper ? @mapper.parse(@faraday_response.body) : @faraday_response.body
end

#envObject



11
12
13
# File 'lib/thetvdb_api/response.rb', line 11

def env
  @faraday_response.env
end

#headersObject



19
20
21
# File 'lib/thetvdb_api/response.rb', line 19

def headers
  @faraday_response.headers
end

#inspectObject



27
28
29
# File 'lib/thetvdb_api/response.rb', line 27

def inspect
  "<ThetvdbApi::Response body=#{body.inspect}, mapper=#{mapper.inspect}>"
end

#mapperObject



7
8
9
# File 'lib/thetvdb_api/response.rb', line 7

def mapper
  @mapper
end

#statusObject



15
16
17
# File 'lib/thetvdb_api/response.rb', line 15

def status
  @faraday_response.status
end