Class: Falcon::ActivitiesActivity

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/activities_activity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ActivitiesActivity

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/crimson-falcon/models/activities_activity.rb', line 162

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_classObject

Activity class to identify how it should be orchestrated. E.g. External, Break, CreateVariable and UpdateVariable



45
46
47
# File 'lib/crimson-falcon/models/activities_activity.rb', line 45

def _class
  @_class
end

#api_scopeObject

Required api scope to use this activity.



36
37
38
# File 'lib/crimson-falcon/models/activities_activity.rb', line 36

def api_scope
  @api_scope
end

#app_idObject

Optional ID if the activity is exposed through an app from Store



39
40
41
# File 'lib/crimson-falcon/models/activities_activity.rb', line 39

def app_id
  @app_id
end

#cidObject

The CID that owns this activity, if this is empty it is a global activity



42
43
44
# File 'lib/crimson-falcon/models/activities_activity.rb', line 42

def cid
  @cid
end

#dependenciesObject

List of dependencies (store apps or foundry app templates) of the activity



48
49
50
# File 'lib/crimson-falcon/models/activities_activity.rb', line 48

def dependencies
  @dependencies
end

#descriptionObject

A detailed description of what this action does



51
52
53
# File 'lib/crimson-falcon/models/activities_activity.rb', line 51

def description
  @description
end

#disruptiveObject

A flag indicating whether the activity is potentially disruptive/destructive



54
55
56
# File 'lib/crimson-falcon/models/activities_activity.rb', line 54

def disruptive
  @disruptive
end

#has_permissionObject

Indicates whether an activity is available for the caller



57
58
59
# File 'lib/crimson-falcon/models/activities_activity.rb', line 57

def has_permission
  @has_permission
end

#idObject

Unique ID of the activity, auto-generated by the API service



60
61
62
# File 'lib/crimson-falcon/models/activities_activity.rb', line 60

def id
  @id
end

#input_fieldsObject

Input fields required for configuring activity



63
64
65
# File 'lib/crimson-falcon/models/activities_activity.rb', line 63

def input_fields
  @input_fields
end

#input_schemaObject

Returns the value of attribute input_schema.



65
66
67
# File 'lib/crimson-falcon/models/activities_activity.rb', line 65

def input_schema
  @input_schema
end

#mock_outputObject

Returns the value of attribute mock_output.



67
68
69
# File 'lib/crimson-falcon/models/activities_activity.rb', line 67

def mock_output
  @mock_output
end

#nameObject

UI name for displaying the activity to a user



70
71
72
# File 'lib/crimson-falcon/models/activities_activity.rb', line 70

def name
  @name
end

#namespaceObject

Unique namespace for the activity.



73
74
75
# File 'lib/crimson-falcon/models/activities_activity.rb', line 73

def namespace
  @namespace
end

#output_fieldsObject

Output fields of the activity once executed



76
77
78
# File 'lib/crimson-falcon/models/activities_activity.rb', line 76

def output_fields
  @output_fields
end

#output_schemaObject

Returns the value of attribute output_schema.



78
79
80
# File 'lib/crimson-falcon/models/activities_activity.rb', line 78

def output_schema
  @output_schema
end

#tag_idsObject

Tag IDs assigned to this activity



81
82
83
# File 'lib/crimson-falcon/models/activities_activity.rb', line 81

def tag_ids
  @tag_ids
end

#updatedObject

Timestamp of when the activity was last updated



84
85
86
# File 'lib/crimson-falcon/models/activities_activity.rb', line 84

def updated
  @updated
end

#use_casesObject

UseCases used by this activity



87
88
89
# File 'lib/crimson-falcon/models/activities_activity.rb', line 87

def use_cases
  @use_cases
end

#vendorObject

Vendors used by this activity



90
91
92
# File 'lib/crimson-falcon/models/activities_activity.rb', line 90

def vendor
  @vendor
end

#versionObject

An incrementing version number



93
94
95
# File 'lib/crimson-falcon/models/activities_activity.rb', line 93

def version
  @version
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



123
124
125
# File 'lib/crimson-falcon/models/activities_activity.rb', line 123

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/crimson-falcon/models/activities_activity.rb', line 96

def self.attribute_map
  {
    :'api_scope' => :'api_scope',
    :'app_id' => :'app_id',
    :'cid' => :'cid',
    :'_class' => :'class',
    :'dependencies' => :'dependencies',
    :'description' => :'description',
    :'disruptive' => :'disruptive',
    :'has_permission' => :'has_permission',
    :'id' => :'id',
    :'input_fields' => :'input_fields',
    :'input_schema' => :'input_schema',
    :'mock_output' => :'mock_output',
    :'name' => :'name',
    :'namespace' => :'namespace',
    :'output_fields' => :'output_fields',
    :'output_schema' => :'output_schema',
    :'tag_ids' => :'tag_ids',
    :'updated' => :'updated',
    :'use_cases' => :'use_cases',
    :'vendor' => :'vendor',
    :'version' => :'version'
  }
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



356
357
358
# File 'lib/crimson-falcon/models/activities_activity.rb', line 356

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



155
156
157
158
# File 'lib/crimson-falcon/models/activities_activity.rb', line 155

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/crimson-falcon/models/activities_activity.rb', line 128

def self.openapi_types
  {
    :'api_scope' => :'String',
    :'app_id' => :'String',
    :'cid' => :'String',
    :'_class' => :'String',
    :'dependencies' => :'Array<ActivitiesDependency>',
    :'description' => :'String',
    :'disruptive' => :'Boolean',
    :'has_permission' => :'Boolean',
    :'id' => :'String',
    :'input_fields' => :'Array<ActivitiesActivityExtField>',
    :'input_schema' => :'JsonschemaSchema',
    :'mock_output' => :'Object',
    :'name' => :'String',
    :'namespace' => :'String',
    :'output_fields' => :'Array<ActivitiesActivityExtField>',
    :'output_schema' => :'JsonschemaSchema',
    :'tag_ids' => :'Array<String>',
    :'updated' => :'Time',
    :'use_cases' => :'Array<String>',
    :'vendor' => :'String',
    :'version' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/crimson-falcon/models/activities_activity.rb', line 315

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      api_scope == o.api_scope &&
      app_id == o.app_id &&
      cid == o.cid &&
      _class == o._class &&
      dependencies == o.dependencies &&
      description == o.description &&
      disruptive == o.disruptive &&
      has_permission == o.has_permission &&
      id == o.id &&
      input_fields == o.input_fields &&
      input_schema == o.input_schema &&
      mock_output == o.mock_output &&
      name == o.name &&
      namespace == o.namespace &&
      output_fields == o.output_fields &&
      output_schema == o.output_schema &&
      tag_ids == o.tag_ids &&
      updated == o.updated &&
      use_cases == o.use_cases &&
      vendor == o.vendor &&
      version == o.version
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



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/crimson-falcon/models/activities_activity.rb', line 387

def _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 = Falcon.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/crimson-falcon/models/activities_activity.rb', line 458

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



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/crimson-falcon/models/activities_activity.rb', line 363

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


343
344
345
# File 'lib/crimson-falcon/models/activities_activity.rb', line 343

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



349
350
351
# File 'lib/crimson-falcon/models/activities_activity.rb', line 349

def hash
  [api_scope, app_id, cid, _class, dependencies, description, disruptive, has_permission, id, input_fields, input_schema, mock_output, name, namespace, output_fields, output_schema, tag_ids, updated, use_cases, vendor, version].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/crimson-falcon/models/activities_activity.rb', line 272

def list_invalid_properties
  invalid_properties = Array.new
  if @cid.nil?
    invalid_properties.push('invalid value for "cid", cid cannot be nil.')
  end

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

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

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

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

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  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



434
435
436
# File 'lib/crimson-falcon/models/activities_activity.rb', line 434

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



440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/crimson-falcon/models/activities_activity.rb', line 440

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



428
429
430
# File 'lib/crimson-falcon/models/activities_activity.rb', line 428

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



303
304
305
306
307
308
309
310
311
# File 'lib/crimson-falcon/models/activities_activity.rb', line 303

def valid?
  return false if @cid.nil?
  return false if @description.nil?
  return false if @disruptive.nil?
  return false if @has_permission.nil?
  return false if @id.nil?
  return false if @name.nil?
  true
end