Class: Zernio::EnableVoiceOnNumberRequest

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/enable_voice_on_number_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ EnableVoiceOnNumberRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 134

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#blocked_callersObject

E.164 numbers rejected before answer. Replaces the whole list; bare 10-digit values are normalized as US numbers.



42
43
44
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 42

def blocked_callers
  @blocked_callers
end

#business_hoursObject

Returns the value of attribute business_hours.



39
40
41
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 39

def business_hours
  @business_hours
end

#business_hours_enabledObject

Outside the windows, inbound skips the forward and goes to voicemail. Off = 24/7.



34
35
36
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 34

def business_hours_enabled
  @business_hours_enabled
end

#business_hours_timezoneObject

IANA timezone the windows are evaluated in.



37
38
39
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 37

def business_hours_timezone
  @business_hours_timezone
end

#forward_caller_idObject

Caller ID on the forwarded leg: your number (business) or the original caller's (caller).



45
46
47
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 45

def forward_caller_id
  @forward_caller_id
end

#forward_toObject

tel:+E164, sip:..., or wss://... destination for inbound calls. Empty string clears the forward (outbound-only); omitted preserves the current one.



19
20
21
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 19

def forward_to
  @forward_to
end

#ivr_enabledObject

IVR menu (supersedes the plain forward within business hours).



48
49
50
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 48

def ivr_enabled
  @ivr_enabled
end

#ivr_optionsObject

Returns the value of attribute ivr_options.



52
53
54
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 52

def ivr_options
  @ivr_options
end

#ivr_promptObject

Returns the value of attribute ivr_prompt.



50
51
52
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 50

def ivr_prompt
  @ivr_prompt
end

#recording_enabledObject

Returns the value of attribute recording_enabled.



21
22
23
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 21

def recording_enabled
  @recording_enabled
end

#transcription_enabledObject

Returns the value of attribute transcription_enabled.



23
24
25
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 23

def transcription_enabled
  @transcription_enabled
end

#transcription_languageObject

Returns the value of attribute transcription_language.



25
26
27
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 25

def transcription_language
  @transcription_language
end

#voicemail_enabledObject

Voicemail is taken when there's no live destination. Default on.



28
29
30
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 28

def voicemail_enabled
  @voicemail_enabled
end

#voicemail_greetingObject

Custom spoken greeting; empty string restores the default.



31
32
33
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 31

def voicemail_greeting
  @voicemail_greeting
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



97
98
99
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 97

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



102
103
104
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 102

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 77

def self.attribute_map
  {
    :'forward_to' => :'forwardTo',
    :'recording_enabled' => :'recordingEnabled',
    :'transcription_enabled' => :'transcriptionEnabled',
    :'transcription_language' => :'transcriptionLanguage',
    :'voicemail_enabled' => :'voicemailEnabled',
    :'voicemail_greeting' => :'voicemailGreeting',
    :'business_hours_enabled' => :'businessHoursEnabled',
    :'business_hours_timezone' => :'businessHoursTimezone',
    :'business_hours' => :'businessHours',
    :'blocked_callers' => :'blockedCallers',
    :'forward_caller_id' => :'forwardCallerId',
    :'ivr_enabled' => :'ivrEnabled',
    :'ivr_prompt' => :'ivrPrompt',
    :'ivr_options' => :'ivrOptions'
  }
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



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 400

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



127
128
129
130
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 127

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 107

def self.openapi_types
  {
    :'forward_to' => :'String',
    :'recording_enabled' => :'Boolean',
    :'transcription_enabled' => :'Boolean',
    :'transcription_language' => :'String',
    :'voicemail_enabled' => :'Boolean',
    :'voicemail_greeting' => :'String',
    :'business_hours_enabled' => :'Boolean',
    :'business_hours_timezone' => :'String',
    :'business_hours' => :'Array<EnableVoiceOnNumberRequestBusinessHoursInner>',
    :'blocked_callers' => :'Array<String>',
    :'forward_caller_id' => :'String',
    :'ivr_enabled' => :'Boolean',
    :'ivr_prompt' => :'String',
    :'ivr_options' => :'Array<EnableVoiceOnNumberRequestIvrOptionsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 366

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      forward_to == o.forward_to &&
      recording_enabled == o.recording_enabled &&
      transcription_enabled == o.transcription_enabled &&
      transcription_language == o.transcription_language &&
      voicemail_enabled == o.voicemail_enabled &&
      voicemail_greeting == o.voicemail_greeting &&
      business_hours_enabled == o.business_hours_enabled &&
      business_hours_timezone == o.business_hours_timezone &&
      business_hours == o.business_hours &&
      blocked_callers == o.blocked_callers &&
      forward_caller_id == o.forward_caller_id &&
      ivr_enabled == o.ivr_enabled &&
      ivr_prompt == o.ivr_prompt &&
      ivr_options == o.ivr_options
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


387
388
389
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 387

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



393
394
395
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 393

def hash
  [forward_to, recording_enabled, transcription_enabled, transcription_language, voicemail_enabled, voicemail_greeting, business_hours_enabled, business_hours_timezone, business_hours, blocked_callers, forward_caller_id, ivr_enabled, ivr_prompt, ivr_options].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 213

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

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

  if !@business_hours.nil? && @business_hours.length > 21
    invalid_properties.push('invalid value for "business_hours", number of items must be less than or equal to 21.')
  end

  if !@blocked_callers.nil? && @blocked_callers.length > 1000
    invalid_properties.push('invalid value for "blocked_callers", number of items must be less than or equal to 1000.')
  end

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

  if !@ivr_options.nil? && @ivr_options.length > 12
    invalid_properties.push('invalid value for "ivr_options", number of items must be less than or equal to 12.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 422

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/zernio-sdk/models/enable_voice_on_number_request.rb', line 245

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  transcription_language_validator = EnumAttributeValidator.new('String', ["auto", "en", "es"])
  return false unless transcription_language_validator.valid?(@transcription_language)
  return false if !@voicemail_greeting.nil? && @voicemail_greeting.to_s.length > 1000
  return false if !@business_hours_timezone.nil? && @business_hours_timezone.to_s.length > 64
  return false if !@business_hours.nil? && @business_hours.length > 21
  return false if !@blocked_callers.nil? && @blocked_callers.length > 1000
  forward_caller_id_validator = EnumAttributeValidator.new('String', ["business", "caller"])
  return false unless forward_caller_id_validator.valid?(@forward_caller_id)
  return false if !@ivr_prompt.nil? && @ivr_prompt.to_s.length > 1000
  return false if !@ivr_options.nil? && @ivr_options.length > 12
  true
end