lib/idonethis/use_cases/new.rb in idonethis-cli-0.14.2 vs lib/idonethis/use_cases/new.rb in idonethis-cli-0.15.0
- old
+ new
@@ -3,20 +3,29 @@
class << self
def apply(credential, args={})
log = args[:log] || fail("You need to supply :internet adapter")
internet = args[:internet] || fail("You need to supply :internet adapter")
team = args[:team]
+ date = args[:date]
log.call "args: #{args}"
log.call "overriding team <#{credential[:team]}> with <#{team}>"
+
+ body = {
+ "raw_text" => args[:message],
+ "team" => (team || credential[:team])
+ }
+
+ body = body.merge({"done_date" => Time.parse(date).strftime("%F")}) if date
+
+ log.call body
parse internet.post(
Idonethis::Index.dones,
{ "Authorization" => "Token #{credential[:token]}", accept: "application/json"},
- {
- "raw_text" => args[:message],
- "team" => (team || credential[:team])})
+ body
+ )
end
private
def parse(reply)
@@ -24,6 +33,6 @@
JSON.parse(reply.body)
end
end
end
-end
\ No newline at end of file
+end