mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
Update v2.8 (#1)
* default v2.4 * links edge is no longer available. use feed https://developers.facebook.com/docs/apps/changelog#v2_4_changes * statuses edge is no longer available. use feed https://developers.facebook.com/docs/apps/changelog#v2_4_changes * invited edge is no longer available https://developers.facebook.com/docs/apps/changelog#v2_4_changes * home edge is no longer available. https://developers.facebook.com/docs/apps/changelog#v2_4_changes * inbox edge is no longer available. https://developers.facebook.com/docs/apps/changelog#v2_4_changes * notifications and outbox edges are no longer availabe. https://developers.facebook.com/docs/apps/changelog#v2_4_changes ps. outbox isn't mentioned in the doc, but read_mailbox deprecation causes outbox deprecation too. * update graph api version to 2.8 * update gem version * remove applications edge * update message_tags json data format * align with features in v2.8 * align with features in v2.7 * align with features in v2.6 * align with features in v2.5 * align with features in v2.4
This commit is contained in:
parent
ce04b4d451
commit
4a49e6faa8
21 changed files with 30 additions and 213 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.8.0
|
||||
0.9.0
|
|
@ -8,7 +8,7 @@ module FbGraph2
|
|||
mattr_accessor :root_url, :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes
|
||||
|
||||
self.root_url = 'https://graph.facebook.com'
|
||||
self.api_version = 'v2.4'
|
||||
self.api_version = 'v2.8'
|
||||
self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
|
||||
self.logger = Logger.new(STDOUT)
|
||||
self.logger.progname = 'FbGraph2'
|
||||
|
|
|
@ -6,7 +6,6 @@ module FbGraph2
|
|||
include Edge::AppEventTypes
|
||||
include Edge::Banned
|
||||
include Edge::Groups
|
||||
include Edge::OpenGraph::Objects
|
||||
include Edge::Permissions
|
||||
include Edge::Picture
|
||||
include Edge::Roles::AppContext
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
module FbGraph2
|
||||
class Edge
|
||||
module Applications
|
||||
def applications(params = {})
|
||||
apps = self.edge :applications, params, edge_scope: :developer
|
||||
apps.collect! do |app|
|
||||
App.new(app[:id], app).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
module FbGraph2
|
||||
class Edge
|
||||
module OpenGraph
|
||||
module Actions
|
||||
def og_actions(action_type, params = {})
|
||||
actions = self.edge action_type, params
|
||||
actions.collect! do |action|
|
||||
FbGraph2::OpenGraph::Action.new(action[:id], action).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
||||
def og_action!(action_type, params = {})
|
||||
action = self.post params, edge: action_type
|
||||
FbGraph2::OpenGraph::Action.new(action[:id], params.merge(action)).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
module FbGraph2
|
||||
class Edge
|
||||
module OpenGraph
|
||||
module Objects
|
||||
def og_object!(object_type, params = {})
|
||||
object = self.post params, edge: :objects, edge_scope: object_type
|
||||
FbGraph2::OpenGraph::Object.new(object[:id], params.merge(object)).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@ module FbGraph2
|
|||
extend Searchable
|
||||
|
||||
register_attributes(
|
||||
raw: [:description, :is_date_only, :location, :name, :privacy, :ticket_uri, :timezone],
|
||||
raw: [:description, :location, :name, :ticket_uri, :timezone],
|
||||
time: [:end_time, :start_time, :updated_time],
|
||||
page: [:venue],
|
||||
profile: [:owner],
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
module FbGraph2
|
||||
module OpenGraph
|
||||
class Action < Node
|
||||
include Edge::Comments
|
||||
include Edge::Likes::LikeeContext
|
||||
|
||||
register_attributes(
|
||||
raw: [:message, :no_feed_story, :ref, :type],
|
||||
time: [:end_time, :publish_time, :start_time],
|
||||
app: [:application],
|
||||
profile: [:from],
|
||||
custom: [:object]
|
||||
)
|
||||
|
||||
def initialize(id, attributes = {})
|
||||
super
|
||||
if attributes.include?(:data) && attributes[:data].include?(:object)
|
||||
_object_ = attributes[:data][:object]
|
||||
self.object = OpenGraph::Object.new _object_[:id], _object_
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
module FbGraph2
|
||||
module OpenGraph
|
||||
class Object < Node
|
||||
register_attributes(
|
||||
raw: [:title, :type, :url]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,9 +26,9 @@ module FbGraph2
|
|||
raw: [
|
||||
:about, :attire, :band_members, :booking_agent, :can_post, :category, :checkins, :company_overview,
|
||||
:current_location, :description, :directed_by, :emails, :founded, :general_info, :general_manager, :global_brand_page_name,
|
||||
:hometown, :hours, :impressum, :is_permanently_closed, :is_published, :is_unclaimed, :likes, :link, :mission, :name,
|
||||
:hometown, :hours, :impressum, :is_permanently_closed, :is_published, :is_unclaimed, :fan_count, :link, :mission, :name,
|
||||
:name_with_location_descriptor, :phone, :press_contact, :price_range, :products, :talking_about_count, :username,
|
||||
:website, :were_here_count,
|
||||
:website, :were_here_count, :is_webhooks_subscribed,
|
||||
# NOTE: only within /:user_id/accounts context
|
||||
:perms
|
||||
],
|
||||
|
|
|
@ -24,11 +24,8 @@ module FbGraph2
|
|||
def initialize(id, attributes = {})
|
||||
super
|
||||
if attributes.include? :message_tags
|
||||
self.message_tags = attributes[:message_tags].inject({}) do |message_tags, (key, values)|
|
||||
_message_tags_ = values.collect do |value|
|
||||
TaggedProfile.new value[:id], value
|
||||
end
|
||||
message_tags.merge! key => _message_tags_
|
||||
self.message_tags = attributes[:message_tags].collect do |message_tag|
|
||||
TaggedProfile.new message_tag[:id], message_tag
|
||||
end
|
||||
end
|
||||
if attributes.include? :privacy
|
||||
|
|
|
@ -4,7 +4,6 @@ module FbGraph2
|
|||
include Edge::Achievements
|
||||
include Edge::Activities
|
||||
include Edge::Albums
|
||||
include Edge::Applications
|
||||
include Edge::AppRequests
|
||||
include Edge::Books
|
||||
include Edge::Domains
|
||||
|
@ -36,7 +35,7 @@ module FbGraph2
|
|||
|
||||
register_attributes(
|
||||
raw: [
|
||||
:about, :bio, :email, :first_name, :gender, :install_type, :installed, :interested_in, :is_eligible_promo,
|
||||
:about, :email, :first_name, :gender, :install_type, :installed, :interested_in, :is_eligible_promo,
|
||||
:is_shared_login, :is_verified, :last_name, :link, :locale, :meeting_for, :middle_name, :name, :name_format,
|
||||
:political, :quotes, :relationship_status, :religion, :test_group, :third_party_id, :timezone, :token_for_business,
|
||||
:verified, :viewer_can_send_gift, :website,
|
||||
|
@ -66,7 +65,6 @@ module FbGraph2
|
|||
:tagging_user
|
||||
],
|
||||
photo: [:cover],
|
||||
location: [:address],
|
||||
custom: [
|
||||
:age_range, :context, :currency, :devices, :education, :payment_mobile_pricepoints, :payment_pricepoints,
|
||||
:security_settings, :suggested_groups, :video_upload_limits, :work
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe FbGraph2::Edge::Applications do
|
||||
context 'included in User' do
|
||||
let(:me) { FbGraph2::User.me('token') }
|
||||
|
||||
describe '#applications' do
|
||||
it 'should return an Array of FbGraph2::App' do
|
||||
apps = mock_graph :get, 'me/applications/developer', 'user/applications', access_token: 'token' do
|
||||
me.applications
|
||||
end
|
||||
apps.should be_instance_of FbGraph2::Edge
|
||||
apps.should_not be_blank
|
||||
apps.each do |app|
|
||||
app.should be_instance_of FbGraph2::App
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,7 +6,7 @@ describe FbGraph2 do
|
|||
|
||||
context 'as default' do
|
||||
its(:logger) { should be_a Logger }
|
||||
its(:api_version) { should == 'v2.4' }
|
||||
its(:api_version) { should == 'v2.8' }
|
||||
its(:root_url) { should == 'https://graph.facebook.com' }
|
||||
it { should_not be_debugging }
|
||||
end
|
||||
|
|
|
@ -7,15 +7,13 @@
|
|||
"id": "140478125968442"
|
||||
},
|
||||
"story": "OAuth.jp shared a link.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "140478125968442",
|
||||
"name": "OAuth.jp",
|
||||
"offset": 0,
|
||||
"length": 8,
|
||||
"type": "page"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"link": "http://oauth.jp/blog/2014/05/09/what-happens-when-oauth2-code-leaked/",
|
||||
"name": "OAuth 2.0 の code は漏れても大丈夫ってホント!? - OAuth.jp",
|
||||
"caption": "oauth.jp",
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
"name": "Shunya Iriki"
|
||||
},
|
||||
"story": "Shunya Iriki shared a link.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "689134294485152",
|
||||
"name": "Shunya Iriki",
|
||||
"offset": 0,
|
||||
"length": 12,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCtEdPdezKIoUxo&w=154&h=154&url=http%3A%2F%2Fi.yimg.jp%2Fi%2Fdocs%2Frelease%2Ffbicon.jpg",
|
||||
"link": "http://docs.yahoo.co.jp/docs/info/terms/chapter1.html#cf2nd",
|
||||
"name": "ヤフー株式会社 - サービス利用規約 第1編 基本ガイドライン",
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"data": [{
|
||||
"name": "gem sample",
|
||||
"namespace": "gem-sample",
|
||||
"id": "210798282372757"
|
||||
}, {
|
||||
"name": "Localhost",
|
||||
"id": "158245434257042"
|
||||
}, {
|
||||
"name": "OAuth.jp",
|
||||
"id": "126213067419995"
|
||||
}],
|
||||
"paging": {
|
||||
"next": "https://graph.facebook.com/v2.1/579612276/applications?type=developer&limit=25&offset=25&__after_id=***"
|
||||
}
|
||||
}
|
|
@ -6,15 +6,13 @@
|
|||
"name": "Nov Matake"
|
||||
},
|
||||
"story": "Nov Matake likes a photo.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"offset": 0,
|
||||
"length": 10,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"privacy": {
|
||||
"value": ""
|
||||
},
|
||||
|
@ -29,22 +27,20 @@
|
|||
},
|
||||
"message": "ビッグデータとひわいっち",
|
||||
"story": "Nov Matake shared Keisuke Hiwatashi's photo.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"offset": 0,
|
||||
"length": 10,
|
||||
"type": "user"
|
||||
}],
|
||||
"18": [{
|
||||
},
|
||||
{
|
||||
"id": "674146975973023",
|
||||
"name": "Keisuke Hiwatashi",
|
||||
"offset": 18,
|
||||
"length": 17,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"picture": "https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-xfp1/t1.0-0/10325169_677983408922713_1895639973177548237_s.jpg",
|
||||
"link": "https://www.facebook.com/photo.php?fbid=677983408922713&set=a.150687431652316.43478.100001331809083&type=1",
|
||||
"name": "Mobile Uploads",
|
||||
|
@ -87,15 +83,13 @@
|
|||
"name": "Nov Matake"
|
||||
},
|
||||
"story": "Nov Matake shared a link.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"offset": 0,
|
||||
"length": 10,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAcHDji1ec2KqYZ&w=154&h=154&url=http%3A%2F%2Fua.nakanohito.jp%2Fua%2F%3Ffrom%3Duamb%26id%3D7932754%26mode%3Ddefault%26h%3D55529355%26rand%3Dnoscript%26guid%3DON%26url%3Dhttp%3A%2F%2Fkirik.tea-nifty.com%2Fdiary%2F2014%2F05%2Fivs-ed80.html%26eflg%3D1",
|
||||
"link": "http://ow.ly/xoEJp",
|
||||
"name": "IVS札幌でセクハラ・レイプ未遂騒ぎが勃発&インサイダー情報が乱舞: やまもといちろうBLOG(ブログ)",
|
||||
|
@ -152,22 +146,20 @@
|
|||
},
|
||||
"message": "じわじわくる",
|
||||
"story": "Nov Matake shared Yoichi Hagiwara's photo.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"offset": 0,
|
||||
"length": 10,
|
||||
"type": "user"
|
||||
}],
|
||||
"18": [{
|
||||
},
|
||||
{
|
||||
"id": "636860593058872",
|
||||
"name": "Yoichi Hagiwara",
|
||||
"offset": 18,
|
||||
"length": 15,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"picture": "https://fbcdn-photos-b-a.akamaihd.net/hphotos-ak-xfp1/t1.0-0/10410479_636298869781711_8967036710690476822_s.jpg",
|
||||
"link": "https://www.facebook.com/photo.php?fbid=636298869781711&set=a.168178316593771.41312.100002048127511&type=1",
|
||||
"name": "Timeline Photos",
|
||||
|
@ -209,15 +201,13 @@
|
|||
"name": "Nov Matake"
|
||||
},
|
||||
"story": "Nov Matake shared a link.",
|
||||
"story_tags": {
|
||||
"0": [{
|
||||
"story_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"offset": 0,
|
||||
"length": 10,
|
||||
"type": "user"
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQDQyx3PnnIPoGqZ&w=154&h=154&url=http%3A%2F%2Fc002.ocn.ne.jp%2Fimg%2Flogo_nttcommunications_001.gif",
|
||||
"link": "http://mypage.ocn.ne.jp/sorry/index.html",
|
||||
"name": "お詫び | マイページ",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "10152411392127277",
|
||||
"bio": "Ruby/Rails developer, developing several gems like fb_graph, rack-oauth2, paypal-express, openid_connect, activitystreams etc.",
|
||||
"about": "Ruby/Rails developer, developing several gems like fb_graph, rack-oauth2, paypal-express, openid_connect, activitystreams etc.",
|
||||
"birthday": "12/13/1981",
|
||||
"education": [{
|
||||
"classes": [{
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
"data": [
|
||||
{
|
||||
"application": {
|
||||
"name": "Test Application",
|
||||
"namespace": "testapp",
|
||||
"id": "495624957249579"
|
||||
},
|
||||
"comments": {
|
||||
"data": [
|
||||
],
|
||||
"can_comment": true,
|
||||
"comment_order": "chronological",
|
||||
"count": 0
|
||||
},
|
||||
"from": {
|
||||
"id": "0815",
|
||||
"name": "John Doe"
|
||||
},
|
||||
"likes": {
|
||||
"data": [
|
||||
],
|
||||
"can_like": true,
|
||||
"count": 0,
|
||||
"user_likes": false
|
||||
},
|
||||
"no_feed_story": false,
|
||||
"publish_time": "2015-04-06T11:53:54+0000",
|
||||
"ref": ".hDGIIZ34.like",
|
||||
"start_time": "2015-04-06T11:53:54+0000",
|
||||
"type": "og.likes",
|
||||
"data": {
|
||||
"object": {
|
||||
"id": "2893972379237",
|
||||
"title": "The awesome test site",
|
||||
"type": "website",
|
||||
"url": "http://example.com"
|
||||
}
|
||||
},
|
||||
"id": "4953745973459"
|
||||
}
|
||||
],
|
||||
"paging": {
|
||||
"cursors": {
|
||||
"before": "MTAzsdfsdfzU2OTM5NDYyNQ==",
|
||||
"after": "NDk2Mz3453czNDergczNzIzNjQw"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,15 +12,13 @@
|
|||
}]
|
||||
},
|
||||
"message": "Nov Matake test",
|
||||
"message_tags": {
|
||||
"0": [{
|
||||
"message_tags": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"type": "user",
|
||||
"offset": 0,
|
||||
"length": 10
|
||||
}]
|
||||
},
|
||||
}],
|
||||
"actions": [{
|
||||
"name": "Comment",
|
||||
"link": "https://www.facebook.com/579612276/posts/10152483324277277"
|
||||
|
|
Loading…
Reference in a new issue