ruby_fgraph 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ nbproject
@@ -0,0 +1,62 @@
1
+ = ruby_fgraph
2
+
3
+ FGraph lite library based on oauth2 gem for authorization and api calls
4
+
5
+ == Installation
6
+
7
+ gem install ruby_fgraph
8
+
9
+ == Example
10
+
11
+ Examaple using rails 3 on http://github.com/randx/Facebook-Graph-Gem-Example
12
+
13
+ == Rails 3 Example
14
+
15
+ class FacebookAccountController < ApplicationController
16
+ # requrie ruby_graph
17
+ require 'ruby_fgraph'
18
+ before_filter :init_fb
19
+
20
+ # create connection object
21
+ def init_fb
22
+ # register facebook app and set params here
23
+ params = {
24
+ :app_id => '149291415089452',
25
+ :app_secret => '4e13073ded8bfb0cc3279e86811121b0',
26
+ :callback_url => "http://127.0.0.1:3000/facebook_account/token/",
27
+ }
28
+ # create fgraph connection
29
+ @f_connection = FGraph::Connection.new params
30
+ end
31
+
32
+ # redirect to auth page
33
+ # to get access for api calls
34
+ def index
35
+ redirect_to @f_connection.rails_authorize_redirect
36
+ end
37
+
38
+ # redirected here after auth
39
+ # get authorization token using recieved code
40
+ def token
41
+ # get token by code
42
+ @f_connection.accept_token params[:code]
43
+ # save token to session
44
+ session[:f_token] = @f_connection.get_access_token
45
+ # now we are ready to test
46
+ render :text => "Ok. now try /facebook_account/query_test"
47
+ end
48
+
49
+ # test query after token saved
50
+ def query_test
51
+ # set token for auth calls
52
+ @f_connection.token = session[:f_token]
53
+ # check if token valid
54
+ return redirect_to :action => "not_auth" unless @f_connection.is_authorized?
55
+ # now its your connection. lets get info
56
+ render :text => @f_connection.query('/me').to_yaml
57
+ end
58
+
59
+ def not_auth
60
+ render :text => "not authorized"
61
+ end
62
+ end
data/Rakefile CHANGED
@@ -1,45 +1,50 @@
1
- #
2
- # To change this template, choose Tools | Templates
3
- # and open the template in the editor.
4
-
5
-
6
1
  require 'rubygems'
7
2
  require 'rake'
8
- require 'rake/clean'
9
- require 'rake/gempackagetask'
10
- require 'rake/rdoctask'
11
- require 'rake/testtask'
12
3
 
13
- spec = Gem::Specification.new do |s|
14
- s.name = 'ruby_fgraph'
15
- s.version = '0.0.11'
16
- s.has_rdoc = true
17
- s.extra_rdoc_files = ['README', 'LICENSE']
18
- s.summary = 'Your summary here'
19
- s.description = s.summary
20
- s.author = 'randx'
21
- s.email = 'railsonweb@gmail.com'
22
- # s.executables = ['your_executable_here']
23
- s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
24
- s.require_path = "lib"
25
- # s.bindir = "bin"
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ruby_fgraph"
8
+ gem.summary = %Q{Lite gem for iteracting with facebook graph api.}
9
+ gem.description = %Q{Lite gem for iteracting with facebook graph api.}
10
+ gem.email = "railsonweb@gmail.com"
11
+ gem.homepage = "http://github.com/randx/Facebook-Graph-Gem"
12
+ gem.authors = ["Dmitriy Zaporozhets"]
13
+ gem.add_dependency 'oauth2', '~> 0.0.11'
14
+ gem.add_development_dependency "rspec", ">= 1.2.9"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+
19
+ task :spec => :check_dependencies
20
+ rescue LoadError
21
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
26
22
  end
27
23
 
28
- Rake::GemPackageTask.new(spec) do |p|
29
- p.gem_spec = spec
30
- p.need_tar = true
31
- p.need_zip = true
24
+ begin
25
+ require 'spec/rake/spectask'
26
+ Spec::Rake::SpecTask.new(:spec) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.spec_files = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
+ spec.libs << 'lib' << 'spec'
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ task :default => :spec
38
+ rescue LoadError
39
+ puts "RSpec (or a dependency) not available. Install it with: gem install rspec"
32
40
  end
33
41
 
42
+ require 'rake/rdoctask'
34
43
  Rake::RDocTask.new do |rdoc|
35
- files =['README', 'LICENSE', 'lib/**/*.rb']
36
- rdoc.rdoc_files.add(files)
37
- rdoc.main = "README" # page to start on
38
- rdoc.title = "FGraph Docs"
39
- rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
40
- rdoc.options << '--line-numbers'
41
- end
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
42
45
 
43
- Rake::TestTask.new do |t|
44
- t.test_files = FileList['test/**/*.rb']
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "ruby_fgraph #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
50
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.12
Binary file
Binary file
metadata CHANGED
@@ -5,43 +5,78 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 11
9
- version: 0.0.11
8
+ - 12
9
+ version: 0.0.12
10
10
  platform: ruby
11
11
  authors:
12
- - randx
12
+ - Dmitriy Zaporozhets
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
17
  date: 2010-09-29 00:00:00 +03:00
18
18
  default_executable:
19
- dependencies: []
20
-
21
- description: Your summary here
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: oauth2
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 0
30
+ - 11
31
+ version: 0.0.11
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 2
44
+ - 9
45
+ version: 1.2.9
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: Lite gem for iteracting with facebook graph api.
22
49
  email: railsonweb@gmail.com
23
50
  executables: []
24
51
 
25
52
  extensions: []
26
53
 
27
54
  extra_rdoc_files:
28
- - README
29
55
  - LICENSE
56
+ - README.rdoc
30
57
  files:
58
+ - .gitignore
31
59
  - LICENSE
32
- - README
60
+ - README.rdoc
33
61
  - Rakefile
62
+ - VERSION
34
63
  - lib/ruby_fgraph.rb
35
64
  - lib/ruby_fgraph/connection.rb
36
- - spec/spec_helper.rb
65
+ - nbproject/private/rake-d.txt
66
+ - nbproject/project.properties
67
+ - nbproject/project.xml
68
+ - pkg/fgraph-0.0.1.gem
69
+ - pkg/ruby_fgraph-0.0.1.gem
70
+ - pkg/ruby_fgraph-0.0.11.gem
37
71
  - spec/ruby_fgraph/connection_spec.rb
72
+ - spec/spec_helper.rb
38
73
  has_rdoc: true
39
- homepage:
74
+ homepage: http://github.com/randx/Facebook-Graph-Gem
40
75
  licenses: []
41
76
 
42
77
  post_install_message:
43
- rdoc_options: []
44
-
78
+ rdoc_options:
79
+ - --charset=UTF-8
45
80
  require_paths:
46
81
  - lib
47
82
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -64,6 +99,7 @@ rubyforge_project:
64
99
  rubygems_version: 1.3.6
65
100
  signing_key:
66
101
  specification_version: 3
67
- summary: Your summary here
68
- test_files: []
69
-
102
+ summary: Lite gem for iteracting with facebook graph api.
103
+ test_files:
104
+ - spec/spec_helper.rb
105
+ - spec/ruby_fgraph/connection_spec.rb
data/README DELETED
@@ -1,4 +0,0 @@
1
- Examaple using rails 3 on http://github.com/randx/Facebook-Graph-Gem-Example
2
-
3
- Installing as gem
4
- - sudo gem install ruby_fgraph