facebook-cli 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79f1f91e3545439c67240cb83896173701b4698a
4
- data.tar.gz: ee318f64b4a6498b904b6a40107414bcf90e5b93
3
+ metadata.gz: 063a8bcc4bb4a962c80ac15e05ec2499925eefa3
4
+ data.tar.gz: 151c977f71edbe195bd03c25c662054a4cf176fd
5
5
  SHA512:
6
- metadata.gz: 1c1bb9c89e8fbfb05ba4b718c7f17d4b1db805dc77a18c2b60cb7450eae516c305ba71434938c64bf725486edbe4ae2955ba02c020bee597bac03fd83d1c755d
7
- data.tar.gz: 8c8a0aeb0cdfd832cb4e95f2cafaec4de68b3cd4f417de7e19f8b35928edc96a561756ebf0386ae68ce544ccea129c33abce9c9c63277d5b9e6f355752cdecbe
6
+ metadata.gz: 9696c883248c1ef9046207d33eddfe86193143575c9d9493f109eb0e295a092c4e179b55433b521c177cb68375a312fa1b874c1aa8f232da3ae585b690b05a58
7
+ data.tar.gz: '095299b209206ad56fa53bb0dfb00753e79a137b9e357b1320b3977809fb6c920361cef4b98edc88a4d2da19bdc69030e8b533b3de62c148b7092fc5b5c002a3'
data/lib/fbcli.rb CHANGED
@@ -259,28 +259,32 @@ command :links do |c|
259
259
  end
260
260
  end
261
261
 
262
- desc "Post a message or image to a page, a group or your timeline"
262
+ TO_FLAG_DESC = 'ID or alias of page or group to post to (use "me" for timeline)'
263
+ TO_COMMAND_DESC = 'to your timeline, a page or a group'
264
+
265
+ desc "Post a message or image " + TO_COMMAND_DESC
263
266
  arg_name "message"
264
267
  long_desc %(
265
- Facebook advises: photos should be less than 4 MB and saved as JPG, PNG, GIF or TIFF files.
268
+ Facebook recommends: photos should be less than 4 MB and saved as JPG, PNG, GIF or TIFF files.
266
269
  )
267
270
  command :post do |c|
271
+ c.flag [:to], :desc => TO_FLAG_DESC, :default_value => 'me'
268
272
  c.flag [:i, :image], :desc => 'File or URL of image to post'
269
273
  c.action do |global_options, options, args|
270
274
  if not options['image'].nil?
271
- full_post_id = FBCLI::publish_image args[0], options['image']
275
+ full_post_id = FBCLI::publish_image options['to'], args[0], options['image']
272
276
  else
273
- full_post_id = FBCLI::publish_post args[0]
277
+ full_post_id = FBCLI::publish_post options['to'], args[0]
274
278
  end
275
279
 
276
280
  puts "Your post: #{link_to_post full_post_id}"
277
281
  end
278
282
  end
279
283
 
280
- desc "Post a video to your timeline"
284
+ desc "Post a video " + TO_COMMAND_DESC
281
285
  arg_name "message"
282
286
  long_desc %(
283
- Facebook advises: aspect ratio must be between 9x16 and 16x9. The following formats are
287
+ Facebook recommends: aspect ratio must be between 9x16 and 16x9. The following formats are
284
288
  supported:
285
289
 
286
290
  3g2, 3gp, 3gpp, asf, avi, dat, divx, dv, f4v, flv, m2ts, m4v,
@@ -288,10 +292,11 @@ long_desc %(
288
292
  ts, vob, and wmv
289
293
  )
290
294
  command :postvideo do |c|
295
+ c.flag [:to], :desc => TO_FLAG_DESC, :default_value => 'me'
291
296
  c.flag [:v, :video], :desc => 'File or URL of video'
292
297
  c.flag [:t, :title], :desc => 'Title'
293
298
  c.action do |global_options, options, args|
294
- video_id = FBCLI::publish_video args[0], options['video'], options['title']
299
+ video_id = FBCLI::publish_video options['to'], args[0], options['video'], options['title']
295
300
  puts "Your post: #{link video_id}"
296
301
  puts "Edit your video: #{link "video/edit/?v=#{video_id}"}"
297
302
  puts
@@ -299,9 +304,10 @@ command :postvideo do |c|
299
304
  end
300
305
  end
301
306
 
302
- desc "Post a link to your timeline"
307
+ desc "Post a link " + TO_COMMAND_DESC
303
308
  arg_name "url"
304
309
  command :postlink do |c|
310
+ c.flag [:to], :desc => TO_FLAG_DESC, :default_value => 'me'
305
311
  c.flag [:m, :message], :desc => 'Main message'
306
312
  c.flag [:n, :name], :desc => 'Link name'
307
313
  c.flag [:d, :description], :desc => 'Link description'
@@ -316,7 +322,7 @@ command :postlink do |c|
316
322
  "picture" => options['image']
317
323
  }
318
324
 
319
- full_post_id = FBCLI::publish_post options['message'], link_metadata
325
+ full_post_id = FBCLI::publish_post options['to'], options['message'], link_metadata
320
326
 
321
327
  puts "Your post: #{link_to_post full_post_id}"
322
328
  end
@@ -94,25 +94,25 @@ Run: #{APP_NAME} login
94
94
  end
95
95
  end
96
96
 
97
- def self.publish_post(msg, link_metadata = {})
97
+ def self.publish_post(target, msg, link_metadata = {})
98
98
  result = api_call lambda { |api|
99
- api.put_wall_post(msg, link_metadata)
99
+ api.put_wall_post(msg, link_metadata, target)
100
100
  }
101
101
 
102
102
  result['id']
103
103
  end
104
104
 
105
- def self.publish_image(msg, image_file_or_url)
105
+ def self.publish_image(target, msg, image_file_or_url)
106
106
  result = api_call lambda { |api|
107
- api.put_picture(image_file_or_url, {:message => msg})
107
+ api.put_picture(image_file_or_url, {:message => msg}, target)
108
108
  }
109
109
 
110
110
  result['post_id']
111
111
  end
112
112
 
113
- def self.publish_video(msg, video_file_or_url, title = nil)
113
+ def self.publish_video(target, msg, video_file_or_url, title = nil)
114
114
  result = api_call lambda { |api|
115
- api.put_video(video_file_or_url, {:title => title, :description => msg})
115
+ api.put_video(video_file_or_url, {:title => title, :description => msg}, target)
116
116
  }
117
117
 
118
118
  result['id']
data/lib/fbcli/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FBCLI
2
- VERSION = '1.5.5'
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ildar Sagdejev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-08 00:00:00.000000000 Z
11
+ date: 2017-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: koala
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.2'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.2'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement