Class: CloudsmithApi::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsmith-api/models/repository.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Repository

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/cloudsmith-api/models/repository.rb', line 148

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#cdn_urlObject

Returns the value of attribute cdn_url.



19
20
21
# File 'lib/cloudsmith-api/models/repository.rb', line 19

def cdn_url
  @cdn_url
end

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/cloudsmith-api/models/repository.rb', line 22

def created_at
  @created_at
end

#deleted_atObject

Returns the value of attribute deleted_at.



25
26
27
# File 'lib/cloudsmith-api/models/repository.rb', line 25

def deleted_at
  @deleted_at
end

#descriptionObject

Returns the value of attribute description.



28
29
30
# File 'lib/cloudsmith-api/models/repository.rb', line 28

def description
  @description
end

#gpg_keysObject

Returns the value of attribute gpg_keys.



31
32
33
# File 'lib/cloudsmith-api/models/repository.rb', line 31

def gpg_keys
  @gpg_keys
end

#index_filesObject

If checked, files contained in packages will be indexed, which increase the synchronisation time required for packages. Note that it is recommended you keep this enabled unless the synchronisation time is significantly impacted.



34
35
36
# File 'lib/cloudsmith-api/models/repository.rb', line 34

def index_files
  @index_files
end

#is_open_sourceObject

Returns the value of attribute is_open_source.



37
38
39
# File 'lib/cloudsmith-api/models/repository.rb', line 37

def is_open_source
  @is_open_source
end

#is_privateObject

Returns the value of attribute is_private.



40
41
42
# File 'lib/cloudsmith-api/models/repository.rb', line 40

def is_private
  @is_private
end

#is_publicObject

Returns the value of attribute is_public.



43
44
45
# File 'lib/cloudsmith-api/models/repository.rb', line 43

def is_public
  @is_public
end

#nameObject

A descriptive name for the repository.



46
47
48
# File 'lib/cloudsmith-api/models/repository.rb', line 46

def name
  @name
end

#namespaceObject

Returns the value of attribute namespace.



49
50
51
# File 'lib/cloudsmith-api/models/repository.rb', line 49

def namespace
  @namespace
end

#namespace_urlObject

Returns the value of attribute namespace_url.



52
53
54
# File 'lib/cloudsmith-api/models/repository.rb', line 52

def namespace_url
  @namespace_url
end

#num_downloadsObject

The number of downloads for packages in the repository.



55
56
57
# File 'lib/cloudsmith-api/models/repository.rb', line 55

def num_downloads
  @num_downloads
end

#package_countObject

The number of packages in the repository.



58
59
60
# File 'lib/cloudsmith-api/models/repository.rb', line 58

def package_count
  @package_count
end

#package_group_countObject

The number of groups in the repository.



61
62
63
# File 'lib/cloudsmith-api/models/repository.rb', line 61

def package_group_count
  @package_group_count
end

#repository_typeObject

The repository type changes how it is accessed and billed. Private repositories can only be used on paid plans, but are visible only to you or authorised delegates. Open-Source repositories are always visible to everyone and are restricted by licensing, but are free to use and come with generous bandwidth/storage. You can only select Open-Source at repository creation time.



64
65
66
# File 'lib/cloudsmith-api/models/repository.rb', line 64

def repository_type
  @repository_type
end

#repository_type_strObject

Returns the value of attribute repository_type_str.



67
68
69
# File 'lib/cloudsmith-api/models/repository.rb', line 67

def repository_type_str
  @repository_type_str
end

#self_html_urlObject

Returns the value of attribute self_html_url.



70
71
72
# File 'lib/cloudsmith-api/models/repository.rb', line 70

def self_html_url
  @self_html_url
end

#self_urlObject

Returns the value of attribute self_url.



73
74
75
# File 'lib/cloudsmith-api/models/repository.rb', line 73

def self_url
  @self_url
end

#sizeObject

The calculated size of the repository.



76
77
78
# File 'lib/cloudsmith-api/models/repository.rb', line 76

def size
  @size
end

#size_strObject

Returns the value of attribute size_str.



79
80
81
# File 'lib/cloudsmith-api/models/repository.rb', line 79

def size_str
  @size_str
end

#slugObject

The slug identifies the repository in URIs.



82
83
84
# File 'lib/cloudsmith-api/models/repository.rb', line 82

def slug
  @slug
end

#slug_permObject

Returns the value of attribute slug_perm.



85
86
87
# File 'lib/cloudsmith-api/models/repository.rb', line 85

def slug_perm
  @slug_perm
end

Class Method Details

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cloudsmith-api/models/repository.rb', line 89

def self.attribute_map
  {
    :'cdn_url' => :'cdn_url',
    :'created_at' => :'created_at',
    :'deleted_at' => :'deleted_at',
    :'description' => :'description',
    :'gpg_keys' => :'gpg_keys',
    :'index_files' => :'index_files',
    :'is_open_source' => :'is_open_source',
    :'is_private' => :'is_private',
    :'is_public' => :'is_public',
    :'name' => :'name',
    :'namespace' => :'namespace',
    :'namespace_url' => :'namespace_url',
    :'num_downloads' => :'num_downloads',
    :'package_count' => :'package_count',
    :'package_group_count' => :'package_group_count',
    :'repository_type' => :'repository_type',
    :'repository_type_str' => :'repository_type_str',
    :'self_html_url' => :'self_html_url',
    :'self_url' => :'self_url',
    :'size' => :'size',
    :'size_str' => :'size_str',
    :'slug' => :'slug',
    :'slug_perm' => :'slug_perm'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/cloudsmith-api/models/repository.rb', line 118

def self.swagger_types
  {
    :'cdn_url' => :'String',
    :'created_at' => :'String',
    :'deleted_at' => :'String',
    :'description' => :'String',
    :'gpg_keys' => :'Array<ReposGpgKeys>',
    :'index_files' => :'BOOLEAN',
    :'is_open_source' => :'BOOLEAN',
    :'is_private' => :'BOOLEAN',
    :'is_public' => :'BOOLEAN',
    :'name' => :'String',
    :'namespace' => :'String',
    :'namespace_url' => :'String',
    :'num_downloads' => :'Integer',
    :'package_count' => :'Integer',
    :'package_group_count' => :'Integer',
    :'repository_type' => :'String',
    :'repository_type_str' => :'String',
    :'self_html_url' => :'String',
    :'self_url' => :'String',
    :'size' => :'Integer',
    :'size_str' => :'String',
    :'slug' => :'String',
    :'slug_perm' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/cloudsmith-api/models/repository.rb', line 290

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      cdn_url == o.cdn_url &&
      created_at == o.created_at &&
      deleted_at == o.deleted_at &&
      description == o.description &&
      gpg_keys == o.gpg_keys &&
      index_files == o.index_files &&
      is_open_source == o.is_open_source &&
      is_private == o.is_private &&
      is_public == o.is_public &&
      name == o.name &&
      namespace == o.namespace &&
      namespace_url == o.namespace_url &&
      num_downloads == o.num_downloads &&
      package_count == o.package_count &&
      package_group_count == o.package_group_count &&
      repository_type == o.repository_type &&
      repository_type_str == o.repository_type_str &&
      self_html_url == o.self_html_url &&
      self_url == o.self_url &&
      size == o.size &&
      size_str == o.size_str &&
      slug == o.slug &&
      slug_perm == o.slug_perm
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



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/cloudsmith-api/models/repository.rb', line 354

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



420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/cloudsmith-api/models/repository.rb', line 420

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



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/cloudsmith-api/models/repository.rb', line 333

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


320
321
322
# File 'lib/cloudsmith-api/models/repository.rb', line 320

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



326
327
328
# File 'lib/cloudsmith-api/models/repository.rb', line 326

def hash
  [cdn_url, created_at, deleted_at, description, gpg_keys, index_files, is_open_source, is_private, is_public, name, namespace, namespace_url, num_downloads, package_count, package_group_count, repository_type, repository_type_str, self_html_url, self_url, size, size_str, slug, slug_perm].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/cloudsmith-api/models/repository.rb', line 252

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

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

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

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

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



400
401
402
# File 'lib/cloudsmith-api/models/repository.rb', line 400

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



406
407
408
409
410
411
412
413
414
# File 'lib/cloudsmith-api/models/repository.rb', line 406

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



394
395
396
# File 'lib/cloudsmith-api/models/repository.rb', line 394

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



279
280
281
282
283
284
285
286
# File 'lib/cloudsmith-api/models/repository.rb', line 279

def valid?
  return false if @description.nil?
  return false if @is_open_source.nil?
  return false if @is_private.nil?
  return false if @is_public.nil?
  return false if @namespace.nil?
  return true
end