fb_joy 0.1.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.
@@ -0,0 +1,15 @@
1
+ module Joey
2
+ class Status < Model
3
+ define_properties :time, :status_id, :message
4
+
5
+ def validate
6
+ valid = true
7
+ end
8
+
9
+ def valid?
10
+ self.validate
11
+ puts self.errors.inspect unless self.errors.empty?
12
+ self.errors.empty?
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Joey
2
+ class Tag < Model
3
+ define_properties :id, :name, :x, :y, :created_time
4
+
5
+ def validate
6
+ created_time.to_time rescue errors << { :message => 'created_time is not compatible' }
7
+ end
8
+
9
+ def valid?
10
+ self.validate
11
+ puts self.errors.inspect unless self.errors.empty?
12
+ self.errors.empty?
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Joey
2
+ class Television < Model
3
+ define_properties :name, :category, :id
4
+
5
+ def validate
6
+ valid = true
7
+ end
8
+
9
+ def valid?
10
+ self.validate
11
+ puts self.errors.inspect unless self.errors.empty?
12
+ self.errors.empty?
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,83 @@
1
+ require 'joey/parser_helpers'
2
+
3
+ module Joey
4
+ class User < Profile
5
+ include Joey::ParserHelpers
6
+
7
+ define_properties :first_name, :last_name, :middle_name, :link, :about, :about_me, :birthday, :gender,
8
+ :email, :website, :timezone, :updated_time, :verified, :religion, :political
9
+ define_properties :pic_small, :pic_big, :pic_square, :pic, :pic_big_with_logo, :pic_small_with_logo,
10
+ :pic_square_with_logo, :pic_with_logo, :picture
11
+ define_properties :is_app_user, :books, :username, :significant_other_id, :meeting_for, :tv, :meeting_sex, :relationship_status
12
+ define_properties :wall_count, :uid, :movies, :sex, :birthday_date, :notes_count, :activities, :profile_blurb, :music, :locale
13
+ define_properties :profile_url, :profile_update_time, :interests, :is_blocked, :quotes, :interested_in, :bio
14
+ define_properties :start_time # Hack to check if it is an event
15
+
16
+ def self.recognize?(hash)
17
+ !hash.has_key?("category")
18
+ end
19
+
20
+ hash_populating_accessor :status, "Status"
21
+ hash_populating_accessor :work, "Work"
22
+ hash_populating_accessor :work_history, "WorkHistory"
23
+ hash_populating_accessor :education, "Education"
24
+ hash_populating_accessor :education_history, "EducationHistory"
25
+
26
+ hash_populating_accessor :location, "Page"
27
+ hash_populating_accessor :current_location, "Location"
28
+ hash_populating_accessor :hometown, "Page"
29
+ hash_populating_accessor :hometown_location, "Location"
30
+ hash_populating_accessor :hs_info, "HsInfo"
31
+ hash_populating_accessor :affiliations, "Affiliation"
32
+ hash_populating_accessor :family, "Relative"
33
+
34
+ #has_association :activities,"Activity"
35
+ has_association :friends, "User"
36
+ has_association :home, "Post"
37
+ #has_association :interests, "Interest"
38
+ #has_association :music, "Music"
39
+ #has_association :books, "Book"
40
+ #has_association :movies, "Movie"
41
+ has_association :television, "Television"
42
+ has_association :likes, "Page"
43
+
44
+ def has_app_permission?(ext_perm)
45
+ permissions = client.get_object('me/permissions', {})['data'].first
46
+ boolianize(permissions[ext_perm])
47
+ end
48
+
49
+ def friends!(ids)
50
+ data = self.client.rest_call('users.getInfo', :uids => ids, :fields =>
51
+ 'about_me,activities,affiliations,books,birthday,birthday_date,current_location,education_history,
52
+ email,family,first_name,hometown_location,hs_info,interests,is_app_user,is_blocked,last_name,
53
+ locale,meeting_for,meeting_sex,movies,music,name,notes_count,pic,pic_big,pic_small,pic_square,
54
+ pic_with_logo,pic_big_with_logo,pic_small_with_logo,pic_square_with_logo,
55
+ political,profile_blurb,profile_update_time,profile_url,quotes,relationship_status,religion,sex,
56
+ significant_other_id,status,timezone,tv,username,wall_count,website,work_history')
57
+ self.client.map_data(data, self.class)
58
+ end
59
+
60
+ def info(args)
61
+ data = self.client.rest_call('users.getInfo', :uids => self.id, :fields => args.join(','))
62
+ user = self.client.map_data(data, self.class).first
63
+ user.id = self.id
64
+ user
65
+ end
66
+
67
+ def validate
68
+ errors << { :message => 'id should not be nil' } if id.nil?
69
+ errors << { :message => "name should be string but is #{name.inspect}" } unless name.is_a?(String)
70
+ errors << { :message => "gender should be 'male' or 'female' but is #{gender.inspect}" } unless ['male', 'female', nil].include?(gender)
71
+ errors << { :message => "pic big is neither string nor nil but is #{pic_big.inspect}" } unless pic_big.is_a?(String) || pic_big.nil?
72
+ errors << { :message => "current location is neither Joey::Location nor nil but is #{current_location.inspect}" } unless current_location.is_a?(Joey::Location) || current_location.nil?
73
+ errors << { :message => "Facebook is an idiot. This is an event instead of a Joey::User or Joey::Page" } unless start_time.nil?
74
+ # updated_time.to_time rescue errors << { :message => 'updated_time is not compatible' }
75
+ end
76
+
77
+ def valid?
78
+ self.validate
79
+ puts self.errors.inspect unless self.errors.empty?
80
+ self.errors.empty?
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,9 @@
1
+ module Joey #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ module Joey
2
+ class Video < Model
3
+
4
+ define_properties :id, :name, :description, :length, :created_time,
5
+ :updated_time, :icon, :picture, :embed_html, :caption, :link, :source, :likes
6
+
7
+ hash_populating_accessor :from, "User", "Page"
8
+ hash_populating_accessor :tags, "Tag"
9
+
10
+ has_association :comments, "Comment"
11
+
12
+ def validate
13
+ self.errors = []
14
+ end
15
+
16
+ def valid?
17
+ self.validate
18
+ puts self.errors.inspect unless self.errors.empty?
19
+ self.errors.empty?
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ module Joey
2
+ class Work < Model
3
+
4
+ define_properties :start_date, :end_date, :description
5
+
6
+ hash_populating_accessor :employer, "Page"
7
+ hash_populating_accessor :location, "Page"
8
+ hash_populating_accessor :position, "Page"
9
+
10
+ def validate
11
+ valid = true
12
+ end
13
+
14
+ def valid?
15
+ self.validate
16
+ puts self.errors.inspect unless self.errors.empty?
17
+ self.errors.empty?
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module Joey
2
+ class WorkHistory < Model
3
+ define_properties :start_date, :position, :company_name, :description, :end_date
4
+
5
+ hash_populating_accessor :location, "Location"
6
+
7
+ def validate
8
+ valid = true
9
+ end
10
+
11
+ def valid?
12
+ self.validate
13
+ puts self.errors.inspect unless self.errors.empty?
14
+ self.errors.empty?
15
+ end
16
+
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fb_joy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Waseem Ahmad
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hashie
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 2.3.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.6.3
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.6.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0.5'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0.5'
94
+ description: Object wrappers for nodes in the Facebook OpenGraph
95
+ email: talk.to.waseem@gmail.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files:
99
+ - LICENSE
100
+ - README.md
101
+ files:
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - VERSION
108
+ - fb_joy.gemspec
109
+ - lib/fb_joy.rb
110
+ - lib/joey/action.rb
111
+ - lib/joey/affiliation.rb
112
+ - lib/joey/album.rb
113
+ - lib/joey/comment.rb
114
+ - lib/joey/education.rb
115
+ - lib/joey/education_history.rb
116
+ - lib/joey/fetching_array.rb
117
+ - lib/joey/hs_info.rb
118
+ - lib/joey/image.rb
119
+ - lib/joey/like.rb
120
+ - lib/joey/location.rb
121
+ - lib/joey/model.rb
122
+ - lib/joey/page.rb
123
+ - lib/joey/parser_helpers.rb
124
+ - lib/joey/photo.rb
125
+ - lib/joey/post.rb
126
+ - lib/joey/privacy.rb
127
+ - lib/joey/profile.rb
128
+ - lib/joey/property.rb
129
+ - lib/joey/relative.rb
130
+ - lib/joey/rest_api.rb
131
+ - lib/joey/status.rb
132
+ - lib/joey/tag.rb
133
+ - lib/joey/television.rb
134
+ - lib/joey/user.rb
135
+ - lib/joey/version.rb
136
+ - lib/joey/video.rb
137
+ - lib/joey/work.rb
138
+ - lib/joey/work_history.rb
139
+ homepage: http://github.com/kristianmandrup/joey
140
+ licenses:
141
+ - MIT
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ none: false
148
+ requirements:
149
+ - - ! '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ segments:
153
+ - 0
154
+ hash: 3548198302155452458
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.24
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: Ruby Wrapper API for Facebook OpenGraph
167
+ test_files: []