Class: Falcon::ActivitiesExternalActivity

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ActivitiesExternalActivity

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
269
270
271
272
273
274
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 166

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



44
45
46
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 44

def _class
  @_class
end

#api_scopeObject

Required api scope to use this activity.



35
36
37
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 35

def api_scope
  @api_scope
end

#app_idObject

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



38
39
40
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 38

def app_id
  @app_id
end

#cidObject

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



41
42
43
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 41

def cid
  @cid
end

#dependenciesObject

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



47
48
49
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 47

def dependencies
  @dependencies
end

#descriptionObject

A detailed description of what this action does



50
51
52
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 50

def description
  @description
end

#disruptiveObject

A flag indicating whether the activity is potentially disruptive/destructive



53
54
55
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 53

def disruptive
  @disruptive
end

#execution_routeObject

Unique execution route for the activity.



56
57
58
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 56

def execution_route
  @execution_route
end

#has_permissionObject

Indicates whether an activity is available for the caller



59
60
61
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 59

def has_permission
  @has_permission
end

#idObject

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



62
63
64
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 62

def id
  @id
end

#input_fieldsObject

Input fields required for configuring activity



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

def input_fields
  @input_fields
end

#input_schemaObject

Returns the value of attribute input_schema.



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

def input_schema
  @input_schema
end

#legacy_namespaceObject

Legacy namespace for the activity.



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

def legacy_namespace
  @legacy_namespace
end

#mock_outputObject

Returns the value of attribute mock_output.



72
73
74
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 72

def mock_output
  @mock_output
end

#nameObject

UI name for displaying the activity to a user



75
76
77
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 75

def name
  @name
end

#namespaceObject

(Deprecated) Unique namespace for the activity.



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

def namespace
  @namespace
end

#output_fieldsObject

Output fields of the activity once executed



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

def output_fields
  @output_fields
end

#output_schemaObject

Returns the value of attribute output_schema.



83
84
85
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 83

def output_schema
  @output_schema
end

#updatedObject

Timestamp of when the activity was last updated



86
87
88
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 86

def updated
  @updated
end

#use_casesObject

UseCases used by this activity



89
90
91
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 89

def use_cases
  @use_cases
end

#vendorObject

Vendors used by this activity



92
93
94
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 92

def vendor
  @vendor
end

#versionObject

An incrementing version number



95
96
97
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 95

def version
  @version
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



126
127
128
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 126

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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

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



363
364
365
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 363

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

.openapi_nullableObject

List of attributes with nullable: true



159
160
161
162
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 159

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'api_scope' => :'String',
    :'app_id' => :'String',
    :'cid' => :'String',
    :'_class' => :'String',
    :'dependencies' => :'Array<ActivitiesDependency>',
    :'description' => :'String',
    :'disruptive' => :'Boolean',
    :'execution_route' => :'String',
    :'has_permission' => :'Boolean',
    :'id' => :'String',
    :'input_fields' => :'Array<ActivitiesActivityExtField>',
    :'input_schema' => :'JsonschemaSchema',
    :'legacy_namespace' => :'String',
    :'mock_output' => :'Object',
    :'name' => :'String',
    :'namespace' => :'String',
    :'output_fields' => :'Array<ActivitiesActivityExtField>',
    :'output_schema' => :'JsonschemaSchema',
    :'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



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

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 &&
      execution_route == o.execution_route &&
      has_permission == o.has_permission &&
      id == o.id &&
      input_fields == o.input_fields &&
      input_schema == o.input_schema &&
      legacy_namespace == o.legacy_namespace &&
      mock_output == o.mock_output &&
      name == o.name &&
      namespace == o.namespace &&
      output_fields == o.output_fields &&
      output_schema == o.output_schema &&
      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



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
425
426
427
428
429
430
431
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 394

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



465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 465

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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 370

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


350
351
352
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 350

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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

def hash
  [api_scope, app_id, cid, _class, dependencies, description, disruptive, execution_route, has_permission, id, input_fields, input_schema, legacy_namespace, mock_output, name, namespace, output_fields, output_schema, 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



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 278

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



441
442
443
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 441

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



447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 447

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



435
436
437
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 435

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



309
310
311
312
313
314
315
316
317
# File 'lib/crimson-falcon/models/activities_external_activity.rb', line 309

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