lib/fb_graph2/edge/picture.rb in fb_graph2-0.7.4 vs lib/fb_graph2/edge/picture.rb in fb_graph2-0.7.5
- old
+ new
@@ -1,11 +1,22 @@
module FbGraph2
class Edge
module Picture
+ def assign(attributes)
+ super
+ if attributes.include? :picture
+ @_cached_picture = attributes[:picture]
+ end
+ end
+
def picture(*args)
params = args.extract_options!
params[:type] = args.first if args.first
- picture = self.get params.merge(redirect: false), edge: :picture
+ picture = if @_cached_picture.present? && params.blank?
+ @_cached_picture
+ else
+ self.get params.merge(redirect: false), edge: :picture
+ end
Struct::Picture.new picture[:data]
end
end
end
end
\ No newline at end of file