Sha256: 5398bbe19fb831806d33e80c2078fee5c487e73f6cc6a635d9b695b695b46147

Contents?: true

Size: 500 Bytes

Versions: 4

Compression:

Stored size: 500 Bytes

Contents

# Help interpret the general type of a particular object
class Interpreter

  # @param [Object] response API response
  # @return [Symbol] Type of provided response
  def self.response_type_for(response)
    if response.is_a? String
      case response.body[0]
      when '<'
        :xml
      when '{'
        :json
      else
        :unknown
      end
    elsif response.is_a? Hash
      :hash
    elsif response.is_a? Nokogiri::XML::NodeSet
      :xml
    else
      :unknown
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soaspec-0.0.34 lib/soaspec/interpreter.rb
soaspec-0.0.33 lib/soaspec/interpreter.rb
soaspec-0.0.32 lib/soaspec/interpreter.rb
soaspec-0.0.31 lib/soaspec/interpreter.rb