Class: PhoneComClient::RuleSetAction

Inherits:
Object
  • Object
show all
Defined in:
lib/phone_com_client/models/rule_set_action.rb

Overview

Filter Object. Optional. See below for details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RuleSetAction

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/phone_com_client/models/rule_set_action.rb', line 82

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#actionObject

Required.



19
20
21
# File 'lib/phone_com_client/models/rule_set_action.rb', line 19

def action
  @action
end

#durationObject

Required. Seconds that the caller should be placed on hold before being moved onto the next action. Must be an integer between 1 and 60 seconds.



37
38
39
# File 'lib/phone_com_client/models/rule_set_action.rb', line 37

def duration
  @duration
end

#extensionObject

Extension that this action refers to. Output is an Extension Summary Object. Input must be an Extension Lookup Object. Required.



22
23
24
# File 'lib/phone_com_client/models/rule_set_action.rb', line 22

def extension
  @extension
end

#greetingObject

Greeting that this action refers to. Output is a Media Summary Object. Input must be a Media Lookup Object. Required. Must refer to a media recording that has is_hold_music set to FALSE.



34
35
36
# File 'lib/phone_com_client/models/rule_set_action.rb', line 34

def greeting
  @greeting
end

#hold_musicObject

Hold Music to be played while callers are waiting. Output is a Media Summary Object. Input must be a Media Lookup Object. Optional. Must refer to a media recording that has is_hold_music set to TRUE. Default is to play a standard ring tone.



31
32
33
# File 'lib/phone_com_client/models/rule_set_action.rb', line 31

def hold_music
  @hold_music
end

#itemsObject

This action is for forwarding calls to any number of extensions or phone numbers. The forwarding is handled in parallel, meaning that all phone numbers and/or extensions will ring simultaneously. When the call is answered by any single phone number or extension, ringing will stop for all of them. Subsequent actions in this rule set will be performed if the call is not answered before the timeout period is reached, or if it is forwarded to an extension that has its own route and that route does not result in any actions that disconnect the call or take over call handling.



25
26
27
# File 'lib/phone_com_client/models/rule_set_action.rb', line 25

def items
  @items
end

Menu that this action refers to. Required. Output is a Menu Summary Object. Input must be a Menu Lookup Object.



40
41
42
# File 'lib/phone_com_client/models/rule_set_action.rb', line 40

def menu
  @menu
end

#queueObject

Queue that this action refers to. Required. Output is a Queue Summary Object. Input must be a Queue Lookup Object.



43
44
45
# File 'lib/phone_com_client/models/rule_set_action.rb', line 43

def queue
  @queue
end

#timeoutObject

Seconds that our routing engine should wait until moving on. Optional. Must be an integer between 5 and 90. Default is 5 seconds.



28
29
30
# File 'lib/phone_com_client/models/rule_set_action.rb', line 28

def timeout
  @timeout
end

#trunkObject

Trunk that this action refers to. Required. Output is a Trunk Summary Object. Input must be a Trunk Lookup Object.



46
47
48
# File 'lib/phone_com_client/models/rule_set_action.rb', line 46

def trunk
  @trunk
end

Class Method Details

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/phone_com_client/models/rule_set_action.rb', line 49

def self.attribute_map
  {
    :'action' => :'action',
    :'extension' => :'extension',
    :'items' => :'items',
    :'timeout' => :'timeout',
    :'hold_music' => :'hold_music',
    :'greeting' => :'greeting',
    :'duration' => :'duration',
    :'menu' => :'menu',
    :'queue' => :'queue',
    :'trunk' => :'trunk'
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/phone_com_client/models/rule_set_action.rb', line 65

def self.swagger_types
  {
    :'action' => :'String',
    :'extension' => :'ExtensionSummary',
    :'items' => :'Array<RuleSetForwardItem>',
    :'timeout' => :'Integer',
    :'hold_music' => :'MediaSummary',
    :'greeting' => :'MediaSummary',
    :'duration' => :'Integer',
    :'menu' => :'MenuSummary',
    :'queue' => :'QueueSummary',
    :'trunk' => :'TrunkSummary'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/phone_com_client/models/rule_set_action.rb', line 161

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      action == o.action &&
      extension == o.extension &&
      items == o.items &&
      timeout == o.timeout &&
      hold_music == o.hold_music &&
      greeting == o.greeting &&
      duration == o.duration &&
      menu == o.menu &&
      queue == o.queue &&
      trunk == o.trunk
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



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

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 = PhoneComClient.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



278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/phone_com_client/models/rule_set_action.rb', line 278

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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/phone_com_client/models/rule_set_action.rb', line 191

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


178
179
180
# File 'lib/phone_com_client/models/rule_set_action.rb', line 178

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



184
185
186
# File 'lib/phone_com_client/models/rule_set_action.rb', line 184

def hash
  [action, extension, items, timeout, hold_music, greeting, duration, menu, queue, trunk].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



133
134
135
136
137
138
139
140
# File 'lib/phone_com_client/models/rule_set_action.rb', line 133

def list_invalid_properties
  invalid_properties = Array.new
  if !@action.nil? && @action !~ Regexp.new(/directory|disconnect|fax|forward|greeting|hold|menu|queue|trunk|voicemail/)
    invalid_properties.push('invalid value for "action", must conform to the pattern /directory|disconnect|fax|forward|greeting|hold|menu|queue|trunk|voicemail/.')
  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



258
259
260
# File 'lib/phone_com_client/models/rule_set_action.rb', line 258

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



264
265
266
267
268
269
270
271
272
# File 'lib/phone_com_client/models/rule_set_action.rb', line 264

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



252
253
254
# File 'lib/phone_com_client/models/rule_set_action.rb', line 252

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



144
145
146
147
# File 'lib/phone_com_client/models/rule_set_action.rb', line 144

def valid?
  return false if !@action.nil? && @action !~ Regexp.new(/directory|disconnect|fax|forward|greeting|hold|menu|queue|trunk|voicemail/)
  true
end