fb_graph 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fb_graph.gemspec +7 -4
- data/lib/fb_graph/application.rb +29 -0
- data/lib/fb_graph/connections/insights.rb +13 -0
- data/lib/fb_graph/insight.rb +13 -0
- data/lib/fb_graph.rb +3 -1
- metadata +26 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/fb_graph.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fb_graph}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.7.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["nov matake"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-13}
|
13
13
|
s.description = %q{A Ruby wrapper for Facebook Graph API}
|
14
14
|
s.email = %q{nov@matake.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"fb_graph.gemspec",
|
29
29
|
"lib/fb_graph.rb",
|
30
30
|
"lib/fb_graph/album.rb",
|
31
|
+
"lib/fb_graph/application.rb",
|
31
32
|
"lib/fb_graph/auth.rb",
|
32
33
|
"lib/fb_graph/auth/cookie.rb",
|
33
34
|
"lib/fb_graph/collection.rb",
|
@@ -46,6 +47,7 @@ Gem::Specification.new do |s|
|
|
46
47
|
"lib/fb_graph/connections/friends.rb",
|
47
48
|
"lib/fb_graph/connections/groups.rb",
|
48
49
|
"lib/fb_graph/connections/home.rb",
|
50
|
+
"lib/fb_graph/connections/insights.rb",
|
49
51
|
"lib/fb_graph/connections/interests.rb",
|
50
52
|
"lib/fb_graph/connections/invited.rb",
|
51
53
|
"lib/fb_graph/connections/likes.rb",
|
@@ -66,6 +68,7 @@ Gem::Specification.new do |s|
|
|
66
68
|
"lib/fb_graph/education.rb",
|
67
69
|
"lib/fb_graph/event.rb",
|
68
70
|
"lib/fb_graph/group.rb",
|
71
|
+
"lib/fb_graph/insight.rb",
|
69
72
|
"lib/fb_graph/link.rb",
|
70
73
|
"lib/fb_graph/node.rb",
|
71
74
|
"lib/fb_graph/note.rb",
|
@@ -204,7 +207,7 @@ Gem::Specification.new do |s|
|
|
204
207
|
s.homepage = %q{http://github.com/nov/fb_graph}
|
205
208
|
s.rdoc_options = ["--charset=UTF-8"]
|
206
209
|
s.require_paths = ["lib"]
|
207
|
-
s.rubygems_version = %q{1.3.
|
210
|
+
s.rubygems_version = %q{1.3.7}
|
208
211
|
s.summary = %q{A Ruby wrapper for Facebook Graph API}
|
209
212
|
s.test_files = [
|
210
213
|
"spec/fb_graph/album_spec.rb",
|
@@ -262,7 +265,7 @@ Gem::Specification.new do |s|
|
|
262
265
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
263
266
|
s.specification_version = 3
|
264
267
|
|
265
|
-
if Gem::Version.new(Gem::
|
268
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
266
269
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
267
270
|
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
268
271
|
s.add_runtime_dependency(%q<rest-client>, [">= 1.4"])
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Application < Node
|
3
|
+
include Connections::Insights
|
4
|
+
|
5
|
+
attr_accessor :name, :description, :category, :subcategory, :link, :secret
|
6
|
+
|
7
|
+
def initialize(client_id, options = {})
|
8
|
+
super
|
9
|
+
@name = options[:name]
|
10
|
+
@description = options[:description]
|
11
|
+
@category = options[:category]
|
12
|
+
@subcategory = options[:subcategory]
|
13
|
+
@link = options[:link]
|
14
|
+
@secret = options[:secret]
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_access_token(secret = nil)
|
18
|
+
self.secret ||= secret
|
19
|
+
auth = FbGraph::Auth.new(self.identifier, self.secret)
|
20
|
+
response_string = auth.client.request(:post, auth.client.access_token_url, {
|
21
|
+
:client_id => self.identifier,
|
22
|
+
:client_secret => self.secret,
|
23
|
+
:type => 'client_cred'
|
24
|
+
})
|
25
|
+
self.access_token = response_string.split('=').last
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FbGraph
|
2
|
+
module Connections
|
3
|
+
module Insights
|
4
|
+
def insights(options = {})
|
5
|
+
options[:access_token] ||= self.access_token || get_access_token(options[:secret])
|
6
|
+
insights = self.connection(:insights, options)
|
7
|
+
insights.map! do |insight|
|
8
|
+
FbGraph::Insight.new(insight.merge(:access_token => options[:access_token]))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Insight
|
3
|
+
include FbGraph::Comparison
|
4
|
+
|
5
|
+
attr_accessor :name, :period, :values
|
6
|
+
|
7
|
+
def initialize(attributes = {})
|
8
|
+
@name = attributes[:name]
|
9
|
+
@period = attributes[:period]
|
10
|
+
@values = attributes[:values].collect(&:with_indifferent_access)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/fb_graph.rb
CHANGED
@@ -54,10 +54,12 @@ require 'fb_graph/searchable'
|
|
54
54
|
|
55
55
|
require 'fb_graph/node'
|
56
56
|
require 'fb_graph/album'
|
57
|
+
require 'fb_graph/application'
|
57
58
|
require 'fb_graph/comment'
|
58
59
|
require 'fb_graph/education'
|
59
60
|
require 'fb_graph/event'
|
60
61
|
require 'fb_graph/group'
|
62
|
+
require 'fb_graph/insight'
|
61
63
|
require 'fb_graph/link'
|
62
64
|
require 'fb_graph/note'
|
63
65
|
require 'fb_graph/page'
|
@@ -68,4 +70,4 @@ require 'fb_graph/tag'
|
|
68
70
|
require 'fb_graph/user'
|
69
71
|
require 'fb_graph/venue'
|
70
72
|
require 'fb_graph/video'
|
71
|
-
require 'fb_graph/work'
|
73
|
+
require 'fb_graph/work'
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 7
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.7.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- nov matake
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-13 00:00:00 +09:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: json
|
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: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: activesupport
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -45,9 +50,11 @@ dependencies:
|
|
45
50
|
name: rest-client
|
46
51
|
prerelease: false
|
47
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
48
54
|
requirements:
|
49
55
|
- - ">="
|
50
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 7
|
51
58
|
segments:
|
52
59
|
- 1
|
53
60
|
- 4
|
@@ -58,9 +65,11 @@ dependencies:
|
|
58
65
|
name: oauth2
|
59
66
|
prerelease: false
|
60
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
61
69
|
requirements:
|
62
70
|
- - ">="
|
63
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 11
|
64
73
|
segments:
|
65
74
|
- 0
|
66
75
|
- 0
|
@@ -72,9 +81,11 @@ dependencies:
|
|
72
81
|
name: rspec
|
73
82
|
prerelease: false
|
74
83
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
75
85
|
requirements:
|
76
86
|
- - ">="
|
77
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
78
89
|
segments:
|
79
90
|
- 0
|
80
91
|
version: "0"
|
@@ -84,9 +95,11 @@ dependencies:
|
|
84
95
|
name: rcov
|
85
96
|
prerelease: false
|
86
97
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
87
99
|
requirements:
|
88
100
|
- - ">="
|
89
101
|
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
90
103
|
segments:
|
91
104
|
- 0
|
92
105
|
version: "0"
|
@@ -96,9 +109,11 @@ dependencies:
|
|
96
109
|
name: fakeweb
|
97
110
|
prerelease: false
|
98
111
|
requirement: &id007 !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
99
113
|
requirements:
|
100
114
|
- - ">="
|
101
115
|
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
102
117
|
segments:
|
103
118
|
- 0
|
104
119
|
version: "0"
|
@@ -125,6 +140,7 @@ files:
|
|
125
140
|
- fb_graph.gemspec
|
126
141
|
- lib/fb_graph.rb
|
127
142
|
- lib/fb_graph/album.rb
|
143
|
+
- lib/fb_graph/application.rb
|
128
144
|
- lib/fb_graph/auth.rb
|
129
145
|
- lib/fb_graph/auth/cookie.rb
|
130
146
|
- lib/fb_graph/collection.rb
|
@@ -143,6 +159,7 @@ files:
|
|
143
159
|
- lib/fb_graph/connections/friends.rb
|
144
160
|
- lib/fb_graph/connections/groups.rb
|
145
161
|
- lib/fb_graph/connections/home.rb
|
162
|
+
- lib/fb_graph/connections/insights.rb
|
146
163
|
- lib/fb_graph/connections/interests.rb
|
147
164
|
- lib/fb_graph/connections/invited.rb
|
148
165
|
- lib/fb_graph/connections/likes.rb
|
@@ -163,6 +180,7 @@ files:
|
|
163
180
|
- lib/fb_graph/education.rb
|
164
181
|
- lib/fb_graph/event.rb
|
165
182
|
- lib/fb_graph/group.rb
|
183
|
+
- lib/fb_graph/insight.rb
|
166
184
|
- lib/fb_graph/link.rb
|
167
185
|
- lib/fb_graph/node.rb
|
168
186
|
- lib/fb_graph/note.rb
|
@@ -307,23 +325,27 @@ rdoc_options:
|
|
307
325
|
require_paths:
|
308
326
|
- lib
|
309
327
|
required_ruby_version: !ruby/object:Gem::Requirement
|
328
|
+
none: false
|
310
329
|
requirements:
|
311
330
|
- - ">="
|
312
331
|
- !ruby/object:Gem::Version
|
332
|
+
hash: 3
|
313
333
|
segments:
|
314
334
|
- 0
|
315
335
|
version: "0"
|
316
336
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
337
|
+
none: false
|
317
338
|
requirements:
|
318
339
|
- - ">="
|
319
340
|
- !ruby/object:Gem::Version
|
341
|
+
hash: 3
|
320
342
|
segments:
|
321
343
|
- 0
|
322
344
|
version: "0"
|
323
345
|
requirements: []
|
324
346
|
|
325
347
|
rubyforge_project:
|
326
|
-
rubygems_version: 1.3.
|
348
|
+
rubygems_version: 1.3.7
|
327
349
|
signing_key:
|
328
350
|
specification_version: 3
|
329
351
|
summary: A Ruby wrapper for Facebook Graph API
|