late-sdk 0.0.104 → 0.0.105

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -0
  3. data/docs/AdCampaignsApi.md +86 -0
  4. data/docs/AdTreeAdSet.md +30 -0
  5. data/docs/AdTreeCampaign.md +40 -0
  6. data/docs/GetAdTree200Response.md +20 -0
  7. data/docs/ValidateApi.md +287 -0
  8. data/docs/ValidateMedia200Response.md +32 -0
  9. data/docs/ValidateMedia200ResponsePlatformLimitsValue.md +22 -0
  10. data/docs/ValidateMediaRequest.md +18 -0
  11. data/docs/ValidatePost200Response.md +49 -0
  12. data/docs/ValidatePost200ResponseOneOf.md +22 -0
  13. data/docs/ValidatePost200ResponseOneOf1.md +22 -0
  14. data/docs/ValidatePost200ResponseOneOf1ErrorsInner.md +20 -0
  15. data/docs/ValidatePost200ResponseOneOfWarningsInner.md +20 -0
  16. data/docs/ValidatePostLength200Response.md +20 -0
  17. data/docs/ValidatePostLength200ResponsePlatformsValue.md +22 -0
  18. data/docs/ValidatePostLengthRequest.md +18 -0
  19. data/docs/ValidatePostRequest.md +22 -0
  20. data/docs/ValidatePostRequestMediaItemsInner.md +20 -0
  21. data/docs/ValidatePostRequestPlatformsInner.md +24 -0
  22. data/docs/ValidatePostRequestPlatformsInnerCustomMediaInner.md +20 -0
  23. data/docs/ValidateSubreddit200Response.md +49 -0
  24. data/docs/ValidateSubreddit200ResponseOneOf.md +20 -0
  25. data/docs/ValidateSubreddit200ResponseOneOf1.md +20 -0
  26. data/docs/ValidateSubreddit200ResponseOneOfSubreddit.md +32 -0
  27. data/lib/late-sdk/api/ad_campaigns_api.rb +105 -0
  28. data/lib/late-sdk/api/validate_api.rb +290 -0
  29. data/lib/late-sdk/models/ad_tree_ad_set.rb +240 -0
  30. data/lib/late-sdk/models/ad_tree_campaign.rb +297 -0
  31. data/lib/late-sdk/models/get_ad_tree200_response.rb +158 -0
  32. data/lib/late-sdk/models/validate_media200_response.rb +249 -0
  33. data/lib/late-sdk/models/validate_media200_response_platform_limits_value.rb +166 -0
  34. data/lib/late-sdk/models/validate_media_request.rb +165 -0
  35. data/lib/late-sdk/models/validate_post200_response.rb +104 -0
  36. data/lib/late-sdk/models/validate_post200_response_one_of.rb +168 -0
  37. data/lib/late-sdk/models/validate_post200_response_one_of1.rb +170 -0
  38. data/lib/late-sdk/models/validate_post200_response_one_of1_errors_inner.rb +156 -0
  39. data/lib/late-sdk/models/validate_post200_response_one_of_warnings_inner.rb +156 -0
  40. data/lib/late-sdk/models/validate_post_length200_response.rb +158 -0
  41. data/lib/late-sdk/models/validate_post_length200_response_platforms_value.rb +168 -0
  42. data/lib/late-sdk/models/validate_post_length_request.rb +165 -0
  43. data/lib/late-sdk/models/validate_post_request.rb +189 -0
  44. data/lib/late-sdk/models/validate_post_request_media_items_inner.rb +190 -0
  45. data/lib/late-sdk/models/validate_post_request_platforms_inner.rb +217 -0
  46. data/lib/late-sdk/models/validate_post_request_platforms_inner_custom_media_inner.rb +190 -0
  47. data/lib/late-sdk/models/validate_subreddit200_response.rb +104 -0
  48. data/lib/late-sdk/models/validate_subreddit200_response_one_of.rb +157 -0
  49. data/lib/late-sdk/models/validate_subreddit200_response_one_of1.rb +157 -0
  50. data/lib/late-sdk/models/validate_subreddit200_response_one_of_subreddit.rb +244 -0
  51. data/lib/late-sdk/version.rb +1 -1
  52. data/lib/late-sdk.rb +23 -0
  53. data/openapi.yaml +330 -1
  54. data/spec/api/ad_campaigns_api_spec.rb +19 -0
  55. data/spec/api/validate_api_spec.rb +83 -0
  56. data/spec/models/ad_tree_ad_set_spec.rb +76 -0
  57. data/spec/models/ad_tree_campaign_spec.rb +110 -0
  58. data/spec/models/get_ad_tree200_response_spec.rb +42 -0
  59. data/spec/models/validate_media200_response_platform_limits_value_spec.rb +48 -0
  60. data/spec/models/validate_media200_response_spec.rb +82 -0
  61. data/spec/models/validate_media_request_spec.rb +36 -0
  62. data/spec/models/validate_post200_response_one_of1_errors_inner_spec.rb +42 -0
  63. data/spec/models/validate_post200_response_one_of1_spec.rb +48 -0
  64. data/spec/models/validate_post200_response_one_of_spec.rb +48 -0
  65. data/spec/models/validate_post200_response_one_of_warnings_inner_spec.rb +42 -0
  66. data/spec/models/validate_post200_response_spec.rb +32 -0
  67. data/spec/models/validate_post_length200_response_platforms_value_spec.rb +48 -0
  68. data/spec/models/validate_post_length200_response_spec.rb +42 -0
  69. data/spec/models/validate_post_length_request_spec.rb +36 -0
  70. data/spec/models/validate_post_request_media_items_inner_spec.rb +46 -0
  71. data/spec/models/validate_post_request_platforms_inner_custom_media_inner_spec.rb +46 -0
  72. data/spec/models/validate_post_request_platforms_inner_spec.rb +58 -0
  73. data/spec/models/validate_post_request_spec.rb +48 -0
  74. data/spec/models/validate_subreddit200_response_one_of1_spec.rb +42 -0
  75. data/spec/models/validate_subreddit200_response_one_of_spec.rb +42 -0
  76. data/spec/models/validate_subreddit200_response_one_of_subreddit_spec.rb +82 -0
  77. data/spec/models/validate_subreddit200_response_spec.rb +32 -0
  78. data/zernio-sdk-0.0.105.gem +0 -0
  79. metadata +94 -2
  80. data/zernio-sdk-0.0.104.gem +0 -0
@@ -0,0 +1,217 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ class ValidatePostRequestPlatformsInner < ApiModelBase
18
+ attr_accessor :platform
19
+
20
+ attr_accessor :custom_content
21
+
22
+ attr_accessor :platform_specific_data
23
+
24
+ attr_accessor :custom_media
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'platform' => :'platform',
52
+ :'custom_content' => :'customContent',
53
+ :'platform_specific_data' => :'platformSpecificData',
54
+ :'custom_media' => :'customMedia'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'platform' => :'String',
72
+ :'custom_content' => :'String',
73
+ :'platform_specific_data' => :'Object',
74
+ :'custom_media' => :'Array<ValidatePostRequestPlatformsInnerCustomMediaInner>'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::ValidatePostRequestPlatformsInner` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::ValidatePostRequestPlatformsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'platform')
101
+ self.platform = attributes[:'platform']
102
+ else
103
+ self.platform = nil
104
+ end
105
+
106
+ if attributes.key?(:'custom_content')
107
+ self.custom_content = attributes[:'custom_content']
108
+ end
109
+
110
+ if attributes.key?(:'platform_specific_data')
111
+ self.platform_specific_data = attributes[:'platform_specific_data']
112
+ end
113
+
114
+ if attributes.key?(:'custom_media')
115
+ if (value = attributes[:'custom_media']).is_a?(Array)
116
+ self.custom_media = value
117
+ end
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @platform.nil?
127
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @platform.nil?
138
+ platform_validator = EnumAttributeValidator.new('String', ["twitter", "instagram", "tiktok", "youtube", "facebook", "linkedin", "bluesky", "threads", "reddit", "pinterest", "telegram", "snapchat", "googlebusiness"])
139
+ return false unless platform_validator.valid?(@platform)
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method checking allowed values (enum).
144
+ # @param [Object] platform Object to be assigned
145
+ def platform=(platform)
146
+ validator = EnumAttributeValidator.new('String', ["twitter", "instagram", "tiktok", "youtube", "facebook", "linkedin", "bluesky", "threads", "reddit", "pinterest", "telegram", "snapchat", "googlebusiness"])
147
+ unless validator.valid?(platform)
148
+ fail ArgumentError, "invalid value for \"platform\", must be one of #{validator.allowable_values}."
149
+ end
150
+ @platform = platform
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ platform == o.platform &&
159
+ custom_content == o.custom_content &&
160
+ platform_specific_data == o.platform_specific_data &&
161
+ custom_media == o.custom_media
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [platform, custom_content, platform_specific_data, custom_media].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
191
+ end
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
195
+ end
196
+ new(transformed_hash)
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ class ValidatePostRequestPlatformsInnerCustomMediaInner < ApiModelBase
18
+ attr_accessor :url
19
+
20
+ attr_accessor :type
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'url' => :'url',
48
+ :'type' => :'type'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'url' => :'String',
66
+ :'type' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::ValidatePostRequestPlatformsInnerCustomMediaInner` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::ValidatePostRequestPlatformsInnerCustomMediaInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'url')
93
+ self.url = attributes[:'url']
94
+ end
95
+
96
+ if attributes.key?(:'type')
97
+ self.type = attributes[:'type']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ type_validator = EnumAttributeValidator.new('String', ["image", "video"])
114
+ return false unless type_validator.valid?(@type)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] type Object to be assigned
120
+ def type=(type)
121
+ validator = EnumAttributeValidator.new('String', ["image", "video"])
122
+ unless validator.valid?(type)
123
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
124
+ end
125
+ @type = type
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ url == o.url &&
134
+ type == o.type
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [url, type].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ module ValidateSubreddit200Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'ValidateSubreddit200ResponseOneOf',
23
+ :'ValidateSubreddit200ResponseOneOf1'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_one_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = Late.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,157 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ # Subreddit exists
18
+ class ValidateSubreddit200ResponseOneOf < ApiModelBase
19
+ attr_accessor :exists
20
+
21
+ attr_accessor :subreddit
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'exists' => :'exists',
27
+ :'subreddit' => :'subreddit'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'exists' => :'Boolean',
45
+ :'subreddit' => :'ValidateSubreddit200ResponseOneOfSubreddit'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::ValidateSubreddit200ResponseOneOf` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::ValidateSubreddit200ResponseOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'exists')
72
+ self.exists = attributes[:'exists']
73
+ end
74
+
75
+ if attributes.key?(:'subreddit')
76
+ self.subreddit = attributes[:'subreddit']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ exists == o.exists &&
101
+ subreddit == o.subreddit
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [exists, subreddit].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ transformed_hash = {}
123
+ openapi_types.each_pair do |key, type|
124
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = nil
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[attribute_map[key]].is_a?(Array)
130
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Returns the object in the form of hash
140
+ # @return [Hash] Returns the object in the form of hash
141
+ def to_hash
142
+ hash = {}
143
+ self.class.attribute_map.each_pair do |attr, param|
144
+ value = self.send(attr)
145
+ if value.nil?
146
+ is_nullable = self.class.openapi_nullable.include?(attr)
147
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
148
+ end
149
+
150
+ hash[param] = _to_hash(value)
151
+ end
152
+ hash
153
+ end
154
+
155
+ end
156
+
157
+ end