facebook-cli 1.4.13 → 1.4.15
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 +30 -3
- data/lib/fbcli/facebook.rb +21 -4
- data/lib/fbcli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b27d241e4fc8f53ea0148f5506ab4c7548d7f0
|
4
|
+
data.tar.gz: 15249f89d1a9feed9ba6e4c14c70fb1742c926f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 835ef2849eb37b4c4c5869bbc31248be910ccf812d30000887defd9d9f98256378dbedf39d12d6311636756cd58f254a3d5d1716f127aff348a6d6ac5a4fe824
|
7
|
+
data.tar.gz: 95c1dea98a1e7811c55f2dcdfd6f6673aead703a233fdb0654cdb28c7c0bbdd815bf1a826a538963fd2aa974533f50867f6297c40e24a132387dcdc01aca609d
|
data/lib/fbcli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'gli'
|
2
2
|
require 'yaml'
|
3
|
+
require 'json'
|
3
4
|
require 'fbcli/auth'
|
4
5
|
require 'fbcli/version'
|
5
6
|
require 'fbcli/facebook'
|
@@ -148,12 +149,38 @@ command :logout do |c|
|
|
148
149
|
end
|
149
150
|
end
|
150
151
|
|
151
|
-
desc "
|
152
|
+
desc "Make a Facebook API request"
|
153
|
+
arg_name "request"
|
154
|
+
long_desc %(
|
155
|
+
This is similar to the online tool:
|
156
|
+
|
157
|
+
https://developers.facebook.com/tools/explorer
|
158
|
+
|
159
|
+
For example, try:
|
160
|
+
|
161
|
+
#{APP_NAME} api "165795193558366?fields=name,about,website"
|
162
|
+
|
163
|
+
To view the list of valid fields you can request, ask for the metadata:
|
164
|
+
|
165
|
+
#{APP_NAME} api "165795193558366?metadata=1"
|
166
|
+
|
167
|
+
Some valid requests may not be honored due to insufficient permissions, which were established during the authentication process.
|
168
|
+
)
|
169
|
+
command :api do |c|
|
170
|
+
c.switch [:raw], :desc => 'Output unformatted JSON', :negatable => false
|
171
|
+
c.action do |global_options, options, args|
|
172
|
+
res = FBCLI::raw_request args[0]
|
173
|
+
res = JSON.pretty_generate res unless options['raw']
|
174
|
+
puts res
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
desc "Show your profile information"
|
152
179
|
command :me do |c|
|
153
180
|
c.action do
|
154
181
|
FBCLI::request_object "me" do |data|
|
155
|
-
puts "Name: #{data["name"]}"
|
156
|
-
puts "
|
182
|
+
puts "Name: #{data["name"]} (#{data["id"]})"
|
183
|
+
puts "Picture: http://graph.facebook.com/#{data["id"]}/picture?type=large"
|
157
184
|
end
|
158
185
|
end
|
159
186
|
end
|
data/lib/fbcli/facebook.rb
CHANGED
@@ -32,8 +32,16 @@ module FBCLI
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.raw_request(req)
|
36
|
+
api_call lambda { |api|
|
37
|
+
api.graph_call req
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
35
41
|
def self.logout
|
36
|
-
api_call lambda { |api|
|
42
|
+
api_call lambda { |api|
|
43
|
+
api.delete_object("me/permissions")
|
44
|
+
}
|
37
45
|
end
|
38
46
|
|
39
47
|
def self.request_token_info
|
@@ -83,17 +91,26 @@ module FBCLI
|
|
83
91
|
end
|
84
92
|
|
85
93
|
def self.publish_post(msg, link_metadata = {})
|
86
|
-
result = api_call lambda { |api|
|
94
|
+
result = api_call lambda { |api|
|
95
|
+
api.put_wall_post(msg, link_metadata)
|
96
|
+
}
|
97
|
+
|
87
98
|
result['id']
|
88
99
|
end
|
89
100
|
|
90
101
|
def self.publish_image(msg, image_file_or_url)
|
91
|
-
result = api_call lambda { |api|
|
102
|
+
result = api_call lambda { |api|
|
103
|
+
api.put_picture(image_file_or_url, {:message => msg})
|
104
|
+
}
|
105
|
+
|
92
106
|
result['post_id']
|
93
107
|
end
|
94
108
|
|
95
109
|
def self.publish_video(msg, video_file_or_url, title = nil)
|
96
|
-
result = api_call lambda { |api|
|
110
|
+
result = api_call lambda { |api|
|
111
|
+
api.put_video(video_file_or_url, {:title => title, :description => msg})
|
112
|
+
}
|
113
|
+
|
97
114
|
result['id']
|
98
115
|
end
|
99
116
|
end
|
data/lib/fbcli/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ildar Sagdejev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: koala
|