joey 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -5,8 +5,10 @@ devel.vim
5
5
  init.rb
6
6
  joey.gemspec
7
7
  lib/joey.rb
8
+ lib/joey/action.rb
8
9
  lib/joey/affiliation.rb
9
10
  lib/joey/album.rb
11
+ lib/joey/comment.rb
10
12
  lib/joey/education.rb
11
13
  lib/joey/education_history.rb
12
14
  lib/joey/fetching_array.rb
@@ -16,6 +18,8 @@ lib/joey/model.rb
16
18
  lib/joey/page.rb
17
19
  lib/joey/parser_helpers.rb
18
20
  lib/joey/photo.rb
21
+ lib/joey/post.rb
22
+ lib/joey/privacy.rb
19
23
  lib/joey/profile.rb
20
24
  lib/joey/relative.rb
21
25
  lib/joey/rest_api.rb
data/joey.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{joey}
5
- s.version = "0.0.2"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Waseem Ahmad"]
9
- s.date = %q{2010-06-22}
9
+ s.date = %q{2010-07-07}
10
10
  s.description = %q{Object wrappers for nodes in the Facebook OpenGraph}
11
11
  s.email = %q{talk.to.waseem@gmail.com}
12
- s.extra_rdoc_files = ["README.md", "lib/joey.rb", "lib/joey/affiliation.rb", "lib/joey/album.rb", "lib/joey/education.rb", "lib/joey/education_history.rb", "lib/joey/fetching_array.rb", "lib/joey/hs_info.rb", "lib/joey/location.rb", "lib/joey/model.rb", "lib/joey/page.rb", "lib/joey/parser_helpers.rb", "lib/joey/photo.rb", "lib/joey/profile.rb", "lib/joey/relative.rb", "lib/joey/rest_api.rb", "lib/joey/status.rb", "lib/joey/television.rb", "lib/joey/user.rb", "lib/joey/version.rb", "lib/joey/work.rb", "lib/joey/work_history.rb"]
13
- s.files = ["COPYING.txt", "README.md", "Rakefile", "devel.vim", "init.rb", "joey.gemspec", "lib/joey.rb", "lib/joey/affiliation.rb", "lib/joey/album.rb", "lib/joey/education.rb", "lib/joey/education_history.rb", "lib/joey/fetching_array.rb", "lib/joey/hs_info.rb", "lib/joey/location.rb", "lib/joey/model.rb", "lib/joey/page.rb", "lib/joey/parser_helpers.rb", "lib/joey/photo.rb", "lib/joey/profile.rb", "lib/joey/relative.rb", "lib/joey/rest_api.rb", "lib/joey/status.rb", "lib/joey/television.rb", "lib/joey/user.rb", "lib/joey/version.rb", "lib/joey/work.rb", "lib/joey/work_history.rb", "Manifest"]
12
+ s.extra_rdoc_files = ["README.md", "lib/joey.rb", "lib/joey/action.rb", "lib/joey/affiliation.rb", "lib/joey/album.rb", "lib/joey/comment.rb", "lib/joey/education.rb", "lib/joey/education_history.rb", "lib/joey/fetching_array.rb", "lib/joey/hs_info.rb", "lib/joey/location.rb", "lib/joey/model.rb", "lib/joey/page.rb", "lib/joey/parser_helpers.rb", "lib/joey/photo.rb", "lib/joey/post.rb", "lib/joey/privacy.rb", "lib/joey/profile.rb", "lib/joey/relative.rb", "lib/joey/rest_api.rb", "lib/joey/status.rb", "lib/joey/television.rb", "lib/joey/user.rb", "lib/joey/version.rb", "lib/joey/work.rb", "lib/joey/work_history.rb"]
13
+ s.files = ["COPYING.txt", "README.md", "Rakefile", "devel.vim", "init.rb", "joey.gemspec", "lib/joey.rb", "lib/joey/action.rb", "lib/joey/affiliation.rb", "lib/joey/album.rb", "lib/joey/comment.rb", "lib/joey/education.rb", "lib/joey/education_history.rb", "lib/joey/fetching_array.rb", "lib/joey/hs_info.rb", "lib/joey/location.rb", "lib/joey/model.rb", "lib/joey/page.rb", "lib/joey/parser_helpers.rb", "lib/joey/photo.rb", "lib/joey/post.rb", "lib/joey/privacy.rb", "lib/joey/profile.rb", "lib/joey/relative.rb", "lib/joey/rest_api.rb", "lib/joey/status.rb", "lib/joey/television.rb", "lib/joey/user.rb", "lib/joey/version.rb", "lib/joey/work.rb", "lib/joey/work_history.rb", "Manifest"]
14
14
  s.homepage = %q{http://github.com/waseem/joey}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Joey", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
@@ -0,0 +1,5 @@
1
+ module Joey
2
+ class Action < Model
3
+ define_properties :name, :link
4
+ end
5
+ end
data/lib/joey/album.rb CHANGED
@@ -5,6 +5,7 @@ module Joey
5
5
  #creation_properties :name, :message
6
6
 
7
7
  hash_populating_accessor :from, "User", "Page"
8
+ hash_populating_accessor :comments, "Comment"
8
9
  has_association :photos, "Photo"
9
10
  #has_association :comments, "Comment"
10
11
 
@@ -0,0 +1,7 @@
1
+ module Joey
2
+ class Comment < Model
3
+ define_properties :id, :message, :created_time
4
+ #creation_properties :message
5
+ hash_populating_accessor :from, "User","Page"
6
+ end
7
+ end
data/lib/joey/model.rb CHANGED
@@ -54,5 +54,9 @@ module Joey
54
54
  #add_creation_method(name, klass)
55
55
  end
56
56
 
57
+ def self.find(id, client = nil)
58
+ client.get_and_map(id, self)
59
+ end
60
+
57
61
  end
58
62
  end
data/lib/joey/post.rb ADDED
@@ -0,0 +1,20 @@
1
+ module Joey
2
+ class Post < Model
3
+
4
+ define_properties :id, :message, :picture, :link, :name, :caption,
5
+ :description, :source, :icon, :attribution, :actions, :likes,
6
+ :created_time, :updated_time, :type
7
+
8
+ #creation_properties :message, :picture, :link, :name, :description
9
+
10
+ hash_populating_accessor :actions, "Action"
11
+ hash_populating_accessor :comments, "Comment"
12
+ hash_populating_accessor :from, "User"
13
+ hash_populating_accessor :to, "User"
14
+ hash_populating_accessor :privacy, "Privacy"
15
+
16
+ #def likes_create
17
+ #client.post("#{id}/likes",nil,{})
18
+ #end
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module Joey
2
+ class Privacy < Model
3
+ define_properties :value, :description, :allow, :friends, :deny
4
+ end
5
+ end
data/lib/joey/profile.rb CHANGED
@@ -2,14 +2,14 @@ module Joey
2
2
  class Profile < Model
3
3
  define_properties :id, :name
4
4
 
5
- #has_association :feed, "Post"
5
+ has_association :feed, "Post"
6
6
  #has_association :links, "Link"
7
7
  has_association :photos, "Photo"
8
8
  #has_association :groups, "Group"
9
9
  has_association :albums,"Album"
10
10
  #has_association :videos, "Video"
11
11
  #has_association :notes, "Note"
12
- #has_association :posts, "Post"
12
+ has_association :posts, "Post"
13
13
  #has_association :events, "Event"
14
14
  #has_association :links, "Link"
15
15
  has_association :statuses, "Status"
data/lib/joey/rest_api.rb CHANGED
@@ -10,12 +10,10 @@ module Joey
10
10
  module ClassMethods
11
11
  end
12
12
 
13
- # return the currently connected user
14
13
  def me
15
14
  get_and_map('me', Joey::User)
16
15
  end
17
16
 
18
- # revoke an extended permissions granted by current connected user
19
17
  def revoke_app_permission(ext_perm)
20
18
  # no need to boolianize. It returns true/false.
21
19
  self.rest_call("auth.revokeExtendedPermission", :perm => ext_perm.to_s)
@@ -35,11 +33,10 @@ module Joey
35
33
  map_data(data,klass)
36
34
  end
37
35
 
38
- # map the returned data to a node class
39
36
  def map_data(data, klass = nil)
40
37
  raise_error_if_necessary(data)
41
38
  hash_or_array = extract_hash_or_array(data, klass)
42
- hash_or_array = map_to_class(hash_or_array,klass) if klass
39
+ hash_or_array = map_to_class(hash_or_array, klass) if klass
43
40
  hash_or_array
44
41
  end
45
42
 
@@ -85,7 +82,7 @@ module Joey
85
82
 
86
83
  def determine_class(klass_or_klasses, data)
87
84
  klasses = Array(klass_or_klasses).map { |k| constantize_string(k)}
88
- klasses.detect {|klass| puts klass.inspect; klass.recognize?(data)} || klasses.first
85
+ klasses.detect {|klass| klass.recognize?(data)} || klasses.first
89
86
  end
90
87
 
91
88
  def raise_error_if_necessary(data)
data/lib/joey/user.rb CHANGED
@@ -2,13 +2,12 @@ module Joey
2
2
  class User < Profile
3
3
  include ParserHelpers
4
4
 
5
- # New Graph API has gender while old REST api has sex. I don't know why facebook does these kind of things.
6
- define_properties :first_name, :last_name, :middle_name, :link, :about, :about_me, :birthday, :gender, :sex,
5
+ define_properties :first_name, :last_name, :middle_name, :link, :about, :about_me, :birthday, :gender,
7
6
  :email, :website, :timezone, :updated_time, :verified, :religion, :political
8
7
  define_properties :pic_small, :pic_big, :pic_square, :pic, :pic_big_with_logo, :pic_small_with_logo,
9
8
  :pic_square_with_logo, :pic_with_logo
10
9
  define_properties :is_app_user, :books, :username, :significant_other_id, :meeting_for, :tv, :meeting_sex, :relationship_status
11
- define_properties :wall_count, :uid, :movies, :birthday_date, :notes_count, :activities, :profile_blurb, :music, :music, :locale
10
+ define_properties :wall_count, :uid, :movies, :sex, :birthday_date, :notes_count, :activities, :profile_blurb, :music, :music, :locale
12
11
  define_properties :profile_url, :profile_update_time, :interests, :is_blocked, :quotes
13
12
 
14
13
  def self.recognize?(hash)
@@ -30,22 +29,19 @@ module Joey
30
29
  hash_populating_accessor :family, "Relative"
31
30
 
32
31
  #has_association :activities,"Activity"
32
+ has_association :friends, "User"
33
+ has_association :home, "Post"
33
34
  #has_association :interests, "Interest"
34
35
  #has_association :music, "Music"
35
36
  #has_association :books, "Book"
36
37
  #has_association :movies, "Movie"
37
38
  has_association :television, "Television"
38
39
  has_association :likes, "Page"
39
- has_association :friends, "User"
40
40
 
41
- # Does the current user has an extender permission
42
41
  def has_app_permission?(ext_perm)
43
42
  boolianize(client.rest_call("users.hasAppPermission", :ext_perm => ext_perm.to_s))
44
43
  end
45
44
 
46
- # Get information about current user's friends.
47
- # A lot of information is not available in Graph api or is available but
48
- # only after making several requests to Facebook.
49
45
  def friends!(ids)
50
46
  data = self.client.rest_call('users.getInfo', :uids => ids, :fields =>
51
47
  'about_me,activities,affiliations,books,birthday,birthday_date,current_location,education_history,
data/lib/joey/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Joey #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 2
4
+ MINOR = 1
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 2
9
- version: 0.0.2
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Waseem Ahmad
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-22 00:00:00 +05:30
17
+ date: 2010-07-07 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -27,8 +27,10 @@ extensions: []
27
27
  extra_rdoc_files:
28
28
  - README.md
29
29
  - lib/joey.rb
30
+ - lib/joey/action.rb
30
31
  - lib/joey/affiliation.rb
31
32
  - lib/joey/album.rb
33
+ - lib/joey/comment.rb
32
34
  - lib/joey/education.rb
33
35
  - lib/joey/education_history.rb
34
36
  - lib/joey/fetching_array.rb
@@ -38,6 +40,8 @@ extra_rdoc_files:
38
40
  - lib/joey/page.rb
39
41
  - lib/joey/parser_helpers.rb
40
42
  - lib/joey/photo.rb
43
+ - lib/joey/post.rb
44
+ - lib/joey/privacy.rb
41
45
  - lib/joey/profile.rb
42
46
  - lib/joey/relative.rb
43
47
  - lib/joey/rest_api.rb
@@ -55,8 +59,10 @@ files:
55
59
  - init.rb
56
60
  - joey.gemspec
57
61
  - lib/joey.rb
62
+ - lib/joey/action.rb
58
63
  - lib/joey/affiliation.rb
59
64
  - lib/joey/album.rb
65
+ - lib/joey/comment.rb
60
66
  - lib/joey/education.rb
61
67
  - lib/joey/education_history.rb
62
68
  - lib/joey/fetching_array.rb
@@ -66,6 +72,8 @@ files:
66
72
  - lib/joey/page.rb
67
73
  - lib/joey/parser_helpers.rb
68
74
  - lib/joey/photo.rb
75
+ - lib/joey/post.rb
76
+ - lib/joey/privacy.rb
69
77
  - lib/joey/profile.rb
70
78
  - lib/joey/relative.rb
71
79
  - lib/joey/rest_api.rb