Class: Falcon::TypesInterface

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TypesInterface

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/crimson-falcon/models/types_interface.rb', line 196

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#accessing_methodsObject

Returns the value of attribute accessing_methods.



37
38
39
# File 'lib/crimson-falcon/models/types_interface.rb', line 37

def accessing_methods
  @accessing_methods
end

#bean_class_nameObject

Returns the value of attribute bean_class_name.



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

def bean_class_name
  @bean_class_name
end

#bean_nameObject

Returns the value of attribute bean_name.



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

def bean_name
  @bean_name
end

#broker_hostObject

Returns the value of attribute broker_host.



43
44
45
# File 'lib/crimson-falcon/models/types_interface.rb', line 43

def broker_host
  @broker_host
end

#broker_portObject

Returns the value of attribute broker_port.



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

def broker_port
  @broker_port
end

#catalogObject

Returns the value of attribute catalog.



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

def catalog
  @catalog
end

#columnsObject

Returns the value of attribute columns.



49
50
51
# File 'lib/crimson-falcon/models/types_interface.rb', line 49

def columns
  @columns
end

#consumesObject

Returns the value of attribute consumes.



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

def consumes
  @consumes
end

#databaseObject

Returns the value of attribute database.



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

def database
  @database
end

#directionObject

Returns the value of attribute direction.



55
56
57
# File 'lib/crimson-falcon/models/types_interface.rb', line 55

def direction
  @direction
end

#driverObject

Returns the value of attribute driver.



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

def driver
  @driver
end

#durable_subscriptionObject

Returns the value of attribute durable_subscription.



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

def durable_subscription
  @durable_subscription
end

#ejb_versionObject

Returns the value of attribute ejb_version.



61
62
63
# File 'lib/crimson-falcon/models/types_interface.rb', line 61

def ejb_version
  @ejb_version
end

#frameworkObject

Returns the value of attribute framework.



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

def framework
  @framework
end

#has_passwordObject

Returns the value of attribute has_password.



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

def has_password
  @has_password
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#interface_nameObject

Returns the value of attribute interface_name.



69
70
71
# File 'lib/crimson-falcon/models/types_interface.rb', line 69

def interface_name
  @interface_name
end

#methodObject

Returns the value of attribute method.



71
72
73
# File 'lib/crimson-falcon/models/types_interface.rb', line 71

def method
  @method
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#port_typeObject

Returns the value of attribute port_type.



77
78
79
# File 'lib/crimson-falcon/models/types_interface.rb', line 77

def port_type
  @port_type
end

#producesObject

Returns the value of attribute produces.



79
80
81
# File 'lib/crimson-falcon/models/types_interface.rb', line 79

def produces
  @produces
end

#propertiesObject

Returns the value of attribute properties.



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

def properties
  @properties
end

#providerObject

Returns the value of attribute provider.



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

def provider
  @provider
end

#pu_nameObject

Returns the value of attribute pu_name.



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

def pu_name
  @pu_name
end

#schemaObject

Returns the value of attribute schema.



85
86
87
# File 'lib/crimson-falcon/models/types_interface.rb', line 85

def schema
  @schema
end

#servicesObject

Returns the value of attribute services.



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

def services
  @services
end

#session_typeObject

Returns the value of attribute session_type.



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

def session_type
  @session_type
end

#tableObject

Returns the value of attribute table.



91
92
93
# File 'lib/crimson-falcon/models/types_interface.rb', line 91

def table
  @table
end

#technologyObject

Returns the value of attribute technology.



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

def technology
  @technology
end

#topicObject

Returns the value of attribute topic.



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

def topic
  @topic
end

#topic_typeObject

Returns the value of attribute topic_type.



97
98
99
# File 'lib/crimson-falcon/models/types_interface.rb', line 97

def topic_type
  @topic_type
end

#typeObject

Returns the value of attribute type.



99
100
101
# File 'lib/crimson-falcon/models/types_interface.rb', line 99

def type
  @type
end

#usernameObject

Returns the value of attribute username.



101
102
103
# File 'lib/crimson-falcon/models/types_interface.rb', line 101

def username
  @username
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



144
145
146
# File 'lib/crimson-falcon/models/types_interface.rb', line 144

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/crimson-falcon/models/types_interface.rb', line 104

def self.attribute_map
  {
    :'properties' => :'Properties',
    :'accessing_methods' => :'accessingMethods',
    :'bean_class_name' => :'beanClassName',
    :'bean_name' => :'beanName',
    :'broker_host' => :'brokerHost',
    :'broker_port' => :'brokerPort',
    :'catalog' => :'catalog',
    :'columns' => :'columns',
    :'consumes' => :'consumes',
    :'database' => :'database',
    :'direction' => :'direction',
    :'driver' => :'driver',
    :'durable_subscription' => :'durableSubscription',
    :'ejb_version' => :'ejbVersion',
    :'framework' => :'framework',
    :'has_password' => :'hasPassword',
    :'id' => :'id',
    :'interface_name' => :'interfaceName',
    :'method' => :'method',
    :'path' => :'path',
    :'port' => :'port',
    :'port_type' => :'portType',
    :'produces' => :'produces',
    :'provider' => :'provider',
    :'pu_name' => :'puName',
    :'schema' => :'schema',
    :'services' => :'services',
    :'session_type' => :'sessionType',
    :'table' => :'table',
    :'technology' => :'technology',
    :'topic' => :'topic',
    :'topic_type' => :'topicType',
    :'type' => :'type',
    :'username' => :'username'
  }
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



432
433
434
# File 'lib/crimson-falcon/models/types_interface.rb', line 432

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

.openapi_nullableObject

List of attributes with nullable: true



189
190
191
192
# File 'lib/crimson-falcon/models/types_interface.rb', line 189

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'properties' => :'Hash<String, String>',
    :'accessing_methods' => :'Array<String>',
    :'bean_class_name' => :'String',
    :'bean_name' => :'String',
    :'broker_host' => :'String',
    :'broker_port' => :'Integer',
    :'catalog' => :'String',
    :'columns' => :'Array<String>',
    :'consumes' => :'Array<String>',
    :'database' => :'String',
    :'direction' => :'String',
    :'driver' => :'String',
    :'durable_subscription' => :'String',
    :'ejb_version' => :'String',
    :'framework' => :'String',
    :'has_password' => :'Boolean',
    :'id' => :'Integer',
    :'interface_name' => :'String',
    :'method' => :'String',
    :'path' => :'String',
    :'port' => :'Integer',
    :'port_type' => :'String',
    :'produces' => :'Array<String>',
    :'provider' => :'String',
    :'pu_name' => :'String',
    :'schema' => :'String',
    :'services' => :'Array<TypesInterfaceService>',
    :'session_type' => :'String',
    :'table' => :'String',
    :'technology' => :'String',
    :'topic' => :'String',
    :'topic_type' => :'String',
    :'type' => :'String',
    :'username' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



378
379
380
381
382
383
384
385
386
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
# File 'lib/crimson-falcon/models/types_interface.rb', line 378

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      properties == o.properties &&
      accessing_methods == o.accessing_methods &&
      bean_class_name == o.bean_class_name &&
      bean_name == o.bean_name &&
      broker_host == o.broker_host &&
      broker_port == o.broker_port &&
      catalog == o.catalog &&
      columns == o.columns &&
      consumes == o.consumes &&
      database == o.database &&
      direction == o.direction &&
      driver == o.driver &&
      durable_subscription == o.durable_subscription &&
      ejb_version == o.ejb_version &&
      framework == o.framework &&
      has_password == o.has_password &&
      id == o.id &&
      interface_name == o.interface_name &&
      method == o.method &&
      path == o.path &&
      port == o.port &&
      port_type == o.port_type &&
      produces == o.produces &&
      provider == o.provider &&
      pu_name == o.pu_name &&
      schema == o.schema &&
      services == o.services &&
      session_type == o.session_type &&
      table == o.table &&
      technology == o.technology &&
      topic == o.topic &&
      topic_type == o.topic_type &&
      type == o.type &&
      username == o.username
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



463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/crimson-falcon/models/types_interface.rb', line 463

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



534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/crimson-falcon/models/types_interface.rb', line 534

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



439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/crimson-falcon/models/types_interface.rb', line 439

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


419
420
421
# File 'lib/crimson-falcon/models/types_interface.rb', line 419

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



425
426
427
# File 'lib/crimson-falcon/models/types_interface.rb', line 425

def hash
  [properties, accessing_methods, bean_class_name, bean_name, broker_host, broker_port, catalog, columns, consumes, database, direction, driver, durable_subscription, ejb_version, framework, has_password, id, interface_name, method, path, port, port_type, produces, provider, pu_name, schema, services, session_type, table, technology, topic, topic_type, type, username].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



360
361
362
363
364
365
366
367
# File 'lib/crimson-falcon/models/types_interface.rb', line 360

def list_invalid_properties
  invalid_properties = Array.new
  if @properties.nil?
    invalid_properties.push('invalid value for "properties", properties 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



510
511
512
# File 'lib/crimson-falcon/models/types_interface.rb', line 510

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



516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/crimson-falcon/models/types_interface.rb', line 516

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



504
505
506
# File 'lib/crimson-falcon/models/types_interface.rb', line 504

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



371
372
373
374
# File 'lib/crimson-falcon/models/types_interface.rb', line 371

def valid?
  return false if @properties.nil?
  true
end