class Connectwise::Opportunity
Attributes
age[RW]
business_unit[RW]
close_probablity[RW]
closed[RW]
estimated_total[RW]
expected_close_date[RW]
id[RW]
location[RW]
lost[RW]
lost_amount[RW]
margin[RW]
marketing_campaign_name[RW]
open_amount[RW]
opportunity_name[RW]
primary_sales_rep[RW]
product_amount[RW]
rating[RW]
recurring_total[RW]
secondary_sales_rep[RW]
service_amount[RW]
source[RW]
stage_name[RW]
status[RW]
type[RW]
won[RW]
won_amount[RW]
Private Class Methods
transform(attrs)
click to toggle source
# File lib/connectwise/opportunity.rb, line 50 def self.transform(attrs) name = attrs.delete(:name) || attrs.delete(:opportunity_name) attrs[:opportunity_name] = name if name attrs end
where_transform(attrs)
click to toggle source
# File lib/connectwise/opportunity.rb, line 56 def self.where_transform(attrs) name = attrs.delete(:name) || attrs.delete(:opportunity_name) attrs[:opportunity_name] = name if name attrs end
Public Instance Methods
company=(company)
click to toggle source
# File lib/connectwise/opportunity.rb, line 9 def company=(company) @company = company end
company_id()
click to toggle source
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)
# 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)
click to toggle source
# File lib/connectwise/opportunity.rb, line 13 def contact=(contact) @contact = contact end
contact_id()
click to toggle source
# 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
Private Instance Methods
to_cw_h()
click to toggle source
Calls superclass method
Connectwise::Model#to_cw_h
# File lib/connectwise/opportunity.rb, line 41 def to_cw_h attrs = super attrs.delete('CompanyId') attrs.delete('ContactId') attrs['Company'] = {'CompanyID' => company_id} if @company attrs['Contact'] = {'Id' => contact_id} if @contact attrs end