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.79 lib/soaspec/interpreter.rb
soaspec-0.0.78 lib/soaspec/interpreter.rb
soaspec-0.0.77 lib/soaspec/interpreter.rb
soaspec-0.0.76 lib/soaspec/interpreter.rb
soaspec-0.0.75 lib/soaspec/interpreter.rb
soaspec-0.0.74 lib/soaspec/interpreter.rb
soaspec-0.0.73 lib/soaspec/interpreter.rb
soaspec-0.0.72 lib/soaspec/interpreter.rb
soaspec-0.0.71 lib/soaspec/interpreter.rb
soaspec-0.0.70 lib/soaspec/interpreter.rb
soaspec-0.0.69 lib/soaspec/interpreter.rb
soaspec-0.0.68 lib/soaspec/interpreter.rb
soaspec-0.0.67 lib/soaspec/interpreter.rb
soaspec-0.0.66 lib/soaspec/interpreter.rb
soaspec-0.0.65 lib/soaspec/interpreter.rb
soaspec-0.0.64 lib/soaspec/interpreter.rb
soaspec-0.0.63 lib/soaspec/interpreter.rb
soaspec-0.0.62 lib/soaspec/interpreter.rb
soaspec-0.0.61 lib/soaspec/interpreter.rb
soaspec-0.0.60 lib/soaspec/interpreter.rb