Class: CloudsmithApi::RepositoryCreate

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RepositoryCreate

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
249
250
251
252
253
254
# File 'lib/cloudsmith-api/models/repository_create.rb', line 151

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

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

Instance Attribute Details

#cdn_url ⇒ Object

Base URL from which packages and other artifacts are downloaded.



18
19
20
# File 'lib/cloudsmith-api/models/repository_create.rb', line 18

def cdn_url
  @cdn_url
end

#created_at ⇒ Object

Returns the value of attribute created_at.



21
22
23
# File 'lib/cloudsmith-api/models/repository_create.rb', line 21

def created_at
  @created_at
end

#deleted_at ⇒ Object

Returns the value of attribute deleted_at.



24
25
26
# File 'lib/cloudsmith-api/models/repository_create.rb', line 24

def deleted_at
  @deleted_at
end

#description ⇒ Object

A description of the repository's purpose/contents.



27
28
29
# File 'lib/cloudsmith-api/models/repository_create.rb', line 27

def description
  @description
end

#gpg_keys ⇒ Object

Returns the value of attribute gpg_keys.



30
31
32
# File 'lib/cloudsmith-api/models/repository_create.rb', line 30

def gpg_keys
  @gpg_keys
end

#index_files ⇒ Object

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.



33
34
35
# File 'lib/cloudsmith-api/models/repository_create.rb', line 33

def index_files
  @index_files
end

#is_open_source ⇒ Object

Returns the value of attribute is_open_source.



36
37
38
# File 'lib/cloudsmith-api/models/repository_create.rb', line 36

def is_open_source
  @is_open_source
end

#is_private ⇒ Object

Returns the value of attribute is_private.



39
40
41
# File 'lib/cloudsmith-api/models/repository_create.rb', line 39

def is_private
  @is_private
end

#is_public ⇒ Object

Returns the value of attribute is_public.



42
43
44
# File 'lib/cloudsmith-api/models/repository_create.rb', line 42

def is_public
  @is_public
end

#name ⇒ Object

A descriptive name for the repository.



45
46
47
# File 'lib/cloudsmith-api/models/repository_create.rb', line 45

def name
  @name
end

#namespace ⇒ Object

Namespace to which this repository belongs.



48
49
50
# File 'lib/cloudsmith-api/models/repository_create.rb', line 48

def namespace
  @namespace
end

#namespace_url ⇒ Object

API endpoint where data about this namespace can be retrieved.



51
52
53
# File 'lib/cloudsmith-api/models/repository_create.rb', line 51

def namespace_url
  @namespace_url
end

#num_downloads ⇒ Object

The number of downloads for packages in the repository.



54
55
56
# File 'lib/cloudsmith-api/models/repository_create.rb', line 54

def num_downloads
  @num_downloads
end

#package_count ⇒ Object

The number of packages in the repository.



57
58
59
# File 'lib/cloudsmith-api/models/repository_create.rb', line 57

def package_count
  @package_count
end

#package_group_count ⇒ Object

The number of groups in the repository.



60
61
62
# File 'lib/cloudsmith-api/models/repository_create.rb', line 60

def package_group_count
  @package_group_count
end

#repository_type ⇒ Object

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.



63
64
65
# File 'lib/cloudsmith-api/models/repository_create.rb', line 63

def repository_type
  @repository_type
end

#repository_type_str ⇒ Object

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. Public repositories are free to use on all plans and visible to all Cloudsmith users.



66
67
68
# File 'lib/cloudsmith-api/models/repository_create.rb', line 66

def repository_type_str
  @repository_type_str
end

#self_html_url ⇒ Object

Website URL for this repository.



69
70
71
# File 'lib/cloudsmith-api/models/repository_create.rb', line 69

def self_html_url
  @self_html_url
end

#self_url ⇒ Object

API endpoint where data about this repository can be retrieved.



72
73
74
# File 'lib/cloudsmith-api/models/repository_create.rb', line 72

def self_url
  @self_url
end

#size ⇒ Object

The calculated size of the repository.



75
76
77
# File 'lib/cloudsmith-api/models/repository_create.rb', line 75

def size
  @size
end

#size_str ⇒ Object

The calculated size of the repository (human readable).



78
79
80
# File 'lib/cloudsmith-api/models/repository_create.rb', line 78

def size_str
  @size_str
end

#slug ⇒ Object

The slug identifies the repository in URIs.



81
82
83
# File 'lib/cloudsmith-api/models/repository_create.rb', line 81

def slug
  @slug
end

#slug_perm ⇒ Object

The slug_perm immutably identifies the repository. It will never change once a repository has been created.



84
85
86
# File 'lib/cloudsmith-api/models/repository_create.rb', line 84

def slug_perm
  @slug_perm
end

#storage_region ⇒ Object

The Cloudsmith region in which package files are stored.



87
88
89
# File 'lib/cloudsmith-api/models/repository_create.rb', line 87

def storage_region
  @storage_region
end

Class Method Details

.attribute_map ⇒ Object

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



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
116
117
# File 'lib/cloudsmith-api/models/repository_create.rb', line 90

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',
    :'storage_region' => :'storage_region'
  }
end

.swagger_types ⇒ Object

Attribute type mapping.



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

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' => :'Integer',
    :'repository_type_str' => :'String',
    :'self_html_url' => :'String',
    :'self_url' => :'String',
    :'size' => :'Integer',
    :'size_str' => :'String',
    :'slug' => :'String',
    :'slug_perm' => :'String',
    :'storage_region' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



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

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 &&
      storage_region == o.storage_region
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



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/cloudsmith-api/models/repository_create.rb', line 341

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



407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/cloudsmith-api/models/repository_create.rb', line 407

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



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/cloudsmith-api/models/repository_create.rb', line 320

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 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


307
308
309
# File 'lib/cloudsmith-api/models/repository_create.rb', line 307

def eql?(o)
  self == o
end

#hash ⇒ Fixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum) —

    Hash code



313
314
315
# File 'lib/cloudsmith-api/models/repository_create.rb', line 313

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, storage_region].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



258
259
260
261
262
263
264
265
# File 'lib/cloudsmith-api/models/repository_create.rb', line 258

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

  invalid_properties
end

#to_body ⇒ Hash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash) —

    Returns the object in the form of hash



387
388
389
# File 'lib/cloudsmith-api/models/repository_create.rb', line 387

def to_body
  to_hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



393
394
395
396
397
398
399
400
401
# File 'lib/cloudsmith-api/models/repository_create.rb', line 393

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_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



381
382
383
# File 'lib/cloudsmith-api/models/repository_create.rb', line 381

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



269
270
271
272
# File 'lib/cloudsmith-api/models/repository_create.rb', line 269

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