mosaic-facebook 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +3 -0
  3. data/Rakefile +20 -0
  4. data/lib/mosaic-facebook.rb +1 -0
  5. data/lib/mosaic/.DS_Store +0 -0
  6. data/lib/mosaic/facebook.rb +5 -0
  7. data/lib/mosaic/facebook/.DS_Store +0 -0
  8. data/lib/mosaic/facebook/api.rb +3 -0
  9. data/lib/mosaic/facebook/api/api_object.rb +10 -0
  10. data/lib/mosaic/facebook/api/notification.rb +17 -0
  11. data/lib/mosaic/facebook/error.rb +44 -0
  12. data/lib/mosaic/facebook/fql.rb +5 -0
  13. data/lib/mosaic/facebook/fql/comment.rb +9 -0
  14. data/lib/mosaic/facebook/fql/fql_object.rb +71 -0
  15. data/lib/mosaic/facebook/fql/post.rb +19 -0
  16. data/lib/mosaic/facebook/graph.rb +10 -0
  17. data/lib/mosaic/facebook/graph/account.rb +32 -0
  18. data/lib/mosaic/facebook/graph/application.rb +13 -0
  19. data/lib/mosaic/facebook/graph/association_proxy.rb +22 -0
  20. data/lib/mosaic/facebook/graph/comment.rb +9 -0
  21. data/lib/mosaic/facebook/graph/graph_object.rb +43 -0
  22. data/lib/mosaic/facebook/graph/insights.rb +9 -0
  23. data/lib/mosaic/facebook/graph/page.rb +13 -0
  24. data/lib/mosaic/facebook/graph/post.rb +25 -0
  25. data/lib/mosaic/facebook/graph/subscription.rb +9 -0
  26. data/lib/mosaic/facebook/graph/user.rb +24 -0
  27. data/lib/mosaic/facebook/object.rb +103 -0
  28. data/lib/mosaic/facebook/time.rb +19 -0
  29. data/lib/mosaic/facebook/version.rb +5 -0
  30. data/lib/mosaic_facebook.rb +2 -0
  31. data/mosaic-facebook.gemspec +30 -0
  32. data/spec/facebook_credentials.yml.example +1 -0
  33. data/spec/mosaic-facebook/notification_spec.rb +26 -0
  34. data/spec/mosaic-facebook_spec.rb +11 -0
  35. data/spec/spec.opts +3 -0
  36. data/spec/spec_helper.rb +14 -0
  37. metadata +135 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .DS_Store
5
+ Gemfile.lock
6
+ spec/facebook_credentials.yml
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+ # Specify your gem's dependencies in mosaic_facebook.gemspec
3
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rspec/core/rake_task'
4
+ require 'bundler'
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+
9
+ desc "Run RSpec"
10
+ RSpec::Core::RakeTask.new do |t|
11
+ t.verbose = false
12
+ end
13
+ # Spec::Rake::SpecTask.new(:spec) do |spec|
14
+ # spec.ruby_opts << '-rubygems'
15
+ # spec.libs << 'lib' << 'spec'
16
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
17
+ # spec.spec_opts = ['--options', 'spec/spec.opts']
18
+ # end
19
+ #
20
+ task :default => [:spec]
@@ -0,0 +1 @@
1
+ require 'mosaic/facebook'
Binary file
@@ -0,0 +1,5 @@
1
+ require 'mosaic/facebook/version'
2
+
3
+ require 'mosaic/facebook/api'
4
+ require 'mosaic/facebook/fql'
5
+ require 'mosaic/facebook/graph'
Binary file
@@ -0,0 +1,3 @@
1
+ require 'mosaic/facebook/object'
2
+ require 'mosaic/facebook/api/api_object'
3
+ require 'mosaic/facebook/api/notification'
@@ -0,0 +1,10 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Api
4
+ class ApiObject < Mosaic::Facebook::Object
5
+ base_uri 'https://api.facebook.com'
6
+
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'mosaic/facebook/error'
2
+
3
+ module Mosaic
4
+ module Facebook
5
+ class Notification < Mosaic::Facebook::Api::ApiObject
6
+
7
+ class << self
8
+ # send_email requires these parameters: to, subject, body, access_token
9
+ def send_email(options)
10
+ response = get("/method/notifications.sendEmail", options)
11
+ raise Mosaic::Facebook::Error.new(response['error_response']) if response.include?('error_response')
12
+ response
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ module Mosaic
2
+ module Facebook
3
+ class Error < StandardError
4
+ attr_reader :error_code
5
+
6
+ def initialize(message, code = nil)
7
+ super(message)
8
+ @error_code = code
9
+ end
10
+
11
+ class << self
12
+ def new(error)
13
+ if error.include?('error_code')
14
+ klass = EXCEPTION_CODES[error['error_code'].to_i] || Error
15
+ klass.allocate.tap { |obj| obj.send :initialize, error['error_msg'], error['error_code'].to_i }
16
+ else
17
+ klass = EXCEPTION_TYPES[error['type']] || Error
18
+ klass.allocate.tap { |obj| obj.send :initialize, error['message'] }
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ class UnknownError < Mosaic::Facebook::Error
25
+ end
26
+
27
+ class ParserError < Mosaic::Facebook::Error
28
+ end
29
+
30
+ class AccessTokenError < Mosaic::Facebook::Error
31
+ end
32
+
33
+ EXCEPTION_CODES = {
34
+ 1 => UnknownError,
35
+ 101 => AccessTokenError,
36
+ 190 => AccessTokenError,
37
+ 601 => ParserError
38
+ }
39
+
40
+ EXCEPTION_TYPES = {
41
+ 'OAuthException' => AccessTokenError
42
+ }
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ require 'mosaic/facebook/api/api_object'
2
+ require 'mosaic/facebook/fql/fql_object'
3
+ require 'mosaic/facebook/fql/comment'
4
+ require 'mosaic/facebook/fql/post'
5
+
@@ -0,0 +1,9 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Fql
4
+ class Comment < Mosaic::Facebook::Fql::FqlObject
5
+ attr_accessor :id, :fromid, :post_id, :text, :time
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,71 @@
1
+ require 'mosaic/facebook/error'
2
+
3
+ module Mosaic
4
+ module Facebook
5
+ module Fql
6
+ class FqlObject < Mosaic::Facebook::Api::ApiObject
7
+ class << self
8
+ def build_fql(options = {})
9
+ fql = "SELECT #{build_fql_columns(options[:select])}"
10
+ fql << " FROM #{table_name}"
11
+ fql << " WHERE #{build_fql_conditions(options[:conditions])}" if options[:conditions]
12
+ fql
13
+ end
14
+
15
+ def build_fql_columns(columns)
16
+ case columns
17
+ when NilClass
18
+ build_fql_columns(attribute_names)
19
+ when String
20
+ columns
21
+ when Array
22
+ columns.collect(&:to_s).join(',')
23
+ else
24
+ columns.to_s
25
+ end
26
+ end
27
+
28
+ def build_fql_condition(name, value)
29
+ if value.is_a?(Array)
30
+ "#{name} IN (#{value.join(',')})"
31
+ else
32
+ "#{name} = #{value}"
33
+ end
34
+ end
35
+
36
+ def build_fql_conditions(conditions)
37
+ case conditions
38
+ when String
39
+ conditions
40
+ when Hash
41
+ conditions.collect { |name,value| build_fql_condition(name,value) }.join(' AND ')
42
+ else
43
+ raise TypeError, "expected string or hash of FQL conditions"
44
+ end
45
+ end
46
+
47
+ def find(*args)
48
+ response = with_retry(Mosaic::Facebook::Fql::UnknownError) { find_by_fql(*args) }
49
+ data = response['fql_query_response'][record_name] || []
50
+ data = [data] unless data.is_a?(Array)
51
+ data.collect { |attributes| new(attributes) }
52
+ end
53
+
54
+ def find_by_fql(*args)
55
+ response = get('/method/fql.query', :query => build_fql(*args))
56
+ raise Mosaic::Facebook::Error.new(response['error_response']) if response.include?('error_response')
57
+ response
58
+ end
59
+
60
+ def record_name
61
+ @record_name ||= name.demodulize.underscore
62
+ end
63
+
64
+ def table_name
65
+ @table_name ||= name.demodulize.underscore
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,19 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Fql
4
+ class Post < Mosaic::Facebook::Fql::FqlObject
5
+ attr_accessor :id, :action_links, :actor_id, :app_data, :app_id, :attachment, :attribution, :comments, :created_time, :likes, :message, :permalink, :privacy, :source_id, :target_id, :updated_time, :viewer_id
6
+
7
+ class << self
8
+ def record_name
9
+ @record_name ||= 'stream_post'
10
+ end
11
+
12
+ def table_name
13
+ @table_name ||= 'stream'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ require 'mosaic/facebook/graph/association_proxy'
2
+ require 'mosaic/facebook/graph/graph_object'
3
+ require 'mosaic/facebook/graph/account'
4
+ require 'mosaic/facebook/graph/application'
5
+ require 'mosaic/facebook/graph/comment'
6
+ require 'mosaic/facebook/graph/insights'
7
+ require 'mosaic/facebook/graph/page'
8
+ require 'mosaic/facebook/graph/post'
9
+ require 'mosaic/facebook/graph/subscription'
10
+ require 'mosaic/facebook/graph/user'
@@ -0,0 +1,32 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Account < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :name, :access_token, :category
6
+
7
+ def insights
8
+ @insights ||= AssociationProxy.new(Mosaic::Facebook::Graph::Insights, "/#{self.id}/insights")
9
+ end
10
+
11
+ def posts
12
+ @posts ||= AssociationProxy.new(Mosaic::Facebook::Graph::Post, "/#{self.id}/posts")
13
+ end
14
+
15
+ def user
16
+ @user ||= AssociationProxy.new(Mosaic::Facebook::Graph::User, "/me")
17
+ end
18
+
19
+ class << self
20
+ def all(options = {})
21
+ # need 'manage_pages' extended permission to get pages (via accounts connection)
22
+ @all ||= find("/#{facebook_user}/accounts", options)
23
+ end
24
+
25
+ def find_by_name(name, options = {})
26
+ all(options).find { |account| account.name == name }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Application < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :name, :link
6
+
7
+ def subscriptions
8
+ @subscriptions ||= AssociationProxy.new(Mosaic::Facebook::Graph::Subscription, "/#{id}/subscriptions")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class AssociationProxy
5
+ def initialize(klass, path, data = nil)
6
+ @klass = klass
7
+ @path = path
8
+ @all = Array(data).collect { |attributes| @klass.new(attributes) } if data
9
+ end
10
+
11
+ def all(options = {})
12
+ @all ||= @klass.find(@path, options)
13
+ end
14
+
15
+ def create(attributes = {}, options = {})
16
+ @klass.new(attributes).post(@path, options)
17
+ @all = nil
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Comment < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :from, :message, :created_time, :likes, :user_likes
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,43 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class GraphObject < Mosaic::Facebook::Object
5
+ base_uri 'https://graph.facebook.com'
6
+
7
+ def delete(path, options = {})
8
+ response = super(path, options)
9
+ raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
10
+ response
11
+ end
12
+
13
+ def post(path, options = {})
14
+ response = super(path, options)
15
+ raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
16
+ response
17
+ end
18
+
19
+ class << self
20
+ def find(path, options = {})
21
+ response = get(path, options)
22
+ raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
23
+ data = response.parsed_response
24
+ if data.include?('data')
25
+ data['data'].collect { |attributes| new(attributes) }
26
+ else
27
+ new(data)
28
+ end
29
+ end
30
+
31
+ def find_by_id(id, options = {})
32
+ find("/#{id}", options)
33
+ end
34
+ end
35
+
36
+ private
37
+ def serialize_body(body)
38
+ body
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,9 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Insights < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :description, :name, :period, :values
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Page < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :name, :picture, :link, :likes, :category, :can_post, :type, :from, :to
6
+
7
+ def feed
8
+ @feed ||= AssociationProxy.new(Mosaic::Facebook::Graph::Post, "/#{self.id}/feed")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Post < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :created_time, :to, :message, :type, :link, :picture, :updated_time
6
+
7
+ def comments
8
+ if @comments.is_a?(Hash)
9
+ @comments = AssociationProxy.new(Mosaic::Facebook::Graph::Comment, "/#{id}/comments", @comments['data'])
10
+ else
11
+ @comments ||= AssociationProxy.new(Mosaic::Facebook::Graph::Comment, "/#{id}/comments")
12
+ end
13
+ end
14
+
15
+ def from
16
+ if @from.is_a?(Hash)
17
+ @from = AssociationProxy.new(Mosaic::Facebook::Graph::User, "/#{@from['id']}")
18
+ else
19
+ @from
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class Subscription < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :object, :fields, :callback_url, :verify_token
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module Mosaic
2
+ module Facebook
3
+ module Graph
4
+ class User < Mosaic::Facebook::Graph::GraphObject
5
+ attr_accessor :id, :birthday, :email, :first_name, :gender, :hometown, :last_name, :link, :locale, :location, :name, :username
6
+ attr_name :picture
7
+
8
+ def accounts
9
+ @accounts ||= AssociationProxy.new(Mosaic::Facebook::Graph::Account, "/#{id}/accounts")
10
+ end
11
+
12
+ def picture
13
+ @picture.is_a?(Hash) ? @picture["data"]["url"] : @picture
14
+ end
15
+
16
+ class << self
17
+ def me(options = {})
18
+ find_by_id('me', options)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,103 @@
1
+ require 'httparty'
2
+
3
+ module Mosaic
4
+ module Facebook
5
+ class Object
6
+ include HTTParty
7
+ debug_output
8
+
9
+ def initialize(attributes = {})
10
+ attributes.each { |key,value| instance_variable_set("@#{key}".to_sym, value) }
11
+ end
12
+
13
+ def delete(path, options = {})
14
+ query = { :access_token => self.class.facebook_access_token }.merge(options)
15
+ body = Hash[instance_variables.collect { |ivar| [ivar.sub(/@/,''),instance_variable_get(ivar)] }]
16
+ self.class.delete path, :query => query, :body => serialize_body(body)
17
+ end
18
+
19
+ def post(path, options)
20
+ query = { :access_token => self.class.facebook_access_token }.merge(options)
21
+ body = Hash[instance_variables.collect { |ivar| [ivar.sub(/@/,''),instance_variable_get(ivar)] }]
22
+ self.class.post path, :query => query, :body => serialize_body(body)
23
+ end
24
+
25
+
26
+ class << self
27
+ def attr_name(*names)
28
+ self.attribute_names += names.collect(&:to_s)
29
+ end
30
+
31
+ def attr_accessor(*names)
32
+ attr_name(*names)
33
+ super
34
+ end
35
+
36
+ def attribute_names
37
+ @attribute_names ||= []
38
+ end
39
+
40
+ def attribute_names=(names)
41
+ @attribute_names = names
42
+ end
43
+
44
+ def configuration
45
+ @configuration ||= configuration_from_file
46
+ end
47
+
48
+ def configuration_from_file
49
+ YAML.load_file(@configuration_file) rescue nil
50
+ end
51
+
52
+ def facebook_access_token
53
+ @facebook_access_token ||= configuration && configuration['access_token']
54
+ end
55
+
56
+ def facebook_user
57
+ @facebook_user ||= configuration['user']
58
+ end
59
+
60
+ def get(path, options)
61
+ super(path, :query => options)
62
+ end
63
+
64
+ private
65
+ def logger
66
+ @logger ||= if defined?(Rails)
67
+ Rails.logger
68
+ else
69
+ require 'logger'
70
+ Logger.new(STDOUT)
71
+ end
72
+ end
73
+
74
+ def serialize_body(body)
75
+ body.to_json
76
+ end
77
+
78
+ def perform_request_with_retry(http_method, path, options)
79
+ with_retry do
80
+ perform_request_without_retry(http_method, path, options)
81
+ end
82
+ end
83
+ # alias_method_chain :perform_request, :retry
84
+ alias_method :perform_request_without_retry, :perform_request
85
+ alias_method :perform_request, :perform_request_with_retry
86
+
87
+ def with_retry(exception = Exception, attempts = 3)
88
+ tries = 0
89
+ begin
90
+ return yield
91
+ rescue exception => e
92
+ if tries < attempts
93
+ tries += 1
94
+ logger.debug "#{e.class.name}: #{e.message}: retry ##{tries}"
95
+ retry
96
+ end
97
+ raise e
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,19 @@
1
+ module Mosaic
2
+ module Facebook
3
+ class Time < ::Time
4
+ class << self
5
+ def at(time)
6
+ use_pacific_zone { Time.zone.at(time) }
7
+ end
8
+
9
+ def parse(text)
10
+ use_pacific_zone { Time.zone.parse(text) }
11
+ end
12
+
13
+ def use_pacific_zone
14
+ use_zone('Pacific Time (US & Canada)') { yield }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Mosaic
2
+ module Facebook
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ STDERR.puts "This version of the gem has been deprecated. Please upgrade to mosaic-facebook."
2
+ require 'mosaic/facebook'
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mosaic/facebook/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mosaic-facebook"
7
+ s.version = Mosaic::Facebook::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ajit Singh"]
10
+ s.email = ["ajit.singh@mosaic.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{gem/plugin to connect to facebook graph api}
13
+ s.description = %q{small app written and improved over time to solve our need to connect and fetch data from facebook}
14
+
15
+ s.files = Dir["{lib,spec}/**/*", "[A-Z]*", "init.rb"]
16
+ s.require_path = "lib"
17
+
18
+ s.rubyforge_project = "mosaic_facebook"
19
+ s.required_rubygems_version = ">= 1.3.4"
20
+
21
+ s.add_dependency "httparty", "~> 0.10.2"
22
+ s.add_dependency "activesupport", "~> 3.0"
23
+
24
+ s.add_development_dependency "rspec"
25
+
26
+ s.files = `git ls-files`.split("\n")
27
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
29
+ s.require_paths = ["lib"]
30
+ end
@@ -0,0 +1 @@
1
+ token: "Your token goes here"
@@ -0,0 +1,26 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
2
+
3
+
4
+ describe Mosaic::Facebook::Notification do
5
+ def options
6
+ options = {:recipients => "535004545", :subject => "testing", :text => "ajit", :access_token => "xxx"}
7
+ end
8
+
9
+ context "when no or invalid token is passed" do
10
+ it "should require an access_token" do
11
+ lambda { Mosaic::Facebook::Notification.send_email(options.merge(:access_token => nil)) }.should raise_error(Mosaic::Facebook::AccessTokenError, /INVALID API KEY/i)
12
+ end
13
+
14
+ it "should require a valid access_token" do
15
+ lambda {Mosaic::Facebook::Notification.send_email(options)}.should raise_error(Mosaic::Facebook::AccessTokenError, /INVALID OAUTH ACCESS TOKEN/i)
16
+ end
17
+
18
+ end
19
+
20
+
21
+ context "when a valid access_token is provided" do
22
+ it "should send a notification" do
23
+ Mosaic::Facebook::Notification.send_email(options.merge(:access_token => FBK_CREDS[:token]))
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe "mosaic-facebook" do
4
+ # before(:each) do
5
+ # @klass = Class.new
6
+ # @klass.instance_eval { include Mosaic }
7
+ # end
8
+ it "should have tests" do
9
+ pending "writing tests"
10
+ end
11
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format specdoc
3
+ --backtrace
@@ -0,0 +1,14 @@
1
+ # $:.push File.expand_path("../lib", __FILE__)
2
+ # require 'httparty'
3
+ # require 'lib/mosaic_facebook'
4
+
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ Bundler.require(:default)
8
+
9
+ SPEC_DIR = File.dirname(__FILE__)
10
+ # lib_path = File.expand_path("#{SPEC_DIR}/../lib")
11
+ # $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
12
+
13
+ require 'mosaic-facebook'
14
+ FBK_CREDS = YAML.load(File.open("#{SPEC_DIR}/facebook_credentials.yml", 'r'))
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mosaic-facebook
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ajit Singh
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.10.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.10.2
30
+ - !ruby/object:Gem::Dependency
31
+ name: activesupport
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: small app written and improved over time to solve our need to connect
63
+ and fetch data from facebook
64
+ email:
65
+ - ajit.singh@mosaic.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - Rakefile
73
+ - lib/mosaic-facebook.rb
74
+ - lib/mosaic/.DS_Store
75
+ - lib/mosaic/facebook.rb
76
+ - lib/mosaic/facebook/.DS_Store
77
+ - lib/mosaic/facebook/api.rb
78
+ - lib/mosaic/facebook/api/api_object.rb
79
+ - lib/mosaic/facebook/api/notification.rb
80
+ - lib/mosaic/facebook/error.rb
81
+ - lib/mosaic/facebook/fql.rb
82
+ - lib/mosaic/facebook/fql/comment.rb
83
+ - lib/mosaic/facebook/fql/fql_object.rb
84
+ - lib/mosaic/facebook/fql/post.rb
85
+ - lib/mosaic/facebook/graph.rb
86
+ - lib/mosaic/facebook/graph/account.rb
87
+ - lib/mosaic/facebook/graph/application.rb
88
+ - lib/mosaic/facebook/graph/association_proxy.rb
89
+ - lib/mosaic/facebook/graph/comment.rb
90
+ - lib/mosaic/facebook/graph/graph_object.rb
91
+ - lib/mosaic/facebook/graph/insights.rb
92
+ - lib/mosaic/facebook/graph/page.rb
93
+ - lib/mosaic/facebook/graph/post.rb
94
+ - lib/mosaic/facebook/graph/subscription.rb
95
+ - lib/mosaic/facebook/graph/user.rb
96
+ - lib/mosaic/facebook/object.rb
97
+ - lib/mosaic/facebook/time.rb
98
+ - lib/mosaic/facebook/version.rb
99
+ - lib/mosaic_facebook.rb
100
+ - mosaic-facebook.gemspec
101
+ - spec/facebook_credentials.yml.example
102
+ - spec/mosaic-facebook/notification_spec.rb
103
+ - spec/mosaic-facebook_spec.rb
104
+ - spec/spec.opts
105
+ - spec/spec_helper.rb
106
+ homepage: ''
107
+ licenses: []
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: 1.3.4
124
+ requirements: []
125
+ rubyforge_project: mosaic_facebook
126
+ rubygems_version: 1.8.23
127
+ signing_key:
128
+ specification_version: 3
129
+ summary: gem/plugin to connect to facebook graph api
130
+ test_files:
131
+ - spec/facebook_credentials.yml.example
132
+ - spec/mosaic-facebook/notification_spec.rb
133
+ - spec/mosaic-facebook_spec.rb
134
+ - spec/spec.opts
135
+ - spec/spec_helper.rb