cloudsmith-api 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +105 -4
  4. data/build.json +1 -1
  5. data/docs/DartUpstream.md +23 -0
  6. data/docs/DartUpstreamRequest.md +20 -0
  7. data/docs/DartUpstreamRequestPatch.md +20 -0
  8. data/docs/DebUpstream.md +27 -0
  9. data/docs/DebUpstreamRequest.md +24 -0
  10. data/docs/DebUpstreamRequestPatch.md +24 -0
  11. data/docs/DockerUpstream.md +23 -0
  12. data/docs/DockerUpstreamRequest.md +20 -0
  13. data/docs/DockerUpstreamRequestPatch.md +20 -0
  14. data/docs/HelmUpstream.md +23 -0
  15. data/docs/HelmUpstreamRequest.md +20 -0
  16. data/docs/HelmUpstreamRequestPatch.md +20 -0
  17. data/docs/MavenPackageUpload.md +2 -0
  18. data/docs/MavenPackageUploadRequest.md +2 -0
  19. data/docs/MavenUpstream.md +23 -0
  20. data/docs/MavenUpstreamRequest.md +20 -0
  21. data/docs/MavenUpstreamRequestPatch.md +20 -0
  22. data/docs/NpmUpstream.md +23 -0
  23. data/docs/NpmUpstreamRequest.md +20 -0
  24. data/docs/NpmUpstreamRequestPatch.md +20 -0
  25. data/docs/NugetUpstream.md +23 -0
  26. data/docs/NugetUpstreamRequest.md +20 -0
  27. data/docs/NugetUpstreamRequestPatch.md +20 -0
  28. data/docs/OrgsApi.md +431 -0
  29. data/docs/PackageLicensePolicyEvaluationRequest.md +14 -0
  30. data/docs/PackageLicensePolicyEvaluationRequestRequest.md +7 -0
  31. data/docs/PackageVulnerabilityPolicyEvaluationRequest.md +14 -0
  32. data/docs/PackageVulnerabilityPolicyEvaluationRequestRequest.md +7 -0
  33. data/docs/PythonUpstream.md +23 -0
  34. data/docs/PythonUpstreamRequest.md +20 -0
  35. data/docs/PythonUpstreamRequestPatch.md +20 -0
  36. data/docs/ReposApi.md +3770 -0
  37. data/docs/RpmUpstream.md +25 -0
  38. data/docs/RpmUpstreamRequest.md +22 -0
  39. data/docs/RpmUpstreamRequestPatch.md +22 -0
  40. data/docs/RubyUpstream.md +23 -0
  41. data/docs/RubyUpstreamRequest.md +20 -0
  42. data/docs/RubyUpstreamRequestPatch.md +20 -0
  43. data/docs/StatusBasic.md +1 -1
  44. data/lib/cloudsmith-api/api/orgs_api.rb +447 -0
  45. data/lib/cloudsmith-api/api/repos_api.rb +3950 -0
  46. data/lib/cloudsmith-api/models/dart_upstream.rb +393 -0
  47. data/lib/cloudsmith-api/models/dart_upstream_request.rb +365 -0
  48. data/lib/cloudsmith-api/models/dart_upstream_request_patch.rb +355 -0
  49. data/lib/cloudsmith-api/models/deb_upstream.rb +440 -0
  50. data/lib/cloudsmith-api/models/deb_upstream_request.rb +412 -0
  51. data/lib/cloudsmith-api/models/deb_upstream_request_patch.rb +397 -0
  52. data/lib/cloudsmith-api/models/docker_upstream.rb +393 -0
  53. data/lib/cloudsmith-api/models/docker_upstream_request.rb +365 -0
  54. data/lib/cloudsmith-api/models/docker_upstream_request_patch.rb +355 -0
  55. data/lib/cloudsmith-api/models/helm_upstream.rb +393 -0
  56. data/lib/cloudsmith-api/models/helm_upstream_request.rb +365 -0
  57. data/lib/cloudsmith-api/models/helm_upstream_request_patch.rb +355 -0
  58. data/lib/cloudsmith-api/models/maven_package_upload.rb +19 -1
  59. data/lib/cloudsmith-api/models/maven_package_upload_request.rb +19 -1
  60. data/lib/cloudsmith-api/models/maven_upstream.rb +393 -0
  61. data/lib/cloudsmith-api/models/maven_upstream_request.rb +365 -0
  62. data/lib/cloudsmith-api/models/maven_upstream_request_patch.rb +355 -0
  63. data/lib/cloudsmith-api/models/npm_upstream.rb +393 -0
  64. data/lib/cloudsmith-api/models/npm_upstream_request.rb +365 -0
  65. data/lib/cloudsmith-api/models/npm_upstream_request_patch.rb +355 -0
  66. data/lib/cloudsmith-api/models/nuget_upstream.rb +393 -0
  67. data/lib/cloudsmith-api/models/nuget_upstream_request.rb +365 -0
  68. data/lib/cloudsmith-api/models/nuget_upstream_request_patch.rb +355 -0
  69. data/lib/cloudsmith-api/models/package_license_policy_evaluation_request.rb +274 -0
  70. data/lib/cloudsmith-api/models/package_license_policy_evaluation_request_request.rb +175 -0
  71. data/lib/cloudsmith-api/models/package_vulnerability_policy_evaluation_request.rb +274 -0
  72. data/lib/cloudsmith-api/models/package_vulnerability_policy_evaluation_request_request.rb +175 -0
  73. data/lib/cloudsmith-api/models/python_upstream.rb +393 -0
  74. data/lib/cloudsmith-api/models/python_upstream_request.rb +365 -0
  75. data/lib/cloudsmith-api/models/python_upstream_request_patch.rb +355 -0
  76. data/lib/cloudsmith-api/models/rpm_upstream.rb +418 -0
  77. data/lib/cloudsmith-api/models/rpm_upstream_request.rb +390 -0
  78. data/lib/cloudsmith-api/models/rpm_upstream_request_patch.rb +375 -0
  79. data/lib/cloudsmith-api/models/ruby_upstream.rb +393 -0
  80. data/lib/cloudsmith-api/models/ruby_upstream_request.rb +365 -0
  81. data/lib/cloudsmith-api/models/ruby_upstream_request_patch.rb +355 -0
  82. data/lib/cloudsmith-api/models/status_basic.rb +1 -1
  83. data/lib/cloudsmith-api/version.rb +1 -1
  84. data/lib/cloudsmith-api.rb +34 -0
  85. data/spec/api/orgs_api_spec.rb +99 -0
  86. data/spec/api/repos_api_spec.rb +870 -0
  87. data/spec/models/dart_upstream_request_patch_spec.rb +121 -0
  88. data/spec/models/dart_upstream_request_spec.rb +121 -0
  89. data/spec/models/dart_upstream_spec.rb +139 -0
  90. data/spec/models/deb_upstream_request_patch_spec.rb +145 -0
  91. data/spec/models/deb_upstream_request_spec.rb +145 -0
  92. data/spec/models/deb_upstream_spec.rb +163 -0
  93. data/spec/models/docker_upstream_request_patch_spec.rb +121 -0
  94. data/spec/models/docker_upstream_request_spec.rb +121 -0
  95. data/spec/models/docker_upstream_spec.rb +139 -0
  96. data/spec/models/helm_upstream_request_patch_spec.rb +121 -0
  97. data/spec/models/helm_upstream_request_spec.rb +121 -0
  98. data/spec/models/helm_upstream_spec.rb +139 -0
  99. data/spec/models/maven_package_upload_request_spec.rb +12 -0
  100. data/spec/models/maven_package_upload_spec.rb +12 -0
  101. data/spec/models/maven_upstream_request_patch_spec.rb +121 -0
  102. data/spec/models/maven_upstream_request_spec.rb +121 -0
  103. data/spec/models/maven_upstream_spec.rb +139 -0
  104. data/spec/models/npm_upstream_request_patch_spec.rb +121 -0
  105. data/spec/models/npm_upstream_request_spec.rb +121 -0
  106. data/spec/models/npm_upstream_spec.rb +139 -0
  107. data/spec/models/nuget_upstream_request_patch_spec.rb +121 -0
  108. data/spec/models/nuget_upstream_request_spec.rb +121 -0
  109. data/spec/models/nuget_upstream_spec.rb +139 -0
  110. data/spec/models/package_license_policy_evaluation_request_request_spec.rb +35 -0
  111. data/spec/models/package_license_policy_evaluation_request_spec.rb +81 -0
  112. data/spec/models/package_vulnerability_policy_evaluation_request_request_spec.rb +35 -0
  113. data/spec/models/package_vulnerability_policy_evaluation_request_spec.rb +81 -0
  114. data/spec/models/python_upstream_request_patch_spec.rb +121 -0
  115. data/spec/models/python_upstream_request_spec.rb +121 -0
  116. data/spec/models/python_upstream_spec.rb +139 -0
  117. data/spec/models/rpm_upstream_request_patch_spec.rb +133 -0
  118. data/spec/models/rpm_upstream_request_spec.rb +133 -0
  119. data/spec/models/rpm_upstream_spec.rb +151 -0
  120. data/spec/models/ruby_upstream_request_patch_spec.rb +121 -0
  121. data/spec/models/ruby_upstream_request_spec.rb +121 -0
  122. data/spec/models/ruby_upstream_spec.rb +139 -0
  123. data/vendor/bundle/ruby/2.6.0/cache/rspec-support-3.12.1.gem +0 -0
  124. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.2.20/gem_make.out +1 -1
  125. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.15.5/gem_make.out +2 -2
  126. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.6.3/gem_make.out +1 -1
  127. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.6.3/mkmf.log +1 -1
  128. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  129. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/Makefile +2 -2
  130. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/ext/generator/Makefile +2 -2
  131. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/ext/parser/Makefile +2 -2
  132. data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/Changelog.md +9 -1
  133. data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/shell_out.rb +3 -0
  134. data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/version.rb +1 -1
  135. data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support.rb +8 -2
  136. data/vendor/bundle/ruby/2.6.0/specifications/{rspec-support-3.12.0.gemspec → rspec-support-3.12.1.gemspec} +5 -5
  137. metadata +176 -40
  138. data/vendor/bundle/ruby/2.6.0/cache/rspec-support-3.12.0.gem +0 -0
  139. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/LICENSE.md +0 -0
  140. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/README.md +0 -0
  141. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/caller_filter.rb +0 -0
  142. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/comparable_version.rb +0 -0
  143. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/differ.rb +0 -0
  144. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/directory_maker.rb +0 -0
  145. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/encoded_string.rb +0 -0
  146. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/fuzzy_matcher.rb +0 -0
  147. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/hunk_generator.rb +0 -0
  148. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/matcher_definition.rb +0 -0
  149. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/method_signature_verifier.rb +0 -0
  150. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/mutex.rb +0 -0
  151. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/object_formatter.rb +0 -0
  152. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/recursive_const_methods.rb +0 -0
  153. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/reentrant_mutex.rb +0 -0
  154. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/ruby_features.rb +0 -0
  155. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/source/location.rb +0 -0
  156. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/source/node.rb +0 -0
  157. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/source/token.rb +0 -0
  158. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/source.rb +0 -0
  159. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/deprecation_helpers.rb +0 -0
  160. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/diff_helpers.rb +0 -0
  161. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/formatting_support.rb +0 -0
  162. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/in_sub_process.rb +0 -0
  163. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/library_wide_checks.rb +0 -0
  164. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/stderr_splitter.rb +0 -0
  165. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/string_matcher.rb +0 -0
  166. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/with_isolated_directory.rb +0 -0
  167. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec/with_isolated_stderr.rb +0 -0
  168. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/spec.rb +0 -0
  169. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/warnings.rb +0 -0
  170. /data/vendor/bundle/ruby/2.6.0/gems/{rspec-support-3.12.0 → rspec-support-3.12.1}/lib/rspec/support/with_keywords_when_needed.rb +0 -0
@@ -0,0 +1,440 @@
1
+ =begin
2
+ #Cloudsmith API (v1)
3
+
4
+ #The API to the Cloudsmith Service
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@cloudsmith.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.26
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+ class DebUpstream
17
+ # The authentication mode to use when accessing this upstream.
18
+ attr_accessor :auth_mode
19
+
20
+ # Secret to provide with requests to upstream.
21
+ attr_accessor :auth_secret
22
+
23
+ # Username to provide with requests to upstream.
24
+ attr_accessor :auth_username
25
+
26
+ # The component to fetch from the upstream
27
+ attr_accessor :component
28
+
29
+ # The datetime the upstream source was created.
30
+ attr_accessor :created_at
31
+
32
+ # The distribution version that packages found on this upstream could be associated with.
33
+ attr_accessor :distro_versions
34
+
35
+ # The key for extra header #1 to send to upstream.
36
+ attr_accessor :extra_header_1
37
+
38
+ # The key for extra header #2 to send to upstream.
39
+ attr_accessor :extra_header_2
40
+
41
+ # The value for extra header #1 to send to upstream. This is stored as plaintext, and is NOT encrypted.
42
+ attr_accessor :extra_value_1
43
+
44
+ # The value for extra header #2 to send to upstream. This is stored as plaintext, and is NOT encrypted.
45
+ attr_accessor :extra_value_2
46
+
47
+ # When true, source packages will be available from this upstream.
48
+ attr_accessor :include_sources
49
+
50
+ # Whether or not this upstream is active and ready for requests.
51
+ attr_accessor :is_active
52
+
53
+ # The mode that this upstream should operate in. Upstream sources can be used to proxy resolved packages, as well as operate in a proxy/cache or cache only mode.
54
+ attr_accessor :mode
55
+
56
+ # A descriptive name for this upstream source. A shortened version of this name will be used for tagging cached packages retrieved from this upstream.
57
+ attr_accessor :name
58
+
59
+ # Upstream sources are selected for resolving requests by sequential order (1..n), followed by creation date.
60
+ attr_accessor :priority
61
+
62
+ attr_accessor :slug_perm
63
+
64
+ attr_accessor :updated_at
65
+
66
+ # The distribution to fetch from the upstream
67
+ attr_accessor :upstream_distribution
68
+
69
+ # The URL for this upstream source. This must be a fully qualified URL including any path elements required to reach the root of the repository.
70
+ attr_accessor :upstream_url
71
+
72
+ # If enabled, SSL certificates are verified when requests are made to this upstream. It's recommended to leave this enabled for all public sources to help mitigate Man-In-The-Middle (MITM) attacks. Please note this only applies to HTTPS upstreams.
73
+ attr_accessor :verify_ssl
74
+
75
+ class EnumAttributeValidator
76
+ attr_reader :datatype
77
+ attr_reader :allowable_values
78
+
79
+ def initialize(datatype, allowable_values)
80
+ @allowable_values = allowable_values.map do |value|
81
+ case datatype.to_s
82
+ when /Integer/i
83
+ value.to_i
84
+ when /Float/i
85
+ value.to_f
86
+ else
87
+ value
88
+ end
89
+ end
90
+ end
91
+
92
+ def valid?(value)
93
+ !value || allowable_values.include?(value)
94
+ end
95
+ end
96
+
97
+ # Attribute mapping from ruby-style variable name to JSON key.
98
+ def self.attribute_map
99
+ {
100
+ :'auth_mode' => :'auth_mode',
101
+ :'auth_secret' => :'auth_secret',
102
+ :'auth_username' => :'auth_username',
103
+ :'component' => :'component',
104
+ :'created_at' => :'created_at',
105
+ :'distro_versions' => :'distro_versions',
106
+ :'extra_header_1' => :'extra_header_1',
107
+ :'extra_header_2' => :'extra_header_2',
108
+ :'extra_value_1' => :'extra_value_1',
109
+ :'extra_value_2' => :'extra_value_2',
110
+ :'include_sources' => :'include_sources',
111
+ :'is_active' => :'is_active',
112
+ :'mode' => :'mode',
113
+ :'name' => :'name',
114
+ :'priority' => :'priority',
115
+ :'slug_perm' => :'slug_perm',
116
+ :'updated_at' => :'updated_at',
117
+ :'upstream_distribution' => :'upstream_distribution',
118
+ :'upstream_url' => :'upstream_url',
119
+ :'verify_ssl' => :'verify_ssl'
120
+ }
121
+ end
122
+
123
+ # Attribute type mapping.
124
+ def self.swagger_types
125
+ {
126
+ :'auth_mode' => :'String',
127
+ :'auth_secret' => :'String',
128
+ :'auth_username' => :'String',
129
+ :'component' => :'String',
130
+ :'created_at' => :'DateTime',
131
+ :'distro_versions' => :'Array<String>',
132
+ :'extra_header_1' => :'String',
133
+ :'extra_header_2' => :'String',
134
+ :'extra_value_1' => :'String',
135
+ :'extra_value_2' => :'String',
136
+ :'include_sources' => :'BOOLEAN',
137
+ :'is_active' => :'BOOLEAN',
138
+ :'mode' => :'String',
139
+ :'name' => :'String',
140
+ :'priority' => :'Integer',
141
+ :'slug_perm' => :'String',
142
+ :'updated_at' => :'DateTime',
143
+ :'upstream_distribution' => :'String',
144
+ :'upstream_url' => :'String',
145
+ :'verify_ssl' => :'BOOLEAN'
146
+ }
147
+ end
148
+
149
+ # Initializes the object
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ def initialize(attributes = {})
152
+ return unless attributes.is_a?(Hash)
153
+
154
+ # convert string to symbol for hash key
155
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
156
+
157
+ if attributes.has_key?(:'auth_mode')
158
+ self.auth_mode = attributes[:'auth_mode']
159
+ else
160
+ self.auth_mode = 'None'
161
+ end
162
+
163
+ if attributes.has_key?(:'auth_secret')
164
+ self.auth_secret = attributes[:'auth_secret']
165
+ end
166
+
167
+ if attributes.has_key?(:'auth_username')
168
+ self.auth_username = attributes[:'auth_username']
169
+ end
170
+
171
+ if attributes.has_key?(:'component')
172
+ self.component = attributes[:'component']
173
+ end
174
+
175
+ if attributes.has_key?(:'created_at')
176
+ self.created_at = attributes[:'created_at']
177
+ end
178
+
179
+ if attributes.has_key?(:'distro_versions')
180
+ if (value = attributes[:'distro_versions']).is_a?(Array)
181
+ self.distro_versions = value
182
+ end
183
+ end
184
+
185
+ if attributes.has_key?(:'extra_header_1')
186
+ self.extra_header_1 = attributes[:'extra_header_1']
187
+ end
188
+
189
+ if attributes.has_key?(:'extra_header_2')
190
+ self.extra_header_2 = attributes[:'extra_header_2']
191
+ end
192
+
193
+ if attributes.has_key?(:'extra_value_1')
194
+ self.extra_value_1 = attributes[:'extra_value_1']
195
+ end
196
+
197
+ if attributes.has_key?(:'extra_value_2')
198
+ self.extra_value_2 = attributes[:'extra_value_2']
199
+ end
200
+
201
+ if attributes.has_key?(:'include_sources')
202
+ self.include_sources = attributes[:'include_sources']
203
+ end
204
+
205
+ if attributes.has_key?(:'is_active')
206
+ self.is_active = attributes[:'is_active']
207
+ end
208
+
209
+ if attributes.has_key?(:'mode')
210
+ self.mode = attributes[:'mode']
211
+ else
212
+ self.mode = 'Proxy Only'
213
+ end
214
+
215
+ if attributes.has_key?(:'name')
216
+ self.name = attributes[:'name']
217
+ end
218
+
219
+ if attributes.has_key?(:'priority')
220
+ self.priority = attributes[:'priority']
221
+ end
222
+
223
+ if attributes.has_key?(:'slug_perm')
224
+ self.slug_perm = attributes[:'slug_perm']
225
+ end
226
+
227
+ if attributes.has_key?(:'updated_at')
228
+ self.updated_at = attributes[:'updated_at']
229
+ end
230
+
231
+ if attributes.has_key?(:'upstream_distribution')
232
+ self.upstream_distribution = attributes[:'upstream_distribution']
233
+ end
234
+
235
+ if attributes.has_key?(:'upstream_url')
236
+ self.upstream_url = attributes[:'upstream_url']
237
+ end
238
+
239
+ if attributes.has_key?(:'verify_ssl')
240
+ self.verify_ssl = attributes[:'verify_ssl']
241
+ end
242
+ end
243
+
244
+ # Show invalid properties with the reasons. Usually used together with valid?
245
+ # @return Array for valid properties with the reasons
246
+ def list_invalid_properties
247
+ invalid_properties = Array.new
248
+ if @distro_versions.nil?
249
+ invalid_properties.push('invalid value for "distro_versions", distro_versions cannot be nil.')
250
+ end
251
+
252
+ if @name.nil?
253
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
254
+ end
255
+
256
+ if @upstream_url.nil?
257
+ invalid_properties.push('invalid value for "upstream_url", upstream_url cannot be nil.')
258
+ end
259
+
260
+ invalid_properties
261
+ end
262
+
263
+ # Check to see if the all the properties in the model are valid
264
+ # @return true if the model is valid
265
+ def valid?
266
+ auth_mode_validator = EnumAttributeValidator.new('String', ['None', 'Username and Password'])
267
+ return false unless auth_mode_validator.valid?(@auth_mode)
268
+ return false if @distro_versions.nil?
269
+ mode_validator = EnumAttributeValidator.new('String', ['Proxy Only', 'Cache and Proxy'])
270
+ return false unless mode_validator.valid?(@mode)
271
+ return false if @name.nil?
272
+ return false if @upstream_url.nil?
273
+ true
274
+ end
275
+
276
+ # Custom attribute writer method checking allowed values (enum).
277
+ # @param [Object] auth_mode Object to be assigned
278
+ def auth_mode=(auth_mode)
279
+ validator = EnumAttributeValidator.new('String', ['None', 'Username and Password'])
280
+ unless validator.valid?(auth_mode)
281
+ fail ArgumentError, 'invalid value for "auth_mode", must be one of #{validator.allowable_values}.'
282
+ end
283
+ @auth_mode = auth_mode
284
+ end
285
+
286
+ # Custom attribute writer method checking allowed values (enum).
287
+ # @param [Object] mode Object to be assigned
288
+ def mode=(mode)
289
+ validator = EnumAttributeValidator.new('String', ['Proxy Only', 'Cache and Proxy'])
290
+ unless validator.valid?(mode)
291
+ fail ArgumentError, 'invalid value for "mode", must be one of #{validator.allowable_values}.'
292
+ end
293
+ @mode = mode
294
+ end
295
+
296
+ # Checks equality by comparing each attribute.
297
+ # @param [Object] Object to be compared
298
+ def ==(o)
299
+ return true if self.equal?(o)
300
+ self.class == o.class &&
301
+ auth_mode == o.auth_mode &&
302
+ auth_secret == o.auth_secret &&
303
+ auth_username == o.auth_username &&
304
+ component == o.component &&
305
+ created_at == o.created_at &&
306
+ distro_versions == o.distro_versions &&
307
+ extra_header_1 == o.extra_header_1 &&
308
+ extra_header_2 == o.extra_header_2 &&
309
+ extra_value_1 == o.extra_value_1 &&
310
+ extra_value_2 == o.extra_value_2 &&
311
+ include_sources == o.include_sources &&
312
+ is_active == o.is_active &&
313
+ mode == o.mode &&
314
+ name == o.name &&
315
+ priority == o.priority &&
316
+ slug_perm == o.slug_perm &&
317
+ updated_at == o.updated_at &&
318
+ upstream_distribution == o.upstream_distribution &&
319
+ upstream_url == o.upstream_url &&
320
+ verify_ssl == o.verify_ssl
321
+ end
322
+
323
+ # @see the `==` method
324
+ # @param [Object] Object to be compared
325
+ def eql?(o)
326
+ self == o
327
+ end
328
+
329
+ # Calculates hash code according to all attributes.
330
+ # @return [Fixnum] Hash code
331
+ def hash
332
+ [auth_mode, auth_secret, auth_username, component, created_at, distro_versions, extra_header_1, extra_header_2, extra_value_1, extra_value_2, include_sources, is_active, mode, name, priority, slug_perm, updated_at, upstream_distribution, upstream_url, verify_ssl].hash
333
+ end
334
+
335
+ # Builds the object from hash
336
+ # @param [Hash] attributes Model attributes in the form of hash
337
+ # @return [Object] Returns the model itself
338
+ def build_from_hash(attributes)
339
+ return nil unless attributes.is_a?(Hash)
340
+ self.class.swagger_types.each_pair do |key, type|
341
+ if type =~ /\AArray<(.*)>/i
342
+ # check to ensure the input is an array given that the attribute
343
+ # is documented as an array but the input is not
344
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
345
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
346
+ end
347
+ elsif !attributes[self.class.attribute_map[key]].nil?
348
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
349
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
350
+ end
351
+
352
+ self
353
+ end
354
+
355
+ # Deserializes the data based on type
356
+ # @param string type Data type
357
+ # @param string value Value to be deserialized
358
+ # @return [Object] Deserialized data
359
+ def _deserialize(type, value)
360
+ case type.to_sym
361
+ when :DateTime
362
+ DateTime.parse(value)
363
+ when :Date
364
+ Date.parse(value)
365
+ when :String
366
+ value.to_s
367
+ when :Integer
368
+ value.to_i
369
+ when :Float
370
+ value.to_f
371
+ when :BOOLEAN
372
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
373
+ true
374
+ else
375
+ false
376
+ end
377
+ when :Object
378
+ # generic object (usually a Hash), return directly
379
+ value
380
+ when /\AArray<(?<inner_type>.+)>\z/
381
+ inner_type = Regexp.last_match[:inner_type]
382
+ value.map { |v| _deserialize(inner_type, v) }
383
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
384
+ k_type = Regexp.last_match[:k_type]
385
+ v_type = Regexp.last_match[:v_type]
386
+ {}.tap do |hash|
387
+ value.each do |k, v|
388
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
389
+ end
390
+ end
391
+ else # model
392
+ temp_model = CloudsmithApi.const_get(type).new
393
+ temp_model.build_from_hash(value)
394
+ end
395
+ end
396
+
397
+ # Returns the string representation of the object
398
+ # @return [String] String presentation of the object
399
+ def to_s
400
+ to_hash.to_s
401
+ end
402
+
403
+ # to_body is an alias to to_hash (backward compatibility)
404
+ # @return [Hash] Returns the object in the form of hash
405
+ def to_body
406
+ to_hash
407
+ end
408
+
409
+ # Returns the object in the form of hash
410
+ # @return [Hash] Returns the object in the form of hash
411
+ def to_hash
412
+ hash = {}
413
+ self.class.attribute_map.each_pair do |attr, param|
414
+ value = self.send(attr)
415
+ next if value.nil?
416
+ hash[param] = _to_hash(value)
417
+ end
418
+ hash
419
+ end
420
+
421
+ # Outputs non-array value in the form of hash
422
+ # For object, use to_hash. Otherwise, just return the value
423
+ # @param [Object] value Any valid value
424
+ # @return [Hash] Returns the value in the form of hash
425
+ def _to_hash(value)
426
+ if value.is_a?(Array)
427
+ value.compact.map { |v| _to_hash(v) }
428
+ elsif value.is_a?(Hash)
429
+ {}.tap do |hash|
430
+ value.each { |k, v| hash[k] = _to_hash(v) }
431
+ end
432
+ elsif value.respond_to? :to_hash
433
+ value.to_hash
434
+ else
435
+ value
436
+ end
437
+ end
438
+
439
+ end
440
+ end