Class: ConnectWise::SalesQuota

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SalesQuota

Initializes the object

Parameters:

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

    Model attributes in the form of hash



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 155

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?(:'member')
    self.member = attributes[:'member']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



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

def _info
  @_info
end

#april_marginObject

Returns the value of attribute april_margin.



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

def april_margin
  @april_margin
end

#april_revenueObject

Returns the value of attribute april_revenue.



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

def april_revenue
  @april_revenue
end

#august_marginObject

Returns the value of attribute august_margin.



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

def august_margin
  @august_margin
end

#august_revenueObject

Returns the value of attribute august_revenue.



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

def august_revenue
  @august_revenue
end

#categoryObject

Returns the value of attribute category.



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

def category
  @category
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#december_marginObject

Returns the value of attribute december_margin.



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

def december_margin
  @december_margin
end

#december_revenueObject

Returns the value of attribute december_revenue.



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

def december_revenue
  @december_revenue
end

#departmentObject

Returns the value of attribute department.



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

def department
  @department
end

#february_marginObject

Returns the value of attribute february_margin.



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

def february_margin
  @february_margin
end

#february_revenueObject

Returns the value of attribute february_revenue.



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

def february_revenue
  @february_revenue
end

#forecast_yearObject

Returns the value of attribute forecast_year.



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

def forecast_year
  @forecast_year
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#january_marginObject

Returns the value of attribute january_margin.



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

def january_margin
  @january_margin
end

#january_revenueObject

Returns the value of attribute january_revenue.



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

def january_revenue
  @january_revenue
end

#july_marginObject

Returns the value of attribute july_margin.



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

def july_margin
  @july_margin
end

#july_revenueObject

Returns the value of attribute july_revenue.



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

def july_revenue
  @july_revenue
end

#june_marginObject

Returns the value of attribute june_margin.



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

def june_margin
  @june_margin
end

#june_revenueObject

Returns the value of attribute june_revenue.



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

def june_revenue
  @june_revenue
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#march_marginObject

Returns the value of attribute march_margin.



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

def march_margin
  @march_margin
end

#march_revenueObject

Returns the value of attribute march_revenue.



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

def march_revenue
  @march_revenue
end

#may_marginObject

Returns the value of attribute may_margin.



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

def may_margin
  @may_margin
end

#may_revenueObject

Returns the value of attribute may_revenue.



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

def may_revenue
  @may_revenue
end

#memberObject

Returns the value of attribute member.



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

def member
  @member
end

#november_marginObject

Returns the value of attribute november_margin.



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

def november_margin
  @november_margin
end

#november_revenueObject

Returns the value of attribute november_revenue.



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

def november_revenue
  @november_revenue
end

#october_marginObject

Returns the value of attribute october_margin.



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

def october_margin
  @october_margin
end

#october_revenueObject

Returns the value of attribute october_revenue.



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

def october_revenue
  @october_revenue
end

#september_marginObject

Returns the value of attribute september_margin.



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

def september_margin
  @september_margin
end

#september_revenueObject

Returns the value of attribute september_revenue.



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

def september_revenue
  @september_revenue
end

#sub_categoryObject

Returns the value of attribute sub_category.



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

def sub_category
  @sub_category
end

Class Method Details

.attribute_mapObject

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



76
77
78
79
80
81
82
83
84
85
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
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 76

def self.attribute_map
  {
    :'id' => :'id',
    :'member' => :'member',
    :'forecast_year' => :'forecastYear',
    :'location' => :'location',
    :'department' => :'department',
    :'category' => :'category',
    :'sub_category' => :'subCategory',
    :'january_revenue' => :'januaryRevenue',
    :'january_margin' => :'januaryMargin',
    :'february_revenue' => :'februaryRevenue',
    :'february_margin' => :'februaryMargin',
    :'march_revenue' => :'marchRevenue',
    :'march_margin' => :'marchMargin',
    :'april_revenue' => :'aprilRevenue',
    :'april_margin' => :'aprilMargin',
    :'may_revenue' => :'mayRevenue',
    :'may_margin' => :'mayMargin',
    :'june_revenue' => :'juneRevenue',
    :'june_margin' => :'juneMargin',
    :'july_revenue' => :'julyRevenue',
    :'july_margin' => :'julyMargin',
    :'august_revenue' => :'augustRevenue',
    :'august_margin' => :'augustMargin',
    :'september_revenue' => :'septemberRevenue',
    :'september_margin' => :'septemberMargin',
    :'october_revenue' => :'octoberRevenue',
    :'october_margin' => :'octoberMargin',
    :'november_revenue' => :'novemberRevenue',
    :'november_margin' => :'novemberMargin',
    :'december_revenue' => :'decemberRevenue',
    :'december_margin' => :'decemberMargin',
    :'currency' => :'currency',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 115

def self.swagger_types
  {
    :'id' => :'Integer',
    :'member' => :'MemberReference',
    :'forecast_year' => :'Integer',
    :'location' => :'SystemLocationReference',
    :'department' => :'SystemDepartmentReference',
    :'category' => :'ProductCategoryReference',
    :'sub_category' => :'ProductSubCategoryReference',
    :'january_revenue' => :'Float',
    :'january_margin' => :'Float',
    :'february_revenue' => :'Float',
    :'february_margin' => :'Float',
    :'march_revenue' => :'Float',
    :'march_margin' => :'Float',
    :'april_revenue' => :'Float',
    :'april_margin' => :'Float',
    :'may_revenue' => :'Float',
    :'may_margin' => :'Float',
    :'june_revenue' => :'Float',
    :'june_margin' => :'Float',
    :'july_revenue' => :'Float',
    :'july_margin' => :'Float',
    :'august_revenue' => :'Float',
    :'august_margin' => :'Float',
    :'september_revenue' => :'Float',
    :'september_margin' => :'Float',
    :'october_revenue' => :'Float',
    :'october_margin' => :'Float',
    :'november_revenue' => :'Float',
    :'november_margin' => :'Float',
    :'december_revenue' => :'Float',
    :'december_margin' => :'Float',
    :'currency' => :'CurrencyReference',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
375
376
377
378
379
380
381
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 345

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      member == o.member &&
      forecast_year == o.forecast_year &&
      location == o.location &&
      department == o.department &&
      category == o.category &&
      sub_category == o.sub_category &&
      january_revenue == o.january_revenue &&
      january_margin == o.january_margin &&
      february_revenue == o.february_revenue &&
      february_margin == o.february_margin &&
      march_revenue == o.march_revenue &&
      march_margin == o.march_margin &&
      april_revenue == o.april_revenue &&
      april_margin == o.april_margin &&
      may_revenue == o.may_revenue &&
      may_margin == o.may_margin &&
      june_revenue == o.june_revenue &&
      june_margin == o.june_margin &&
      july_revenue == o.july_revenue &&
      july_margin == o.july_margin &&
      august_revenue == o.august_revenue &&
      august_margin == o.august_margin &&
      september_revenue == o.september_revenue &&
      september_margin == o.september_margin &&
      october_revenue == o.october_revenue &&
      october_margin == o.october_margin &&
      november_revenue == o.november_revenue &&
      november_margin == o.november_margin &&
      december_revenue == o.december_revenue &&
      december_margin == o.december_margin &&
      currency == o.currency &&
      _info == o._info
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



419
420
421
422
423
424
425
426
427
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
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 419

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



485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 485

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



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 398

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


385
386
387
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 385

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



391
392
393
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 391

def hash
  [id, member, forecast_year, location, department, category, sub_category, january_revenue, january_margin, february_revenue, february_margin, march_revenue, march_margin, april_revenue, april_margin, may_revenue, may_margin, june_revenue, june_margin, july_revenue, july_margin, august_revenue, august_margin, september_revenue, september_margin, october_revenue, october_margin, november_revenue, november_margin, december_revenue, december_margin, currency, _info].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 297

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

  if !@forecast_year.nil? && @forecast_year > 3000
    invalid_properties.push("invalid value for 'forecast_year', must be smaller than or equal to 3000.")
  end

  if !@forecast_year.nil? && @forecast_year < 1900
    invalid_properties.push("invalid value for 'forecast_year', must be greater than or equal to 1900.")
  end

  if @location.nil?
    invalid_properties.push("invalid value for 'location', location cannot be nil.")
  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



465
466
467
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 465

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



471
472
473
474
475
476
477
478
479
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 471

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



459
460
461
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 459

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



320
321
322
323
324
325
326
# File 'lib/connectwise-ruby-sdk/models/sales_quota.rb', line 320

def valid?
  return false if @member.nil?
  return false if !@forecast_year.nil? && @forecast_year > 3000
  return false if !@forecast_year.nil? && @forecast_year < 1900
  return false if @location.nil?
  return true
end