Class: Vzaar::Response::Base

Inherits:
Struct
  • Object
show all
Includes:
Helper
Defined in:
lib/vzaar/response/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#blank?, #hash_to_xml, #symb_keys

Instance Attribute Details

#resObject

Returns the value of attribute res

Returns:

  • (Object)

    the current value of res



3
4
5
# File 'lib/vzaar/response/base.rb', line 3

def res
  @res
end

Instance Method Details

#bodyObject



6
7
8
# File 'lib/vzaar/response/base.rb', line 6

def body
  json? ? JSON.parse(res.body) : res.body
end

#content_typeObject



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

def content_type
  @content_type ||= res.content_type
end

#json?Boolean

Returns:

  • (Boolean)


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

def json?
  content_type == "application/json"
end