Class: Geostats::Commands::Push
- Inherits:
-
Base
- Object
- Base
- Geostats::Commands::Push
show all
- Defined in:
- lib/geostats/commands/push.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #invoke
Instance Method Details
#after ⇒ Object
17
18
19
|
# File 'lib/geostats/commands/push.rb', line 17
def after
logout
end
|
#before ⇒ Object
12
13
14
15
|
# File 'lib/geostats/commands/push.rb', line 12
def before
connect_database
login
end
|
#parse_args ⇒ Object
8
9
10
|
# File 'lib/geostats/commands/push.rb', line 8
def parse_args
raise UsageError unless @args.length.zero?
end
|
#run ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/geostats/commands/push.rb', line 21
def run
log yellow("Generating statistics")
@html = Generator.generate
log "\r", green("Successfully generated statistics"), erase, "\n"
log yellow("Pushing statistics to geocaching.com")
resp, data = HTTP.post("/account/editprofiledetails.aspx", {
"ctl00$ContentBody$uxProfileDetails" => @html,
"ctl00$ContentBody$uxSave" => "Save Changes"
})
log "\r",
green("Successfully pushed statistics to geocaching.com"),
erase, "\n"
rescue Net::HTTPExceptions => e
error e.message
end
|
#usage ⇒ Object
4
5
6
|
# File 'lib/geostats/commands/push.rb', line 4
def usage
STDERR.puts "Usage: geostats push"
end
|