Sha256: eb7588efe30d7cc54139d1cfc1e4b9aaa099aecc62340220909a4d31e1eeac84
Contents?: true
Size: 537 Bytes
Versions: 5
Compression:
Stored size: 537 Bytes
Contents
class FlixCloud::Response attr_accessor :code, :body, :errors, :body_as_hash def initialize(response) self.code = response.code self.body = response.to_s self.body_as_hash = Crack::XML.parse(response.to_s) self.errors = [] process_response_xml end def success? errors.empty? end protected def process_response_xml if body_as_hash['errors'] && body_as_hash['errors'].is_a?(Hash) && body_as_hash['errors']['error'] self.errors = Array(body_as_hash['errors']['error']) end end end
Version data entries
5 entries across 5 versions & 1 rubygems