mini_fb 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +30 -0
- data/Rakefile +23 -0
- data/lib/mini_fb.rb +4 -2
- data/lib/version.rb +3 -0
- data/mini_fb.gemspec +22 -0
- data/spec/mini_fb_spec.rb +67 -0
- metadata +31 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 47673e1ef51af1dfe27fdefc65c2923c2ee65300
|
4
|
+
data.tar.gz: 20c9ea4d481521de3a8cbc41796dcbb66ade9f29
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8846e74c083cd3ab2513d7efae29fcbe68f8a292f84efc9464d8bb8c8b88e9f879f096b8f83cba4f4e7a1c70d5bd24a6e393467768ba7452ad2b293704cfcdcf
|
7
|
+
data.tar.gz: 0c1b39eebfa8e53877725bf6798d48bf727270b585ccae3fd9cdaccc1a7af6ea20339ee860a12f793a5ff32618b5faff1bcb6cf7e0afea051ccbd381da8d34ae
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm ree-1.8.7@mini-fb
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mini_fb (2.1.0)
|
5
|
+
hashie
|
6
|
+
rest_client
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
hashie (2.0.5)
|
13
|
+
netrc (0.7.7)
|
14
|
+
rest_client (1.7.3)
|
15
|
+
netrc (~> 0.7.7)
|
16
|
+
rspec (2.14.1)
|
17
|
+
rspec-core (~> 2.14.0)
|
18
|
+
rspec-expectations (~> 2.14.0)
|
19
|
+
rspec-mocks (~> 2.14.0)
|
20
|
+
rspec-core (2.14.8)
|
21
|
+
rspec-expectations (2.14.5)
|
22
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
23
|
+
rspec-mocks (2.14.6)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
mini_fb!
|
30
|
+
rspec
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'jeweler2'
|
4
|
+
Jeweler::Tasks.new do |gemspec|
|
5
|
+
gemspec.name = "mini_fb"
|
6
|
+
gemspec.summary = "Tiny facebook library"
|
7
|
+
gemspec.description = "Tiny facebook library"
|
8
|
+
gemspec.email = "travis@appoxy.com"
|
9
|
+
gemspec.homepage = "http://github.com/appoxy/mini_fb"
|
10
|
+
gemspec.authors = ["Travis Reeder"]
|
11
|
+
gemspec.files = FileList['lib/**/*.rb']
|
12
|
+
gemspec.add_dependency 'rest-client'
|
13
|
+
gemspec.add_dependency 'hashie'
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler2"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rspec/core/rake_task'
|
21
|
+
RSpec::Core::RakeTask.new do |t|
|
22
|
+
t.rspec_opts = ["--color", '--format doc']
|
23
|
+
end
|
data/lib/mini_fb.rb
CHANGED
@@ -19,6 +19,7 @@ require 'hashie'
|
|
19
19
|
require 'base64'
|
20
20
|
require 'openssl'
|
21
21
|
require 'logger'
|
22
|
+
require_relative 'version'
|
22
23
|
|
23
24
|
module MiniFB
|
24
25
|
|
@@ -562,7 +563,7 @@ module MiniFB
|
|
562
563
|
options[:method] = :get
|
563
564
|
options[:response_type] = :params
|
564
565
|
resp = fetch(url, options)
|
565
|
-
puts 'resp=' + resp
|
566
|
+
puts 'resp=' + resp if @@logging
|
566
567
|
resp
|
567
568
|
end
|
568
569
|
|
@@ -684,6 +685,7 @@ module MiniFB
|
|
684
685
|
if res_hash.is_a? Array # fql return this
|
685
686
|
res_hash.collect! { |x| x.is_a?(Hash) ? Hashie::Mash.new(x) : x }
|
686
687
|
else
|
688
|
+
res_hash = { response: res_hash } unless res_hash.is_a? Hash
|
687
689
|
res_hash = Hashie::Mash.new(res_hash)
|
688
690
|
end
|
689
691
|
|
@@ -693,7 +695,7 @@ module MiniFB
|
|
693
695
|
|
694
696
|
return res_hash
|
695
697
|
rescue RestClient::Exception => ex
|
696
|
-
puts "ex.http_code=" + ex.http_code.to_s
|
698
|
+
puts "ex.http_code=" + ex.http_code.to_s if @@logging
|
697
699
|
puts 'ex.http_body=' + ex.http_body if @@logging
|
698
700
|
res_hash = JSON.parse(ex.http_body) # probably should ensure it has a good response
|
699
701
|
raise MiniFB::FaceBookError.new(ex.http_code, "#{res_hash["error"]["type"]}: #{res_hash["error"]["message"]}")
|
data/lib/version.rb
ADDED
data/mini_fb.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../lib/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Travis Reeder"]
|
5
|
+
gem.email = ["travis@appoxy.com"]
|
6
|
+
gem.description = "Tiny facebook library by Appoxy.com"
|
7
|
+
gem.summary = "Tiny facebook library by Appoxy.com"
|
8
|
+
gem.homepage = "http://github.com/appoxy/mini_fb/"
|
9
|
+
|
10
|
+
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
gem.name = "mini_fb"
|
14
|
+
gem.require_paths = ["lib"]
|
15
|
+
gem.version = MiniFB::VERSION
|
16
|
+
|
17
|
+
gem.required_rubygems_version = ">= 1.3.6"
|
18
|
+
gem.required_ruby_version = Gem::Requirement.new(">= 1.9")
|
19
|
+
gem.add_runtime_dependency "rest_client", ">= 0"
|
20
|
+
gem.add_runtime_dependency "hashie", ">= 0"
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'uri'
|
3
|
+
require 'yaml'
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
require_relative '../lib/mini_fb'
|
6
|
+
|
7
|
+
describe MiniFB do
|
8
|
+
|
9
|
+
before :all do
|
10
|
+
@is_setup = true
|
11
|
+
file_path = File.expand_path("../mini_fb_tests.yml", File.dirname(__FILE__))
|
12
|
+
@config = File.open(file_path) { |yf| YAML::load(yf) }
|
13
|
+
MiniFB.log_level = :warn
|
14
|
+
|
15
|
+
@oauth_url = MiniFB.oauth_url(@config['fb_app_id'],
|
16
|
+
"http://localhost:3000", # redirect url
|
17
|
+
:scope=>MiniFB.scopes.join(","))
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
before :each do
|
23
|
+
# this code runs once per-test
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'test_uri_escape' do
|
27
|
+
URI.escape("x=y").should eq("x=y")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'test_authenticate_as_app' do
|
31
|
+
res = MiniFB.authenticate_as_app(@config["fb_api_key"], @config["fb_secret"])
|
32
|
+
res.should include("access_token")
|
33
|
+
res["access_token"].should match(/^#{@config['fb_app_id']}/)#starts_with?(@config["fb_app_id"].to_s)
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
it 'test_signed_request_params' do
|
38
|
+
# Example request and secret taken from http://developers.facebook.com/docs/authentication/canvas
|
39
|
+
secret = 'secret'
|
40
|
+
req = 'vlXgu64BQGFSQrY0ZcJBZASMvYvTHu9GQ0YM9rjPSso.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsIjAiOiJwYXlsb2FkIn0'
|
41
|
+
expect(MiniFB.signed_request_params(secret, req)).to eq({"0" => "payload"})
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def access_token
|
48
|
+
@config['access_token']
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def test_me_with_fields
|
53
|
+
fields = {
|
54
|
+
'interests' => [:name],
|
55
|
+
'activities'=> [:name],
|
56
|
+
'music' => [:name],
|
57
|
+
'videos' => [:name],
|
58
|
+
'television'=> [:name],
|
59
|
+
'movies' => [:name],
|
60
|
+
'likes' => [:name],
|
61
|
+
'work' => [:name],
|
62
|
+
'education' => [:name],
|
63
|
+
'books' => [:name]
|
64
|
+
}
|
65
|
+
|
66
|
+
snap = MiniFB.get(access_token, 'me', :fields =>fields.keys)
|
67
|
+
end
|
metadata
CHANGED
@@ -1,113 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_fb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Travis Reeder
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: rest_client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: hashie
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :runtime
|
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
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: hashie
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
description: Tiny facebook library
|
79
|
-
email: travis@appoxy.com
|
41
|
+
description: Tiny facebook library by Appoxy.com
|
42
|
+
email:
|
43
|
+
- travis@appoxy.com
|
80
44
|
executables: []
|
81
45
|
extensions: []
|
82
|
-
extra_rdoc_files:
|
83
|
-
- LICENSE.txt
|
84
|
-
- README.markdown
|
46
|
+
extra_rdoc_files: []
|
85
47
|
files:
|
86
|
-
-
|
48
|
+
- .gitignore
|
49
|
+
- .rvmrc
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
87
52
|
- LICENSE.txt
|
88
53
|
- README.markdown
|
89
|
-
|
54
|
+
- Rakefile
|
55
|
+
- lib/mini_fb.rb
|
56
|
+
- lib/version.rb
|
57
|
+
- mini_fb.gemspec
|
58
|
+
- spec/mini_fb_spec.rb
|
59
|
+
homepage: http://github.com/appoxy/mini_fb/
|
90
60
|
licenses: []
|
61
|
+
metadata: {}
|
91
62
|
post_install_message:
|
92
63
|
rdoc_options: []
|
93
64
|
require_paths:
|
94
65
|
- lib
|
95
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
67
|
requirements:
|
98
|
-
- -
|
68
|
+
- - '>='
|
99
69
|
- !ruby/object:Gem::Version
|
100
|
-
version: '
|
70
|
+
version: '1.9'
|
101
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
72
|
requirements:
|
104
|
-
- -
|
73
|
+
- - '>='
|
105
74
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
75
|
+
version: 1.3.6
|
107
76
|
requirements: []
|
108
77
|
rubyforge_project:
|
109
|
-
rubygems_version:
|
78
|
+
rubygems_version: 2.2.2
|
110
79
|
signing_key:
|
111
|
-
specification_version:
|
112
|
-
summary: Tiny facebook library
|
113
|
-
test_files:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Tiny facebook library by Appoxy.com
|
82
|
+
test_files:
|
83
|
+
- spec/mini_fb_spec.rb
|