mirror of
				https://github.com/nov/fb_graph2
				synced 2023-03-27 23:22:15 -04:00 
			
		
		
		
	achievements, activities and albums edges
This commit is contained in:
		
							parent
							
								
									3df4406927
								
							
						
					
					
						commit
						a5265ad0d3
					
				
					 7 changed files with 67 additions and 0 deletions
				
			
		
							
								
								
									
										16
									
								
								lib/fb_graph2/achievement.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								lib/fb_graph2/achievement.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class Achievement < Node
 | 
			
		||||
    register_attributes(
 | 
			
		||||
      raw: [:type, :no_feed_story],
 | 
			
		||||
      time: [:publish_time],
 | 
			
		||||
      application: [:application],
 | 
			
		||||
      user: [:from],
 | 
			
		||||
      custom: [:data]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    def initialize(id, attributes = {})
 | 
			
		||||
      super
 | 
			
		||||
      # TODO: handle custom attributes.
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										10
									
								
								lib/fb_graph2/album.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								lib/fb_graph2/album.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class Album < Node
 | 
			
		||||
    register_attributes(
 | 
			
		||||
      raw: [:can_upload, :count, :cover_photo, :description, :link, :location, :name, :privacy, :type],
 | 
			
		||||
      time: [:created_time, :updated_time],
 | 
			
		||||
      user: [:from],
 | 
			
		||||
      page: [:place]
 | 
			
		||||
    )
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -44,6 +44,8 @@ module FbGraph2
 | 
			
		|||
              Collection.new(raw).collect do |_raw_|
 | 
			
		||||
                as_profile _raw_
 | 
			
		||||
              end
 | 
			
		||||
            when :application
 | 
			
		||||
              Application.new raw[:id], raw
 | 
			
		||||
            when :user
 | 
			
		||||
              User.new raw[:id], raw
 | 
			
		||||
            else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								lib/fb_graph2/edge/achievements.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								lib/fb_graph2/edge/achievements.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class Edge
 | 
			
		||||
    module Achievements
 | 
			
		||||
      def achievements(params = {})
 | 
			
		||||
        achievements = self.edge :achievements, params
 | 
			
		||||
        achievements.collect do |achievement|
 | 
			
		||||
          Achievement.new(achievement[:id], achievement).authenticate self.access_token
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										12
									
								
								lib/fb_graph2/edge/activities.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								lib/fb_graph2/edge/activities.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class Edge
 | 
			
		||||
    module Activities
 | 
			
		||||
      def activities(params = {})
 | 
			
		||||
        pages = self.edge :activities, params
 | 
			
		||||
        pages.collect do |page|
 | 
			
		||||
          Page.new(page[:id], page).authenticate self.access_token
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										12
									
								
								lib/fb_graph2/edge/albums.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								lib/fb_graph2/edge/albums.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class Edge
 | 
			
		||||
    module Albums
 | 
			
		||||
      def albums(params = {})
 | 
			
		||||
        albums = self.edge :albums, params
 | 
			
		||||
        albums.collect do |album|
 | 
			
		||||
          Album.new(album[:id], album).authenticate self.access_token
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,9 @@
 | 
			
		|||
module FbGraph2
 | 
			
		||||
  class User < Node
 | 
			
		||||
    include Edge::Accounts
 | 
			
		||||
    include Edge::Achievements
 | 
			
		||||
    include Edge::Activities
 | 
			
		||||
    include Edge::Albums
 | 
			
		||||
    include Edge::Books
 | 
			
		||||
    include Edge::Feed
 | 
			
		||||
    include Edge::Friends
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue