Sha256: 9d712e1d68a40a774df8ee4e277fbf11c17f08f059a19c29b34f4955864d0abf
Contents?: true
Size: 679 Bytes
Versions: 1
Compression:
Stored size: 679 Bytes
Contents
require 'json' require 'yajl' class FakeResponse def self.render(resource, id = nil, collection = false) new(resource, id, collection).render end def initialize(resource, id = nil, collection = false) @resource, @id, @collection = resource, id, collection end def render collection ? '[' + output + ']' : output end private attr_reader :resource, :id, :collection def output return converted if id raw end def converted JSON(parsed) end def parsed @parsed ||= Yajl::Parser.parse(raw).merge!('id' => id) end def raw @raw ||= File .read(File.dirname(__FILE__) + "/../remotes/#{resource}.json") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.9 | test/support/fake_trello/fake_response.rb |