Class: ConnectWise::SalesQuota

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/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

Raises:

  • (ArgumentError)


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
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
# File 'lib/connect_wise/models/sales_quota.rb', line 134

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::SalesQuota` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `ConnectWise::SalesQuota`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.id = attributes[:id] if attributes.key?(:id)

  self.member = attributes[:member] if attributes.key?(:member)

  self.forecast_year = attributes[:forecast_year] if attributes.key?(:forecast_year)

  self.location = attributes[:location] if attributes.key?(:location)

  self.department = attributes[:department] if attributes.key?(:department)

  self.category = attributes[:category] if attributes.key?(:category)

  self.sub_category = attributes[:sub_category] if attributes.key?(:sub_category)

  self.january_revenue = attributes[:january_revenue] if attributes.key?(:january_revenue)

  self.january_margin = attributes[:january_margin] if attributes.key?(:january_margin)

  self.february_revenue = attributes[:february_revenue] if attributes.key?(:february_revenue)

  self.february_margin = attributes[:february_margin] if attributes.key?(:february_margin)

  self.march_revenue = attributes[:march_revenue] if attributes.key?(:march_revenue)

  self.march_margin = attributes[:march_margin] if attributes.key?(:march_margin)

  self.april_revenue = attributes[:april_revenue] if attributes.key?(:april_revenue)

  self.april_margin = attributes[:april_margin] if attributes.key?(:april_margin)

  self.may_revenue = attributes[:may_revenue] if attributes.key?(:may_revenue)

  self.may_margin = attributes[:may_margin] if attributes.key?(:may_margin)

  self.june_revenue = attributes[:june_revenue] if attributes.key?(:june_revenue)

  self.june_margin = attributes[:june_margin] if attributes.key?(:june_margin)

  self.july_revenue = attributes[:july_revenue] if attributes.key?(:july_revenue)

  self.july_margin = attributes[:july_margin] if attributes.key?(:july_margin)

  self.august_revenue = attributes[:august_revenue] if attributes.key?(:august_revenue)

  self.august_margin = attributes[:august_margin] if attributes.key?(:august_margin)

  self.september_revenue = attributes[:september_revenue] if attributes.key?(:september_revenue)

  self.september_margin = attributes[:september_margin] if attributes.key?(:september_margin)

  self.october_revenue = attributes[:october_revenue] if attributes.key?(:october_revenue)

  self.october_margin = attributes[:october_margin] if attributes.key?(:october_margin)

  self.november_revenue = attributes[:november_revenue] if attributes.key?(:november_revenue)

  self.november_margin = attributes[:november_margin] if attributes.key?(:november_margin)

  self.december_revenue = attributes[:december_revenue] if attributes.key?(:december_revenue)

  self.december_margin = attributes[:december_margin] if attributes.key?(:december_margin)

  self.currency = attributes[:currency] if attributes.key?(:currency)

  return unless attributes.key?(:_info)
  return unless (value = attributes[:_info]).is_a?(Hash)

  self._info = value
end

Instance Attribute Details

#_infoObject

Returns the value of attribute _info.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def _info
  @_info
end

#april_marginObject

Returns the value of attribute april_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def april_margin
  @april_margin
end

#april_revenueObject

Returns the value of attribute april_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def april_revenue
  @april_revenue
end

#august_marginObject

Returns the value of attribute august_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def august_margin
  @august_margin
end

#august_revenueObject

Returns the value of attribute august_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def august_revenue
  @august_revenue
end

#categoryObject

Returns the value of attribute category.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def category
  @category
end

#currencyObject

Returns the value of attribute currency.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def currency
  @currency
end

#december_marginObject

Returns the value of attribute december_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def december_margin
  @december_margin
end

#december_revenueObject

Returns the value of attribute december_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def december_revenue
  @december_revenue
end

#departmentObject

Returns the value of attribute department.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def department
  @department
end

#february_marginObject

Returns the value of attribute february_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def february_margin
  @february_margin
end

#february_revenueObject

Returns the value of attribute february_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def february_revenue
  @february_revenue
end

#forecast_yearObject

Returns the value of attribute forecast_year.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def forecast_year
  @forecast_year
end

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def id
  @id
end

#january_marginObject

Returns the value of attribute january_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def january_margin
  @january_margin
end

#january_revenueObject

Returns the value of attribute january_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def january_revenue
  @january_revenue
end

#july_marginObject

Returns the value of attribute july_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def july_margin
  @july_margin
end

#july_revenueObject

Returns the value of attribute july_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def july_revenue
  @july_revenue
end

#june_marginObject

Returns the value of attribute june_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def june_margin
  @june_margin
end

#june_revenueObject

Returns the value of attribute june_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def june_revenue
  @june_revenue
end

#locationObject

Returns the value of attribute location.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def location
  @location
end

#march_marginObject

Returns the value of attribute march_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def march_margin
  @march_margin
end

#march_revenueObject

Returns the value of attribute march_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def march_revenue
  @march_revenue
end

#may_marginObject

Returns the value of attribute may_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def may_margin
  @may_margin
end

#may_revenueObject

Returns the value of attribute may_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def may_revenue
  @may_revenue
end

#memberObject

Returns the value of attribute member.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def member
  @member
end

#november_marginObject

Returns the value of attribute november_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def november_margin
  @november_margin
end

#november_revenueObject

Returns the value of attribute november_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def november_revenue
  @november_revenue
end

#october_marginObject

Returns the value of attribute october_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def october_margin
  @october_margin
end

#october_revenueObject

Returns the value of attribute october_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def october_revenue
  @october_revenue
end

#september_marginObject

Returns the value of attribute september_margin.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def september_margin
  @september_margin
end

#september_revenueObject

Returns the value of attribute september_revenue.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def september_revenue
  @september_revenue
end

#sub_categoryObject

Returns the value of attribute sub_category.



16
17
18
# File 'lib/connect_wise/models/sales_quota.rb', line 16

def sub_category
  @sub_category
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



58
59
60
# File 'lib/connect_wise/models/sales_quota.rb', line 58

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/connect_wise/models/sales_quota.rb', line 19

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

.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



282
283
284
# File 'lib/connect_wise/models/sales_quota.rb', line 282

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



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
128
129
130
# File 'lib/connect_wise/models/sales_quota.rb', line 102

def self.openapi_nullable
  Set.new(%i[
            forecast_year
            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
          ])
end

.openapi_typesObject

Attribute type mapping.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/connect_wise/models/sales_quota.rb', line 63

def self.openapi_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: :'Hash<String, String>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/connect_wise/models/sales_quota.rb', line 228

def ==(other)
  return true if equal?(other)

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



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/connect_wise/models/sales_quota.rb', line 312

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = ConnectWise.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/connect_wise/models/sales_quota.rb', line 383

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



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/connect_wise/models/sales_quota.rb', line 289

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


269
270
271
# File 'lib/connect_wise/models/sales_quota.rb', line 269

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



275
276
277
# File 'lib/connect_wise/models/sales_quota.rb', line 275

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 properties with the reasons



216
217
218
# File 'lib/connect_wise/models/sales_quota.rb', line 216

def list_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



359
360
361
# File 'lib/connect_wise/models/sales_quota.rb', line 359

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



365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/connect_wise/models/sales_quota.rb', line 365

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



353
354
355
# File 'lib/connect_wise/models/sales_quota.rb', line 353

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



222
223
224
# File 'lib/connect_wise/models/sales_quota.rb', line 222

def valid?
  true
end