facebook-cli 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fbcli.rb +45 -2
- data/lib/fbcli/auth.rb +1 -1
- data/lib/fbcli/format.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b43e88b0462f22b153e6b31aa3f14ab6e3129aab
|
4
|
+
data.tar.gz: 3b39f775a897e4e5c9ab3cb7bb0310ddbcd28092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8730da7429b2dcb7c57677bb450083430fbac028962cc042ff0be74031dd9eaf7f6d075918d231be046ad6f7368a8cd77313f35cf3c4d6fb87deb726a30c9570
|
7
|
+
data.tar.gz: 4149d6345806ee902dfb37947f485a80bd7d1c50a548d02fc0d1e542de14b93f93b75c58e568d2836a2e829868b1f3d183b3f178269dcac21b9d1802e4739cbe
|
data/lib/fbcli.rb
CHANGED
@@ -11,7 +11,7 @@ include GLI::App
|
|
11
11
|
|
12
12
|
program_desc "Facebook command line interface"
|
13
13
|
|
14
|
-
version '1.
|
14
|
+
version '1.2.0'
|
15
15
|
|
16
16
|
flag [:token], :desc => 'Provide Facebook access token', :required => false
|
17
17
|
flag [:format], :desc => 'Output format (values: text, html)', :default_value => "text"
|
@@ -44,7 +44,9 @@ formattable_commands = [
|
|
44
44
|
:feed,
|
45
45
|
:friends,
|
46
46
|
:photos,
|
47
|
-
:photosof
|
47
|
+
:photosof,
|
48
|
+
:events,
|
49
|
+
:pastevents
|
48
50
|
]
|
49
51
|
|
50
52
|
def save_config
|
@@ -208,4 +210,45 @@ command :photosof do |c|
|
|
208
210
|
end
|
209
211
|
end
|
210
212
|
|
213
|
+
def list_events(global_options, past = false)
|
214
|
+
now = Time.new
|
215
|
+
|
216
|
+
FBCLI::page_items global_options, "events" do |item|
|
217
|
+
starts = Time.parse(item['start_time'])
|
218
|
+
|
219
|
+
if (past and starts < now) ^ (not past and starts > now)
|
220
|
+
unless item['end_time'].nil?
|
221
|
+
ends = Time.parse(item['end_time'])
|
222
|
+
duration = ends - starts
|
223
|
+
end
|
224
|
+
|
225
|
+
FBCLI::write "#{item['name']} (#{item['id']})"
|
226
|
+
FBCLI::write
|
227
|
+
FBCLI::write "Location: #{item['place']['name']}" unless item['place'].nil?
|
228
|
+
FBCLI::write "Date: #{FBCLI::date(item['start_time'])}"
|
229
|
+
FBCLI::write "Duration: #{duration / 3600} hours" if defined?(duration) and not duration.nil?
|
230
|
+
FBCLI::write "RSVP: #{item['rsvp_status'].sub(/unsure/, "maybe")}"
|
231
|
+
FBCLI::write
|
232
|
+
FBCLI::write FBCLI::link "events/#{item['id']}"
|
233
|
+
FBCLI::write
|
234
|
+
FBCLI::write item['description']
|
235
|
+
FBCLI::write "---------------------------------"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
desc "List your upcoming events"
|
241
|
+
command :events do |c|
|
242
|
+
c.action do |global_options,options,args|
|
243
|
+
list_events global_options
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
desc "List your past events"
|
248
|
+
command :pastevents do |c|
|
249
|
+
c.action do |global_options,options,args|
|
250
|
+
list_events global_options, true
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
211
254
|
exit run(ARGV)
|
data/lib/fbcli/auth.rb
CHANGED
@@ -9,7 +9,7 @@ module FBCLI
|
|
9
9
|
def self.listen_for_auth_code(port, app_id, app_secret)
|
10
10
|
uri = "https://www.facebook.com/dialog/oauth?client_id=#{app_id}" +
|
11
11
|
"&redirect_uri=http://localhost:#{port}/" +
|
12
|
-
"&scope=user_likes,user_friends,user_photos,user_posts"
|
12
|
+
"&scope=user_likes,user_friends,user_photos,user_posts,user_events"
|
13
13
|
|
14
14
|
puts "Please open: #{uri}"
|
15
15
|
puts
|
data/lib/fbcli/format.rb
CHANGED