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'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.parserObject

Returns the value of attribute parser.



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

def parser
  @parser
end

Class Method Details

.define_parser(&block) ⇒ Object



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

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

Instance Method Details

#parse_response?(env) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#response_type(env) ⇒ Object



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

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