Sha256: f515494decd2ccba2f20e79db8184f1d2cb8c1ab8c98deae8ffc8a2db659cb3d
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# -*- coding: utf-8 -*- class Courier::Service::Facebook < Courier::Service::Base FACEBOOK_PROPERTY_ATTRS = [:from, :to, :picture, :link, :name, :caption, :description, :message, :source, :icon, :attribution, :actions, :privacy, :targeting] def initialize raise "No Koala defined. Add gem 'koala' to your Gemfile. " unless defined? Koala attr_accessor={} super end # # message.options[:facebook_properties] are all available options from # http://developers.facebook.com/docs/reference/api/post/ # def deliver_message(message) args = message.options[:facebook_properties] || message.options.slice(FACEBOOK_PROPERTY_ATTRS) args[:message] ||= message.options[:text] || Courier.template(message.template). get_text(message.service, message.options) token = args[:token] token ||= message.owner.facebook_token if message.owner.respond_to?(:facebook_token) return true unless token to = args[:to] || (message.owner.respond_to?(:facebook_id) ? message.owner.facebook_id : nil) || 'me' # Settings.omniauth.facebook.app_id, Settings.omniauth.facebook.secret # Это post_on_wall Koala::Facebook::GraphAPI.new(token).put_object(to, "feed", args) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
courier-0.2.4 | lib/courier/service/facebook.rb |