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.59 lib/soaspec/interpreter.rb
soaspec-0.0.58 lib/soaspec/interpreter.rb
soaspec-0.0.57 lib/soaspec/interpreter.rb
soaspec-0.0.56 lib/soaspec/interpreter.rb
soaspec-0.0.55 lib/soaspec/interpreter.rb
soaspec-0.0.54 lib/soaspec/interpreter.rb
soaspec-0.0.53 lib/soaspec/interpreter.rb
soaspec-0.0.52 lib/soaspec/interpreter.rb
soaspec-0.0.51 lib/soaspec/interpreter.rb
soaspec-0.0.50 lib/soaspec/interpreter.rb
soaspec-0.0.49 lib/soaspec/interpreter.rb
soaspec-0.0.48 lib/soaspec/interpreter.rb
soaspec-0.0.47 lib/soaspec/interpreter.rb
soaspec-0.0.46 lib/soaspec/interpreter.rb
soaspec-0.0.45 lib/soaspec/interpreter.rb
soaspec-0.0.44 lib/soaspec/interpreter.rb
soaspec-0.0.43 lib/soaspec/interpreter.rb
soaspec-0.0.42 lib/soaspec/interpreter.rb
soaspec-0.0.41 lib/soaspec/interpreter.rb
soaspec-0.0.40 lib/soaspec/interpreter.rb