Sha256: bb4203d8745c74482a6d7679594b73399a25a3432e577d765472545f0fe5f7c8

Contents?: true

Size: 505 Bytes

Versions: 45

Compression:

Stored size: 505 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

45 entries across 45 versions & 1 rubygems

Version Path
soaspec-0.0.39 lib/soaspec/interpreter.rb
soaspec-0.0.38 lib/soaspec/interpreter.rb
soaspec-0.0.37 lib/soaspec/interpreter.rb
soaspec-0.0.36 lib/soaspec/interpreter.rb
soaspec-0.0.35 lib/soaspec/interpreter.rb