Class: BitBucket::Response

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

Overview

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

Direct Known Subclasses

Helpers, Jsonize, Mashify, Xmlize

Defined Under Namespace

Classes: Helpers, Jsonize, Mashify, RaiseError, Xmlize

Constant Summary collapse

CONTENT_TYPE =
'Content-Type'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.parserObject

Returns the value of attribute parser.



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

def parser
  @parser
end

Class Method Details

.define_parser(&block) ⇒ Object



14
15
16
# File 'lib/bitbucket_rest_api/response.rb', line 14

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

Instance Method Details

#parse_response?(env) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/bitbucket_rest_api/response.rb', line 22

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

#response_type(env) ⇒ Object



18
19
20
# File 'lib/bitbucket_rest_api/response.rb', line 18

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