Class: CloudsmithApi::Repository
- Inherits:
-
Object
- Object
- CloudsmithApi::Repository
- Defined in:
- lib/cloudsmith-api/models/repository.rb
Instance Attribute Summary collapse
-
#cdn_url ⇒ Object
Returns the value of attribute cdn_url.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#deleted_at ⇒ Object
Returns the value of attribute deleted_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#gpg_keys ⇒ Object
Returns the value of attribute gpg_keys.
-
#index_files ⇒ Object
If checked, files contained in packages will be indexed, which increase the synchronisation time required for packages.
-
#is_open_source ⇒ Object
Returns the value of attribute is_open_source.
-
#is_private ⇒ Object
Returns the value of attribute is_private.
-
#is_public ⇒ Object
Returns the value of attribute is_public.
-
#name ⇒ Object
A descriptive name for the repository.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#namespace_url ⇒ Object
Returns the value of attribute namespace_url.
-
#num_downloads ⇒ Object
The number of downloads for packages in the repository.
-
#package_count ⇒ Object
The number of packages in the repository.
-
#package_group_count ⇒ Object
The number of groups in the repository.
-
#repository_type ⇒ Object
The repository type changes how it is accessed and billed.
-
#repository_type_str ⇒ Object
Returns the value of attribute repository_type_str.
-
#self_html_url ⇒ Object
Returns the value of attribute self_html_url.
-
#self_url ⇒ Object
Returns the value of attribute self_url.
-
#size ⇒ Object
The calculated size of the repository.
-
#size_str ⇒ Object
Returns the value of attribute size_str.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#slug_perm ⇒ Object
Returns the value of attribute slug_perm.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Repository
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Repository
Initializes the object
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_url ⇒ Object
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_at ⇒ Object
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_at ⇒ Object
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 |
#description ⇒ Object
Returns the value of attribute description.
28 29 30 |
# File 'lib/cloudsmith-api/models/repository.rb', line 28 def description @description end |
#gpg_keys ⇒ Object
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_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.
34 35 36 |
# File 'lib/cloudsmith-api/models/repository.rb', line 34 def index_files @index_files end |
#is_open_source ⇒ Object
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_private ⇒ Object
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_public ⇒ Object
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 |
#name ⇒ Object
A descriptive name for the repository.
46 47 48 |
# File 'lib/cloudsmith-api/models/repository.rb', line 46 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
49 50 51 |
# File 'lib/cloudsmith-api/models/repository.rb', line 49 def namespace @namespace end |
#namespace_url ⇒ Object
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_downloads ⇒ Object
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_count ⇒ Object
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_count ⇒ Object
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_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.
64 65 66 |
# File 'lib/cloudsmith-api/models/repository.rb', line 64 def repository_type @repository_type end |
#repository_type_str ⇒ Object
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_url ⇒ Object
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_url ⇒ Object
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 |
#size ⇒ Object
The calculated size of the repository.
76 77 78 |
# File 'lib/cloudsmith-api/models/repository.rb', line 76 def size @size end |
#size_str ⇒ Object
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 |
#slug ⇒ Object
Returns the value of attribute slug.
82 83 84 |
# File 'lib/cloudsmith-api/models/repository.rb', line 82 def slug @slug end |
#slug_perm ⇒ Object
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_map ⇒ Object
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_types ⇒ Object
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.
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 |
# File 'lib/cloudsmith-api/models/repository.rb', line 280 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
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 378 379 380 |
# File 'lib/cloudsmith-api/models/repository.rb', line 344 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
410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/cloudsmith-api/models/repository.rb', line 410 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
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/cloudsmith-api/models/repository.rb', line 323 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
310 311 312 |
# File 'lib/cloudsmith-api/models/repository.rb', line 310 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
316 317 318 |
# File 'lib/cloudsmith-api/models/repository.rb', line 316 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_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/cloudsmith-api/models/repository.rb', line 252 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push("invalid value for 'name', name cannot be nil.") end if @namespace.nil? invalid_properties.push("invalid value for 'namespace', namespace cannot be nil.") end if @slug.nil? invalid_properties.push("invalid value for 'slug', slug cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
390 391 392 |
# File 'lib/cloudsmith-api/models/repository.rb', line 390 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
396 397 398 399 400 401 402 403 404 |
# File 'lib/cloudsmith-api/models/repository.rb', line 396 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
384 385 386 |
# File 'lib/cloudsmith-api/models/repository.rb', line 384 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
271 272 273 274 275 276 |
# File 'lib/cloudsmith-api/models/repository.rb', line 271 def valid? return false if @name.nil? return false if @namespace.nil? return false if @slug.nil? return true end |