lib/redd/utilities/unmarshaller.rb in redd-0.8.1 vs lib/redd/utilities/unmarshaller.rb in redd-0.8.2
- old
+ new
@@ -13,10 +13,11 @@
't4' => Models::PrivateMessage,
't5' => Models::Subreddit,
'more' => Models::MoreComments,
'wikipage' => Models::WikiPage,
'Listing' => Models::Listing,
+ 'modaction' => Models::Subreddit::ModAction,
'LabeledMulti' => Models::Multireddit,
'LiveUpdate' => Models::LiveThread::LiveUpdate
}.freeze
def initialize(client)
@@ -24,15 +25,15 @@
end
def unmarshal(response)
if response[:json] && response[:json][:data]
if response[:json][:data][:things]
- Models::Listing.from_response(@client, children: response[:json][:data][:things])
+ Models::Listing.new(@client, children: response[:json][:data][:things])
else
Models::BasicModel.new(@client, response[:json][:data])
end
elsif MAPPING.key?(response[:kind])
- MAPPING[response[:kind]].from_response(@client, response[:data])
+ MAPPING[response[:kind]].new(@client, response[:data])
else
raise "unknown type to unmarshal: #{response[:kind].inspect}"
end
end
end