geppetto 0.9.7 → 0.9.8
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.
- data/lib/geppetto.rb +5 -2
- data/lib/geppetto/cli.rb +21 -0
- data/lib/geppetto/version.rb +1 -1
- metadata +4 -4
data/lib/geppetto.rb
CHANGED
|
@@ -49,17 +49,20 @@ module Geppetto
|
|
|
49
49
|
http.use_ssl = true if private_request
|
|
50
50
|
|
|
51
51
|
result = http.start do |http|
|
|
52
|
-
Geppetto.log("#{verb.upcase} #{path} #{encode_params(args)}")
|
|
53
52
|
response, body = if verb == "post"
|
|
54
53
|
if params_require_multipart? args
|
|
54
|
+
Geppetto.log("curl -i -X #{verb.upcase} (multi-part-params) 'http#{http.use_ssl? ? 's':''}://#{http.address}:#{http.port}#{path}'")
|
|
55
55
|
http.request Net::HTTP::Post::Multipart.new path, encode_multipart_params(args)
|
|
56
56
|
else
|
|
57
|
+
params = encode_params(args).split('&').collect {|param| "-d #{param} " }
|
|
58
|
+
Geppetto.log("curl -i -X #{verb.upcase} #{params.to_s} 'http#{http.use_ssl? ? 's':''}://#{http.address}:#{http.port}#{path}'")
|
|
57
59
|
http.post(path, encode_params(args))
|
|
58
60
|
end
|
|
59
61
|
else
|
|
62
|
+
Geppetto.log("curl -i -X #{verb.upcase} 'http#{http.use_ssl? ? 's':''}://#{http.address}:#{http.port}#{path}?#{encode_params(args)}'")
|
|
60
63
|
http.get("#{path}?#{encode_params(args)}")
|
|
61
64
|
end
|
|
62
|
-
Geppetto.log("#{response.code
|
|
65
|
+
Geppetto.log("#{response.code} #{body}") if response.code.to_i != 200
|
|
63
66
|
Koala::Response.new(response.code.to_i, body, response)
|
|
64
67
|
end
|
|
65
68
|
end
|
data/lib/geppetto/cli.rb
CHANGED
|
@@ -73,6 +73,27 @@ module Geppetto
|
|
|
73
73
|
def befriend(id1, id2)
|
|
74
74
|
@test_users.befriend(get_user_hash(id1), get_user_hash(id2))
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
desc "befriend_all", "Friend all users with each other"
|
|
78
|
+
def befriend_all
|
|
79
|
+
if yes? "Are you sure you want to befriend ALL existing test users (this could take a while)?", :red
|
|
80
|
+
users = get_test_users
|
|
81
|
+
friends = users.clone
|
|
82
|
+
users.each do |user|
|
|
83
|
+
# Remove this user from list of friends
|
|
84
|
+
friends.delete_at(0)
|
|
85
|
+
# befriend all the others
|
|
86
|
+
friends.each do |friend|
|
|
87
|
+
say "Befriending #{user['id']} #{friend['id']}"
|
|
88
|
+
begin
|
|
89
|
+
@test_users.befriend(user, friend)
|
|
90
|
+
rescue Facebook::APIError => e
|
|
91
|
+
say "Problem befriending: #{e}", :red
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
76
97
|
|
|
77
98
|
desc "wall_post ID TEXT", "Post to the user's wall"
|
|
78
99
|
def wall_post(id, text)
|
data/lib/geppetto/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geppetto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 43
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
|
-
-
|
|
10
|
-
version: 0.9.
|
|
9
|
+
- 8
|
|
10
|
+
version: 0.9.8
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Georges Auberger
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-06-08 00:00:00 -07:00
|
|
19
19
|
default_executable: geppetto
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|