lib/bearcat/api_array.rb in bearcat-0.9.3 vs lib/bearcat/api_array.rb in bearcat-0.9.4

- old
+ new

@@ -3,11 +3,11 @@ include Enumerable attr_reader :status, :headers, :members def self.process_response(response, api_client) - if response.is_a?(Array) + if response.body.is_a?(Array) ApiArray.new(response, api_client) elsif key = array_key(response) ApiArray.new(response, api_client, key) else response.body @@ -116,12 +116,10 @@ end end #TODO: This is a quick fix for JSONAPI responses if we need to do this for anything else we need to do this a better way def self.array_key(response) - if response.env[:method] == :get && response.env[:url].path.match(/.*\/(courses||groups)\/\d+\/conferences/) - 'conferences' - end + 'conferences' if (response.env[:method] == :get && response.env[:url].path.match(/.*\/(courses||groups)\/\d+\/conferences/)) end def process_body(response) if response.body.is_a?(Array) response.body \ No newline at end of file