Sha256: a6dce350171c887e7f82eba209d176071f542d24cbeaf209d72ed501840082b9

Contents?: true

Size: 256 Bytes

Versions: 2

Compression:

Stored size: 256 Bytes

Contents

require 'httparty'

class JSONPParser < HTTParty::Parser
  SupportedFormats = {
    "application/javascript" => :jsonp,
    "application/json" => :json
  }

  def jsonp
    JSON.load(body.strip[2..-2], nil)
  end

  def json
    JSON.load(body)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
campminder-1.0.1 lib/campminder/parser.rb
campminder-1.0.0 lib/campminder/parser.rb