open_graph 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/build.md +2 -0
- data/lib/open_graph/fb_open_graph.rb +6 -5
- data/lib/open_graph/version.rb +1 -1
- data/open_graph.gemspec +2 -0
- metadata +20 -7
data/build.md
ADDED
@@ -1,6 +1,8 @@
|
|
1
1
|
module OpenGraph
|
2
2
|
class FBOpenGraph < Struct.new(:all_cookies)
|
3
3
|
|
4
|
+
@@request_options = {:timeout => 5}
|
5
|
+
|
4
6
|
def facebook_cookie
|
5
7
|
@facebook_cookie ||= begin
|
6
8
|
cookie = all_cookies["fbs_#{OpenGraph.config[:appid]}"]
|
@@ -117,14 +119,14 @@ module OpenGraph
|
|
117
119
|
:query => query,
|
118
120
|
:format => 'json'
|
119
121
|
}
|
120
|
-
HTTParty.get("https://api.facebook.com/method/fql.query#{query_string(options)}").parsed_response
|
122
|
+
HTTParty.get("https://api.facebook.com/method/fql.query#{query_string(options)}", @@request_options).parsed_response
|
121
123
|
end
|
122
124
|
|
123
125
|
def graph_post(options={})
|
124
126
|
return false unless valid?
|
125
127
|
options.symbolize_keys!.reverse_merge!(default_options)
|
126
128
|
url = build_url(options.dup)
|
127
|
-
HTTParty.post(url).parsed_response
|
129
|
+
HTTParty.post(url, @@request_options).parsed_response
|
128
130
|
end
|
129
131
|
|
130
132
|
def fb_cache(key, value=nil)
|
@@ -146,7 +148,7 @@ module OpenGraph
|
|
146
148
|
return fb_cache(url) if fb_cache(url)
|
147
149
|
|
148
150
|
OpenGraph.logger.info("[OpenGraph] fetching: #{url}")
|
149
|
-
response = HTTParty.get(url).response
|
151
|
+
response = HTTParty.get(url, @@request_options).response
|
150
152
|
response_hash = parse_response(response)
|
151
153
|
if response.is_a?(Net::HTTPOK)
|
152
154
|
response_hash['location'] = fetch_codified_location(options.slice(:uid, :access_token)) if requested_call == :info
|
@@ -187,6 +189,5 @@ module OpenGraph
|
|
187
189
|
end
|
188
190
|
|
189
191
|
end
|
190
|
-
|
191
|
-
|
192
|
+
|
192
193
|
end
|
data/lib/open_graph/version.rb
CHANGED
data/open_graph.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.rubyforge_project = "open_graph"
|
16
16
|
|
17
|
+
s.add_dependency 'rake'
|
18
|
+
|
17
19
|
s.files = `git ls-files`.split("\n")
|
18
20
|
s.files << 'facebook-stub/facebook-stub.js'
|
19
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Change.org Engineering
|
@@ -15,10 +15,23 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-09 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
requirement: *id001
|
32
|
+
name: rake
|
33
|
+
prerelease: false
|
34
|
+
type: :runtime
|
22
35
|
description: OpenGraph provides an easy to use wrapper for making facebook calls. It also provides javascript stubs allowing seemless testing against the javascript sdk.
|
23
36
|
email:
|
24
37
|
- engineering@change.org
|
@@ -34,6 +47,7 @@ files:
|
|
34
47
|
- Gemfile
|
35
48
|
- Rakefile
|
36
49
|
- Readme.md
|
50
|
+
- build.md
|
37
51
|
- lib/open_graph.rb
|
38
52
|
- lib/open_graph/fb_open_graph.rb
|
39
53
|
- lib/open_graph/rails/action_controller_accessor.rb
|
@@ -41,7 +55,6 @@ files:
|
|
41
55
|
- lib/open_graph/test/facebook_stub.rb
|
42
56
|
- lib/open_graph/test/facebook_stub/picture.png
|
43
57
|
- lib/open_graph/version.rb
|
44
|
-
- open_graph-0.1.1.gem
|
45
58
|
- open_graph.gemspec
|
46
59
|
- spec/open_graph_spec.rb
|
47
60
|
- spec/spec_helper.rb
|