Class: ConnectWise::Opportunity

Inherits:
Object
  • Object
show all
Defined in:
lib/connectwise-ruby-sdk/models/opportunity.rb

Overview

A list of the member's currently assigned Opportunities

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Opportunity

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 175

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'expectedCloseDate')
    self.expected_close_date = attributes[:'expectedCloseDate']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'stage')
    self.stage = attributes[:'stage']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.has_key?(:'notes')
    self.notes = attributes[:'notes']
  end

  if attributes.has_key?(:'probability')
    self.probability = attributes[:'probability']
  end

  if attributes.has_key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.has_key?(:'rating')
    self.rating = attributes[:'rating']
  end

  if attributes.has_key?(:'campaign')
    self.campaign = attributes[:'campaign']
  end

  if attributes.has_key?(:'primarySalesRep')
    self.primary_sales_rep = attributes[:'primarySalesRep']
  end

  if attributes.has_key?(:'secondarySalesRep')
    self.secondary_sales_rep = attributes[:'secondarySalesRep']
  end

  if attributes.has_key?(:'locationId')
    self.location_id = attributes[:'locationId']
  end

  if attributes.has_key?(:'businessUnitId')
    self.business_unit_id = attributes[:'businessUnitId']
  end

  if attributes.has_key?(:'company')
    self.company = attributes[:'company']
  end

  if attributes.has_key?(:'contact')
    self.contact = attributes[:'contact']
  end

  if attributes.has_key?(:'site')
    self.site = attributes[:'site']
  end

  if attributes.has_key?(:'customerPO')
    self.customer_po = attributes[:'customerPO']
  end

  if attributes.has_key?(:'pipelineChangeDate')
    self.pipeline_change_date = attributes[:'pipelineChangeDate']
  end

  if attributes.has_key?(:'dateBecameLead')
    self.date_became_lead = attributes[:'dateBecameLead']
  end

  if attributes.has_key?(:'closedDate')
    self.closed_date = attributes[:'closedDate']
  end

  if attributes.has_key?(:'closedBy')
    self.closed_by = attributes[:'closedBy']
  end

  if attributes.has_key?(:'totalSalesTax')
    self.total_sales_tax = attributes[:'totalSalesTax']
  end

  if attributes.has_key?(:'shipToCompany')
    self.ship_to_company = attributes[:'shipToCompany']
  end

  if attributes.has_key?(:'shipToContact')
    self.ship_to_contact = attributes[:'shipToContact']
  end

  if attributes.has_key?(:'shipToSite')
    self.ship_to_site = attributes[:'shipToSite']
  end

  if attributes.has_key?(:'billToCompany')
    self.bill_to_company = attributes[:'billToCompany']
  end

  if attributes.has_key?(:'billToContact')
    self.bill_to_contact = attributes[:'billToContact']
  end

  if attributes.has_key?(:'billToSite')
    self.bill_to_site = attributes[:'billToSite']
  end

  if attributes.has_key?(:'billingTerms')
    self.billing_terms = attributes[:'billingTerms']
  end

  if attributes.has_key?(:'taxCode')
    self.tax_code = attributes[:'taxCode']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

  if attributes.has_key?(:'customFields')
    if (value = attributes[:'customFields']).is_a?(Array)
      self.custom_fields = value
    end
  end

  if attributes.has_key?(:'count')
    self.count = attributes[:'count']
  end

  if attributes.has_key?(:'reAssignToMember')
    self.re_assign_to_member = attributes[:'reAssignToMember']
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



76
77
78
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 76

def _info
  @_info
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



63
64
65
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 63

def bill_to_company
  @bill_to_company
end

#bill_to_contactObject

Returns the value of attribute bill_to_contact.



65
66
67
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 65

def bill_to_contact
  @bill_to_contact
end

#bill_to_siteObject

Returns the value of attribute bill_to_site.



67
68
69
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 67

def bill_to_site
  @bill_to_site
end

#billing_termsObject

Returns the value of attribute billing_terms.



69
70
71
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 69

def billing_terms
  @billing_terms
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



37
38
39
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 37

def business_unit_id
  @business_unit_id
end

#campaignObject

Returns the value of attribute campaign.



29
30
31
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 29

def campaign
  @campaign
end

#closed_byObject

Returns the value of attribute closed_by.



53
54
55
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 53

def closed_by
  @closed_by
end

#closed_dateObject

Returns the value of attribute closed_date.



51
52
53
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 51

def closed_date
  @closed_date
end

#companyObject

Returns the value of attribute company.



39
40
41
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 39

def company
  @company
end

#contactObject

Returns the value of attribute contact.



41
42
43
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 41

def contact
  @contact
end

#countObject

Returns the value of attribute count.



80
81
82
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 80

def count
  @count
end

#currencyObject

Returns the value of attribute currency.



73
74
75
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 73

def currency
  @currency
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



78
79
80
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 78

def custom_fields
  @custom_fields
end

#customer_poObject

Returns the value of attribute customer_po.



45
46
47
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 45

def customer_po
  @customer_po
end

#date_became_leadObject

Returns the value of attribute date_became_lead.



49
50
51
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 49

def date_became_lead
  @date_became_lead
end

#expected_close_dateObject

Returns the value of attribute expected_close_date.



11
12
13
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 11

def expected_close_date
  @expected_close_date
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 7

def id
  @id
end

#location_idObject

Returns the value of attribute location_id.



35
36
37
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 35

def location_id
  @location_id
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 9

def name
  @name
end

#notesObject

Returns the value of attribute notes.



21
22
23
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 21

def notes
  @notes
end

#pipeline_change_dateObject

Returns the value of attribute pipeline_change_date.



47
48
49
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 47

def pipeline_change_date
  @pipeline_change_date
end

#primary_sales_repObject

Returns the value of attribute primary_sales_rep.



31
32
33
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 31

def primary_sales_rep
  @primary_sales_rep
end

#priorityObject

Returns the value of attribute priority.



19
20
21
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 19

def priority
  @priority
end

#probabilityObject

Returns the value of attribute probability.



23
24
25
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 23

def probability
  @probability
end

#ratingObject

Returns the value of attribute rating.



27
28
29
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 27

def rating
  @rating
end

#re_assign_to_memberObject

Returns the value of attribute re_assign_to_member.



82
83
84
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 82

def re_assign_to_member
  @re_assign_to_member
end

#secondary_sales_repObject

Returns the value of attribute secondary_sales_rep.



33
34
35
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 33

def secondary_sales_rep
  @secondary_sales_rep
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



57
58
59
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 57

def ship_to_company
  @ship_to_company
end

#ship_to_contactObject

Returns the value of attribute ship_to_contact.



59
60
61
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 59

def ship_to_contact
  @ship_to_contact
end

#ship_to_siteObject

Returns the value of attribute ship_to_site.



61
62
63
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 61

def ship_to_site
  @ship_to_site
end

#siteObject

Returns the value of attribute site.



43
44
45
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 43

def site
  @site
end

#sourceObject

Returns the value of attribute source.



25
26
27
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 25

def source
  @source
end

#stageObject

Returns the value of attribute stage.



15
16
17
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 15

def stage
  @stage
end

#statusObject

Returns the value of attribute status.



17
18
19
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 17

def status
  @status
end

#tax_codeObject

Returns the value of attribute tax_code.



71
72
73
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 71

def tax_code
  @tax_code
end

#total_sales_taxObject

Returns the value of attribute total_sales_tax.



55
56
57
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 55

def total_sales_tax
  @total_sales_tax
end

#typeObject

Returns the value of attribute type.



13
14
15
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 13

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 86

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'expected_close_date' => :'expectedCloseDate',
    :'type' => :'type',
    :'stage' => :'stage',
    :'status' => :'status',
    :'priority' => :'priority',
    :'notes' => :'notes',
    :'probability' => :'probability',
    :'source' => :'source',
    :'rating' => :'rating',
    :'campaign' => :'campaign',
    :'primary_sales_rep' => :'primarySalesRep',
    :'secondary_sales_rep' => :'secondarySalesRep',
    :'location_id' => :'locationId',
    :'business_unit_id' => :'businessUnitId',
    :'company' => :'company',
    :'contact' => :'contact',
    :'site' => :'site',
    :'customer_po' => :'customerPO',
    :'pipeline_change_date' => :'pipelineChangeDate',
    :'date_became_lead' => :'dateBecameLead',
    :'closed_date' => :'closedDate',
    :'closed_by' => :'closedBy',
    :'total_sales_tax' => :'totalSalesTax',
    :'ship_to_company' => :'shipToCompany',
    :'ship_to_contact' => :'shipToContact',
    :'ship_to_site' => :'shipToSite',
    :'bill_to_company' => :'billToCompany',
    :'bill_to_contact' => :'billToContact',
    :'bill_to_site' => :'billToSite',
    :'billing_terms' => :'billingTerms',
    :'tax_code' => :'taxCode',
    :'currency' => :'currency',
    :'_info' => :'_info',
    :'custom_fields' => :'customFields',
    :'count' => :'count',
    :'re_assign_to_member' => :'reAssignToMember'
  }
end

.swagger_typesObject

Attribute type mapping.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 130

def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'expected_close_date' => :'DateTime',
    :'type' => :'OpportunityTypeReference',
    :'stage' => :'OpportunityStageReference',
    :'status' => :'OpportunityStatusReference',
    :'priority' => :'OpportunityPriorityReference',
    :'notes' => :'String',
    :'probability' => :'OpportunityProbabilityReference',
    :'source' => :'String',
    :'rating' => :'OpportunityRatingReference',
    :'campaign' => :'CampaignReference',
    :'primary_sales_rep' => :'MemberReference',
    :'secondary_sales_rep' => :'MemberReference',
    :'location_id' => :'Integer',
    :'business_unit_id' => :'Integer',
    :'company' => :'CompanyReference',
    :'contact' => :'ContactReference',
    :'site' => :'SiteReference',
    :'customer_po' => :'String',
    :'pipeline_change_date' => :'DateTime',
    :'date_became_lead' => :'DateTime',
    :'closed_date' => :'DateTime',
    :'closed_by' => :'MemberReference',
    :'total_sales_tax' => :'Float',
    :'ship_to_company' => :'CompanyReference',
    :'ship_to_contact' => :'ContactReference',
    :'ship_to_site' => :'SiteReference',
    :'bill_to_company' => :'CompanyReference',
    :'bill_to_contact' => :'ContactReference',
    :'bill_to_site' => :'SiteReference',
    :'billing_terms' => :'BillingTermsReference',
    :'tax_code' => :'TaxCodeReference',
    :'currency' => :'CurrencyReference',
    :'_info' => :'Metadata',
    :'custom_fields' => :'Array<CustomFieldValue>',
    :'count' => :'Integer',
    :'re_assign_to_member' => :'MemberReference'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 428

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      expected_close_date == o.expected_close_date &&
      type == o.type &&
      stage == o.stage &&
      status == o.status &&
      priority == o.priority &&
      notes == o.notes &&
      probability == o.probability &&
      source == o.source &&
      rating == o.rating &&
      campaign == o.campaign &&
      primary_sales_rep == o.primary_sales_rep &&
      secondary_sales_rep == o.secondary_sales_rep &&
      location_id == o.location_id &&
      business_unit_id == o.business_unit_id &&
      company == o.company &&
      contact == o.contact &&
      site == o.site &&
      customer_po == o.customer_po &&
      pipeline_change_date == o.pipeline_change_date &&
      date_became_lead == o.date_became_lead &&
      closed_date == o.closed_date &&
      closed_by == o.closed_by &&
      total_sales_tax == o.total_sales_tax &&
      ship_to_company == o.ship_to_company &&
      ship_to_contact == o.ship_to_contact &&
      ship_to_site == o.ship_to_site &&
      bill_to_company == o.bill_to_company &&
      bill_to_contact == o.bill_to_contact &&
      bill_to_site == o.bill_to_site &&
      billing_terms == o.billing_terms &&
      tax_code == o.tax_code &&
      currency == o.currency &&
      _info == o._info &&
      custom_fields == o.custom_fields &&
      count == o.count &&
      re_assign_to_member == o.re_assign_to_member
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 507

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ConnectWise.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 573

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 486

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


473
474
475
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 473

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



479
480
481
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 479

def hash
  [id, name, expected_close_date, type, stage, status, priority, notes, probability, source, rating, campaign, primary_sales_rep, secondary_sales_rep, location_id, business_unit_id, company, contact, site, customer_po, pipeline_change_date, date_became_lead, closed_date, closed_by, total_sales_tax, ship_to_company, ship_to_contact, ship_to_site, bill_to_company, bill_to_contact, bill_to_site, billing_terms, tax_code, currency, _info, custom_fields, count, re_assign_to_member].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 339

def list_invalid_properties
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end

  if @name.to_s.length > 100
    invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 100.")
  end

  if !@source.nil? && @source.to_s.length > 50
    invalid_properties.push("invalid value for 'source', the character length must be smaller than or equal to 50.")
  end

  if @primary_sales_rep.nil?
    invalid_properties.push("invalid value for 'primary_sales_rep', primary_sales_rep cannot be nil.")
  end

  if @company.nil?
    invalid_properties.push("invalid value for 'company', company cannot be nil.")
  end

  if @contact.nil?
    invalid_properties.push("invalid value for 'contact', contact cannot be nil.")
  end

  if @site.nil?
    invalid_properties.push("invalid value for 'site', site cannot be nil.")
  end

  if !@customer_po.nil? && @customer_po.to_s.length > 25
    invalid_properties.push("invalid value for 'customer_po', the character length must be smaller than or equal to 25.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



553
554
555
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 553

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



559
560
561
562
563
564
565
566
567
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 559

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



547
548
549
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 547

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



378
379
380
381
382
383
384
385
386
387
388
# File 'lib/connectwise-ruby-sdk/models/opportunity.rb', line 378

def valid?
  return false if @name.nil?
  return false if @name.to_s.length > 100
  return false if !@source.nil? && @source.to_s.length > 50
  return false if @primary_sales_rep.nil?
  return false if @company.nil?
  return false if @contact.nil?
  return false if @site.nil?
  return false if !@customer_po.nil? && @customer_po.to_s.length > 25
  return true
end