Class: Zest::FileRemote

Inherits:
Object
  • Object
show all
Defined in:
lib/zest/models/file_remote.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FileRemote

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/zest/models/file_remote.rb', line 132

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'policy')
    self.policy = attributes[:'policy']
  else
    self.policy = "immediate"
  end

end

Instance Attribute Details

#_createdObject

Timestamp of creation.



21
22
23
# File 'lib/zest/models/file_remote.rb', line 21

def _created
  @_created
end

#_hrefObject

Returns the value of attribute _href.



18
19
20
# File 'lib/zest/models/file_remote.rb', line 18

def _href
  @_href
end

#_last_updatedObject

Timestamp of the most recent update of the remote.



56
57
58
# File 'lib/zest/models/file_remote.rb', line 56

def _last_updated
  @_last_updated
end

#_typeObject

Returns the value of attribute _type.



23
24
25
# File 'lib/zest/models/file_remote.rb', line 23

def _type
  @_type
end

#download_concurrencyObject

Total number of simultaneous connections.



59
60
61
# File 'lib/zest/models/file_remote.rb', line 59

def download_concurrency
  @download_concurrency
end

#nameObject

A unique name for this remote.



26
27
28
# File 'lib/zest/models/file_remote.rb', line 26

def name
  @name
end

#passwordObject

The password to be used for authentication when syncing.



53
54
55
# File 'lib/zest/models/file_remote.rb', line 53

def password
  @password
end

#policyObject

The policy to use when downloading content. The possible values include: ‘immediate’, ‘on_demand’, and ‘cache_only’. ‘immediate’ is the default.



62
63
64
# File 'lib/zest/models/file_remote.rb', line 62

def policy
  @policy
end

#proxy_urlObject

The proxy URL. Format: scheme://user:password@host:port



47
48
49
# File 'lib/zest/models/file_remote.rb', line 47

def proxy_url
  @proxy_url
end

#ssl_ca_certificateObject

A PEM encoded CA certificate used to validate the server certificate presented by the remote server.



35
36
37
# File 'lib/zest/models/file_remote.rb', line 35

def ssl_ca_certificate
  @ssl_ca_certificate
end

#ssl_client_certificateObject

A PEM encoded client certificate used for authentication.



38
39
40
# File 'lib/zest/models/file_remote.rb', line 38

def ssl_client_certificate
  @ssl_client_certificate
end

#ssl_client_keyObject

A PEM encoded private key used for authentication.



41
42
43
# File 'lib/zest/models/file_remote.rb', line 41

def ssl_client_key
  @ssl_client_key
end

#ssl_validationObject

If True, SSL peer validation must be performed.



44
45
46
# File 'lib/zest/models/file_remote.rb', line 44

def ssl_validation
  @ssl_validation
end

#urlObject

The URL of an external content source.



29
30
31
# File 'lib/zest/models/file_remote.rb', line 29

def url
  @url
end

#usernameObject

The username to be used for authentication when syncing.



50
51
52
# File 'lib/zest/models/file_remote.rb', line 50

def username
  @username
end

#validateObject

If True, the plugin will validate imported artifacts.



32
33
34
# File 'lib/zest/models/file_remote.rb', line 32

def validate
  @validate
end

Class Method Details

.attribute_mapObject

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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/zest/models/file_remote.rb', line 87

def self.attribute_map
  {
    :'_href' => :'_href',
    :'_created' => :'_created',
    :'_type' => :'_type',
    :'name' => :'name',
    :'url' => :'url',
    :'validate' => :'validate',
    :'ssl_ca_certificate' => :'ssl_ca_certificate',
    :'ssl_client_certificate' => :'ssl_client_certificate',
    :'ssl_client_key' => :'ssl_client_key',
    :'ssl_validation' => :'ssl_validation',
    :'proxy_url' => :'proxy_url',
    :'username' => :'username',
    :'password' => :'password',
    :'_last_updated' => :'_last_updated',
    :'download_concurrency' => :'download_concurrency',
    :'policy' => :'policy'
  }
end

.swagger_typesObject

Attribute type mapping.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/zest/models/file_remote.rb', line 109

def self.swagger_types
  {
    :'_href' => :'String',
    :'_created' => :'DateTime',
    :'_type' => :'String',
    :'name' => :'String',
    :'url' => :'String',
    :'validate' => :'BOOLEAN',
    :'ssl_ca_certificate' => :'String',
    :'ssl_client_certificate' => :'String',
    :'ssl_client_key' => :'String',
    :'ssl_validation' => :'BOOLEAN',
    :'proxy_url' => :'String',
    :'username' => :'String',
    :'password' => :'String',
    :'_last_updated' => :'DateTime',
    :'download_concurrency' => :'Integer',
    :'policy' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/zest/models/file_remote.rb', line 313

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _href == o._href &&
      _created == o._created &&
      _type == o._type &&
      name == o.name &&
      url == o.url &&
      validate == o.validate &&
      ssl_ca_certificate == o.ssl_ca_certificate &&
      ssl_client_certificate == o.ssl_client_certificate &&
      ssl_client_key == o.ssl_client_key &&
      ssl_validation == o.ssl_validation &&
      proxy_url == o.proxy_url &&
      username == o.username &&
      password == o.password &&
      _last_updated == o._last_updated &&
      download_concurrency == o.download_concurrency &&
      policy == o.policy
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



370
371
372
373
374
375
376
377
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
# File 'lib/zest/models/file_remote.rb', line 370

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



436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/zest/models/file_remote.rb', line 436

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



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/zest/models/file_remote.rb', line 349

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


336
337
338
# File 'lib/zest/models/file_remote.rb', line 336

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



342
343
344
# File 'lib/zest/models/file_remote.rb', line 342

def hash
  [_href, _created, _type, name, url, validate, ssl_ca_certificate, ssl_client_certificate, ssl_client_key, ssl_validation, proxy_url, username, password, _last_updated, download_concurrency, policy].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zest/models/file_remote.rb', line 208

def list_invalid_properties
  invalid_properties = Array.new
  if !@_type.nil? && @_type.to_s.length < 1
    invalid_properties.push("invalid value for '_type', the character length must be great than or equal to 1.")
  end

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

  if @name.to_s.length < 1
    invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
  end

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

  if @url.to_s.length < 1
    invalid_properties.push("invalid value for 'url', the character length must be great than or equal to 1.")
  end

  if !@download_concurrency.nil? && @download_concurrency < 1
    invalid_properties.push("invalid value for 'download_concurrency', must be greater than or equal to 1.")
  end

  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



416
417
418
# File 'lib/zest/models/file_remote.rb', line 416

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



422
423
424
425
426
427
428
429
430
# File 'lib/zest/models/file_remote.rb', line 422

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



410
411
412
# File 'lib/zest/models/file_remote.rb', line 410

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



239
240
241
242
243
244
245
246
247
248
249
# File 'lib/zest/models/file_remote.rb', line 239

def valid?
  return false if !@_type.nil? && @_type.to_s.length < 1
  return false if @name.nil?
  return false if @name.to_s.length < 1
  return false if @url.nil?
  return false if @url.to_s.length < 1
  return false if !@download_concurrency.nil? && @download_concurrency < 1
  policy_validator = EnumAttributeValidator.new('String', ["immediate", "on_demand", "streamed"])
  return false unless policy_validator.valid?(@policy)
  return true
end