facebook_sdk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +5 -0
- data/Rakefile +10 -0
- data/facebook_sdk.gemspec +31 -0
- data/lib/facebook_sdk/api.rb +13 -0
- data/lib/facebook_sdk/configuration.rb +5 -0
- data/lib/facebook_sdk/middleware/json_decoder.rb +14 -0
- data/lib/facebook_sdk/version.rb +3 -0
- data/lib/facebook_sdk.rb +40 -0
- data/test/helper.rb +10 -0
- data/test/test_basic.rb +20 -0
- metadata +111 -0
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "facebook_sdk/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "facebook_sdk"
|
7
|
+
s.version = FacebookSDK::VERSION
|
8
|
+
s.authors = ["Erick Zetta"]
|
9
|
+
s.email = ["erick.zetta@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Facebook SDK for Graph API}
|
12
|
+
s.description = %q{Facebook SDK for Graph API}
|
13
|
+
|
14
|
+
s.rubyforge_project = "facebook_sdk"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
|
25
|
+
s.add_development_dependency "test-unit"
|
26
|
+
s.add_development_dependency "turn"
|
27
|
+
|
28
|
+
s.add_runtime_dependency "json"
|
29
|
+
s.add_runtime_dependency "hashie"
|
30
|
+
s.add_runtime_dependency "faraday"
|
31
|
+
end
|
data/lib/facebook_sdk.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "facebook_sdk/version"
|
2
|
+
require "forwardable"
|
3
|
+
require "faraday"
|
4
|
+
|
5
|
+
require "facebook_sdk/configuration"
|
6
|
+
require "facebook_sdk/api"
|
7
|
+
|
8
|
+
require "facebook_sdk/middleware/json_decoder"
|
9
|
+
|
10
|
+
module FacebookSDK
|
11
|
+
class Session
|
12
|
+
extend Forwardable
|
13
|
+
|
14
|
+
include Api
|
15
|
+
|
16
|
+
GRAPH_URL = "https://graph.facebook.com/"
|
17
|
+
|
18
|
+
def_delegators :@config, :app_id, :secret
|
19
|
+
def_delegators :@conn, :get, :post
|
20
|
+
|
21
|
+
def initialize(&block)
|
22
|
+
|
23
|
+
@conn = Faraday.new(:url => GRAPH_URL) do |builder|
|
24
|
+
#builder.use Faraday::Response::Logger # log the request to STDOUT
|
25
|
+
|
26
|
+
builder.use Faraday::Adapter::NetHttp # make http requests with Net::HTTP
|
27
|
+
builder.use FacebookSDK::Middleware::JSONDecoder # use own JSONDecoder
|
28
|
+
|
29
|
+
|
30
|
+
@config = Configuration.new
|
31
|
+
|
32
|
+
@config.faraday = builder
|
33
|
+
yield @config
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
data/test/helper.rb
ADDED
data/test/test_basic.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
class TestBasic < FacebookSDK::TestCase
|
4
|
+
# def setup
|
5
|
+
# end
|
6
|
+
|
7
|
+
# def teardown
|
8
|
+
# end
|
9
|
+
|
10
|
+
def test_get_facebook_platform
|
11
|
+
fb = FacebookSDK::Session.new do |config|
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
p = fb.api '/19292868552'
|
16
|
+
|
17
|
+
assert_equal "Facebook Platform", p.name
|
18
|
+
assert_equal "http://developers.facebook.com", p.website
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facebook_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Erick Zetta
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: test-unit
|
16
|
+
requirement: &73638110 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *73638110
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: turn
|
27
|
+
requirement: &73637760 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *73637760
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: json
|
38
|
+
requirement: &73637430 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *73637430
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: hashie
|
49
|
+
requirement: &73637060 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *73637060
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: faraday
|
60
|
+
requirement: &73636640 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *73636640
|
69
|
+
description: Facebook SDK for Graph API
|
70
|
+
email:
|
71
|
+
- erick.zetta@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- Rakefile
|
79
|
+
- facebook_sdk.gemspec
|
80
|
+
- lib/facebook_sdk.rb
|
81
|
+
- lib/facebook_sdk/api.rb
|
82
|
+
- lib/facebook_sdk/configuration.rb
|
83
|
+
- lib/facebook_sdk/middleware/json_decoder.rb
|
84
|
+
- lib/facebook_sdk/version.rb
|
85
|
+
- test/helper.rb
|
86
|
+
- test/test_basic.rb
|
87
|
+
homepage: ''
|
88
|
+
licenses: []
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project: facebook_sdk
|
107
|
+
rubygems_version: 1.8.10
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Facebook SDK for Graph API
|
111
|
+
test_files: []
|