fgraph 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/History +4 -0
  2. data/README.rdoc +12 -1
  3. data/VERSION.yml +1 -1
  4. data/lib/fgraph/client.rb +16 -0
  5. metadata +19 -4
data/History CHANGED
@@ -1,3 +1,7 @@
1
+ v0.4.0
2
+ * Add FGraph::Client#instance
3
+ * Handle expired session error in fgraph_logged_in? gracefully
4
+
1
5
  v0.3.1
2
6
  * Fix FGraph::Client#insights not passing app_access_token value properly
3
7
  * Move fgraph_picture_url from fgraph_tag_helper to fgraph_helper
data/README.rdoc CHANGED
@@ -120,7 +120,7 @@ OAuth Application Access Token, required to access application anlytics data:
120
120
  FGraph.publish('arjun/feed', :message => 'Hello, Arjun. I like this n ew API.',
121
121
  :access_token => '...')
122
122
  FGraph.publish_feed('arjun', :message => '...', :access_token => '... ')
123
- FGraph.publish_feed('me', ':message => '...', :access_token => '...')
123
+ FGraph.publish_feed('me', :message => '...', :access_token => '...')
124
124
 
125
125
  === Remove from Facebook Graph
126
126
 
@@ -199,6 +199,17 @@ For Asynchronous load, use <tt>window.afterFbAsyncInit</tt>:
199
199
  </script>
200
200
  <%= fgraph_javascript_init_tag :async => true %>
201
201
 
202
+ Facebook invalidates session token when you log out from <tt>facebook.com</tt>,
203
+ and <tt>fgraph_logged_in?</tt> does not check if the session is still valid
204
+ on Facebook server. The trick is you have to catch <tt>FGraph::OAuthError</tt>
205
+ in <tt>ApplicationController</tt>:
206
+
207
+ rescue_from FGraph::OAuthError do
208
+ flash[:notice] = "Your Facebook session has expired, please login again."
209
+ reset_session
210
+ redirect_to index_url
211
+ end
212
+
202
213
  == License
203
214
 
204
215
  (The MIT License)
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :build:
5
5
  :minor: 3
data/lib/fgraph/client.rb CHANGED
@@ -5,6 +5,22 @@ module FGraph
5
5
  class Client
6
6
  attr_reader :oauth_client, :client_id, :client_secret, :options
7
7
 
8
+ @@instance = nil
9
+
10
+ # Return static instance of FGraph::Client with default options set in FGraph.config.
11
+ #
12
+ def self.instance
13
+ return @@instance if @@instance
14
+ if FGraph.config
15
+ @@instance = FGraph::Client.new(
16
+ :client_id => FGraph.config['app_id'],
17
+ :client_secret => FGraph.config['app_secret']
18
+ )
19
+ else
20
+ @@instance = FGraph::Client.new
21
+ end
22
+ end
23
+
8
24
  # Initialize Client with default options, so options are not required to be passed
9
25
  # when calling respective Facebook Graph API methods.
10
26
  #
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fgraph
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 1
9
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Herryanto Siatono
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-29 00:00:00 +08:00
18
+ date: 2010-07-07 00:00:00 +08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: httparty
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 11
27
30
  segments:
28
31
  - 0
29
32
  - 5
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: shoulda
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ~>
40
44
  - !ruby/object:Gem::Version
45
+ hash: 39
41
46
  segments:
42
47
  - 2
43
48
  - 10
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: jnunemaker-matchy
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ~>
54
60
  - !ruby/object:Gem::Version
61
+ hash: 15
55
62
  segments:
56
63
  - 0
57
64
  - 4
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: mocha
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ~>
68
76
  - !ruby/object:Gem::Version
77
+ hash: 59
69
78
  segments:
70
79
  - 0
71
80
  - 9
@@ -77,9 +86,11 @@ dependencies:
77
86
  name: fakeweb
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ~>
82
92
  - !ruby/object:Gem::Version
93
+ hash: 31
83
94
  segments:
84
95
  - 1
85
96
  - 2
@@ -126,23 +137,27 @@ rdoc_options:
126
137
  require_paths:
127
138
  - lib
128
139
  required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
129
141
  requirements:
130
142
  - - ">="
131
143
  - !ruby/object:Gem::Version
144
+ hash: 3
132
145
  segments:
133
146
  - 0
134
147
  version: "0"
135
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
136
150
  requirements:
137
151
  - - ">="
138
152
  - !ruby/object:Gem::Version
153
+ hash: 3
139
154
  segments:
140
155
  - 0
141
156
  version: "0"
142
157
  requirements: []
143
158
 
144
159
  rubyforge_project:
145
- rubygems_version: 1.3.6
160
+ rubygems_version: 1.3.7
146
161
  signing_key:
147
162
  specification_version: 3
148
163
  summary: Ruby Facebook Graph API