lib/itunes_api/request.rb in itunes_api-2.1.0 vs lib/itunes_api/request.rb in itunes_api-2.2.0
- old
+ new
@@ -7,18 +7,26 @@
@results ||= parsed_response.fetch('results') { [] }
end
private
- def parsed_response
- JSON.parse(response.body)
- end
-
def connection
Faraday.new(url: BASE_URL)
end
+ def parsed_response
+ JSON.parse(response.body)
+ end
+
def response
connection.get(action, query)
+ end
+
+ def unwrapped_results(type)
+ return [] unless results.any?
+
+ results.find_all do |wrappers|
+ wrappers['wrapperType'] == type.to_s
+ end
end
end
end