Class: QuoteBuilder::ProjectCreator

Inherits:
Object
  • Object
show all
Defined in:
app/services/quote_builder/project_creator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(party) ⇒ ProjectCreator

Returns a new instance of ProjectCreator.



14
15
16
# File 'app/services/quote_builder/project_creator.rb', line 14

def initialize(party)
  @party = party
end

Class Method Details

.call(party) ⇒ Object



10
11
12
# File 'app/services/quote_builder/project_creator.rb', line 10

def self.call(party)
  new(party).call
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
# File 'app/services/quote_builder/project_creator.rb', line 18

def call
  @party.save
  customer.save
  project = customer.opportunities.create(opportunity_attributes)
  @party.save
  project
end