late-sdk 0.0.915 → 0.0.916

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/docs/ConnectApi.md +17 -13
  4. data/docs/SelectFacebookPage200Response.md +1 -1
  5. data/docs/SelectFacebookPageRequest.md +39 -16
  6. data/docs/SelectFacebookPageRequestOneOf.md +26 -0
  7. data/docs/SelectFacebookPageRequestOneOf1.md +20 -0
  8. data/docs/SelectFacebookPageRequestOneOfNot.md +18 -0
  9. data/docs/{SelectFacebookPageRequestUserProfile.md → SelectFacebookPageRequestOneOfUserProfile.md} +2 -2
  10. data/lib/zernio-sdk/api/connect_api.rb +20 -25
  11. data/lib/zernio-sdk/models/select_facebook_page200_response.rb +1 -1
  12. data/lib/zernio-sdk/models/select_facebook_page_request.rb +78 -229
  13. data/lib/zernio-sdk/models/select_facebook_page_request_one_of.rb +255 -0
  14. data/lib/zernio-sdk/models/select_facebook_page_request_one_of1.rb +203 -0
  15. data/lib/zernio-sdk/models/select_facebook_page_request_one_of_not.rb +150 -0
  16. data/lib/zernio-sdk/models/{select_facebook_page_request_user_profile.rb → select_facebook_page_request_one_of_user_profile.rb} +4 -4
  17. data/lib/zernio-sdk/version.rb +1 -1
  18. data/lib/zernio-sdk.rb +4 -1
  19. data/openapi.yaml +64 -39
  20. data/spec/api/connect_api_spec.rb +7 -6
  21. data/spec/models/select_facebook_page_request_one_of1_spec.rb +42 -0
  22. data/spec/models/select_facebook_page_request_one_of_not_spec.rb +36 -0
  23. data/spec/models/select_facebook_page_request_one_of_spec.rb +60 -0
  24. data/spec/models/{select_facebook_page_request_user_profile_spec.rb → select_facebook_page_request_one_of_user_profile_spec.rb} +6 -6
  25. data/spec/models/select_facebook_page_request_spec.rb +5 -33
  26. data/zernio-sdk-0.0.916.gem +0 -0
  27. metadata +18 -6
  28. data/zernio-sdk-0.0.915.gem +0 -0
@@ -14,242 +14,91 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class SelectFacebookPageRequest < ApiModelBase
18
- # Profile ID from your connection flow
19
- attr_accessor :profile_id
20
-
21
- # The Facebook Page ID selected by the user
22
- attr_accessor :page_id
23
-
24
- # Temporary Facebook access token from OAuth
25
- attr_accessor :temp_token
26
-
27
- attr_accessor :user_profile
28
-
29
- # Optional custom redirect URL to return to after selection
30
- attr_accessor :redirect_url
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'profile_id' => :'profileId',
36
- :'page_id' => :'pageId',
37
- :'temp_token' => :'tempToken',
38
- :'user_profile' => :'userProfile',
39
- :'redirect_url' => :'redirect_url'
40
- }
41
- end
42
-
43
- # Returns attribute mapping this model knows about
44
- def self.acceptable_attribute_map
45
- attribute_map
46
- end
47
-
48
- # Returns all the JSON keys this model knows about
49
- def self.acceptable_attributes
50
- acceptable_attribute_map.values
51
- end
52
-
53
- # Attribute type mapping.
54
- def self.openapi_types
55
- {
56
- :'profile_id' => :'String',
57
- :'page_id' => :'String',
58
- :'temp_token' => :'String',
59
- :'user_profile' => :'SelectFacebookPageRequestUserProfile',
60
- :'redirect_url' => :'String'
61
- }
62
- end
63
-
64
- # List of attributes with nullable: true
65
- def self.openapi_nullable
66
- Set.new([
67
- ])
68
- end
69
-
70
- # Initializes the object
71
- # @param [Hash] attributes Model attributes in the form of hash
72
- def initialize(attributes = {})
73
- if (!attributes.is_a?(Hash))
74
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::SelectFacebookPageRequest` initialize method"
75
- end
76
-
77
- # check to see if the attribute exists and convert string to symbol for hash key
78
- acceptable_attribute_map = self.class.acceptable_attribute_map
79
- attributes = attributes.each_with_object({}) { |(k, v), h|
80
- if (!acceptable_attribute_map.key?(k.to_sym))
81
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::SelectFacebookPageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
- end
83
- h[k.to_sym] = v
84
- }
85
-
86
- if attributes.key?(:'profile_id')
87
- self.profile_id = attributes[:'profile_id']
88
- else
89
- self.profile_id = nil
90
- end
91
-
92
- if attributes.key?(:'page_id')
93
- self.page_id = attributes[:'page_id']
94
- else
95
- self.page_id = nil
96
- end
97
-
98
- if attributes.key?(:'temp_token')
99
- self.temp_token = attributes[:'temp_token']
100
- else
101
- self.temp_token = nil
102
- end
103
-
104
- if attributes.key?(:'user_profile')
105
- self.user_profile = attributes[:'user_profile']
106
- else
107
- self.user_profile = nil
108
- end
109
-
110
- if attributes.key?(:'redirect_url')
111
- self.redirect_url = attributes[:'redirect_url']
112
- end
113
- end
114
-
115
- # Show invalid properties with the reasons. Usually used together with valid?
116
- # @return Array for valid properties with the reasons
117
- def list_invalid_properties
118
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
- invalid_properties = Array.new
120
- if @profile_id.nil?
121
- invalid_properties.push('invalid value for "profile_id", profile_id cannot be nil.')
122
- end
123
-
124
- if @page_id.nil?
125
- invalid_properties.push('invalid value for "page_id", page_id cannot be nil.')
126
- end
127
-
128
- if @temp_token.nil?
129
- invalid_properties.push('invalid value for "temp_token", temp_token cannot be nil.')
130
- end
131
-
132
- if @user_profile.nil?
133
- invalid_properties.push('invalid value for "user_profile", user_profile cannot be nil.')
134
- end
135
-
136
- invalid_properties
137
- end
138
-
139
- # Check to see if the all the properties in the model are valid
140
- # @return true if the model is valid
141
- def valid?
142
- warn '[DEPRECATED] the `valid?` method is obsolete'
143
- return false if @profile_id.nil?
144
- return false if @page_id.nil?
145
- return false if @temp_token.nil?
146
- return false if @user_profile.nil?
147
- true
148
- end
149
-
150
- # Custom attribute writer method with validation
151
- # @param [Object] profile_id Value to be assigned
152
- def profile_id=(profile_id)
153
- if profile_id.nil?
154
- fail ArgumentError, 'profile_id cannot be nil'
155
- end
156
-
157
- @profile_id = profile_id
158
- end
159
-
160
- # Custom attribute writer method with validation
161
- # @param [Object] page_id Value to be assigned
162
- def page_id=(page_id)
163
- if page_id.nil?
164
- fail ArgumentError, 'page_id cannot be nil'
165
- end
166
-
167
- @page_id = page_id
168
- end
169
-
170
- # Custom attribute writer method with validation
171
- # @param [Object] temp_token Value to be assigned
172
- def temp_token=(temp_token)
173
- if temp_token.nil?
174
- fail ArgumentError, 'temp_token cannot be nil'
175
- end
176
-
177
- @temp_token = temp_token
178
- end
179
-
180
- # Custom attribute writer method with validation
181
- # @param [Object] user_profile Value to be assigned
182
- def user_profile=(user_profile)
183
- if user_profile.nil?
184
- fail ArgumentError, 'user_profile cannot be nil'
185
- end
186
-
187
- @user_profile = user_profile
188
- end
189
-
190
- # Checks equality by comparing each attribute.
191
- # @param [Object] Object to be compared
192
- def ==(o)
193
- return true if self.equal?(o)
194
- self.class == o.class &&
195
- profile_id == o.profile_id &&
196
- page_id == o.page_id &&
197
- temp_token == o.temp_token &&
198
- user_profile == o.user_profile &&
199
- redirect_url == o.redirect_url
200
- end
201
-
202
- # @see the `==` method
203
- # @param [Object] Object to be compared
204
- def eql?(o)
205
- self == o
206
- end
207
-
208
- # Calculates hash code according to all attributes.
209
- # @return [Integer] Hash code
210
- def hash
211
- [profile_id, page_id, temp_token, user_profile, redirect_url].hash
212
- end
213
-
214
- # Builds the object from hash
215
- # @param [Hash] attributes Model attributes in the form of hash
216
- # @return [Object] Returns the model itself
217
- def self.build_from_hash(attributes)
218
- return nil unless attributes.is_a?(Hash)
219
- attributes = attributes.transform_keys(&:to_sym)
220
- transformed_hash = {}
221
- openapi_types.each_pair do |key, type|
222
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
223
- transformed_hash["#{key}"] = nil
224
- elsif type =~ /\AArray<(.*)>/i
225
- # check to ensure the input is an array given that the attribute
226
- # is documented as an array but the input is not
227
- if attributes[attribute_map[key]].is_a?(Array)
228
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
17
+ module SelectFacebookPageRequest
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'SelectFacebookPageRequestOneOf',
23
+ :'SelectFacebookPageRequestOneOf1'
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
229
43
  end
230
- elsif !attributes[attribute_map[key]].nil?
231
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
232
44
  end
233
- end
234
- new(transformed_hash)
235
- end
236
45
 
237
- # Returns the object in the form of hash
238
- # @return [Hash] Returns the object in the form of hash
239
- def to_hash
240
- hash = {}
241
- self.class.attribute_map.each_pair do |attr, param|
242
- value = self.send(attr)
243
- if value.nil?
244
- is_nullable = self.class.openapi_nullable.include?(attr)
245
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
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 = Zernio.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
246
95
  end
247
96
 
248
- hash[param] = _to_hash(value)
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
249
100
  end
250
- hash
251
101
  end
252
-
253
102
  end
254
103
 
255
104
  end
@@ -0,0 +1,255 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
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 Zernio
17
+ class SelectFacebookPageRequestOneOf < ApiModelBase
18
+ # Profile ID from your classic connection flow.
19
+ attr_accessor :profile_id
20
+
21
+ # The Facebook Page ID selected by the user.
22
+ attr_accessor :page_id
23
+
24
+ # Temporary Facebook access token from OAuth.
25
+ attr_accessor :temp_token
26
+
27
+ attr_accessor :user_profile
28
+
29
+ # Optional custom redirect URL to return to after selection.
30
+ attr_accessor :redirect_url
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'profile_id' => :'profileId',
36
+ :'page_id' => :'pageId',
37
+ :'temp_token' => :'tempToken',
38
+ :'user_profile' => :'userProfile',
39
+ :'redirect_url' => :'redirect_url'
40
+ }
41
+ end
42
+
43
+ # Returns attribute mapping this model knows about
44
+ def self.acceptable_attribute_map
45
+ attribute_map
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ acceptable_attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'profile_id' => :'String',
57
+ :'page_id' => :'String',
58
+ :'temp_token' => :'String',
59
+ :'user_profile' => :'SelectFacebookPageRequestOneOfUserProfile',
60
+ :'redirect_url' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::SelectFacebookPageRequestOneOf` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::SelectFacebookPageRequestOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'profile_id')
87
+ self.profile_id = attributes[:'profile_id']
88
+ else
89
+ self.profile_id = nil
90
+ end
91
+
92
+ if attributes.key?(:'page_id')
93
+ self.page_id = attributes[:'page_id']
94
+ else
95
+ self.page_id = nil
96
+ end
97
+
98
+ if attributes.key?(:'temp_token')
99
+ self.temp_token = attributes[:'temp_token']
100
+ else
101
+ self.temp_token = nil
102
+ end
103
+
104
+ if attributes.key?(:'user_profile')
105
+ self.user_profile = attributes[:'user_profile']
106
+ else
107
+ self.user_profile = nil
108
+ end
109
+
110
+ if attributes.key?(:'redirect_url')
111
+ self.redirect_url = attributes[:'redirect_url']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @profile_id.nil?
121
+ invalid_properties.push('invalid value for "profile_id", profile_id cannot be nil.')
122
+ end
123
+
124
+ if @page_id.nil?
125
+ invalid_properties.push('invalid value for "page_id", page_id cannot be nil.')
126
+ end
127
+
128
+ if @temp_token.nil?
129
+ invalid_properties.push('invalid value for "temp_token", temp_token cannot be nil.')
130
+ end
131
+
132
+ if @user_profile.nil?
133
+ invalid_properties.push('invalid value for "user_profile", user_profile cannot be nil.')
134
+ end
135
+
136
+ invalid_properties
137
+ end
138
+
139
+ # Check to see if the all the properties in the model are valid
140
+ # @return true if the model is valid
141
+ def valid?
142
+ warn '[DEPRECATED] the `valid?` method is obsolete'
143
+ return false if @profile_id.nil?
144
+ return false if @page_id.nil?
145
+ return false if @temp_token.nil?
146
+ return false if @user_profile.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] profile_id Value to be assigned
152
+ def profile_id=(profile_id)
153
+ if profile_id.nil?
154
+ fail ArgumentError, 'profile_id cannot be nil'
155
+ end
156
+
157
+ @profile_id = profile_id
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] page_id Value to be assigned
162
+ def page_id=(page_id)
163
+ if page_id.nil?
164
+ fail ArgumentError, 'page_id cannot be nil'
165
+ end
166
+
167
+ @page_id = page_id
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] temp_token Value to be assigned
172
+ def temp_token=(temp_token)
173
+ if temp_token.nil?
174
+ fail ArgumentError, 'temp_token cannot be nil'
175
+ end
176
+
177
+ @temp_token = temp_token
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] user_profile Value to be assigned
182
+ def user_profile=(user_profile)
183
+ if user_profile.nil?
184
+ fail ArgumentError, 'user_profile cannot be nil'
185
+ end
186
+
187
+ @user_profile = user_profile
188
+ end
189
+
190
+ # Checks equality by comparing each attribute.
191
+ # @param [Object] Object to be compared
192
+ def ==(o)
193
+ return true if self.equal?(o)
194
+ self.class == o.class &&
195
+ profile_id == o.profile_id &&
196
+ page_id == o.page_id &&
197
+ temp_token == o.temp_token &&
198
+ user_profile == o.user_profile &&
199
+ redirect_url == o.redirect_url
200
+ end
201
+
202
+ # @see the `==` method
203
+ # @param [Object] Object to be compared
204
+ def eql?(o)
205
+ self == o
206
+ end
207
+
208
+ # Calculates hash code according to all attributes.
209
+ # @return [Integer] Hash code
210
+ def hash
211
+ [profile_id, page_id, temp_token, user_profile, redirect_url].hash
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def self.build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ attributes = attributes.transform_keys(&:to_sym)
220
+ transformed_hash = {}
221
+ openapi_types.each_pair do |key, type|
222
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
223
+ transformed_hash["#{key}"] = nil
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[attribute_map[key]].is_a?(Array)
228
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
229
+ end
230
+ elsif !attributes[attribute_map[key]].nil?
231
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
232
+ end
233
+ end
234
+ new(transformed_hash)
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ if value.nil?
244
+ is_nullable = self.class.openapi_nullable.include?(attr)
245
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
+ end
247
+
248
+ hash[param] = _to_hash(value)
249
+ end
250
+ hash
251
+ end
252
+
253
+ end
254
+
255
+ end