lib/ruby_isds/responses/messages/collection.rb in ruby_isds-0.10.1 vs lib/ruby_isds/responses/messages/collection.rb in ruby_isds-0.10.2
- old
+ new
@@ -9,19 +9,20 @@
@messages = load_messages
@status = ::RubyIsds::Responses::Dm::Status.new(parsed_body)
end
def load_messages
+ return [] if results.blank?
return [::RubyIsds::DataMessage.new(results)] if results.is_a?(Hash)
results.map do |result|
::RubyIsds::DataMessage.new(result)
end
end
private
def results
- parsed_body['dmRecords']['dmRecord']
+ parsed_body['dmRecords'].try(:[], 'dmRecord')
end
end
end
end
end