Class: TheTvDB::Response

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/the_tv_db/response.rb

Overview

Contains methods and attributes that act on the response returned from the request

Direct Known Subclasses

Xmlize

Defined Under Namespace

Classes: RaiseError, Unzip, Xmlize

Constant Summary collapse

CONTENT_TYPE =
'Content-Type'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.parserObject

Returns the value of attribute parser.



10
11
12
# File 'lib/the_tv_db/response.rb', line 10

def parser
  @parser
end

Class Method Details

.define_parser(&block) ⇒ Object



13
14
15
# File 'lib/the_tv_db/response.rb', line 13

def self.define_parser(&block)
  @parser = block
end

Instance Method Details

#parse_response?(env) ⇒ Boolean

Returns:

  • (Boolean)


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

def parse_response?(env)
  env[:body].respond_to? :to_str
end

#response_type(env) ⇒ Object



17
18
19
# File 'lib/the_tv_db/response.rb', line 17

def response_type(env)
  env[:response_headers][CONTENT_TYPE].to_s
end