Class: Norbelys::ProgramCreateParams

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ProgramCreateParams

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Norbelys::ProgramCreateParams` 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::ProgramCreateParams`. 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_days')
    if (value = attributes[:'active_days']).is_a?(Array)
      self.active_days = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#active_daysObject

Returns the value of attribute active_days.



18
19
20
# File 'lib/norbelys/models/program_create_params.rb', line 18

def active_days
  @active_days
end

#add_unsubscribeObject

Attach RFC 8058 one-click unsubscribe headers + footer. Defaults off (opt-in).



21
22
23
# File 'lib/norbelys/models/program_create_params.rb', line 21

def add_unsubscribe
  @add_unsubscribe
end

#auto_pause_on_company_replyObject

Pause every lead at a company once one of them replies.



24
25
26
# File 'lib/norbelys/models/program_create_params.rb', line 24

def auto_pause_on_company_reply
  @auto_pause_on_company_reply
end

#bounce_pause_thresholdObject

Auto-pause when the bounce rate reaches this percent; 0 disables. Default 2.



27
28
29
# File 'lib/norbelys/models/program_create_params.rb', line 27

def bounce_pause_threshold
  @bounce_pause_threshold
end

#jitter_max_secondsObject

Random extra wait per send, upper bound (seconds).



30
31
32
# File 'lib/norbelys/models/program_create_params.rb', line 30

def jitter_max_seconds
  @jitter_max_seconds
end

#jitter_min_secondsObject

Random extra wait per send, lower bound (seconds).



33
34
35
# File 'lib/norbelys/models/program_create_params.rb', line 33

def jitter_min_seconds
  @jitter_min_seconds
end

#kindObject

Defaults to "cold_sequence".



36
37
38
# File 'lib/norbelys/models/program_create_params.rb', line 36

def kind
  @kind
end

#nameObject

Display name.



39
40
41
# File 'lib/norbelys/models/program_create_params.rb', line 39

def name
  @name
end

#new_per_dayObject

New leads started per day for the whole campaign, shared across all its mailboxes (follow-ups excluded); 0 = uncapped.



42
43
44
# File 'lib/norbelys/models/program_create_params.rb', line 42

def new_per_day
  @new_per_day
end

#plain_text_modeObject

Send the body as plain text only: no HTML part, open pixel, or link tracking.



45
46
47
# File 'lib/norbelys/models/program_create_params.rb', line 45

def plain_text_mode
  @plain_text_mode
end

#send_interval_minutesObject

Minutes between sends from one mailbox (cold-email floor is 3).



48
49
50
# File 'lib/norbelys/models/program_create_params.rb', line 48

def send_interval_minutes
  @send_interval_minutes
end

#spam_pause_thresholdObject

Auto-pause when the spam-complaint rate reaches this percent; 0 disables. Default 0.3.



51
52
53
# File 'lib/norbelys/models/program_create_params.rb', line 51

def spam_pause_threshold
  @spam_pause_threshold
end

#start_dateObject

Returns the value of attribute start_date.



53
54
55
# File 'lib/norbelys/models/program_create_params.rb', line 53

def start_date
  @start_date
end

#stepsObject

Build the whole cadence in one call: ordered steps, each with its arms. Omit to start empty and add steps later via programs.update.



56
57
58
# File 'lib/norbelys/models/program_create_params.rb', line 56

def steps
  @steps
end

#stop_conditionObject

Engagement that pulls a lead out of the cadence: reply, click, open, none.



59
60
61
# File 'lib/norbelys/models/program_create_params.rb', line 59

def stop_condition
  @stop_condition
end

#timezoneObject

IANA timezone.



62
63
64
# File 'lib/norbelys/models/program_create_params.rb', line 62

def timezone
  @timezone
end

#track_clicksObject

Rewrite links to track clicks.



65
66
67
# File 'lib/norbelys/models/program_create_params.rb', line 65

def track_clicks
  @track_clicks
end

#track_opensObject

Insert the open pixel.



70
71
72
# File 'lib/norbelys/models/program_create_params.rb', line 70

def track_opens
  @track_opens
end

#tracking_domain_idObject

Returns the value of attribute tracking_domain_id.



67
68
69
# File 'lib/norbelys/models/program_create_params.rb', line 67

def tracking_domain_id
  @tracking_domain_id
end

#unsubscribe_textObject

Custom unsubscribe footer copy.



73
74
75
# File 'lib/norbelys/models/program_create_params.rb', line 73

def unsubscribe_text
  @unsubscribe_text
end

#variant_distributionObject

How A/B arms are spread across leads with no decided winner: pattern (deterministic per-lead hash) or random (independent roll per lead).



76
77
78
# File 'lib/norbelys/models/program_create_params.rb', line 76

def variant_distribution
  @variant_distribution
end

#window_fromObject

Returns the value of attribute window_from.



78
79
80
# File 'lib/norbelys/models/program_create_params.rb', line 78

def window_from
  @window_from
end

#window_toObject

Returns the value of attribute window_to.



80
81
82
# File 'lib/norbelys/models/program_create_params.rb', line 80

def window_to
  @window_to
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



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/norbelys/models/program_create_params.rb', line 617

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



134
135
136
# File 'lib/norbelys/models/program_create_params.rb', line 134

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
131
# File 'lib/norbelys/models/program_create_params.rb', line 105

def self.attribute_map
  {
    :'active_days' => :'activeDays',
    :'add_unsubscribe' => :'addUnsubscribe',
    :'auto_pause_on_company_reply' => :'autoPauseOnCompanyReply',
    :'bounce_pause_threshold' => :'bouncePauseThreshold',
    :'jitter_max_seconds' => :'jitterMaxSeconds',
    :'jitter_min_seconds' => :'jitterMinSeconds',
    :'kind' => :'kind',
    :'name' => :'name',
    :'new_per_day' => :'newPerDay',
    :'plain_text_mode' => :'plainTextMode',
    :'send_interval_minutes' => :'sendIntervalMinutes',
    :'spam_pause_threshold' => :'spamPauseThreshold',
    :'start_date' => :'startDate',
    :'steps' => :'steps',
    :'stop_condition' => :'stopCondition',
    :'timezone' => :'timezone',
    :'track_clicks' => :'trackClicks',
    :'tracking_domain_id' => :'trackingDomainId',
    :'track_opens' => :'trackOpens',
    :'unsubscribe_text' => :'unsubscribeText',
    :'variant_distribution' => :'variantDistribution',
    :'window_from' => :'windowFrom',
    :'window_to' => :'windowTo'
  }
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



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/norbelys/models/program_create_params.rb', line 593

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



168
169
170
171
172
173
174
175
176
# File 'lib/norbelys/models/program_create_params.rb', line 168

def self.openapi_nullable
  Set.new([
    :'active_days',
    :'start_date',
    :'tracking_domain_id',
    :'window_from',
    :'window_to'
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'active_days' => :'Array<Integer>',
    :'add_unsubscribe' => :'Boolean',
    :'auto_pause_on_company_reply' => :'Boolean',
    :'bounce_pause_threshold' => :'Float',
    :'jitter_max_seconds' => :'Integer',
    :'jitter_min_seconds' => :'Integer',
    :'kind' => :'String',
    :'name' => :'String',
    :'new_per_day' => :'Integer',
    :'plain_text_mode' => :'Boolean',
    :'send_interval_minutes' => :'Integer',
    :'spam_pause_threshold' => :'Float',
    :'start_date' => :'Integer',
    :'steps' => :'Array<ProgramStepInput>',
    :'stop_condition' => :'String',
    :'timezone' => :'String',
    :'track_clicks' => :'Boolean',
    :'tracking_domain_id' => :'String',
    :'track_opens' => :'Boolean',
    :'unsubscribe_text' => :'String',
    :'variant_distribution' => :'String',
    :'window_from' => :'String',
    :'window_to' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/norbelys/models/program_create_params.rb', line 550

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active_days == o.active_days &&
      add_unsubscribe == o.add_unsubscribe &&
      auto_pause_on_company_reply == o.auto_pause_on_company_reply &&
      bounce_pause_threshold == o.bounce_pause_threshold &&
      jitter_max_seconds == o.jitter_max_seconds &&
      jitter_min_seconds == o.jitter_min_seconds &&
      kind == o.kind &&
      name == o.name &&
      new_per_day == o.new_per_day &&
      plain_text_mode == o.plain_text_mode &&
      send_interval_minutes == o.send_interval_minutes &&
      spam_pause_threshold == o.spam_pause_threshold &&
      start_date == o.start_date &&
      steps == o.steps &&
      stop_condition == o.stop_condition &&
      timezone == o.timezone &&
      track_clicks == o.track_clicks &&
      tracking_domain_id == o.tracking_domain_id &&
      track_opens == o.track_opens &&
      unsubscribe_text == o.unsubscribe_text &&
      variant_distribution == o.variant_distribution &&
      window_from == o.window_from &&
      window_to == o.window_to
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



688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/norbelys/models/program_create_params.rb', line 688

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


580
581
582
# File 'lib/norbelys/models/program_create_params.rb', line 580

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



586
587
588
# File 'lib/norbelys/models/program_create_params.rb', line 586

def hash
  [active_days, add_unsubscribe, auto_pause_on_company_reply, bounce_pause_threshold, jitter_max_seconds, jitter_min_seconds, kind, name, new_per_day, plain_text_mode, send_interval_minutes, spam_pause_threshold, start_date, steps, stop_condition, timezone, track_clicks, tracking_domain_id, track_opens, unsubscribe_text, variant_distribution, window_from, window_to].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/norbelys/models/program_create_params.rb', line 294

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@bounce_pause_threshold.nil? && @bounce_pause_threshold > 100
    invalid_properties.push('invalid value for "bounce_pause_threshold", must be smaller than or equal to 100.')
  end

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

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

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

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

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

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

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

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

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

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

  pattern = Regexp.new(/^([01]?\d|2[0-3]):[0-5]\d$/)
  if !@window_from.nil? && @window_from !~ pattern
    invalid_properties.push("invalid value for \"window_from\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^([01]?\d|2[0-3]):[0-5]\d$/)
  if !@window_to.nil? && @window_to !~ pattern
    invalid_properties.push("invalid value for \"window_to\", must conform to the pattern #{pattern}.")
  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



664
665
666
# File 'lib/norbelys/models/program_create_params.rb', line 664

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



670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/norbelys/models/program_create_params.rb', line 670

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



658
659
660
# File 'lib/norbelys/models/program_create_params.rb', line 658

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



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/norbelys/models/program_create_params.rb', line 356

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@bounce_pause_threshold.nil? && @bounce_pause_threshold > 100
  return false if !@bounce_pause_threshold.nil? && @bounce_pause_threshold < 0
  return false if !@jitter_max_seconds.nil? && @jitter_max_seconds < 0
  return false if !@jitter_min_seconds.nil? && @jitter_min_seconds < 0
  kind_validator = EnumAttributeValidator.new('String', ["cold_sequence"])
  return false unless kind_validator.valid?(@kind)
  return false if @name.nil?
  return false if @name.to_s.length < 1
  return false if !@new_per_day.nil? && @new_per_day < 0
  return false if !@send_interval_minutes.nil? && @send_interval_minutes < 3
  return false if !@spam_pause_threshold.nil? && @spam_pause_threshold > 100
  return false if !@spam_pause_threshold.nil? && @spam_pause_threshold < 0
  return false if !@start_date.nil? && @start_date < 0
  stop_condition_validator = EnumAttributeValidator.new('String', ["reply", "click", "open", "none"])
  return false unless stop_condition_validator.valid?(@stop_condition)
  variant_distribution_validator = EnumAttributeValidator.new('String', ["pattern", "random"])
  return false unless variant_distribution_validator.valid?(@variant_distribution)
  return false if !@window_from.nil? && @window_from !~ Regexp.new(/^([01]?\d|2[0-3]):[0-5]\d$/)
  return false if !@window_to.nil? && @window_to !~ Regexp.new(/^([01]?\d|2[0-3]):[0-5]\d$/)
  true
end