lib/portatext/command/base.rb in portatext-1.5.10 vs lib/portatext/command/base.rb in portatext-1.5.11

- old
+ new

@@ -35,16 +35,18 @@ self end def content_type(_method) return 'text/csv' unless @args[:file].nil? + return 'audio/mpeg' unless @args[:sound_file].nil? 'application/json' end def accept_content_type(_method) return '*/*' unless @args[:accept_any_file].nil? return 'text/csv' unless @args[:accept_file].nil? + return 'audio/mpeg' unless @args[:accept_sound_file].nil? 'application/json' end def body(_method) return "file:#{@args[:file]}" unless @args[:file].nil? @@ -56,20 +58,24 @@ @args = {} end private + # rubocop:disable Metrics/MethodLength def run(method) a_type = accept_content_type method command_endpoint = endpoint(method) file = @args[:accept_file] file ||= @args[:accept_any_file] + file ||= @args[:accept_sound_file] @args.delete :accept_file @args.delete :accept_any_file + @args.delete :accept_sound_file @client.run( command_endpoint, method, content_type(method), a_type, body(method), file ) end + # rubocop:enable Metrics/MethodLength end end end