Sha256: 112a431d8584bcb5c34c3154cbe2e2b553f52dcd90cb538a27c6b78dcaa2eddd
Contents?: true
Size: 1.21 KB
Versions: 20
Compression:
Stored size: 1.21 KB
Contents
module Adparlor module Facebook module GraphApi class CollectionProxy def initialize(klass, path, access_token, data = nil, options = {}) @klass = klass @path = path @access_token = access_token @options = options @all = Array(data).collect { |attributes| @klass.new(attributes) } if data end def all(options = {}) options.merge!(access_token: @access_token) unless options[:access_token] options.merge!(@options) if @options.any? @all ||= @klass.get(@path, options) end def create(attributes = {}, options = {}) options.merge!(access_token: @access_token) unless options[:access_token] @klass.new(attributes).create(@path, options) end def destroy(attributes = {}, options = {}) options.merge!(access_token: @access_token) unless options[:access_token] @klass.new(attributes).destroy(@path, options) end def update(attributes = {}, options = {}) options.merge!(access_token: @access_token) unless options[:access_token] @klass.new(attributes).update(@path, options) end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems