Module: Cosm::Parsers::JSON::FeedDefaults
Instance Method Summary
collapse
Methods included from Helpers
#join_tags, #parse_tag_string
Instance Method Details
#from_json(json) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cosm-rb/parsers/json/feed_defaults.rb', line 9
def from_json(json)
begin
hash = MultiJson.load(json)
rescue MultiJson::DecodeError => e
raise InvalidJSONError, e.message
end
raise InvalidJSONError, "JSON doesn't appear to be a hash" unless hash.is_a?(Hash)
case hash['version']
when '0.6-alpha', '0.6'
transform_0_6_alpha(hash)
else
transform_1_0_0(hash)
end
end
|