Sha256: 85ef7d78e46962fbdf0e00b2b0edd036b103bf241064f847b4fcd68d65b5681b
Contents?: true
Size: 721 Bytes
Versions: 2
Compression:
Stored size: 721 Bytes
Contents
module Schoolfinder class Response attr_accessor :body def initialize(response) self.body = rash_response(response) if self.body.respond_to?('fault_string') raise Schoolfinder::Error.new(self.body.fault_code, self.body.fault_string) end end private def rash_response(response) if response.is_a?(Array) self.body = [] response.each do |b| if b.is_a?(Hash) self.body << Hashie::Rash.new(b) else self.body << b end end elsif response.is_a?(Hash) self.body = Hashie::Rash.new(response) else self.body = response end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
schoolfinder-0.2.0 | lib/schoolfinder/response.rb |
schoolfinder-0.1.0 | lib/schoolfinder/response.rb |