131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/mockws/crud_manager.rb', line 131
def self.configure(service)
@@service = service
unless configuration.settings.services.select {|key,value| value[:type] == :crud }.empty? then
@@store = MockWS::Store::new
output.info "Mock CRUD initialisation : "
configuration.settings.services.select {|key,value| value[:type] == :crud }.each do |_key, definition|
@@store.add_model definition: definition
output.item "Create JSON CRUD for #{definition[:object]}"
output.arrow "GET /crud/#{definition[:object]}/list"
output.arrow "GET /crud/#{definition[:object]}/<KEY>"
output.arrow "POST /crud/#{definition[:object]} [JSON BODY]"
output.arrow "PUT /crud/#{definition[:object]} [JSON BODY]"
output.arrow "DELETE /crud/#{definition[:object]}/<KEY> "
end
create_crud_service
end
end
|