Class: Connectwise::Opportunity

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/connectwise/connectwise.rb,
lib/connectwise/opportunity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Model

#defined_attributes, #destroy, included, #initialize, #persisted?, #save, #to_h

Instance Attribute Details

#ageObject

Returns the value of attribute age.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def age
  @age
end

#business_unitObject

Returns the value of attribute business_unit.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def business_unit
  @business_unit
end

#close_probablityObject

Returns the value of attribute close_probablity.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def close_probablity
  @close_probablity
end

#closedObject

Returns the value of attribute closed.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def closed
  @closed
end

#estimated_totalObject

Returns the value of attribute estimated_total.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def estimated_total
  @estimated_total
end

#expected_close_dateObject

Returns the value of attribute expected_close_date.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def expected_close_date
  @expected_close_date
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def id
  @id
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def location
  @location
end

#lostObject

Returns the value of attribute lost.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def lost
  @lost
end

#lost_amountObject

Returns the value of attribute lost_amount.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def lost_amount
  @lost_amount
end

#marginObject

Returns the value of attribute margin.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def margin
  @margin
end

#marketing_campaign_nameObject

Returns the value of attribute marketing_campaign_name.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def marketing_campaign_name
  @marketing_campaign_name
end

#open_amountObject

Returns the value of attribute open_amount.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def open_amount
  @open_amount
end

#opportunity_nameObject

Returns the value of attribute opportunity_name.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def opportunity_name
  @opportunity_name
end

#primary_sales_repObject

Returns the value of attribute primary_sales_rep.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def primary_sales_rep
  @primary_sales_rep
end

#product_amountObject

Returns the value of attribute product_amount.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def product_amount
  @product_amount
end

#ratingObject

Returns the value of attribute rating.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def rating
  @rating
end

#recurring_totalObject

Returns the value of attribute recurring_total.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def recurring_total
  @recurring_total
end

#secondary_sales_repObject

Returns the value of attribute secondary_sales_rep.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def secondary_sales_rep
  @secondary_sales_rep
end

#service_amountObject

Returns the value of attribute service_amount.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def service_amount
  @service_amount
end

#sourceObject

Returns the value of attribute source.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def source
  @source
end

#stage_nameObject

Returns the value of attribute stage_name.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def stage_name
  @stage_name
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def status
  @status
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def type
  @type
end

#wonObject

Returns the value of attribute won.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def won
  @won
end

#won_amountObject

Returns the value of attribute won_amount.



6
7
8
# File 'lib/connectwise/opportunity.rb', line 6

def won_amount
  @won_amount
end

Instance Method Details

#company=(company) ⇒ Object



9
10
11
# File 'lib/connectwise/opportunity.rb', line 9

def company=(company)
  @company = company
end

#company_idObject

TODO - These two id methods are both hacky - should have a contact or company object Probably need two different objects, one for finds, and another for gets (need to confirm save and get return the same thing)



19
20
21
22
23
24
25
26
27
# File 'lib/connectwise/opportunity.rb', line 19

def company_id
  if @company.respond_to?(:to_hash)
    @company.fetch(:company_id) { @company }
  elsif @company.respond_to?(:company_id)
    @company.company_id
  else
    @company
  end
end

#contact=(contact) ⇒ Object



13
14
15
# File 'lib/connectwise/opportunity.rb', line 13

def contact=(contact)
  @contact = contact
end

#contact_idObject



29
30
31
32
33
34
35
36
37
# File 'lib/connectwise/opportunity.rb', line 29

def contact_id
  if @contact.respond_to?(:to_hash)
    @contact.fetch(:contact_rec_id) { @contact }
  elsif @contact.respond_to?(:id)
    @contact.id
  else
    @contact
  end
end