Class: HTTParty::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/actblue.rb

Instance Method Summary collapse

Instance Method Details

#parse_response(body) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/actblue.rb', line 15

def parse_response(body)
  return nil if body.nil? or body.empty? or body.strip.empty?
  case format
    when :xml
      HTTParty::Parsers::XML.parse(body)
    when :json
      HTTParty::Parsers::JSON.decode(body)
    when :yaml
      YAML::load(body)
    else
      body
    end
end