Class: Weft::CuratedMarketplaceContract

Inherits:
ApiModelBase show all
Defined in:
lib/weft/generated/models/curated_marketplace_contract.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CuratedMarketplaceContract

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 102

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Weft::CuratedMarketplaceContract` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Weft::CuratedMarketplaceContract`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'schema_version')
    self.schema_version = attributes[:'schema_version']
  else
    self.schema_version = nil
  end

  if attributes.key?(:'snapshot')
    if (value = attributes[:'snapshot']).is_a?(Hash)
      self.snapshot = value
    end
  else
    self.snapshot = nil
  end

  if attributes.key?(:'provider')
    if (value = attributes[:'provider']).is_a?(Hash)
      self.provider = value
    end
  else
    self.provider = nil
  end

  if attributes.key?(:'service')
    if (value = attributes[:'service']).is_a?(Hash)
      self.service = value
    end
  else
    self.service = nil
  end

  if attributes.key?(:'operation')
    if (value = attributes[:'operation']).is_a?(Hash)
      self.operation = value
    end
  else
    self.operation = nil
  end

  if attributes.key?(:'request')
    if (value = attributes[:'request']).is_a?(Hash)
      self.request = value
    end
  else
    self.request = nil
  end

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

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

Instance Attribute Details

#access_methodsObject

Returns the value of attribute access_methods.



30
31
32
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 30

def access_methods
  @access_methods
end

#evidenceObject

Returns the value of attribute evidence.



32
33
34
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 32

def evidence
  @evidence
end

#operationObject

Returns the value of attribute operation.



26
27
28
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 26

def operation
  @operation
end

#providerObject

Returns the value of attribute provider.



22
23
24
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 22

def provider
  @provider
end

#requestObject

Returns the value of attribute request.



28
29
30
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 28

def request
  @request
end

#schema_versionObject

Returns the value of attribute schema_version.



18
19
20
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 18

def schema_version
  @schema_version
end

#serviceObject

Returns the value of attribute service.



24
25
26
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 24

def service
  @service
end

#snapshotObject

Returns the value of attribute snapshot.



20
21
22
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 20

def snapshot
  @snapshot
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



71
72
73
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 71

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



76
77
78
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 76

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 57

def self.attribute_map
  {
    :'schema_version' => :'schema_version',
    :'snapshot' => :'snapshot',
    :'provider' => :'provider',
    :'service' => :'service',
    :'operation' => :'operation',
    :'request' => :'request',
    :'access_methods' => :'access_methods',
    :'evidence' => :'evidence'
  }
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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 346

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



95
96
97
98
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 95

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

.openapi_typesObject

Attribute type mapping.



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 81

def self.openapi_types
  {
    :'schema_version' => :'Integer',
    :'snapshot' => :'Hash<String, Object>',
    :'provider' => :'Hash<String, Object>',
    :'service' => :'Hash<String, Object>',
    :'operation' => :'Hash<String, Object>',
    :'request' => :'Hash<String, Object>',
    :'access_methods' => :'Array<Hash<String, Object>>',
    :'evidence' => :'Array<Hash<String, Object>>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 318

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      schema_version == o.schema_version &&
      snapshot == o.snapshot &&
      provider == o.provider &&
      service == o.service &&
      operation == o.operation &&
      request == o.request &&
      access_methods == o.access_methods &&
      evidence == o.evidence
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


333
334
335
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 333

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



339
340
341
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 339

def hash
  [schema_version, snapshot, provider, service, operation, request, access_methods, evidence].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 181

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @schema_version.nil?
    invalid_properties.push('invalid value for "schema_version", schema_version cannot be nil.')
  end

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

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

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 368

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

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/weft/generated/models/curated_marketplace_contract.rb', line 221

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @schema_version.nil?
  schema_version_validator = EnumAttributeValidator.new('Integer', [1])
  return false unless schema_version_validator.valid?(@schema_version)
  return false if @snapshot.nil?
  return false if @provider.nil?
  return false if @service.nil?
  return false if @operation.nil?
  return false if @request.nil?
  return false if @access_methods.nil?
  return false if @evidence.nil?
  true
end