module Idonethis::UseCases module New 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") log.call "args: #{args}" parse internet.post( Idonethis::Index.dones, { "Authorization" => "Token #{credential[:token]}", accept: "application/json"}, { "raw_text" => args[:message], "team" => credential[:team]}) end private def parse(reply) require 'json' JSON.parse(reply.body) end end end end