joey 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +26 -0
- data/README.md +3 -0
- data/Rakefile +16 -0
- data/devel.vim +342 -0
- data/init.rb +1 -0
- data/joey.gemspec +30 -0
- data/lib/joey/affiliation.rb +5 -0
- data/lib/joey/album.rb +12 -0
- data/lib/joey/education.rb +10 -0
- data/lib/joey/education_history.rb +5 -0
- data/lib/joey/fetching_array.rb +26 -0
- data/lib/joey/hs_info.rb +5 -0
- data/lib/joey/location.rb +5 -0
- data/lib/joey/model.rb +58 -0
- data/lib/joey/page.rb +20 -0
- data/lib/joey/parser_helpers.rb +7 -0
- data/lib/joey/photo.rb +9 -0
- data/lib/joey/profile.rb +21 -0
- data/lib/joey/relative.rb +5 -0
- data/lib/joey/rest_api.rb +99 -0
- data/lib/joey/status.rb +5 -0
- data/lib/joey/television.rb +6 -0
- data/lib/joey/user.rb +56 -0
- data/lib/joey/version.rb +9 -0
- data/lib/joey/work.rb +10 -0
- data/lib/joey/work_history.rb +7 -0
- data/lib/joey.rb +12 -0
- metadata +115 -0
data/Manifest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
README.md
|
2
|
+
Rakefile
|
3
|
+
devel.vim
|
4
|
+
init.rb
|
5
|
+
lib/joey.rb
|
6
|
+
lib/joey/affiliation.rb
|
7
|
+
lib/joey/album.rb
|
8
|
+
lib/joey/education.rb
|
9
|
+
lib/joey/education_history.rb
|
10
|
+
lib/joey/fetching_array.rb
|
11
|
+
lib/joey/hs_info.rb
|
12
|
+
lib/joey/location.rb
|
13
|
+
lib/joey/model.rb
|
14
|
+
lib/joey/page.rb
|
15
|
+
lib/joey/parser_helpers.rb
|
16
|
+
lib/joey/photo.rb
|
17
|
+
lib/joey/profile.rb
|
18
|
+
lib/joey/relative.rb
|
19
|
+
lib/joey/rest_api.rb
|
20
|
+
lib/joey/status.rb
|
21
|
+
lib/joey/television.rb
|
22
|
+
lib/joey/user.rb
|
23
|
+
lib/joey/version.rb
|
24
|
+
lib/joey/work.rb
|
25
|
+
lib/joey/work_history.rb
|
26
|
+
Manifest
|
data/README.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
Joey
|
2
|
+
====
|
3
|
+
Joey(<a href="http://github.com/waseem/joey">http://github.com/waseem/joey</a>) is object wrappers for nodes in the Facebook OpenGraph. It also provides wrapper for the data returned by requesting the facebook REST api. This gem depends upon Koala(<a href="http://github.com/arsduo/koala">http://github.com/arsduo/koala</a>).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
require 'lib/joey/version'
|
5
|
+
|
6
|
+
Echoe.new('joey') do |p|
|
7
|
+
p.version = Joey::VERSION::STRING
|
8
|
+
p.description = "Object wrappers for nodes in the Facebook OpenGraph"
|
9
|
+
p.url = "http://github.com/waseem/joey"
|
10
|
+
p.author = "Waseem Ahmad"
|
11
|
+
p.email = "talk.to.waseem@gmail.com"
|
12
|
+
p.ignore_pattern = ["tmp/*", "script/*", 'pkg/*']
|
13
|
+
p.development_dependencies = []
|
14
|
+
end
|
15
|
+
|
16
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/devel.vim
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
let SessionLoad = 1
|
2
|
+
if &cp | set nocp | endif
|
3
|
+
let s:cpo_save=&cpo
|
4
|
+
set cpo&vim
|
5
|
+
inoremap <silent> <S-Tab> =BackwardsSnippet()
|
6
|
+
snoremap <silent> i<Right>=TriggerSnippet()
|
7
|
+
snoremap b<BS>
|
8
|
+
noremap <PageDown>
|
9
|
+
snoremap % b<BS>%
|
10
|
+
snoremap ' b<BS>'
|
11
|
+
nmap <silent> ,cI :call NERDComment(0, "prepend")
|
12
|
+
nmap <silent> ,cA :call NERDComment(0, "append")
|
13
|
+
nnoremap <silent> ,c$ :call NERDComment(0, "toEOL")
|
14
|
+
vnoremap <silent> ,cu :call NERDComment(1, "uncomment")
|
15
|
+
nnoremap <silent> ,cu :call NERDComment(0, "uncomment")
|
16
|
+
vnoremap <silent> ,cn :call NERDComment(1, "nested")
|
17
|
+
nnoremap <silent> ,cn :call NERDComment(0, "nested")
|
18
|
+
vnoremap <silent> ,cb :call NERDComment(1, "alignBoth")
|
19
|
+
nnoremap <silent> ,cb :call NERDComment(0, "alignBoth")
|
20
|
+
vnoremap <silent> ,cr :call NERDComment(1, "alignRight")
|
21
|
+
nnoremap <silent> ,cr :call NERDComment(0, "alignRight")
|
22
|
+
vnoremap <silent> ,cl :call NERDComment(1, "alignLeft")
|
23
|
+
nnoremap <silent> ,cl :call NERDComment(0, "alignLeft")
|
24
|
+
vmap <silent> ,cy :call NERDComment(1, "yank")
|
25
|
+
nmap <silent> ,cy :call NERDComment(0, "yank")
|
26
|
+
vnoremap <silent> ,ci :call NERDComment(1, "invert")
|
27
|
+
nnoremap <silent> ,ci :call NERDComment(0, "invert")
|
28
|
+
vnoremap <silent> ,cs :call NERDComment(1, "sexy")
|
29
|
+
nnoremap <silent> ,cs :call NERDComment(0, "sexy")
|
30
|
+
vnoremap <silent> ,cm :call NERDComment(1, "minimal")
|
31
|
+
nnoremap <silent> ,cm :call NERDComment(0, "minimal")
|
32
|
+
vnoremap <silent> ,c :call NERDComment(1, "toggle")
|
33
|
+
nnoremap <silent> ,c :call NERDComment(0, "toggle")
|
34
|
+
vnoremap <silent> ,cc :call NERDComment(1, "norm")
|
35
|
+
nnoremap <silent> ,cc :call NERDComment(0, "norm")
|
36
|
+
nnoremap ; l
|
37
|
+
xmap S <Plug>VSurround
|
38
|
+
snoremap U b<BS>U
|
39
|
+
vmap [% [%m'gv``
|
40
|
+
snoremap \ b<BS>\
|
41
|
+
vmap ]% ]%m'gv``
|
42
|
+
snoremap ^ b<BS>^
|
43
|
+
snoremap ` b<BS>`
|
44
|
+
vmap a% [%v]%
|
45
|
+
noremap b ^
|
46
|
+
nmap cs <Plug>Csurround
|
47
|
+
nmap ds <Plug>Dsurround
|
48
|
+
nmap gx <Plug>NetrwBrowseX
|
49
|
+
noremap h b
|
50
|
+
nnoremap j h
|
51
|
+
nnoremap k j
|
52
|
+
nnoremap l k
|
53
|
+
map n :tabnew
|
54
|
+
xmap s <Plug>Vsurround
|
55
|
+
nmap ySS <Plug>YSsurround
|
56
|
+
nmap ySs <Plug>YSsurround
|
57
|
+
nmap yss <Plug>Yssurround
|
58
|
+
nmap yS <Plug>YSurround
|
59
|
+
nmap ys <Plug>Ysurround
|
60
|
+
snoremap <Left> bi
|
61
|
+
snoremap <Right> a
|
62
|
+
snoremap <BS> b<BS>
|
63
|
+
snoremap <silent> <S-Tab> i<Right>=BackwardsSnippet()
|
64
|
+
nnoremap <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0)
|
65
|
+
nmap <silent> <F12> <Plug>ToggleProject
|
66
|
+
nnoremap <BS> <PageUp>
|
67
|
+
xnoremap <BS> <PageUp>
|
68
|
+
onoremap <BS> <PageUp>
|
69
|
+
inoremap <silent> <BS>:call NERDComment(0, "insert")
|
70
|
+
imap S <Plug>ISurround
|
71
|
+
imap s <Plug>Isurround
|
72
|
+
inoremap <silent> =TriggerSnippet()
|
73
|
+
inoremap <silent> =ShowAvailableSnips()
|
74
|
+
imap <Plug>Isurround
|
75
|
+
imap ;k
|
76
|
+
imap j;
|
77
|
+
abbr adn and
|
78
|
+
abbr itn int
|
79
|
+
abbr teh the
|
80
|
+
let &cpo=s:cpo_save
|
81
|
+
unlet s:cpo_save
|
82
|
+
set autoindent
|
83
|
+
set background=dark
|
84
|
+
set backspace=indent,eol,start
|
85
|
+
set cindent
|
86
|
+
set expandtab
|
87
|
+
set fileencodings=ucs-bom,utf-8,default,latin1
|
88
|
+
set helplang=en
|
89
|
+
set history=50
|
90
|
+
set hlsearch
|
91
|
+
set ignorecase
|
92
|
+
set incsearch
|
93
|
+
set nomodeline
|
94
|
+
set printoptions=paper:a4
|
95
|
+
set ruler
|
96
|
+
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
|
97
|
+
set shiftwidth=2
|
98
|
+
set smartcase
|
99
|
+
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
|
100
|
+
set tabstop=2
|
101
|
+
set whichwrap=h,l,~,[,]
|
102
|
+
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
|
103
|
+
let v:this_session=expand("<sfile>:p")
|
104
|
+
silent only
|
105
|
+
cd ~/Repositories/MyRails/joey
|
106
|
+
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
107
|
+
let s:wipebuf = bufnr('%')
|
108
|
+
endif
|
109
|
+
set shortmess=aoO
|
110
|
+
badd +0 lib/joey/rest_api.rb
|
111
|
+
badd +0 lib/joey/user.rb
|
112
|
+
args lib/joey/rest_api.rb
|
113
|
+
edit lib/joey/rest_api.rb
|
114
|
+
set splitbelow splitright
|
115
|
+
set nosplitbelow
|
116
|
+
set nosplitright
|
117
|
+
wincmd t
|
118
|
+
set winheight=1 winwidth=1
|
119
|
+
argglobal
|
120
|
+
setlocal keymap=
|
121
|
+
setlocal noarabic
|
122
|
+
setlocal autoindent
|
123
|
+
setlocal balloonexpr=RubyBalloonexpr()
|
124
|
+
setlocal nobinary
|
125
|
+
setlocal bufhidden=
|
126
|
+
setlocal buflisted
|
127
|
+
setlocal buftype=
|
128
|
+
setlocal cindent
|
129
|
+
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
|
130
|
+
setlocal cinoptions=
|
131
|
+
setlocal cinwords=if,else,while,do,for,switch
|
132
|
+
setlocal comments=:#
|
133
|
+
setlocal commentstring=#\ %s
|
134
|
+
setlocal complete=.,w,b,u,t,i
|
135
|
+
setlocal completefunc=
|
136
|
+
setlocal nocopyindent
|
137
|
+
setlocal nocursorcolumn
|
138
|
+
setlocal nocursorline
|
139
|
+
setlocal define=
|
140
|
+
setlocal dictionary=
|
141
|
+
setlocal nodiff
|
142
|
+
setlocal equalprg=
|
143
|
+
setlocal errorformat=
|
144
|
+
setlocal expandtab
|
145
|
+
if &filetype != 'ruby'
|
146
|
+
setlocal filetype=ruby
|
147
|
+
endif
|
148
|
+
setlocal foldcolumn=0
|
149
|
+
setlocal foldenable
|
150
|
+
setlocal foldexpr=0
|
151
|
+
setlocal foldignore=#
|
152
|
+
setlocal foldlevel=0
|
153
|
+
setlocal foldmarker={{{,}}}
|
154
|
+
setlocal foldmethod=manual
|
155
|
+
setlocal foldminlines=1
|
156
|
+
setlocal foldnestmax=20
|
157
|
+
setlocal foldtext=foldtext()
|
158
|
+
setlocal formatexpr=
|
159
|
+
setlocal formatoptions=croql
|
160
|
+
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
161
|
+
setlocal grepprg=
|
162
|
+
setlocal iminsert=2
|
163
|
+
setlocal imsearch=2
|
164
|
+
setlocal include=^\\s*\\<\\(load\\|w*require\\)\\>
|
165
|
+
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
|
166
|
+
setlocal indentexpr=GetRubyIndent()
|
167
|
+
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,=end,=elsif,=when,=ensure,=rescue,==begin,==end
|
168
|
+
setlocal noinfercase
|
169
|
+
setlocal iskeyword=@,48-57,_,192-255
|
170
|
+
setlocal keywordprg=ri
|
171
|
+
setlocal nolinebreak
|
172
|
+
setlocal nolisp
|
173
|
+
setlocal nolist
|
174
|
+
setlocal makeprg=
|
175
|
+
setlocal matchpairs=(:),{:},[:]
|
176
|
+
setlocal nomodeline
|
177
|
+
setlocal modifiable
|
178
|
+
setlocal nrformats=octal,hex
|
179
|
+
set number
|
180
|
+
setlocal number
|
181
|
+
setlocal numberwidth=4
|
182
|
+
setlocal omnifunc=rubycomplete#Complete
|
183
|
+
setlocal path=.,/usr/lib/ruby/gems/1.8/gems/json_pure-1.2.0/bin,/usr/lib/ruby/gems/1.8/gems/json_pure-1.2.0/lib,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/bin,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/lib,/usr/local/lib/site_ruby/1.8,/usr/local/lib/site_ruby/1.8/i486-linux,/usr/local/lib/site_ruby/1.8/i386-linux,/usr/local/lib/site_ruby,/usr/lib/ruby/vendor_ruby/1.8,/usr/lib/ruby/vendor_ruby/1.8/i486-linux,/usr/lib/ruby/vendor_ruby,/usr/lib/ruby/1.8,/usr/lib/ruby/1.8/i486-linux,/usr/lib/ruby/1.8/i386-linux,,~/.gem/ruby/1.8/gems/ryanb-acts-as-list-0.1.2/lib,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/ext,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/lib,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/lib/case_sensitive_require,/usr/lib/ruby/gems/1.8/gems/Selenium-1.1.14/lib,/usr/lib/ruby/gems/1.8/gems/ZenTest-4.1.3/lib,/usr/lib/ruby/gems/1.8/gems/abstract-1.0.0/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/addressable-2.1.2/lib,/usr/lib/ruby/gems/1.8/gems/adzap-ar_mailer-2.1.5/lib,/usr/lib/ruby/gems/1.8/gems/arel-0.2.1/lib,/usr/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.3.104/lib,/usr/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.3.11.6/lib,/usr/lib/ruby/gems/1.8/gems/aub-record_filter-0.9.12/lib,/usr/lib/ruby/gems/1.8/gems/authlogic-2.1.1/lib,/usr/lib/ruby/gems/1.8/gems/bmabey-email_spec-0.2.0/lib,/usr/lib/ruby/gems/1.8/gems/bmabey-email_spec-0.3.4/lib,/usr/lib/ruby/gems/1.8/gems/builder-2.1.2/lib,/usr/lib/ruby/gems/1.8/gems/bundler-0.9.6/lib,/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib,/usr/lib/ruby/gems/1.8/gems/cgi_multipart_eof_fix-2.5.0/lib,/usr/lib/ruby/gems/1.8/gems/chrislloyd-gravtastic-2.1.3/lib,/usr/lib/ruby/gems/1.8/gems/cldwalker-hirb-0.2.5/lib,/usr/lib/ruby/gems/1.8/gems/columnize-0.3.0/lib,/usr/lib/ruby/gems/1.8/gems/configuration-1.1.0/lib,/usr/lib/ruby/gems/1.8/gems/crack-0.1.6/lib,/usr/lib/ruby/gems/1.8/gems/cucumber-0.5.3/lib,/usr/lib/ruby/gems/1.8/gems/cucumber-rails-0.2.2/lib,/usr/lib/ruby/gems/1.8/gems/curb-0.4.8.0/ext,/usr/lib/ruby/gems/1.8/gems/curb-0.4.8.0/lib,/usr/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib,/usr/lib/ruby/gems/1.8/gems/database_cleaner-0.4.0/lib,/usr/lib/ruby/gems/1.8/gems/diff-lcs-1.1.2/lib,/usr/lib/ruby/gems/1.8/gems/echoe-3.1.1/lib,/usr/lib/ruby/gems/1.8/gems/echoe-4.3.1/lib,/usr/lib/ruby/gems/1.8/gems/erubis-2.6.5/lib,/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib,/usr/lib/ruby/gems/1.8/gems/facebooker-1.0.61/lib,/usr/lib/ruby/gems/1.8/gems/facebooker-1.0.64/lib,/usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.0/lib,/usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/ext,/usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/lib,/usr/lib/ruby/gems/1.8/gems/flexmock-0.8.6/lib,/usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/lib,/usr/lib/ruby/gems/1.8/gems/gravtastic-2.2.0/lib,/usr/lib/ruby/gems/1.8/gems/grit-1.1.1/lib,/usr/lib/ruby/gems/1.8/gems/hashie-0.2.0/lib,/usr/lib/ruby/gems/1.8/gems/heroku-1.6.5/lib,/usr/lib/ruby/gems/1.8/gems/highline-1.5.1/lib,/usr/lib/ruby/gems/1.8/gems/hoe-2.3.0/lib,/usr/lib/ruby/gems/1.8/gems/httparty-0.5.2/lib,/usr/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib,/usr/lib/ruby/gems/1.8/gems/json-1.1.6/ext,/usr/lib/ruby/gems/1.8/gems/json-1.1.6/ext/json/ext,/usr/lib/ruby/gems
|
184
|
+
setlocal nopreserveindent
|
185
|
+
setlocal nopreviewwindow
|
186
|
+
setlocal quoteescape=\\
|
187
|
+
setlocal noreadonly
|
188
|
+
setlocal norightleft
|
189
|
+
setlocal rightleftcmd=search
|
190
|
+
setlocal noscrollbind
|
191
|
+
setlocal shiftwidth=2
|
192
|
+
setlocal noshortname
|
193
|
+
setlocal nosmartindent
|
194
|
+
setlocal softtabstop=0
|
195
|
+
setlocal nospell
|
196
|
+
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
197
|
+
setlocal spellfile=
|
198
|
+
setlocal spelllang=en
|
199
|
+
setlocal statusline=
|
200
|
+
setlocal suffixesadd=.rb
|
201
|
+
setlocal swapfile
|
202
|
+
setlocal synmaxcol=3000
|
203
|
+
if &syntax != 'ruby'
|
204
|
+
setlocal syntax=ruby
|
205
|
+
endif
|
206
|
+
setlocal tabstop=2
|
207
|
+
setlocal tags=
|
208
|
+
setlocal textwidth=0
|
209
|
+
setlocal thesaurus=
|
210
|
+
setlocal nowinfixheight
|
211
|
+
setlocal nowinfixwidth
|
212
|
+
setlocal wrap
|
213
|
+
setlocal wrapmargin=0
|
214
|
+
silent! normal! zE
|
215
|
+
let s:l = 40 - ((35 * winheight(0) + 18) / 36)
|
216
|
+
if s:l < 1 | let s:l = 1 | endif
|
217
|
+
exe s:l
|
218
|
+
normal! zt
|
219
|
+
40
|
220
|
+
normal! 0
|
221
|
+
tabedit lib/joey/user.rb
|
222
|
+
set splitbelow splitright
|
223
|
+
set nosplitbelow
|
224
|
+
set nosplitright
|
225
|
+
wincmd t
|
226
|
+
set winheight=1 winwidth=1
|
227
|
+
argglobal
|
228
|
+
setlocal keymap=
|
229
|
+
setlocal noarabic
|
230
|
+
setlocal autoindent
|
231
|
+
setlocal balloonexpr=RubyBalloonexpr()
|
232
|
+
setlocal nobinary
|
233
|
+
setlocal bufhidden=
|
234
|
+
setlocal buflisted
|
235
|
+
setlocal buftype=
|
236
|
+
setlocal cindent
|
237
|
+
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
|
238
|
+
setlocal cinoptions=
|
239
|
+
setlocal cinwords=if,else,while,do,for,switch
|
240
|
+
setlocal comments=:#
|
241
|
+
setlocal commentstring=#\ %s
|
242
|
+
setlocal complete=.,w,b,u,t,i
|
243
|
+
setlocal completefunc=
|
244
|
+
setlocal nocopyindent
|
245
|
+
setlocal nocursorcolumn
|
246
|
+
setlocal nocursorline
|
247
|
+
setlocal define=
|
248
|
+
setlocal dictionary=
|
249
|
+
setlocal nodiff
|
250
|
+
setlocal equalprg=
|
251
|
+
setlocal errorformat=
|
252
|
+
setlocal expandtab
|
253
|
+
if &filetype != 'ruby'
|
254
|
+
setlocal filetype=ruby
|
255
|
+
endif
|
256
|
+
setlocal foldcolumn=0
|
257
|
+
setlocal foldenable
|
258
|
+
setlocal foldexpr=0
|
259
|
+
setlocal foldignore=#
|
260
|
+
setlocal foldlevel=0
|
261
|
+
setlocal foldmarker={{{,}}}
|
262
|
+
setlocal foldmethod=manual
|
263
|
+
setlocal foldminlines=1
|
264
|
+
setlocal foldnestmax=20
|
265
|
+
setlocal foldtext=foldtext()
|
266
|
+
setlocal formatexpr=
|
267
|
+
setlocal formatoptions=croql
|
268
|
+
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
269
|
+
setlocal grepprg=
|
270
|
+
setlocal iminsert=2
|
271
|
+
setlocal imsearch=2
|
272
|
+
setlocal include=^\\s*\\<\\(load\\|w*require\\)\\>
|
273
|
+
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
|
274
|
+
setlocal indentexpr=GetRubyIndent()
|
275
|
+
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,=end,=elsif,=when,=ensure,=rescue,==begin,==end
|
276
|
+
setlocal noinfercase
|
277
|
+
setlocal iskeyword=@,48-57,_,192-255
|
278
|
+
setlocal keywordprg=ri
|
279
|
+
setlocal nolinebreak
|
280
|
+
setlocal nolisp
|
281
|
+
setlocal nolist
|
282
|
+
setlocal makeprg=
|
283
|
+
setlocal matchpairs=(:),{:},[:]
|
284
|
+
setlocal nomodeline
|
285
|
+
setlocal modifiable
|
286
|
+
setlocal nrformats=octal,hex
|
287
|
+
set number
|
288
|
+
setlocal number
|
289
|
+
setlocal numberwidth=4
|
290
|
+
setlocal omnifunc=rubycomplete#Complete
|
291
|
+
setlocal path=.,/usr/lib/ruby/gems/1.8/gems/json_pure-1.2.0/bin,/usr/lib/ruby/gems/1.8/gems/json_pure-1.2.0/lib,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/bin,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/lib,/usr/local/lib/site_ruby/1.8,/usr/local/lib/site_ruby/1.8/i486-linux,/usr/local/lib/site_ruby/1.8/i386-linux,/usr/local/lib/site_ruby,/usr/lib/ruby/vendor_ruby/1.8,/usr/lib/ruby/vendor_ruby/1.8/i486-linux,/usr/lib/ruby/vendor_ruby,/usr/lib/ruby/1.8,/usr/lib/ruby/1.8/i486-linux,/usr/lib/ruby/1.8/i386-linux,,~/.gem/ruby/1.8/gems/ryanb-acts-as-list-0.1.2/lib,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/ext,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/lib,/usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.1/lib/case_sensitive_require,/usr/lib/ruby/gems/1.8/gems/Selenium-1.1.14/lib,/usr/lib/ruby/gems/1.8/gems/ZenTest-4.1.3/lib,/usr/lib/ruby/gems/1.8/gems/abstract-1.0.0/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/actionmailer-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activemodel-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activeresource-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib,/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib,/usr/lib/ruby/gems/1.8/gems/addressable-2.1.2/lib,/usr/lib/ruby/gems/1.8/gems/adzap-ar_mailer-2.1.5/lib,/usr/lib/ruby/gems/1.8/gems/arel-0.2.1/lib,/usr/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.3.104/lib,/usr/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.3.11.6/lib,/usr/lib/ruby/gems/1.8/gems/aub-record_filter-0.9.12/lib,/usr/lib/ruby/gems/1.8/gems/authlogic-2.1.1/lib,/usr/lib/ruby/gems/1.8/gems/bmabey-email_spec-0.2.0/lib,/usr/lib/ruby/gems/1.8/gems/bmabey-email_spec-0.3.4/lib,/usr/lib/ruby/gems/1.8/gems/builder-2.1.2/lib,/usr/lib/ruby/gems/1.8/gems/bundler-0.9.6/lib,/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.5/lib,/usr/lib/ruby/gems/1.8/gems/cgi_multipart_eof_fix-2.5.0/lib,/usr/lib/ruby/gems/1.8/gems/chrislloyd-gravtastic-2.1.3/lib,/usr/lib/ruby/gems/1.8/gems/cldwalker-hirb-0.2.5/lib,/usr/lib/ruby/gems/1.8/gems/columnize-0.3.0/lib,/usr/lib/ruby/gems/1.8/gems/configuration-1.1.0/lib,/usr/lib/ruby/gems/1.8/gems/crack-0.1.6/lib,/usr/lib/ruby/gems/1.8/gems/cucumber-0.5.3/lib,/usr/lib/ruby/gems/1.8/gems/cucumber-rails-0.2.2/lib,/usr/lib/ruby/gems/1.8/gems/curb-0.4.8.0/ext,/usr/lib/ruby/gems/1.8/gems/curb-0.4.8.0/lib,/usr/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib,/usr/lib/ruby/gems/1.8/gems/database_cleaner-0.4.0/lib,/usr/lib/ruby/gems/1.8/gems/diff-lcs-1.1.2/lib,/usr/lib/ruby/gems/1.8/gems/echoe-3.1.1/lib,/usr/lib/ruby/gems/1.8/gems/echoe-4.3.1/lib,/usr/lib/ruby/gems/1.8/gems/erubis-2.6.5/lib,/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib,/usr/lib/ruby/gems/1.8/gems/facebooker-1.0.61/lib,/usr/lib/ruby/gems/1.8/gems/facebooker-1.0.64/lib,/usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.0/lib,/usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/ext,/usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/lib,/usr/lib/ruby/gems/1.8/gems/flexmock-0.8.6/lib,/usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib,/usr/lib/ruby/gems/1.8/gems/gemcutter-0.4.1/lib,/usr/lib/ruby/gems/1.8/gems/gravtastic-2.2.0/lib,/usr/lib/ruby/gems/1.8/gems/grit-1.1.1/lib,/usr/lib/ruby/gems/1.8/gems/hashie-0.2.0/lib,/usr/lib/ruby/gems/1.8/gems/heroku-1.6.5/lib,/usr/lib/ruby/gems/1.8/gems/highline-1.5.1/lib,/usr/lib/ruby/gems/1.8/gems/hoe-2.3.0/lib,/usr/lib/ruby/gems/1.8/gems/httparty-0.5.2/lib,/usr/lib/ruby/gems/1.8/gems/i18n-0.3.5/lib,/usr/lib/ruby/gems/1.8/gems/json-1.1.6/ext,/usr/lib/ruby/gems/1.8/gems/json-1.1.6/ext/json/ext,/usr/lib/ruby/gems
|
292
|
+
setlocal nopreserveindent
|
293
|
+
setlocal nopreviewwindow
|
294
|
+
setlocal quoteescape=\\
|
295
|
+
setlocal noreadonly
|
296
|
+
setlocal norightleft
|
297
|
+
setlocal rightleftcmd=search
|
298
|
+
setlocal noscrollbind
|
299
|
+
setlocal shiftwidth=2
|
300
|
+
setlocal noshortname
|
301
|
+
setlocal nosmartindent
|
302
|
+
setlocal softtabstop=0
|
303
|
+
setlocal nospell
|
304
|
+
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
305
|
+
setlocal spellfile=
|
306
|
+
setlocal spelllang=en
|
307
|
+
setlocal statusline=
|
308
|
+
setlocal suffixesadd=.rb
|
309
|
+
setlocal swapfile
|
310
|
+
setlocal synmaxcol=3000
|
311
|
+
if &syntax != 'ruby'
|
312
|
+
setlocal syntax=ruby
|
313
|
+
endif
|
314
|
+
setlocal tabstop=2
|
315
|
+
setlocal tags=
|
316
|
+
setlocal textwidth=0
|
317
|
+
setlocal thesaurus=
|
318
|
+
setlocal nowinfixheight
|
319
|
+
setlocal nowinfixwidth
|
320
|
+
setlocal wrap
|
321
|
+
setlocal wrapmargin=0
|
322
|
+
silent! normal! zE
|
323
|
+
let s:l = 2 - ((1 * winheight(0) + 18) / 36)
|
324
|
+
if s:l < 1 | let s:l = 1 | endif
|
325
|
+
exe s:l
|
326
|
+
normal! zt
|
327
|
+
2
|
328
|
+
normal! 0
|
329
|
+
tabnext 2
|
330
|
+
if exists('s:wipebuf')
|
331
|
+
silent exe 'bwipe ' . s:wipebuf
|
332
|
+
endif
|
333
|
+
unlet! s:wipebuf
|
334
|
+
set winheight=1 winwidth=20 shortmess=filnxtToO
|
335
|
+
let s:sx = expand("<sfile>:p:r")."x.vim"
|
336
|
+
if file_readable(s:sx)
|
337
|
+
exe "source " . fnameescape(s:sx)
|
338
|
+
endif
|
339
|
+
let &so = s:so_save | let &siso = s:siso_save
|
340
|
+
doautoall SessionLoadPost
|
341
|
+
unlet SessionLoad
|
342
|
+
" vim: set ft=vim :
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'joey'
|
data/joey.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{joey}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Waseem Ahmad"]
|
9
|
+
s.date = %q{2010-06-16}
|
10
|
+
s.description = %q{Object wrappers for nodes in the Facebook OpenGraph}
|
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 = ["README.md", "Rakefile", "devel.vim", "init.rb", "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", "joey.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/waseem/joey}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Joey", "--main", "README.md"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{joey}
|
18
|
+
s.rubygems_version = %q{1.3.6}
|
19
|
+
s.summary = %q{Object wrappers for nodes in the Facebook OpenGraph}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/lib/joey/album.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Joey
|
2
|
+
class Album < Model
|
3
|
+
|
4
|
+
define_properties :id, :name, :description, :link, :count, :created_time, :updated_time, :privacy, :location
|
5
|
+
#creation_properties :name, :message
|
6
|
+
|
7
|
+
hash_populating_accessor :from, "User", "Page"
|
8
|
+
has_association :photos, "Photo"
|
9
|
+
#has_association :comments, "Comment"
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Joey
|
2
|
+
class FetchingArray < Array
|
3
|
+
attr_accessor :next_url, :previous_url, :client, :classes
|
4
|
+
|
5
|
+
def fetch_next
|
6
|
+
return [] if next_url.blank?
|
7
|
+
# FIXME: following only returns a hash like {"id"=>"http://graph.facebook.com/100000637452380/feed"}
|
8
|
+
# try to write a method in koala which can request absolute urls
|
9
|
+
additions = client.get_and_map_url(next_url, classes)
|
10
|
+
self.next_url = additions.next_url
|
11
|
+
self.concat(additions)
|
12
|
+
additions
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch_previous
|
16
|
+
return [] if previous_url.blank?
|
17
|
+
# FIXME: following only returns a hash like {"id"=>"http://graph.facebook.com/100000637452380/feed"}
|
18
|
+
# try to write a method in koala which can request absolute urls
|
19
|
+
additions = client.get_and_map_url(previous_url, classes)
|
20
|
+
self.previous_url = additions.previous_url
|
21
|
+
self.unshift(*additions)
|
22
|
+
additions
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/joey/hs_info.rb
ADDED
data/lib/joey/model.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
module Joey
|
2
|
+
class Model < Hashie::Dash
|
3
|
+
|
4
|
+
class KoalaClientRequiredError < Exception; end
|
5
|
+
|
6
|
+
attr_accessor :client
|
7
|
+
|
8
|
+
def initialize(hash = {}, client = nil)
|
9
|
+
self.client = client
|
10
|
+
super(hash || {})
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.define_properties(*args)
|
14
|
+
args.each do |arg|
|
15
|
+
property arg
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.recognize?(data)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.hash_populating_accessor(method_name, *klass)
|
24
|
+
define_method "#{method_name}=" do |hash|
|
25
|
+
instance_variable_set("@#{method_name}", client.map_data(hash, klass))
|
26
|
+
end
|
27
|
+
|
28
|
+
define_method "#{method_name}" do
|
29
|
+
instance_variable_get "@#{method_name}"
|
30
|
+
end
|
31
|
+
#add_creation_method(method_name,klass)
|
32
|
+
end
|
33
|
+
|
34
|
+
# TODO: Look out for creation of nodes in the Graph
|
35
|
+
# me = koala_client.me
|
36
|
+
# me.friends_create(args)
|
37
|
+
#def self.add_creation_method(name, klass)
|
38
|
+
#define_method "#{name}_create" do |arg|
|
39
|
+
#params = arg.nil? ? {} : arg.post_params
|
40
|
+
#klass_to_send = arg.nil? ? nil : klass
|
41
|
+
#client.post("#{id}/#{name}", klass_to_send, params)
|
42
|
+
#end
|
43
|
+
#end
|
44
|
+
|
45
|
+
def self.has_association(name, klass)
|
46
|
+
define_method(name) do
|
47
|
+
if (ret = instance_variable_get("@#{name}")).nil?
|
48
|
+
ret = client.get_and_map("#{id}/#{name}", klass)
|
49
|
+
instance_variable_set("@#{name}", ret)
|
50
|
+
end
|
51
|
+
return ret
|
52
|
+
end
|
53
|
+
|
54
|
+
#add_creation_method(name, klass)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
data/lib/joey/page.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Joey
|
2
|
+
class Page < Profile
|
3
|
+
|
4
|
+
define_properties :id, :name, :category, :username
|
5
|
+
|
6
|
+
# General
|
7
|
+
define_properties :fan_count, :link, :picture, :has_added_app
|
8
|
+
|
9
|
+
# Retail
|
10
|
+
define_properties :founded, :products, :mission, :company_overview
|
11
|
+
|
12
|
+
# Musicians
|
13
|
+
define_properties :record_label, :hometown, :band_members, :genre
|
14
|
+
|
15
|
+
def self.recognize?(hash)
|
16
|
+
hash.has_key?("category")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/joey/photo.rb
ADDED
data/lib/joey/profile.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Joey
|
2
|
+
class Profile < Model
|
3
|
+
define_properties :id, :name
|
4
|
+
|
5
|
+
#has_association :feed, "Post"
|
6
|
+
#has_association :links, "Link"
|
7
|
+
has_association :photos, "Photo"
|
8
|
+
#has_association :groups, "Group"
|
9
|
+
has_association :albums,"Album"
|
10
|
+
#has_association :videos, "Video"
|
11
|
+
#has_association :notes, "Note"
|
12
|
+
#has_association :posts, "Post"
|
13
|
+
#has_association :events, "Event"
|
14
|
+
#has_association :links, "Link"
|
15
|
+
has_association :statuses, "Status"
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Joey
|
2
|
+
module RestAPI
|
3
|
+
include ParserHelpers
|
4
|
+
class UnrecognizeableClassError < Exception; end
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
end
|
12
|
+
|
13
|
+
def me
|
14
|
+
get_and_map('me', Joey::User)
|
15
|
+
end
|
16
|
+
|
17
|
+
def revoke_app_permission(ext_perm)
|
18
|
+
# no need to boolianize. It returns true/false.
|
19
|
+
self.rest_call("auth.revokeExtendedPermission", :perm => ext_perm.to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
# path can be some node id in the Facebook Graph e.g. 'me', 'me/feed', '1234567890/feed'.
|
23
|
+
# klass is wrapper class for that node.
|
24
|
+
def get_and_map(path, klass = nil)
|
25
|
+
data = self.get_object(path)
|
26
|
+
map_data(data, klass)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_and_map_url(url, klass = nil)
|
30
|
+
# FIXME: following only returns a hash like {"id"=>"http://graph.facebook.com/100000637452380/feed"}
|
31
|
+
# try to write a method in koala which can request absolute Facebook urls. See fetching_array.rb:7.
|
32
|
+
data = self.class.get_object(url)
|
33
|
+
map_data(data,klass)
|
34
|
+
end
|
35
|
+
|
36
|
+
def map_data(data, klass = nil)
|
37
|
+
raise_error_if_necessary(data)
|
38
|
+
hash_or_array = extract_hash_or_array(data, klass)
|
39
|
+
hash_or_array = map_to_class(hash_or_array,klass) if klass
|
40
|
+
hash_or_array
|
41
|
+
end
|
42
|
+
|
43
|
+
def extract_hash_or_array(hash_or_array, klass)
|
44
|
+
return nil unless hash_or_array
|
45
|
+
return hash_or_array if hash_or_array.kind_of?(Array)
|
46
|
+
return extract_fetching_array(hash_or_array, klass) if hash_or_array.has_key?("data")
|
47
|
+
return hash_or_array
|
48
|
+
end
|
49
|
+
|
50
|
+
def extract_fetching_array(hash, klass)
|
51
|
+
f = Joey::FetchingArray.new
|
52
|
+
f.concat(hash["data"])
|
53
|
+
f.client = self
|
54
|
+
f.classes = Array(klass)
|
55
|
+
if hash["paging"]
|
56
|
+
f.next_url = hash["paging"]["next"]
|
57
|
+
f.previous_url = hash["paging"]["previous"]
|
58
|
+
end
|
59
|
+
f
|
60
|
+
end
|
61
|
+
|
62
|
+
def map_to_class(hash_or_array, klass)
|
63
|
+
return nil if hash_or_array.nil?
|
64
|
+
if hash_or_array.kind_of?(Array)
|
65
|
+
hash_or_array.map! {|elmnt| create_instance(klass, elmnt)}
|
66
|
+
else
|
67
|
+
hash_or_array = create_instance(klass, hash_or_array)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_instance(klass, data)
|
72
|
+
klass = determine_class(klass, data)
|
73
|
+
if klass.nil?
|
74
|
+
raise UnrecognizeableClassError.new("unable to recognize klass for #{klass.inspect} => #{data.inspect}")
|
75
|
+
end
|
76
|
+
klass.new(data, self)
|
77
|
+
end
|
78
|
+
|
79
|
+
def constantize_string(klass)
|
80
|
+
klass.is_a?(String) ? Joey.const_get(klass) : klass
|
81
|
+
end
|
82
|
+
|
83
|
+
def determine_class(klass_or_klasses, data)
|
84
|
+
klasses = Array(klass_or_klasses).map { |k| constantize_string(k)}
|
85
|
+
klasses.detect {|klass| puts klass.inspect; klass.recognize?(data)} || klasses.first
|
86
|
+
end
|
87
|
+
|
88
|
+
def raise_error_if_necessary(data)
|
89
|
+
if data.kind_of?(Hash)
|
90
|
+
if data.keys.size == 1 and data["error"]
|
91
|
+
type = data["error"]["type"]
|
92
|
+
message = data["error"]["message"]
|
93
|
+
raise Exception.new("#{type}: #{message}")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
data/lib/joey/status.rb
ADDED
data/lib/joey/user.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Joey
|
2
|
+
class User < Profile
|
3
|
+
include ParserHelpers
|
4
|
+
|
5
|
+
define_properties :first_name, :last_name, :middle_name, :link, :about, :about_me, :birthday, :gender,
|
6
|
+
:email, :website, :timezone, :updated_time, :verified, :religion, :political
|
7
|
+
define_properties :pic_small, :pic_big, :pic_square, :pic, :pic_big_with_logo, :pic_small_with_logo,
|
8
|
+
:pic_square_with_logo, :pic_with_logo
|
9
|
+
define_properties :is_app_user, :books, :username, :significant_other_id, :meeting_for, :tv, :meeting_sex, :relationship_status
|
10
|
+
define_properties :wall_count, :uid, :movies, :sex, :birthday_date, :notes_count, :activities, :profile_blurb, :music, :music, :locale
|
11
|
+
define_properties :profile_url, :profile_update_time, :interests, :is_blocked, :quotes
|
12
|
+
|
13
|
+
def self.recognize?(hash)
|
14
|
+
!hash.has_key?("category")
|
15
|
+
end
|
16
|
+
|
17
|
+
hash_populating_accessor :status, "Status"
|
18
|
+
hash_populating_accessor :work, "Work"
|
19
|
+
hash_populating_accessor :work_history, "WorkHistory"
|
20
|
+
hash_populating_accessor :education, "Education"
|
21
|
+
hash_populating_accessor :education_history, "EducationHistory"
|
22
|
+
|
23
|
+
hash_populating_accessor :location, "Page"
|
24
|
+
hash_populating_accessor :current_location, "Location"
|
25
|
+
hash_populating_accessor :hometown, "Page"
|
26
|
+
hash_populating_accessor :hometown_location, "Location"
|
27
|
+
hash_populating_accessor :hs_info, "HsInfo"
|
28
|
+
hash_populating_accessor :affiliations, "Affiliation"
|
29
|
+
hash_populating_accessor :family, "Relative"
|
30
|
+
|
31
|
+
#has_association :activities,"Activity"
|
32
|
+
has_association :friends, "User"
|
33
|
+
#has_association :interests, "Interest"
|
34
|
+
#has_association :music, "Music"
|
35
|
+
#has_association :books, "Book"
|
36
|
+
#has_association :movies, "Movie"
|
37
|
+
has_association :television, "Television"
|
38
|
+
has_association :likes, "Page"
|
39
|
+
|
40
|
+
def has_app_permission?(ext_perm)
|
41
|
+
boolianize(client.rest_call("users.hasAppPermission", :ext_perm => ext_perm.to_s))
|
42
|
+
end
|
43
|
+
|
44
|
+
def friends!(ids)
|
45
|
+
data = self.client.rest_call('users.getInfo', :uids => ids, :fields =>
|
46
|
+
'about_me,activities,affiliations,books,birthday,birthday_date,current_location,education_history,
|
47
|
+
email,family,first_name,hometown_location,hs_info,interests,is_app_user,is_blocked,last_name,
|
48
|
+
locale,meeting_for,meeting_sex,movies,music,name,notes_count,pic,pic_big,pic_small,pic_square,
|
49
|
+
pic_with_logo,pic_big_with_logo,pic_small_with_logo,pic_square_with_logo,
|
50
|
+
political,profile_blurb,profile_update_time,profile_url,quotes,relationship_status,religion,sex,
|
51
|
+
significant_other_id,status,timezone,tv,username,wall_count,website,work_history')
|
52
|
+
self.client.map_data(data, self.class)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/joey/version.rb
ADDED
data/lib/joey/work.rb
ADDED
data/lib/joey.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: joey
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Waseem Ahmad
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-16 00:00:00 +05:30
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Object wrappers for nodes in the Facebook OpenGraph
|
22
|
+
email: talk.to.waseem@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.md
|
29
|
+
- lib/joey.rb
|
30
|
+
- lib/joey/affiliation.rb
|
31
|
+
- lib/joey/album.rb
|
32
|
+
- lib/joey/education.rb
|
33
|
+
- lib/joey/education_history.rb
|
34
|
+
- lib/joey/fetching_array.rb
|
35
|
+
- lib/joey/hs_info.rb
|
36
|
+
- lib/joey/location.rb
|
37
|
+
- lib/joey/model.rb
|
38
|
+
- lib/joey/page.rb
|
39
|
+
- lib/joey/parser_helpers.rb
|
40
|
+
- lib/joey/photo.rb
|
41
|
+
- lib/joey/profile.rb
|
42
|
+
- lib/joey/relative.rb
|
43
|
+
- lib/joey/rest_api.rb
|
44
|
+
- lib/joey/status.rb
|
45
|
+
- lib/joey/television.rb
|
46
|
+
- lib/joey/user.rb
|
47
|
+
- lib/joey/version.rb
|
48
|
+
- lib/joey/work.rb
|
49
|
+
- lib/joey/work_history.rb
|
50
|
+
files:
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- devel.vim
|
54
|
+
- init.rb
|
55
|
+
- lib/joey.rb
|
56
|
+
- lib/joey/affiliation.rb
|
57
|
+
- lib/joey/album.rb
|
58
|
+
- lib/joey/education.rb
|
59
|
+
- lib/joey/education_history.rb
|
60
|
+
- lib/joey/fetching_array.rb
|
61
|
+
- lib/joey/hs_info.rb
|
62
|
+
- lib/joey/location.rb
|
63
|
+
- lib/joey/model.rb
|
64
|
+
- lib/joey/page.rb
|
65
|
+
- lib/joey/parser_helpers.rb
|
66
|
+
- lib/joey/photo.rb
|
67
|
+
- lib/joey/profile.rb
|
68
|
+
- lib/joey/relative.rb
|
69
|
+
- lib/joey/rest_api.rb
|
70
|
+
- lib/joey/status.rb
|
71
|
+
- lib/joey/television.rb
|
72
|
+
- lib/joey/user.rb
|
73
|
+
- lib/joey/version.rb
|
74
|
+
- lib/joey/work.rb
|
75
|
+
- lib/joey/work_history.rb
|
76
|
+
- Manifest
|
77
|
+
- joey.gemspec
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/waseem/joey
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options:
|
84
|
+
- --line-numbers
|
85
|
+
- --inline-source
|
86
|
+
- --title
|
87
|
+
- Joey
|
88
|
+
- --main
|
89
|
+
- README.md
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 1
|
105
|
+
- 2
|
106
|
+
version: "1.2"
|
107
|
+
requirements: []
|
108
|
+
|
109
|
+
rubyforge_project: joey
|
110
|
+
rubygems_version: 1.3.6
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: Object wrappers for nodes in the Facebook OpenGraph
|
114
|
+
test_files: []
|
115
|
+
|