cloudsmith-api 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +12 -4
  4. data/build.json +1 -1
  5. data/docs/InlineResponse200.md +9 -0
  6. data/docs/InlineResponse200CountryCode.md +9 -0
  7. data/docs/ReposApi.md +180 -0
  8. data/docs/RepositoryGeoIPList.md +9 -0
  9. data/docs/RespositoryGeoIPEnableDisable.md +7 -0
  10. data/docs/RespositoryGeoIPEnableDisableRequest.md +7 -0
  11. data/docs/StatusBasic.md +1 -1
  12. data/lib/cloudsmith-api/api/repos_api.rb +182 -0
  13. data/lib/cloudsmith-api/models/inline_response_200.rb +193 -0
  14. data/lib/cloudsmith-api/models/inline_response_200_country_code.rb +197 -0
  15. data/lib/cloudsmith-api/models/repository_geo_ip_list.rb +195 -0
  16. data/lib/cloudsmith-api/models/respository_geo_ip_enable_disable.rb +175 -0
  17. data/lib/cloudsmith-api/models/respository_geo_ip_enable_disable_request.rb +175 -0
  18. data/lib/cloudsmith-api/models/status_basic.rb +1 -1
  19. data/lib/cloudsmith-api/version.rb +1 -1
  20. data/lib/cloudsmith-api.rb +5 -0
  21. data/spec/api/repos_api_spec.rb +41 -0
  22. data/spec/models/inline_response_200_country_code_spec.rb +47 -0
  23. data/spec/models/inline_response_200_spec.rb +47 -0
  24. data/spec/models/repository_geo_ip_list_spec.rb +47 -0
  25. data/spec/models/respository_geo_ip_enable_disable_request_spec.rb +35 -0
  26. data/spec/models/respository_geo_ip_enable_disable_spec.rb +35 -0
  27. data/vendor/bundle/ruby/2.6.0/cache/rspec-expectations-3.12.1.gem +0 -0
  28. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.2.20/gem_make.out +1 -1
  29. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.15.5/gem_make.out +2 -2
  30. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.6.3/gem_make.out +1 -1
  31. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.6.3/mkmf.log +1 -1
  32. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  33. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/Makefile +2 -2
  34. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/ext/generator/Makefile +2 -2
  35. data/vendor/bundle/ruby/2.6.0/gems/json-2.6.3/ext/json/ext/parser/Makefile +2 -2
  36. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/.document +0 -0
  37. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/.yardopts +0 -0
  38. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/Changelog.md +10 -1
  39. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/LICENSE.md +0 -0
  40. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/README.md +0 -0
  41. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/block_snippet_extractor.rb +0 -0
  42. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/configuration.rb +0 -0
  43. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/expectation_target.rb +0 -0
  44. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/fail_with.rb +0 -0
  45. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/failure_aggregator.rb +17 -0
  46. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/handler.rb +0 -0
  47. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/minitest_integration.rb +0 -0
  48. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/syntax.rb +0 -0
  49. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations/version.rb +1 -1
  50. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/expectations.rb +0 -0
  51. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/aliased_matcher.rb +0 -0
  52. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/all.rb +0 -0
  53. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/base_matcher.rb +0 -0
  54. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/be.rb +0 -0
  55. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/be_between.rb +0 -0
  56. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/be_instance_of.rb +0 -0
  57. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/be_kind_of.rb +0 -0
  58. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/be_within.rb +0 -0
  59. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/change.rb +0 -0
  60. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/compound.rb +0 -0
  61. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/contain_exactly.rb +0 -0
  62. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/count_expectation.rb +0 -0
  63. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/cover.rb +0 -0
  64. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/eq.rb +0 -0
  65. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/eql.rb +0 -0
  66. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/equal.rb +0 -0
  67. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/exist.rb +0 -0
  68. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/has.rb +0 -0
  69. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/have_attributes.rb +0 -0
  70. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/include.rb +0 -0
  71. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/match.rb +0 -0
  72. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/operators.rb +0 -0
  73. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/output.rb +0 -0
  74. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/raise_error.rb +0 -0
  75. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/respond_to.rb +0 -0
  76. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/satisfy.rb +0 -0
  77. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/start_or_end_with.rb +0 -0
  78. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/throw_symbol.rb +0 -0
  79. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in/yield.rb +0 -0
  80. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/built_in.rb +0 -0
  81. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/composable.rb +0 -0
  82. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/dsl.rb +1 -0
  83. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/english_phrasing.rb +0 -0
  84. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +0 -0
  85. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/fail_matchers.rb +0 -0
  86. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/generated_descriptions.rb +0 -0
  87. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/matcher_delegator.rb +0 -0
  88. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers/matcher_protocol.rb +0 -0
  89. data/vendor/bundle/ruby/2.6.0/gems/{rspec-expectations-3.12.0 → rspec-expectations-3.12.1}/lib/rspec/matchers.rb +0 -0
  90. data/vendor/bundle/ruby/2.6.0/specifications/{rspec-expectations-3.12.0.gemspec → rspec-expectations-3.12.1.gemspec} +5 -5
  91. metadata +78 -58
  92. data/vendor/bundle/ruby/2.6.0/cache/rspec-expectations-3.12.0.gem +0 -0
@@ -0,0 +1,193 @@
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 InlineResponse200
17
+ attr_accessor :country_code
18
+
19
+ attr_accessor :cidr
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'country_code' => :'country_code',
25
+ :'cidr' => :'cidr'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'country_code' => :'InlineResponse200CountryCode',
33
+ :'cidr' => :'InlineResponse200CountryCode'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'country_code')
46
+ self.country_code = attributes[:'country_code']
47
+ end
48
+
49
+ if attributes.has_key?(:'cidr')
50
+ self.cidr = attributes[:'cidr']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ 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
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ country_code == o.country_code &&
73
+ cidr == o.cidr
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
+ [country_code, cidr].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 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
+ end
@@ -0,0 +1,197 @@
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 InlineResponse200CountryCode
17
+ attr_accessor :allow
18
+
19
+ attr_accessor :deny
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'allow' => :'allow',
25
+ :'deny' => :'deny'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'allow' => :'Array<String>',
33
+ :'deny' => :'Array<String>'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'allow')
46
+ if (value = attributes[:'allow']).is_a?(Array)
47
+ self.allow = value
48
+ end
49
+ end
50
+
51
+ if attributes.has_key?(:'deny')
52
+ if (value = attributes[:'deny']).is_a?(Array)
53
+ self.deny = value
54
+ end
55
+ end
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ true
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] Object to be compared
73
+ def ==(o)
74
+ return true if self.equal?(o)
75
+ self.class == o.class &&
76
+ allow == o.allow &&
77
+ deny == o.deny
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [allow, deny].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /\AArray<(.*)>/i
99
+ # check to ensure the input is an array given that the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
102
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
103
+ end
104
+ elsif !attributes[self.class.attribute_map[key]].nil?
105
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
106
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
107
+ end
108
+
109
+ self
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def _deserialize(type, value)
117
+ case type.to_sym
118
+ when :DateTime
119
+ DateTime.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :BOOLEAN
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+ when :Object
135
+ # generic object (usually a Hash), return directly
136
+ value
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ temp_model = CloudsmithApi.const_get(type).new
150
+ temp_model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # Returns the object in the form of hash
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_hash
169
+ hash = {}
170
+ self.class.attribute_map.each_pair do |attr, param|
171
+ value = self.send(attr)
172
+ next if value.nil?
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map { |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+
196
+ end
197
+ end
@@ -0,0 +1,195 @@
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 RepositoryGeoIPList
17
+ # List all CIDR geographic rules within the repository
18
+ attr_accessor :cidr
19
+
20
+ # List all GeoIP geographic rules within the repository
21
+ attr_accessor :country_code
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'cidr' => :'cidr',
27
+ :'country_code' => :'country_code'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'cidr' => :'String',
35
+ :'country_code' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
46
+
47
+ if attributes.has_key?(:'cidr')
48
+ self.cidr = attributes[:'cidr']
49
+ end
50
+
51
+ if attributes.has_key?(:'country_code')
52
+ self.country_code = attributes[:'country_code']
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ 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
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ cidr == o.cidr &&
75
+ country_code == o.country_code
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
+ [cidr, country_code].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 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
+ end