cloudsmith-api 0.52.0 → 0.53.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +16 -4
  4. data/build.json +1 -1
  5. data/docs/EntitlementTokenMetric.md +9 -0
  6. data/docs/MetricsApi.md +158 -0
  7. data/docs/MetricsownerrepopackagesusageActivePackages.md +10 -0
  8. data/docs/PackageUsageMetric.md +11 -0
  9. data/docs/PackagesCopy.md +1 -0
  10. data/docs/Quota.md +8 -0
  11. data/docs/QuotaApi.md +272 -0
  12. data/docs/QuotaHistory.md +8 -0
  13. data/docs/QuotaownerhistoryHistory.md +13 -0
  14. data/docs/RepositoryToken.md +3 -0
  15. data/docs/RepositoryTokenRefresh.md +3 -0
  16. data/docs/RepositoryTokenSyncTokens.md +3 -0
  17. data/lib/cloudsmith-api.rb +8 -0
  18. data/lib/cloudsmith-api/api/metrics_api.rb +167 -0
  19. data/lib/cloudsmith-api/api/quota_api.rb +251 -0
  20. data/lib/cloudsmith-api/models/entitlement_token_metric.rb +209 -0
  21. data/lib/cloudsmith-api/models/metricsownerrepopackagesusage_active_packages.rb +209 -0
  22. data/lib/cloudsmith-api/models/package_usage_metric.rb +243 -0
  23. data/lib/cloudsmith-api/models/packages_copy.rb +14 -4
  24. data/lib/cloudsmith-api/models/quota.rb +194 -0
  25. data/lib/cloudsmith-api/models/quota_history.rb +196 -0
  26. data/lib/cloudsmith-api/models/quotaownerhistory_history.rb +239 -0
  27. data/lib/cloudsmith-api/models/repository_token.rb +31 -1
  28. data/lib/cloudsmith-api/models/repository_token_refresh.rb +31 -1
  29. data/lib/cloudsmith-api/models/repository_token_sync_tokens.rb +31 -1
  30. data/lib/cloudsmith-api/version.rb +1 -1
  31. data/spec/api/metrics_api_spec.rb +71 -0
  32. data/spec/api/quota_api_spec.rb +91 -0
  33. data/spec/models/entitlement_token_metric_spec.rb +48 -0
  34. data/spec/models/metricsownerrepopackagesusage_active_packages_spec.rb +54 -0
  35. data/spec/models/package_usage_metric_spec.rb +60 -0
  36. data/spec/models/packages_copy_spec.rb +6 -0
  37. data/spec/models/quota_history_spec.rb +42 -0
  38. data/spec/models/quota_spec.rb +42 -0
  39. data/spec/models/quotaownerhistory_history_spec.rb +72 -0
  40. data/spec/models/repository_token_refresh_spec.rb +18 -0
  41. data/spec/models/repository_token_spec.rb +18 -0
  42. data/spec/models/repository_token_sync_tokens_spec.rb +18 -0
  43. data/vendor/bundle/ruby/2.6.0/cache/public_suffix-4.0.6.gem +0 -0
  44. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.2.17/gem_make.out +1 -1
  45. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.13.1/gem_make.out +2 -2
  46. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.1/gem_make.out +1 -1
  47. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.13.1/ext/ffi_c/Makefile +3 -3
  48. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.github/FUNDING.yml +0 -0
  49. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.github/workflows/tests.yml +1 -1
  50. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.gitignore +0 -0
  51. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.rubocop.yml +0 -0
  52. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.rubocop_opinionated.yml +1 -18
  53. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.travis.yml +1 -1
  54. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/.yardopts +0 -0
  55. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/2.0-Upgrade.md +0 -0
  56. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/CHANGELOG.md +7 -0
  57. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/Gemfile +1 -1
  58. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/LICENSE.txt +0 -0
  59. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/README.md +0 -0
  60. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/Rakefile +0 -0
  61. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/SECURITY.md +0 -0
  62. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/bin/console +0 -0
  63. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/codecov.yml +0 -2
  64. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/data/list.txt +312 -78
  65. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix.rb +0 -0
  66. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix/domain.rb +0 -0
  67. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix/errors.rb +0 -0
  68. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix/list.rb +0 -0
  69. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix/rule.rb +0 -0
  70. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/lib/public_suffix/version.rb +1 -1
  71. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/public_suffix.gemspec +0 -0
  72. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/.empty +0 -0
  73. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/acceptance_test.rb +2 -0
  74. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_find.rb +0 -0
  75. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_find_all.rb +0 -0
  76. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_names.rb +0 -0
  77. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_select.rb +0 -0
  78. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_select_incremental.rb +0 -0
  79. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/benchmarks/bm_valid.rb +0 -0
  80. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/domain_profiler.rb +0 -0
  81. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/find_profiler.rb +0 -0
  82. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/find_profiler_jp.rb +0 -0
  83. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/initialization_profiler.rb +0 -0
  84. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/list_profsize.rb +0 -0
  85. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/profilers/object_binsize.rb +0 -0
  86. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/psl_test.rb +1 -1
  87. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/test_helper.rb +0 -0
  88. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/tests.txt +0 -0
  89. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/unit/domain_test.rb +0 -0
  90. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/unit/errors_test.rb +0 -0
  91. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/unit/list_test.rb +0 -0
  92. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/unit/public_suffix_test.rb +0 -0
  93. data/vendor/bundle/ruby/2.6.0/gems/{public_suffix-4.0.5 → public_suffix-4.0.6}/test/unit/rule_test.rb +0 -0
  94. data/vendor/bundle/ruby/2.6.0/specifications/{public_suffix-4.0.5.gemspec → public_suffix-4.0.6.gemspec} +4 -4
  95. data/vendor/bundle/ruby/2.6.0/specifications/sys-uname-1.2.1.gemspec +1 -1
  96. metadata +166 -134
  97. data/vendor/bundle/ruby/2.6.0/cache/public_suffix-4.0.5.gem +0 -0
@@ -18,18 +18,23 @@ module CloudsmithApi
18
18
  # None
19
19
  attr_accessor :destination
20
20
 
21
+ # If true, the package will overwrite any others with the same attributes (e.g. same version); otherwise, it will be flagged as a duplicate.
22
+ attr_accessor :republish
23
+
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
25
- :'destination' => :'destination'
28
+ :'destination' => :'destination',
29
+ :'republish' => :'republish'
26
30
  }
27
31
  end
28
32
 
29
33
  # Attribute type mapping.
30
34
  def self.swagger_types
31
35
  {
32
- :'destination' => :'String'
36
+ :'destination' => :'String',
37
+ :'republish' => :'BOOLEAN'
33
38
  }
34
39
  end
35
40
 
@@ -45,6 +50,10 @@ module CloudsmithApi
45
50
  self.destination = attributes[:'destination']
46
51
  end
47
52
 
53
+ if attributes.has_key?(:'republish')
54
+ self.republish = attributes[:'republish']
55
+ end
56
+
48
57
  end
49
58
 
50
59
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -70,7 +79,8 @@ module CloudsmithApi
70
79
  def ==(o)
71
80
  return true if self.equal?(o)
72
81
  self.class == o.class &&
73
- destination == o.destination
82
+ destination == o.destination &&
83
+ republish == o.republish
74
84
  end
75
85
 
76
86
  # @see the `==` method
@@ -82,7 +92,7 @@ module CloudsmithApi
82
92
  # Calculates hash code according to all attributes.
83
93
  # @return [Fixnum] Hash code
84
94
  def hash
85
- [destination].hash
95
+ [destination, republish].hash
86
96
  end
87
97
 
88
98
  # Builds the object from hash
@@ -0,0 +1,194 @@
1
+ =begin
2
+ #Cloudsmith API
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+
17
+ class Quota
18
+ #
19
+ attr_accessor :usage
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'usage' => :'usage'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'usage' => :'Object'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'usage')
45
+ self.usage = attributes[:'usage']
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properies with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ if @usage.nil?
55
+ invalid_properties.push("invalid value for 'usage', usage cannot be nil.")
56
+ end
57
+
58
+ return invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ return false if @usage.nil?
65
+ return true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ usage == o.usage
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [usage].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = CloudsmithApi.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map{ |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+ end
193
+
194
+ end
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #Cloudsmith API
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+
17
+ class QuotaHistory
18
+ #
19
+ attr_accessor :history
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'history' => :'history'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'history' => :'Array<QuotaownerhistoryHistory>'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'history')
45
+ if (value = attributes[:'history']).is_a?(Array)
46
+ self.history = value
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ # Show invalid properties with the reasons. Usually used together with valid?
53
+ # @return Array for valid properies with the reasons
54
+ def list_invalid_properties
55
+ invalid_properties = Array.new
56
+ if @history.nil?
57
+ invalid_properties.push("invalid value for 'history', history cannot be nil.")
58
+ end
59
+
60
+ return invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ return false if @history.nil?
67
+ return true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ history == o.history
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [history].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = CloudsmithApi.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map{ |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+
194
+ end
195
+
196
+ end
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #Cloudsmith API
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+
17
+ class QuotaownerhistoryHistory
18
+ #
19
+ attr_accessor :days
20
+
21
+ #
22
+ attr_accessor :display
23
+
24
+ #
25
+ attr_accessor :_end
26
+
27
+ #
28
+ attr_accessor :plan
29
+
30
+ #
31
+ attr_accessor :raw
32
+
33
+ #
34
+ attr_accessor :start
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'days' => :'days',
41
+ :'display' => :'display',
42
+ :'_end' => :'end',
43
+ :'plan' => :'plan',
44
+ :'raw' => :'raw',
45
+ :'start' => :'start'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'days' => :'Integer',
53
+ :'display' => :'Object',
54
+ :'_end' => :'String',
55
+ :'plan' => :'String',
56
+ :'raw' => :'Object',
57
+ :'start' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
+
69
+ if attributes.has_key?(:'days')
70
+ self.days = attributes[:'days']
71
+ end
72
+
73
+ if attributes.has_key?(:'display')
74
+ self.display = attributes[:'display']
75
+ end
76
+
77
+ if attributes.has_key?(:'end')
78
+ self._end = attributes[:'end']
79
+ end
80
+
81
+ if attributes.has_key?(:'plan')
82
+ self.plan = attributes[:'plan']
83
+ end
84
+
85
+ if attributes.has_key?(:'raw')
86
+ self.raw = attributes[:'raw']
87
+ end
88
+
89
+ if attributes.has_key?(:'start')
90
+ self.start = attributes[:'start']
91
+ end
92
+
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properies with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ return invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ days == o.days &&
114
+ display == o.display &&
115
+ _end == o._end &&
116
+ plan == o.plan &&
117
+ raw == o.raw &&
118
+ start == o.start
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Fixnum] Hash code
129
+ def hash
130
+ [days, display, _end, plan, raw, start].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.swagger_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ temp_model = CloudsmithApi.const_get(type).new
191
+ temp_model.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map{ |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end