Class: ThetvdbApi::Response
- Inherits:
-
Object
- Object
- ThetvdbApi::Response
show all
- Defined in:
- lib/thetvdb_api/response.rb
Defined Under Namespace
Modules: Collection
Classes: Actors, Banners, Episode, FullSeries, SearchMultipleEpisode, SearchMultipleSeries, SearchSeries, Series, Update
Instance Method Summary
collapse
Constructor Details
#initialize(faraday_response, mapping = false) ⇒ Response
Returns a new instance of Response.
4
5
6
7
|
# File 'lib/thetvdb_api/response.rb', line 4
def initialize(faraday_response, mapping = false)
@faraday_response = faraday_response
@mapping = mapping
end
|
Instance Method Details
#[](key) ⇒ Object
29
30
31
|
# File 'lib/thetvdb_api/response.rb', line 29
def [](key)
parse[key]
end
|
#[]=(key, value) ⇒ Object
33
34
35
|
# File 'lib/thetvdb_api/response.rb', line 33
def []=(key, value)
parse[key] = value
end
|
#body ⇒ Object
21
22
23
|
# File 'lib/thetvdb_api/response.rb', line 21
def body
@body ||= @mapping ? parse : @faraday_response.body
end
|
#each(&block) ⇒ Object
37
38
39
|
# File 'lib/thetvdb_api/response.rb', line 37
def each(&block)
parse.each(&block)
end
|
#env ⇒ Object
9
10
11
|
# File 'lib/thetvdb_api/response.rb', line 9
def env
@faraday_response.env
end
|
17
18
19
|
# File 'lib/thetvdb_api/response.rb', line 17
def
@faraday_response.
end
|
#inspect ⇒ Object
25
26
27
|
# File 'lib/thetvdb_api/response.rb', line 25
def inspect
body.inspect
end
|
#multi_xml_parse ⇒ Object
41
42
43
|
# File 'lib/thetvdb_api/response.rb', line 41
def multi_xml_parse
MultiXml.parse(@faraday_response.body)
end
|
#parse ⇒ Object
49
50
51
|
# File 'lib/thetvdb_api/response.rb', line 49
def parse
@parse ||= xml_parse
end
|
#status ⇒ Object
13
14
15
|
# File 'lib/thetvdb_api/response.rb', line 13
def status
@faraday_response.status
end
|
#xml_parse ⇒ Object
45
46
47
|
# File 'lib/thetvdb_api/response.rb', line 45
def xml_parse
multi_xml_parse
end
|