Sha256: 6c292ca39fe1b84d3ada358c130523247449a0b26688dcec790cfbc7c7a9bb55
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
# -*- coding: utf-8 -*- class Courier::Service::Facebook < Courier::Service::Base 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) message.owner.respond_to?(:facebook_token) or raise "method facebook_token is not defined in your owner's model #{owner.class}" token = message.owner.facebook_token or raise "owner's facebook_token is empty" unless args = message.options[:facebook_properties] args = message.options.slice(:from, :to, :picture, :link, :name, :caption, :message, :description, :source, :icon, :attribution, :actions, :privacy, :targeting) end args[:message] ||= message.options[:text] || Courier.template(message.template).get_text(message.service, message.options) Koala::Facebook::GraphAPI.new(token).put_object(args[:to] || 'me', "feed", args) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
courier-0.2.1 | lib/courier/service/facebook.rb |
courier-0.2.0 | lib/courier/service/facebook.rb |
courier-0.1.5 | lib/courier/service/facebook.rb |
courier-0.1.4 | lib/courier/service/facebook.rb |