Class: SmoochApi::Enums

Inherits:
Object
  • Object
show all
Defined in:
lib/smooch-api/models/enums.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Enums

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
209
210
211
212
# File 'lib/smooch-api/models/enums.rb', line 130

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#actionSizeObject

Returns the value of attribute actionSize.



18
19
20
# File 'lib/smooch-api/models/enums.rb', line 18

def actionSize
  @actionSize
end

#actionTypeObject

Returns the value of attribute actionType.



20
21
22
# File 'lib/smooch-api/models/enums.rb', line 20

def actionType
  @actionType
end

#businessSystemTypeObject

Returns the value of attribute businessSystemType.



22
23
24
# File 'lib/smooch-api/models/enums.rb', line 22

def businessSystemType
  @businessSystemType
end

#clientStatusObject

Returns the value of attribute clientStatus.



24
25
26
# File 'lib/smooch-api/models/enums.rb', line 24

def clientStatus
  @clientStatus
end

#confirmationTypeObject

Returns the value of attribute confirmationType.



26
27
28
# File 'lib/smooch-api/models/enums.rb', line 26

def confirmationType
  @confirmationType
end

#conversationActivityTypeObject

Returns the value of attribute conversationActivityType.



28
29
30
# File 'lib/smooch-api/models/enums.rb', line 28

def conversationActivityType
  @conversationActivityType
end

#deploymentActivationMethodObject

Returns the value of attribute deploymentActivationMethod.



30
31
32
# File 'lib/smooch-api/models/enums.rb', line 30

def deploymentActivationMethod
  @deploymentActivationMethod
end

#deploymentHostingObject

Returns the value of attribute deploymentHosting.



32
33
34
# File 'lib/smooch-api/models/enums.rb', line 32

def deploymentHosting
  @deploymentHosting
end

#deploymentStatusObject

Returns the value of attribute deploymentStatus.



34
35
36
# File 'lib/smooch-api/models/enums.rb', line 34

def deploymentStatus
  @deploymentStatus
end

#fieldTypeObject

Returns the value of attribute fieldType.



48
49
50
# File 'lib/smooch-api/models/enums.rb', line 48

def fieldType
  @fieldType
end

#imageAspectRatioObject

Returns the value of attribute imageAspectRatio.



36
37
38
# File 'lib/smooch-api/models/enums.rb', line 36

def imageAspectRatio
  @imageAspectRatio
end

#integrationStatusObject

Returns the value of attribute integrationStatus.



38
39
40
# File 'lib/smooch-api/models/enums.rb', line 38

def integrationStatus
  @integrationStatus
end

#integrationTypeObject

Returns the value of attribute integrationType.



40
41
42
# File 'lib/smooch-api/models/enums.rb', line 40

def integrationType
  @integrationType
end

Returns the value of attribute menuItemType.



42
43
44
# File 'lib/smooch-api/models/enums.rb', line 42

def menuItemType
  @menuItemType
end

#messageItemSizeObject

Returns the value of attribute messageItemSize.



44
45
46
# File 'lib/smooch-api/models/enums.rb', line 44

def messageItemSize
  @messageItemSize
end

#messageTypeObject

Returns the value of attribute messageType.



46
47
48
# File 'lib/smooch-api/models/enums.rb', line 46

def messageType
  @messageType
end

#quotedMessageTypeObject

Returns the value of attribute quotedMessageType.



50
51
52
# File 'lib/smooch-api/models/enums.rb', line 50

def quotedMessageType
  @quotedMessageType
end

#roleObject

Returns the value of attribute role.



52
53
54
# File 'lib/smooch-api/models/enums.rb', line 52

def role
  @role
end

#webhookTriggersObject

Returns the value of attribute webhookTriggers.



54
55
56
# File 'lib/smooch-api/models/enums.rb', line 54

def webhookTriggers
  @webhookTriggers
end

Class Method Details

.attribute_mapObject

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



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/smooch-api/models/enums.rb', line 79

def self.attribute_map
  {
    :'actionSize' => :'ActionSize',
    :'actionType' => :'ActionType',
    :'businessSystemType' => :'BusinessSystemType',
    :'clientStatus' => :'ClientStatus',
    :'confirmationType' => :'ConfirmationType',
    :'conversationActivityType' => :'ConversationActivityType',
    :'deploymentActivationMethod' => :'DeploymentActivationMethod',
    :'deploymentHosting' => :'DeploymentHosting',
    :'deploymentStatus' => :'DeploymentStatus',
    :'imageAspectRatio' => :'ImageAspectRatio',
    :'integrationStatus' => :'IntegrationStatus',
    :'integrationType' => :'IntegrationType',
    :'menuItemType' => :'MenuItemType',
    :'messageItemSize' => :'MessageItemSize',
    :'messageType' => :'MessageType',
    :'fieldType' => :'FieldType',
    :'quotedMessageType' => :'QuotedMessageType',
    :'role' => :'Role',
    :'webhookTriggers' => :'WebhookTriggers'
  }
end

.swagger_typesObject

Attribute type mapping.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/smooch-api/models/enums.rb', line 104

def self.swagger_types
  {
    :'actionSize' => :'String',
    :'actionType' => :'String',
    :'businessSystemType' => :'String',
    :'clientStatus' => :'String',
    :'confirmationType' => :'String',
    :'conversationActivityType' => :'String',
    :'deploymentActivationMethod' => :'String',
    :'deploymentHosting' => :'String',
    :'deploymentStatus' => :'String',
    :'imageAspectRatio' => :'String',
    :'integrationStatus' => :'String',
    :'integrationType' => :'String',
    :'menuItemType' => :'String',
    :'messageItemSize' => :'String',
    :'messageType' => :'String',
    :'fieldType' => :'String',
    :'quotedMessageType' => :'String',
    :'role' => :'String',
    :'webhookTriggers' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/smooch-api/models/enums.rb', line 457

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      actionSize == o.actionSize &&
      actionType == o.actionType &&
      businessSystemType == o.businessSystemType &&
      clientStatus == o.clientStatus &&
      confirmationType == o.confirmationType &&
      conversationActivityType == o.conversationActivityType &&
      deploymentActivationMethod == o.deploymentActivationMethod &&
      deploymentHosting == o.deploymentHosting &&
      deploymentStatus == o.deploymentStatus &&
      imageAspectRatio == o.imageAspectRatio &&
      integrationStatus == o.integrationStatus &&
      integrationType == o.integrationType &&
      menuItemType == o.menuItemType &&
      messageItemSize == o.messageItemSize &&
      messageType == o.messageType &&
      fieldType == o.fieldType &&
      quotedMessageType == o.quotedMessageType &&
      role == o.role &&
      webhookTriggers == o.webhookTriggers
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



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/smooch-api/models/enums.rb', line 517

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



583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/smooch-api/models/enums.rb', line 583

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



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/smooch-api/models/enums.rb', line 496

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


483
484
485
# File 'lib/smooch-api/models/enums.rb', line 483

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



489
490
491
# File 'lib/smooch-api/models/enums.rb', line 489

def hash
  [actionSize, actionType, businessSystemType, clientStatus, confirmationType, conversationActivityType, deploymentActivationMethod, deploymentHosting, deploymentStatus, imageAspectRatio, integrationStatus, integrationType, menuItemType, messageItemSize, messageType, fieldType, quotedMessageType, role, webhookTriggers].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



216
217
218
219
# File 'lib/smooch-api/models/enums.rb', line 216

def list_invalid_properties
  invalid_properties = Array.new
  return 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



563
564
565
# File 'lib/smooch-api/models/enums.rb', line 563

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



569
570
571
572
573
574
575
576
577
# File 'lib/smooch-api/models/enums.rb', line 569

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



557
558
559
# File 'lib/smooch-api/models/enums.rb', line 557

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



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
# File 'lib/smooch-api/models/enums.rb', line 223

def valid?
  actionSize_validator = EnumAttributeValidator.new('String', ["compact", "full", "tall"])
  return false unless actionSize_validator.valid?(@actionSize)
  actionType_validator = EnumAttributeValidator.new('String', ["buy", "link", "locationRequest", "postback", "reply", "share", "webview"])
  return false unless actionType_validator.valid?(@actionType)
  businessSystemType_validator = EnumAttributeValidator.new('String', ["helpscout", "slack", "zendesk"])
  return false unless businessSystemType_validator.valid?(@businessSystemType)
  clientStatus_validator = EnumAttributeValidator.new('String', ["active", "blocked", "inactive", "pending"])
  return false unless clientStatus_validator.valid?(@clientStatus)
  confirmationType_validator = EnumAttributeValidator.new('String', ["immediate", "userActivity", "prompt"])
  return false unless confirmationType_validator.valid?(@confirmationType)
  conversationActivityType_validator = EnumAttributeValidator.new('String', ["conversation:read", "typing:start", "typing:stop"])
  return false unless conversationActivityType_validator.valid?(@conversationActivityType)
  deploymentActivationMethod_validator = EnumAttributeValidator.new('String', ["sms", "voice"])
  return false unless deploymentActivationMethod_validator.valid?(@deploymentActivationMethod)
  deploymentHosting_validator = EnumAttributeValidator.new('String', ["self", "smooch"])
  return false unless deploymentHosting_validator.valid?(@deploymentHosting)
  deploymentStatus_validator = EnumAttributeValidator.new('String', ["deleting", "error", "integrated", "pending", "registered", "starting", "unregistered"])
  return false unless deploymentStatus_validator.valid?(@deploymentStatus)
  imageAspectRatio_validator = EnumAttributeValidator.new('String', ["horizontal", "square"])
  return false unless imageAspectRatio_validator.valid?(@imageAspectRatio)
  integrationStatus_validator = EnumAttributeValidator.new('String', ["active", "inactive", "error"])
  return false unless integrationStatus_validator.valid?(@integrationStatus)
  integrationType_validator = EnumAttributeValidator.new('String', ["android", "api", "apn", "fcm", "ios", "line", "mailgun", "messagebird", "messenger", "telegram", "twilio", "twitter", "viber", "web", "wechat", "whatsapp"])
  return false unless integrationType_validator.valid?(@integrationType)
  menuItemType_validator = EnumAttributeValidator.new('String', ["link", "postback", "submenu"])
  return false unless menuItemType_validator.valid?(@menuItemType)
  messageItemSize_validator = EnumAttributeValidator.new('String', ["compact", "large"])
  return false unless messageItemSize_validator.valid?(@messageItemSize)
  messageType_validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text", "form", "formResponse"])
  return false unless messageType_validator.valid?(@messageType)
  fieldType_validator = EnumAttributeValidator.new('String', ["text", "email", "select"])
  return false unless fieldType_validator.valid?(@fieldType)
  quotedMessageType_validator = EnumAttributeValidator.new('String', ["message", "externalMessageId"])
  return false unless quotedMessageType_validator.valid?(@quotedMessageType)
  role_validator = EnumAttributeValidator.new('String', ["appMaker", "appUser"])
  return false unless role_validator.valid?(@role)
  webhookTriggers_validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "conversation:start", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "notification:delivery:channel", "notification:delivery:failure", "notification:delivery:user", "payment:success", "postback", "typing:appUser"])
  return false unless webhookTriggers_validator.valid?(@webhookTriggers)
  return true
end