class Parsers::AudioFileListResponse

Attributes

error[RW]
list[RW]
success[RW]

Public Class Methods

new(body) click to toggle source
# File lib/slybroadcast/parsers/audio_file_list_response.rb, line 7
def initialize(body)
  @list = []
  response_parse(body)
end

Public Instance Methods

failed?() click to toggle source
# File lib/slybroadcast/parsers/audio_file_list_response.rb, line 12
def failed?
  not success?
end
success?() click to toggle source
# File lib/slybroadcast/parsers/audio_file_list_response.rb, line 16
def success?
  success
end

Private Instance Methods

response_parse(body) click to toggle source
# File lib/slybroadcast/parsers/audio_file_list_response.rb, line 22
def response_parse(body)
  response = body.split("\n")
  @success = response[0].strip != 'ERROR'
  @error = response[1].strip unless success

  @list = response.map do |line|
    system_file_name, audio_file_name, created = line.delete('\\"').split("|",3)
    {
      system_file_name: system_file_name,
      audio_file_name: audio_file_name,
      created: created
    }
  end
end