Class: Geo::Service::Orcamento

Inherits:
Object
  • Object
show all
Defined in:
lib/geo-core/service/orcamento_service.rb

Class Method Summary collapse

Class Method Details

.novoObject



8
9
10
# File 'lib/geo-core/service/orcamento_service.rb', line 8

def self.novo
	return Geo::Domain::Orcamento.new
end

.salvar(params) ⇒ Object

FIXME fazer tratamento de errors



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/geo-core/service/orcamento_service.rb', line 13

def self.salvar(params)
	begin
		orcamento = Geo::Domain::Orcamento.new params
		raise orcamento.errors unless orcamento.valid? 
		orcamento.save
		orcamento.itens= Array.new
		orcamento.itens.push criar_itens params[:itens_attributes]
		return orcamento
	rescue Exception => e
		raise e
	end					
end