# Band registration form for Norsk Urskog Metal Sampler # Copyright (C) 2015-2018 Harald Eilersen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . module BandFactory def create_band_params(options = {}) opts = { :songs => 1, :name => 'Band name', :city => 'Somewhere', :website => 'http://bandsite.com', :label => 'A Record Label', :bio => 'A short bio about the band', :contact_name => 'Contact Name', :contact_street => "Streetname 666", :contact_postcode => "1234", :contact_city => "Someplace Nice", :contact_phone => '98765432', :contact_email => 'band@example.com', :members => "Member 1 (Instrument 1, 24\nMember 2 (Instrument 2)\nMember 3", }.merge(options) num_songs = opts.delete(:songs) params = { 'name' => opts[:name], 'city' => opts[:city], 'website' => opts[:website], 'label' => opts[:label], 'shortbio' => opts[:bio], 'contact' => { 'name' => opts[:contact_name], 'street' => opts[:contact_street], 'postcode' => opts[:contact_postcode], 'city' => opts[:contact_city], 'phone' => opts[:contact_phone], 'email' => opts[:contact_email] }, 'members' => opts[:members], 'songs' => {} } (1..num_songs).each do |i| num = i.to_s params['songs'][num] = create_song_params end params end def create_song_params { 'title' => 'A song title', 'time' => '02:30', 'isrc' => '', 'performers' => "Performer 1\nPerformer 2\nPerformer 3", 'composers' => "Composer 1\nComposer 2", 'notes' => 'Some notes' } end end