fb_graph 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/fb_graph.gemspec +53 -2
- data/lib/fb_graph/album.rb +26 -0
- data/lib/fb_graph/comment.rb +18 -0
- data/lib/fb_graph/connections/activities.rb +12 -0
- data/lib/fb_graph/connections/albums.rb +12 -0
- data/lib/fb_graph/connections/attending.rb +16 -0
- data/lib/fb_graph/connections/books.rb +12 -0
- data/lib/fb_graph/connections/comments.rb +12 -0
- data/lib/fb_graph/connections/declined.rb +16 -0
- data/lib/fb_graph/connections/events.rb +12 -0
- data/lib/fb_graph/connections/feed.rb +4 -1
- data/lib/fb_graph/connections/friends.rb +12 -0
- data/lib/fb_graph/connections/groups.rb +12 -0
- data/lib/fb_graph/connections/home.rb +4 -1
- data/lib/fb_graph/connections/interests.rb +12 -0
- data/lib/fb_graph/connections/invited.rb +16 -0
- data/lib/fb_graph/connections/links.rb +12 -0
- data/lib/fb_graph/connections/maybe.rb +16 -0
- data/lib/fb_graph/connections/members.rb +16 -0
- data/lib/fb_graph/connections/movies.rb +12 -0
- data/lib/fb_graph/connections/music.rb +12 -0
- data/lib/fb_graph/connections/noreply.rb +16 -0
- data/lib/fb_graph/connections/notes.rb +12 -0
- data/lib/fb_graph/connections/photos.rb +12 -0
- data/lib/fb_graph/connections/posts.rb +1 -4
- data/lib/fb_graph/connections/tagged.rb +4 -1
- data/lib/fb_graph/connections/television.rb +12 -0
- data/lib/fb_graph/connections/videos.rb +12 -0
- data/lib/fb_graph/event.rb +28 -0
- data/lib/fb_graph/group.rb +23 -0
- data/lib/fb_graph/link.rb +21 -0
- data/lib/fb_graph/note.rb +22 -0
- data/lib/fb_graph/page.rb +10 -0
- data/lib/fb_graph/photo.rb +42 -0
- data/lib/fb_graph/post.rb +7 -5
- data/lib/fb_graph/status.rb +5 -3
- data/lib/fb_graph/user.rb +21 -1
- data/lib/fb_graph/video.rb +23 -0
- data/lib/fb_graph.rb +11 -3
- data/spec/fake_json/users/activities/arjun_private.json +24 -0
- data/spec/fake_json/users/activities/arjun_public.json +6 -0
- data/spec/fake_json/users/feed/arjun_private.json +520 -0
- data/spec/fake_json/users/feed/arjun_public.json +520 -0
- data/spec/fake_json/users/friends/arjun_private.json +6 -0
- data/spec/fake_json/users/friends/arjun_public.json +6 -0
- data/spec/fake_json/users/friends/me_private.json +524 -0
- data/spec/fake_json/users/friends/me_public.json +6 -0
- data/spec/fake_json/users/posts/arjun_private.json +386 -0
- data/spec/fake_json/users/posts/arjun_public.json +386 -0
- data/spec/fake_json/users/tagged/arjun_private.json +308 -0
- data/spec/fake_json/users/tagged/arjun_public.json +308 -0
- data/spec/fb_graph/connections/activities_spec.rb +28 -0
- data/spec/fb_graph/connections/feed_spec.rb +34 -0
- data/spec/fb_graph/connections/friends_spec.rb +42 -0
- data/spec/fb_graph/connections/home_spec.rb +14 -2
- data/spec/fb_graph/connections/likes_spec.rb +0 -5
- data/spec/fb_graph/connections/posts_spec.rb +34 -0
- data/spec/fb_graph/connections/statuses_spec.rb +0 -19
- data/spec/fb_graph/connections/tagged_spec.rb +41 -0
- metadata +53 -2
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            module FbGraph
         | 
| 2 | 
            +
              class Photo < Node
         | 
| 3 | 
            +
                include Connections::Comments
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                attr_accessor :from, :tags, :name, :picture, :source, :height, :width, :link, :created_time, :updated_time
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                class Tag
         | 
| 8 | 
            +
                  attr_accessor :user, :x, :y, :created_time
         | 
| 9 | 
            +
                  def initialize(identifier, options = {})
         | 
| 10 | 
            +
                    @x = options.delete(:x)
         | 
| 11 | 
            +
                    @y = options.delete(:y)
         | 
| 12 | 
            +
                    @created_time = options.delete(:created_time)
         | 
| 13 | 
            +
                    @user = User.new(identifier, options)
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def initialize(identifier, options = {})
         | 
| 18 | 
            +
                  super
         | 
| 19 | 
            +
                  if (from = options[:from])
         | 
| 20 | 
            +
                    @from = if from[:category]
         | 
| 21 | 
            +
                      FbGraph::Page.new(from.delete(:id), from) 
         | 
| 22 | 
            +
                    else
         | 
| 23 | 
            +
                      FbGraph::User.new(from.delete(:id), from) 
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
                  @tags = []
         | 
| 27 | 
            +
                  if options[:tags]
         | 
| 28 | 
            +
                    options[:tags][:data].each do |tag|
         | 
| 29 | 
            +
                      FbGraph::Tag.new(tag.delete(:id), tag) 
         | 
| 30 | 
            +
                    end
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
                  @name         = options[:name]
         | 
| 33 | 
            +
                  @picture      = options[:picture]
         | 
| 34 | 
            +
                  @source       = options[:source]
         | 
| 35 | 
            +
                  @height       = options[:height]
         | 
| 36 | 
            +
                  @width        = options[:width]
         | 
| 37 | 
            +
                  @link         = options[:link]
         | 
| 38 | 
            +
                  @created_time = options[:created_time]
         | 
| 39 | 
            +
                  @updated_time = options[:updated_time]
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
    
        data/lib/fb_graph/post.rb
    CHANGED
    
    | @@ -1,23 +1,25 @@ | |
| 1 1 | 
             
            module FbGraph
         | 
| 2 2 | 
             
              class Post < Node
         | 
| 3 | 
            +
                include Connections::Comments
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
                attr_accessor :from, :to, :message, :picture, :link, :name, :caption, :description, :source, :icon, :attribution, :actions, :likes, :created_time, :updated_time
         | 
| 4 6 |  | 
| 5 7 | 
             
                def initialize(identifier, options = {})
         | 
| 6 8 | 
             
                  super
         | 
| 7 9 | 
             
                  if (from = options[:from])
         | 
| 8 10 | 
             
                    @from = if from[:category]
         | 
| 9 | 
            -
                      FbGraph::Page.new(from | 
| 11 | 
            +
                      FbGraph::Page.new(from.delete(:id), from) 
         | 
| 10 12 | 
             
                    else
         | 
| 11 | 
            -
                      FbGraph::User.new(from | 
| 13 | 
            +
                      FbGraph::User.new(from.delete(:id), from) 
         | 
| 12 14 | 
             
                    end
         | 
| 13 15 | 
             
                  end
         | 
| 14 16 | 
             
                  @to = []
         | 
| 15 17 | 
             
                  if options[:to]
         | 
| 16 | 
            -
                    options[:to].each do |to|
         | 
| 18 | 
            +
                    options[:to][:data].each do |to|
         | 
| 17 19 | 
             
                      @to << if to[:category]
         | 
| 18 | 
            -
                        FbGraph::Page.new(to | 
| 20 | 
            +
                        FbGraph::Page.new(to.delete(:id), to) 
         | 
| 19 21 | 
             
                      else
         | 
| 20 | 
            -
                        FbGraph::User.new(to | 
| 22 | 
            +
                        FbGraph::User.new(to.delete(:id), to) 
         | 
| 21 23 | 
             
                      end
         | 
| 22 24 | 
             
                    end
         | 
| 23 25 | 
             
                  end
         | 
    
        data/lib/fb_graph/status.rb
    CHANGED
    
    | @@ -1,17 +1,19 @@ | |
| 1 1 | 
             
            module FbGraph
         | 
| 2 2 | 
             
              class Status < Node
         | 
| 3 | 
            +
                include Connections::Comments
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
                attr_accessor :from, :message, :updated_time
         | 
| 4 6 |  | 
| 5 7 | 
             
                def initialize(identifier, options = {})
         | 
| 6 8 | 
             
                  super
         | 
| 7 9 | 
             
                  if (from = options[:from])
         | 
| 8 10 | 
             
                    @from = if from[:category]
         | 
| 9 | 
            -
                      FbGraph::Page.new(from | 
| 11 | 
            +
                      FbGraph::Page.new(from.delete(:id), from)
         | 
| 10 12 | 
             
                    else
         | 
| 11 | 
            -
                      FbGraph::User.new(from | 
| 13 | 
            +
                      FbGraph::User.new(from.delete(:id), from) 
         | 
| 12 14 | 
             
                    end
         | 
| 13 15 | 
             
                  end
         | 
| 14 | 
            -
                  @message | 
| 16 | 
            +
                  @message      = options[:message]
         | 
| 15 17 | 
             
                  @updated_time = options[:updated_time]
         | 
| 16 18 | 
             
                end
         | 
| 17 19 | 
             
              end
         | 
    
        data/lib/fb_graph/user.rb
    CHANGED
    
    | @@ -2,10 +2,30 @@ module FbGraph | |
| 2 2 | 
             
              class User < Node
         | 
| 3 3 | 
             
                include Connections::Home
         | 
| 4 4 | 
             
                include Connections::Feed
         | 
| 5 | 
            +
                include Connections::Tagged
         | 
| 5 6 | 
             
                include Connections::Posts
         | 
| 6 | 
            -
                include Connections::Likes
         | 
| 7 7 | 
             
                include Connections::Picture
         | 
| 8 | 
            +
                include Connections::Friends
         | 
| 9 | 
            +
                include Connections::Activities
         | 
| 10 | 
            +
                include Connections::Interests
         | 
| 11 | 
            +
                include Connections::Music
         | 
| 12 | 
            +
                include Connections::Books
         | 
| 13 | 
            +
                include Connections::Movies
         | 
| 14 | 
            +
                include Connections::Television
         | 
| 15 | 
            +
                include Connections::Likes
         | 
| 16 | 
            +
                include Connections::Photos
         | 
| 17 | 
            +
                include Connections::Albums
         | 
| 18 | 
            +
                include Connections::Videos
         | 
| 19 | 
            +
                include Connections::Groups
         | 
| 8 20 | 
             
                include Connections::Statuses
         | 
| 21 | 
            +
                include Connections::Links
         | 
| 22 | 
            +
                include Connections::Notes
         | 
| 23 | 
            +
                include Connections::Events
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                # TODO:
         | 
| 26 | 
            +
                # include Connections::Inbox
         | 
| 27 | 
            +
                # include Connections::Outbox
         | 
| 28 | 
            +
                # include Connections::Updates
         | 
| 9 29 |  | 
| 10 30 | 
             
                attr_accessor :name, :last_name, :first_name, :link, :about, :birthday, :work, :education, :email, :website
         | 
| 11 31 |  | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            module FbGraph
         | 
| 2 | 
            +
              class Video < Node
         | 
| 3 | 
            +
                include Connections::Comments
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                attr_accessor :from, :message, :description, :length, :created_time, :updated_time
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def initialize(identifier, options = {})
         | 
| 8 | 
            +
                  super
         | 
| 9 | 
            +
                  if (from = options[:from])
         | 
| 10 | 
            +
                    @from = if from[:category]
         | 
| 11 | 
            +
                      FbGraph::Page.new(from.delete(:id), from) 
         | 
| 12 | 
            +
                    else
         | 
| 13 | 
            +
                      FbGraph::User.new(from.delete(:id), from) 
         | 
| 14 | 
            +
                    end
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                  @message      = options[:message]
         | 
| 17 | 
            +
                  @description  = options[:description]
         | 
| 18 | 
            +
                  @length       = options[:length]
         | 
| 19 | 
            +
                  @created_time = options[:created_time]
         | 
| 20 | 
            +
                  @updated_time = options[:updated_time]
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
    
        data/lib/fb_graph.rb
    CHANGED
    
    | @@ -21,6 +21,14 @@ module FbGraph | |
| 21 21 |  | 
| 22 22 | 
             
            end
         | 
| 23 23 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 24 | 
            +
            require 'fb_graph/node'
         | 
| 25 | 
            +
            require 'fb_graph/connections'
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            require 'fb_graph/album'
         | 
| 28 | 
            +
            require 'fb_graph/group'
         | 
| 29 | 
            +
            require 'fb_graph/page'
         | 
| 30 | 
            +
            require 'fb_graph/photo'
         | 
| 31 | 
            +
            require 'fb_graph/post'
         | 
| 32 | 
            +
            require 'fb_graph/status'
         | 
| 33 | 
            +
            require 'fb_graph/user'
         | 
| 34 | 
            +
            require 'fb_graph/video'
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
               "data": [
         | 
| 3 | 
            +
                  {
         | 
| 4 | 
            +
                     "name": "Doing Things at the Last Minute",
         | 
| 5 | 
            +
                     "category": "\u6d3b\u52d5",
         | 
| 6 | 
            +
                     "id": "378209722137"
         | 
| 7 | 
            +
                  },
         | 
| 8 | 
            +
                  {
         | 
| 9 | 
            +
                     "name": "Coding",
         | 
| 10 | 
            +
                     "category": "\u6d3b\u52d5",
         | 
| 11 | 
            +
                     "id": "113492995333781"
         | 
| 12 | 
            +
                  },
         | 
| 13 | 
            +
                  {
         | 
| 14 | 
            +
                     "name": "Reading",
         | 
| 15 | 
            +
                     "category": "\u6d3b\u52d5",
         | 
| 16 | 
            +
                     "id": "108865669148432"
         | 
| 17 | 
            +
                  },
         | 
| 18 | 
            +
                  {
         | 
| 19 | 
            +
                     "name": "Camping",
         | 
| 20 | 
            +
                     "category": "\u6d3b\u52d5",
         | 
| 21 | 
            +
                     "id": "105426616157521"
         | 
| 22 | 
            +
                  }
         | 
| 23 | 
            +
               ]
         | 
| 24 | 
            +
            }
         |