Class: Norbelys::EnrollmentCounts

Inherits:
Object
  • Object
show all
Defined in:
lib/norbelys/models/enrollment_counts.rb

Overview

Enrollment-status counts for the whole queried scope (they ignore the status filter).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EnrollmentCounts

Initializes the object

Parameters:

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

    Model attributes in the form of hash



114
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
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
# File 'lib/norbelys/models/enrollment_counts.rb', line 114

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Norbelys::EnrollmentCounts` initialize method"
  end

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

  if attributes.key?(:'active')
    self.active = attributes[:'active']
  else
    self.active = nil
  end

  if attributes.key?(:'bounced')
    self.bounced = attributes[:'bounced']
  else
    self.bounced = nil
  end

  if attributes.key?(:'by_step')
    if (value = attributes[:'by_step']).is_a?(Hash)
      self.by_step = value
    end
  end

  if attributes.key?(:'cancelled')
    self.cancelled = attributes[:'cancelled']
  else
    self.cancelled = nil
  end

  if attributes.key?(:'finished')
    self.finished = attributes[:'finished']
  else
    self.finished = nil
  end

  if attributes.key?(:'in_progress')
    self.in_progress = attributes[:'in_progress']
  else
    self.in_progress = nil
  end

  if attributes.key?(:'next_send_at')
    self.next_send_at = attributes[:'next_send_at']
  end

  if attributes.key?(:'not_started')
    self.not_started = attributes[:'not_started']
  else
    self.not_started = nil
  end

  if attributes.key?(:'paused')
    self.paused = attributes[:'paused']
  else
    self.paused = nil
  end

  if attributes.key?(:'replied')
    self.replied = attributes[:'replied']
  else
    self.replied = nil
  end

  if attributes.key?(:'skipped')
    self.skipped = attributes[:'skipped']
  else
    self.skipped = nil
  end

  if attributes.key?(:'stopped')
    self.stopped = attributes[:'stopped']
  else
    self.stopped = nil
  end

  if attributes.key?(:'total')
    self.total = attributes[:'total']
  else
    self.total = nil
  end

  if attributes.key?(:'unsubscribed')
    self.unsubscribed = attributes[:'unsubscribed']
  else
    self.unsubscribed = nil
  end
end

Instance Attribute Details

#activeObject

Active leads.



20
21
22
# File 'lib/norbelys/models/enrollment_counts.rb', line 20

def active
  @active
end

#bouncedObject

Leads that bounced.



23
24
25
# File 'lib/norbelys/models/enrollment_counts.rb', line 23

def bounced
  @bounced
end

#by_stepObject

Active leads waiting at each cadence step (currentStepId → count) — who sits between which emails right now.



26
27
28
# File 'lib/norbelys/models/enrollment_counts.rb', line 26

def by_step
  @by_step
end

#cancelledObject

Leads whose run was cancelled by archiving the campaign.



29
30
31
# File 'lib/norbelys/models/enrollment_counts.rb', line 29

def cancelled
  @cancelled
end

#finishedObject

Leads that finished the cadence.



32
33
34
# File 'lib/norbelys/models/enrollment_counts.rb', line 32

def finished
  @finished
end

#in_progressObject

Active leads mid-cadence.



35
36
37
# File 'lib/norbelys/models/enrollment_counts.rb', line 35

def in_progress
  @in_progress
end

#next_send_atObject

Returns the value of attribute next_send_at.



37
38
39
# File 'lib/norbelys/models/enrollment_counts.rb', line 37

def next_send_at
  @next_send_at
end

#not_startedObject

Active leads not yet contacted.



40
41
42
# File 'lib/norbelys/models/enrollment_counts.rb', line 40

def not_started
  @not_started
end

#pausedObject

Paused leads.



43
44
45
# File 'lib/norbelys/models/enrollment_counts.rb', line 43

def paused
  @paused
end

#repliedObject

Leads that replied.



46
47
48
# File 'lib/norbelys/models/enrollment_counts.rb', line 46

def replied
  @replied
end

#skippedObject

Leads skipped because they were suppressed at send time.



49
50
51
# File 'lib/norbelys/models/enrollment_counts.rb', line 49

def skipped
  @skipped
end

#stoppedObject

Leads pulled out by an engagement stop (open/click).



52
53
54
# File 'lib/norbelys/models/enrollment_counts.rb', line 52

def stopped
  @stopped
end

#totalObject

All enrollments in scope.



55
56
57
# File 'lib/norbelys/models/enrollment_counts.rb', line 55

def total
  @total
end

#unsubscribedObject

Leads that unsubscribed.



58
59
60
# File 'lib/norbelys/models/enrollment_counts.rb', line 58

def unsubscribed
  @unsubscribed
end

Class Method Details

._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



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
# File 'lib/norbelys/models/enrollment_counts.rb', line 573

def self._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 = Norbelys.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



81
82
83
# File 'lib/norbelys/models/enrollment_counts.rb', line 81

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/norbelys/models/enrollment_counts.rb', line 61

def self.attribute_map
  {
    :'active' => :'active',
    :'bounced' => :'bounced',
    :'by_step' => :'byStep',
    :'cancelled' => :'cancelled',
    :'finished' => :'finished',
    :'in_progress' => :'inProgress',
    :'next_send_at' => :'nextSendAt',
    :'not_started' => :'notStarted',
    :'paused' => :'paused',
    :'replied' => :'replied',
    :'skipped' => :'skipped',
    :'stopped' => :'stopped',
    :'total' => :'total',
    :'unsubscribed' => :'unsubscribed'
  }
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



549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/norbelys/models/enrollment_counts.rb', line 549

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



106
107
108
109
110
# File 'lib/norbelys/models/enrollment_counts.rb', line 106

def self.openapi_nullable
  Set.new([
    :'next_send_at',
  ])
end

.openapi_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/norbelys/models/enrollment_counts.rb', line 86

def self.openapi_types
  {
    :'active' => :'Integer',
    :'bounced' => :'Integer',
    :'by_step' => :'Hash<String, Integer>',
    :'cancelled' => :'Integer',
    :'finished' => :'Integer',
    :'in_progress' => :'Integer',
    :'next_send_at' => :'Object',
    :'not_started' => :'Integer',
    :'paused' => :'Integer',
    :'replied' => :'Integer',
    :'skipped' => :'Integer',
    :'stopped' => :'Integer',
    :'total' => :'Integer',
    :'unsubscribed' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/norbelys/models/enrollment_counts.rb', line 515

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active == o.active &&
      bounced == o.bounced &&
      by_step == o.by_step &&
      cancelled == o.cancelled &&
      finished == o.finished &&
      in_progress == o.in_progress &&
      next_send_at == o.next_send_at &&
      not_started == o.not_started &&
      paused == o.paused &&
      replied == o.replied &&
      skipped == o.skipped &&
      stopped == o.stopped &&
      total == o.total &&
      unsubscribed == o.unsubscribed
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



644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/norbelys/models/enrollment_counts.rb', line 644

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


536
537
538
# File 'lib/norbelys/models/enrollment_counts.rb', line 536

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



542
543
544
# File 'lib/norbelys/models/enrollment_counts.rb', line 542

def hash
  [active, bounced, by_step, cancelled, finished, in_progress, next_send_at, not_started, paused, replied, skipped, stopped, total, unsubscribed].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/norbelys/models/enrollment_counts.rb', line 212

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @active.nil?
    invalid_properties.push('invalid value for "active", active cannot be nil.')
  end

  if @active < 0
    invalid_properties.push('invalid value for "active", must be greater than or equal to 0.')
  end

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

  if @bounced < 0
    invalid_properties.push('invalid value for "bounced", must be greater than or equal to 0.')
  end

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

  if @cancelled < 0
    invalid_properties.push('invalid value for "cancelled", must be greater than or equal to 0.')
  end

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

  if @finished < 0
    invalid_properties.push('invalid value for "finished", must be greater than or equal to 0.')
  end

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

  if @in_progress < 0
    invalid_properties.push('invalid value for "in_progress", must be greater than or equal to 0.')
  end

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

  if @not_started < 0
    invalid_properties.push('invalid value for "not_started", must be greater than or equal to 0.')
  end

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

  if @paused < 0
    invalid_properties.push('invalid value for "paused", must be greater than or equal to 0.')
  end

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

  if @replied < 0
    invalid_properties.push('invalid value for "replied", must be greater than or equal to 0.')
  end

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

  if @skipped < 0
    invalid_properties.push('invalid value for "skipped", must be greater than or equal to 0.')
  end

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

  if @stopped < 0
    invalid_properties.push('invalid value for "stopped", must be greater than or equal to 0.')
  end

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

  if @total < 0
    invalid_properties.push('invalid value for "total", must be greater than or equal to 0.')
  end

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

  if @unsubscribed < 0
    invalid_properties.push('invalid value for "unsubscribed", must be greater than or equal to 0.')
  end

  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



620
621
622
# File 'lib/norbelys/models/enrollment_counts.rb', line 620

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



626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/norbelys/models/enrollment_counts.rb', line 626

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.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



614
615
616
# File 'lib/norbelys/models/enrollment_counts.rb', line 614

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



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
# File 'lib/norbelys/models/enrollment_counts.rb', line 316

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @active.nil?
  return false if @active < 0
  return false if @bounced.nil?
  return false if @bounced < 0
  return false if @cancelled.nil?
  return false if @cancelled < 0
  return false if @finished.nil?
  return false if @finished < 0
  return false if @in_progress.nil?
  return false if @in_progress < 0
  return false if @not_started.nil?
  return false if @not_started < 0
  return false if @paused.nil?
  return false if @paused < 0
  return false if @replied.nil?
  return false if @replied < 0
  return false if @skipped.nil?
  return false if @skipped < 0
  return false if @stopped.nil?
  return false if @stopped < 0
  return false if @total.nil?
  return false if @total < 0
  return false if @unsubscribed.nil?
  return false if @unsubscribed < 0
  true
end