From 6b6fb17034633501b72c92b77b4e6c948fbc7ef4 Mon Sep 17 00:00:00 2001 From: nov Date: Wed, 4 Jun 2014 17:13:48 +0900 Subject: [PATCH] rename FbGraph2::Application to FbGraph2::App --- lib/fb_graph2/achievement.rb | 2 +- lib/fb_graph2/achievement_type.rb | 11 +++++++++++ lib/fb_graph2/{application.rb => app.rb} | 2 +- lib/fb_graph2/app_link_host.rb | 0 lib/fb_graph2/attribute_assigner.rb | 6 +++--- lib/fb_graph2/domain.rb | 7 +++++++ lib/fb_graph2/notification.rb | 2 +- lib/fb_graph2/post.rb | 2 +- lib/fb_graph2/struct/score.rb | 2 +- spec/fb_graph2/application_spec.rb | 4 ++-- spec/mock_json/{application => app}/app.json | 0 11 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 lib/fb_graph2/achievement_type.rb rename lib/fb_graph2/{application.rb => app.rb} (97%) create mode 100644 lib/fb_graph2/app_link_host.rb create mode 100644 lib/fb_graph2/domain.rb rename spec/mock_json/{application => app}/app.json (100%) diff --git a/lib/fb_graph2/achievement.rb b/lib/fb_graph2/achievement.rb index a8cc725..92005bb 100644 --- a/lib/fb_graph2/achievement.rb +++ b/lib/fb_graph2/achievement.rb @@ -6,7 +6,7 @@ module FbGraph2 register_attributes( raw: [:type, :no_feed_story], time: [:publish_time], - application: [:application], + app: [:application], user: [:from], custom: [:data] ) diff --git a/lib/fb_graph2/achievement_type.rb b/lib/fb_graph2/achievement_type.rb new file mode 100644 index 0000000..fcd798d --- /dev/null +++ b/lib/fb_graph2/achievement_type.rb @@ -0,0 +1,11 @@ +module FbGraph2 + class AchievementType < Node + register_attributes( + raw: [:type, :title, :url, :description, :is_scraped], + time: [:updated_time, :created_time], + picture: [:image], + app: [:application], + custom: [:data, :context] + ) + end +end \ No newline at end of file diff --git a/lib/fb_graph2/application.rb b/lib/fb_graph2/app.rb similarity index 97% rename from lib/fb_graph2/application.rb rename to lib/fb_graph2/app.rb index a00bfb5..226ab1a 100644 --- a/lib/fb_graph2/application.rb +++ b/lib/fb_graph2/app.rb @@ -1,5 +1,5 @@ module FbGraph2 - class Application < Node + class App < Node register_attributes( raw: [ :id, :android_key_hash, :app_domains, :auth_dialog_data_help_url, :auth_dialog_headline, diff --git a/lib/fb_graph2/app_link_host.rb b/lib/fb_graph2/app_link_host.rb new file mode 100644 index 0000000..e69de29 diff --git a/lib/fb_graph2/attribute_assigner.rb b/lib/fb_graph2/attribute_assigner.rb index e58d913..425b13b 100644 --- a/lib/fb_graph2/attribute_assigner.rb +++ b/lib/fb_graph2/attribute_assigner.rb @@ -36,8 +36,8 @@ module FbGraph2 end when :album Album.new raw[:id], raw - when :application - Application.new raw[:id], raw + when :app + App.new raw[:id], raw when :comment Comment.new raw[:id], raw when :group @@ -78,7 +78,7 @@ module FbGraph2 def as_profile(raw) klass = if raw.include?(:namespace) - Application + App elsif raw.include?(:category) Page else diff --git a/lib/fb_graph2/domain.rb b/lib/fb_graph2/domain.rb new file mode 100644 index 0000000..585fbeb --- /dev/null +++ b/lib/fb_graph2/domain.rb @@ -0,0 +1,7 @@ +module FbGraph2 + class Domain < Node + register_attributes( + raw: [:name] + ) + end +end \ No newline at end of file diff --git a/lib/fb_graph2/notification.rb b/lib/fb_graph2/notification.rb index 3fc0381..e218a35 100644 --- a/lib/fb_graph2/notification.rb +++ b/lib/fb_graph2/notification.rb @@ -5,7 +5,7 @@ module FbGraph2 time: [:created_time, :updated_time], profile: [:from], user: [:to], - application: [:application], + app: [:application], custom: [:object] ) diff --git a/lib/fb_graph2/post.rb b/lib/fb_graph2/post.rb index 3fcddc2..235d547 100644 --- a/lib/fb_graph2/post.rb +++ b/lib/fb_graph2/post.rb @@ -10,7 +10,7 @@ module FbGraph2 :source, :story ], time: [:created_time, :updated_time], - application: [:application], + app: [:application], page: [:place], profile: [:from], profiles: [:to, :with_tags], diff --git a/lib/fb_graph2/struct/score.rb b/lib/fb_graph2/struct/score.rb index c03dcb7..93fe882 100644 --- a/lib/fb_graph2/struct/score.rb +++ b/lib/fb_graph2/struct/score.rb @@ -4,7 +4,7 @@ module FbGraph2 register_attributes( raw: [:score], user: [:user], - application: [:application] + app: [:application] ) end end diff --git a/spec/fb_graph2/application_spec.rb b/spec/fb_graph2/application_spec.rb index 95208ba..73a864e 100644 --- a/spec/fb_graph2/application_spec.rb +++ b/spec/fb_graph2/application_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe FbGraph2::User do describe '.app' do - let(:klass) { FbGraph2::Application } + let(:klass) { FbGraph2::App } it 'should not call API' do expect do @@ -13,7 +13,7 @@ describe FbGraph2::User do context 'when fetched' do it 'should call API' do - app = mock_graph :get, 'app', 'application/app' do + app = mock_graph :get, 'app', 'app/app' do klass.app('token').fetch end app.should be_instance_of klass diff --git a/spec/mock_json/application/app.json b/spec/mock_json/app/app.json similarity index 100% rename from spec/mock_json/application/app.json rename to spec/mock_json/app/app.json