Class: Backdrop::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/backdrop/builders/builder.rb

Instance Method Summary collapse

Instance Method Details

#build_response(output, project, data, response) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/backdrop/builders/builder.rb', line 3

def build_response(output, project, data, response)
  file = data['requests'].first['request_path']
  method = data['http_method'].downcase
  path = File.dirname file
  filename = File.basename file
  filepath = File.join(output, project, path)
  FileUtils.mkdir_p filepath
  File.write("#{File.join(filepath, filename)}.#{method}", response)
end