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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74750faa426059425c7abd637447a8fdad787239
4
- data.tar.gz: 766bad5045a521469346a990a8d63ab799eb8a7e
3
+ metadata.gz: 5596c03f7eb3eaaf04d9e4ded6d72c5468807781
4
+ data.tar.gz: 8ff0e6c72704f8181507d184a270507e8b0bf990
5
5
  SHA512:
6
- metadata.gz: 300cbfc8444dc6e4efaaa5ff530bc424da44304f5b46f753c8aeea9887aa0ddc0bf94fb3da45f2297ff2c3d437ad98907fbfc3f035d3431a1f6621d74d3a78cd
7
- data.tar.gz: fb4423e27def44ce916faf226d9c96c2843fd83d8a94723417a9fa4ae19b267a8092c8b24e1f0dda5d91f4b00da23289f5e0d4ab3d140fbdb84fc9a7d7084300
6
+ metadata.gz: e4fdcdbbb437eeb097f3e4605c9eaee73d6146af7cecdad1ccd3a65183883ea501f744314af0c6ceae04aed86a5c1fc7233625e2edd813c9b6f706d0882271f7
7
+ data.tar.gz: a1c0c0ff0e723dbdd115d4717f8795a27456cbd9737c3bee3e02cf19d622fa130b89751b59bf01ac904fe61147b578840df336e30d22b6f1b89ab97f1f212585
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -6,7 +6,7 @@ module FbGraph2
6
6
  register_attributes(
7
7
  raw: [:type, :no_feed_story],
8
8
  time: [:publish_time],
9
- application: [:application],
9
+ app: [:application],
10
10
  user: [:from],
11
11
  custom: [:data]
12
12
  )
@@ -0,0 +1,11 @@
1
+ module FbGraph2
2
+ class AchievementType < Node
3
+ register_attributes(
4
+ raw: [:type, :title, :url, :description, :is_scraped],
5
+ time: [:updated_time, :created_time],
6
+ picture: [:image],
7
+ app: [:application],
8
+ custom: [:data, :context]
9
+ )
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module FbGraph2
2
- class Application < Node
2
+ class App < Node
3
3
  register_attributes(
4
4
  raw: [
5
5
  :id, :android_key_hash, :app_domains, :auth_dialog_data_help_url, :auth_dialog_headline,
@@ -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 :application
40
- Application.new raw[:id], raw
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?(:namespace)
81
- Application
82
- elsif raw.include?(:category)
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
@@ -0,0 +1,7 @@
1
+ module FbGraph2
2
+ class Domain < Node
3
+ register_attributes(
4
+ raw: [:name]
5
+ )
6
+ end
7
+ end
@@ -3,7 +3,7 @@ module FbGraph2
3
3
  module Comments
4
4
  def assign(attributes)
5
5
  super
6
- if attributes.include?(:comments)
6
+ if attributes.include? :comments
7
7
  @_cached_comments = Collection.new attributes[:comments]
8
8
  end
9
9
  end
@@ -18,7 +18,7 @@ module FbGraph2
18
18
  module LikeeContext
19
19
  def assign(attributes)
20
20
  super
21
- if attributes.include?(:likes)
21
+ if attributes.include? :likes
22
22
  @_cached_likes = Collection.new attributes[:likes]
23
23
  end
24
24
  end
@@ -0,0 +1,9 @@
1
+ module FbGraph2
2
+ class Message < Node
3
+ register_attributes(
4
+ raw: [:message],
5
+ time: [:created_time],
6
+ profile: [:from]
7
+ )
8
+ end
9
+ end
@@ -43,6 +43,10 @@ module FbGraph2
43
43
  end.collect(&:instance_methods).sort
44
44
  end
45
45
 
46
+ def update(params = {}, options = {})
47
+ post params, options
48
+ end
49
+
46
50
  def destroy(params = {}, options = {})
47
51
  delete params, options
48
52
  end
@@ -5,7 +5,7 @@ module FbGraph2
5
5
  time: [:created_time, :updated_time],
6
6
  profile: [:from],
7
7
  user: [:to],
8
- application: [:application],
8
+ app: [:application],
9
9
  custom: [:object]
10
10
  )
11
11
 
@@ -0,0 +1,9 @@
1
+ module FbGraph2
2
+ class Order < Node
3
+ register_attributes(
4
+ raw: [:amount, :country, :from, :refund_reason_code, :status],
5
+ time: [:created_time, :updated_time],
6
+ app: [:application]
7
+ )
8
+ end
9
+ end
@@ -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
@@ -0,0 +1,8 @@
1
+ module FbGraph2
2
+ class PlaceTag < Node
3
+ register_attributes(
4
+ time: [:created_time],
5
+ page: [:place]
6
+ )
7
+ end
8
+ end
@@ -10,7 +10,7 @@ module FbGraph2
10
10
  :source, :story
11
11
  ],
12
12
  time: [:created_time, :updated_time],
13
- application: [:application],
13
+ app: [:application],
14
14
  page: [:place],
15
15
  profile: [:from],
16
16
  profiles: [:to, :with_tags],
@@ -0,0 +1,10 @@
1
+ module FbGraph2
2
+ class Request < Node
3
+ register_attributes(
4
+ raw: [:message],
5
+ time: [:created_time],
6
+ app: [:application],
7
+ user: [:to, :from]
8
+ )
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module FbGraph2
2
+ class Review < Node
3
+ register_attributes(
4
+ raw: [:message, :rating],
5
+ time: [:created_time],
6
+ app: [:to],
7
+ user: [:from]
8
+ )
9
+ end
10
+ end
@@ -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
@@ -4,7 +4,7 @@ module FbGraph2
4
4
  register_attributes(
5
5
  raw: [:score],
6
6
  user: [:user],
7
- application: [:application]
7
+ app: [:application]
8
8
  )
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ module FbGraph2
2
+ class Thread < Node
3
+ register_attributes(
4
+ raw: [:unread, :unseen],
5
+ time: [:updated_time],
6
+ profiles: [:to],
7
+ messages: [:comments]
8
+ )
9
+ end
10
+ 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::Application }
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', 'application/app' do
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.5
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-03 00:00:00.000000000 Z
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/application.rb
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/application/app.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.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