fb_graph2 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/fb_graph2/achievement.rb +1 -1
- data/lib/fb_graph2/achievement_type.rb +11 -0
- data/lib/fb_graph2/{application.rb → app.rb} +1 -1
- data/lib/fb_graph2/app_link_host.rb +35 -0
- data/lib/fb_graph2/attribute_assigner.rb +13 -6
- data/lib/fb_graph2/domain.rb +7 -0
- data/lib/fb_graph2/edge/comments.rb +1 -1
- data/lib/fb_graph2/edge/likes.rb +1 -1
- data/lib/fb_graph2/message.rb +9 -0
- data/lib/fb_graph2/node.rb +4 -0
- data/lib/fb_graph2/notification.rb +1 -1
- data/lib/fb_graph2/order.rb +9 -0
- data/lib/fb_graph2/payment.rb +16 -0
- data/lib/fb_graph2/place_tag.rb +8 -0
- data/lib/fb_graph2/post.rb +1 -1
- data/lib/fb_graph2/request.rb +10 -0
- data/lib/fb_graph2/review.rb +10 -0
- data/lib/fb_graph2/struct/app_link.rb +39 -0
- data/lib/fb_graph2/struct/score.rb +1 -1
- data/lib/fb_graph2/thread.rb +10 -0
- data/spec/fb_graph2/application_spec.rb +2 -2
- data/spec/mock_json/{application → app}/app.json +0 -0
- metadata +16 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5596c03f7eb3eaaf04d9e4ded6d72c5468807781
|
4
|
+
data.tar.gz: 8ff0e6c72704f8181507d184a270507e8b0bf990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4fdcdbbb437eeb097f3e4605c9eaee73d6146af7cecdad1ccd3a65183883ea501f744314af0c6ceae04aed86a5c1fc7233625e2edd813c9b6f706d0882271f7
|
7
|
+
data.tar.gz: a1c0c0ff0e723dbdd115d4717f8795a27456cbd9737c3bee3e02cf19d622fa130b89751b59bf01ac904fe61147b578840df336e30d22b6f1b89ab97f1f212585
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class AppLinkHost < Node
|
3
|
+
register_attributes(
|
4
|
+
raw: [:name, :canonical_url],
|
5
|
+
custom: [:ios, :iphone, :ipad, :android, :windows_phone, :web]
|
6
|
+
)
|
7
|
+
|
8
|
+
def initialize(id, attributes = {})
|
9
|
+
super
|
10
|
+
[:ios, :iphone, :ipad, :android, :windows_phone].each do |link_attr|
|
11
|
+
if attributes.include? link_attr
|
12
|
+
self.send :"#{link_attr}=", collect_links(attributes, link_attr)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def collect_links(attributes, link_attr)
|
20
|
+
Collection.new(attributes[link_attr]).collect do |link|
|
21
|
+
klass = case link_attr
|
22
|
+
when :ios, :iphone, :ipad
|
23
|
+
Struct::AppLink::Native::IOS
|
24
|
+
when :android
|
25
|
+
Struct::AppLink::Native::Android
|
26
|
+
when :windows_phone
|
27
|
+
Struct::AppLink::Native::WindowsPhone
|
28
|
+
else
|
29
|
+
raise 'Unknown AppLink Type'
|
30
|
+
end
|
31
|
+
klass.new link
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -36,8 +36,8 @@ module FbGraph2
|
|
36
36
|
end
|
37
37
|
when :album
|
38
38
|
Album.new raw[:id], raw
|
39
|
-
when :
|
40
|
-
|
39
|
+
when :app
|
40
|
+
App.new raw[:id], raw
|
41
41
|
when :comment
|
42
42
|
Comment.new raw[:id], raw
|
43
43
|
when :group
|
@@ -46,6 +46,10 @@ module FbGraph2
|
|
46
46
|
Collection.new(raw).collect do |_raw_|
|
47
47
|
Struct::ImageSource.new _raw_
|
48
48
|
end
|
49
|
+
when :messages
|
50
|
+
Collection.new(raw).collect do |_raw_|
|
51
|
+
Message.new _raw_[:id], _raw_
|
52
|
+
end
|
49
53
|
when :page
|
50
54
|
Page.new raw[:id], raw
|
51
55
|
when :pages
|
@@ -77,12 +81,15 @@ module FbGraph2
|
|
77
81
|
private
|
78
82
|
|
79
83
|
def as_profile(raw)
|
80
|
-
klass = if raw.include?
|
81
|
-
|
82
|
-
elsif raw.include?
|
84
|
+
klass = if raw.include? :namespace
|
85
|
+
App
|
86
|
+
elsif raw.include? :category
|
83
87
|
Page
|
88
|
+
elsif raw.include? :start_time
|
89
|
+
Event
|
90
|
+
elsif raw.include? :owner
|
91
|
+
Group
|
84
92
|
else
|
85
|
-
# TODO: needs to handle Event and Group here.
|
86
93
|
User
|
87
94
|
end
|
88
95
|
klass.new raw[:id], raw
|
data/lib/fb_graph2/edge/likes.rb
CHANGED
data/lib/fb_graph2/node.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Payment < Node
|
3
|
+
register_attributes(
|
4
|
+
raw: [:product, :quantity, :request_id, :country, :created_time, :payout_foreign_exchange_rate, :test],
|
5
|
+
time: [:created_time, :updated_time],
|
6
|
+
user: [:user],
|
7
|
+
app: [:application],
|
8
|
+
custom: [:actions, :items, :disputes]
|
9
|
+
)
|
10
|
+
|
11
|
+
def initialize(id, attributes = {})
|
12
|
+
super
|
13
|
+
# TODO: handle custom attributes.
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/fb_graph2/post.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Struct
|
3
|
+
class AppLink < Struct
|
4
|
+
register_attributes(
|
5
|
+
raw: [:url]
|
6
|
+
)
|
7
|
+
|
8
|
+
class Native < AppLink
|
9
|
+
register_attributes(
|
10
|
+
raw: [:app_name]
|
11
|
+
)
|
12
|
+
|
13
|
+
class IOS < Native
|
14
|
+
register_attributes(
|
15
|
+
raw: [:app_store_id]
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
class Android < Native
|
20
|
+
register_attributes(
|
21
|
+
raw: [:class, :package]
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
class WindowsPhone < Native
|
26
|
+
register_attributes(
|
27
|
+
raw: [:app_name]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Web < AppLink
|
33
|
+
register_attributes(
|
34
|
+
raw: [:should_fallback]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FbGraph2::User do
|
4
4
|
describe '.app' do
|
5
|
-
let(:klass) { FbGraph2::
|
5
|
+
let(:klass) { FbGraph2::App }
|
6
6
|
|
7
7
|
it 'should not call API' do
|
8
8
|
expect do
|
@@ -13,7 +13,7 @@ describe FbGraph2::User do
|
|
13
13
|
|
14
14
|
context 'when fetched' do
|
15
15
|
it 'should call API' do
|
16
|
-
app = mock_graph :get, 'app', '
|
16
|
+
app = mock_graph :get, 'app', 'app/app' do
|
17
17
|
klass.app('token').fetch
|
18
18
|
end
|
19
19
|
app.should be_instance_of klass
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -152,11 +152,14 @@ files:
|
|
152
152
|
- fb_graph2.gemspec
|
153
153
|
- lib/fb_graph2.rb
|
154
154
|
- lib/fb_graph2/achievement.rb
|
155
|
+
- lib/fb_graph2/achievement_type.rb
|
155
156
|
- lib/fb_graph2/album.rb
|
156
|
-
- lib/fb_graph2/
|
157
|
+
- lib/fb_graph2/app.rb
|
158
|
+
- lib/fb_graph2/app_link_host.rb
|
157
159
|
- lib/fb_graph2/attribute_assigner.rb
|
158
160
|
- lib/fb_graph2/collection.rb
|
159
161
|
- lib/fb_graph2/comment.rb
|
162
|
+
- lib/fb_graph2/domain.rb
|
160
163
|
- lib/fb_graph2/edge.rb
|
161
164
|
- lib/fb_graph2/edge/accounts.rb
|
162
165
|
- lib/fb_graph2/edge/achievements.rb
|
@@ -200,24 +203,32 @@ files:
|
|
200
203
|
- lib/fb_graph2/event.rb
|
201
204
|
- lib/fb_graph2/friend_list.rb
|
202
205
|
- lib/fb_graph2/group.rb
|
206
|
+
- lib/fb_graph2/message.rb
|
203
207
|
- lib/fb_graph2/milestone.rb
|
204
208
|
- lib/fb_graph2/node.rb
|
205
209
|
- lib/fb_graph2/notification.rb
|
206
210
|
- lib/fb_graph2/offer.rb
|
211
|
+
- lib/fb_graph2/order.rb
|
207
212
|
- lib/fb_graph2/page.rb
|
208
213
|
- lib/fb_graph2/page_category.rb
|
214
|
+
- lib/fb_graph2/payment.rb
|
209
215
|
- lib/fb_graph2/photo.rb
|
216
|
+
- lib/fb_graph2/place_tag.rb
|
210
217
|
- lib/fb_graph2/post.rb
|
218
|
+
- lib/fb_graph2/request.rb
|
211
219
|
- lib/fb_graph2/request_filter/authenticator.rb
|
212
220
|
- lib/fb_graph2/request_filter/debugger.rb
|
221
|
+
- lib/fb_graph2/review.rb
|
213
222
|
- lib/fb_graph2/struct.rb
|
214
223
|
- lib/fb_graph2/struct/action.rb
|
224
|
+
- lib/fb_graph2/struct/app_link.rb
|
215
225
|
- lib/fb_graph2/struct/image_source.rb
|
216
226
|
- lib/fb_graph2/struct/invitable_friend.rb
|
217
227
|
- lib/fb_graph2/struct/permission.rb
|
218
228
|
- lib/fb_graph2/struct/picture.rb
|
219
229
|
- lib/fb_graph2/struct/poke.rb
|
220
230
|
- lib/fb_graph2/struct/score.rb
|
231
|
+
- lib/fb_graph2/thread.rb
|
221
232
|
- lib/fb_graph2/user.rb
|
222
233
|
- lib/fb_graph2/util.rb
|
223
234
|
- lib/fb_graph2/video.rb
|
@@ -264,7 +275,7 @@ files:
|
|
264
275
|
- spec/fb_graph2/user_spec.rb
|
265
276
|
- spec/fb_graph2/util_spec.rb
|
266
277
|
- spec/fb_graph2_spec.rb
|
267
|
-
- spec/mock_json/
|
278
|
+
- spec/mock_json/app/app.json
|
268
279
|
- spec/mock_json/blank_collection.json
|
269
280
|
- spec/mock_json/error/400/2500.json
|
270
281
|
- spec/mock_json/error/invalid_format.json
|
@@ -330,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
341
|
version: '0'
|
331
342
|
requirements: []
|
332
343
|
rubyforge_project:
|
333
|
-
rubygems_version: 2.2.
|
344
|
+
rubygems_version: 2.2.0
|
334
345
|
signing_key:
|
335
346
|
specification_version: 4
|
336
347
|
summary: Facebook Graph API v2.0 Wrapper in Ruby
|