postboost 1.0.0

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 (206) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +0 -0
  5. data/Rakefile +10 -0
  6. data/docs/Account.md +34 -0
  7. data/docs/AccountsApi.md +149 -0
  8. data/docs/AddGenericSubscriptionRequest.md +22 -0
  9. data/docs/ChangeSubscriptionPlanRequest.md +24 -0
  10. data/docs/CheckoutSubscription200Response.md +18 -0
  11. data/docs/CheckoutSubscriptionRequest.md +22 -0
  12. data/docs/DeleteMediaBulkRequest.md +18 -0
  13. data/docs/DeleteMode.md +15 -0
  14. data/docs/DeletePostRequest.md +20 -0
  15. data/docs/DeletePostsBulkRequest.md +22 -0
  16. data/docs/DeleteReceiptsBulkRequest.md +18 -0
  17. data/docs/DeleteResult.md +22 -0
  18. data/docs/DeleteUser400Response.md +20 -0
  19. data/docs/DeleteUsersBulkRequest.md +18 -0
  20. data/docs/DeleteWorkspacesBulkRequest.md +18 -0
  21. data/docs/GetRemoteUploadStatus200Response.md +20 -0
  22. data/docs/InitiateChunkedUpload200Response.md +22 -0
  23. data/docs/InitiateChunkedUploadRequest.md +22 -0
  24. data/docs/InitiateRemoteUpload200Response.md +49 -0
  25. data/docs/InitiateRemoteUpload200ResponseOneOf.md +18 -0
  26. data/docs/InitiateRemoteUploadRequest.md +20 -0
  27. data/docs/ListAccounts200Response.md +18 -0
  28. data/docs/ListMedia200Response.md +22 -0
  29. data/docs/ListPosts200Response.md +22 -0
  30. data/docs/ListReceipts200Response.md +22 -0
  31. data/docs/ListTags200Response.md +18 -0
  32. data/docs/ListUsers200Response.md +22 -0
  33. data/docs/ListWorkspaces200Response.md +22 -0
  34. data/docs/Media.md +34 -0
  35. data/docs/MediaApi.md +810 -0
  36. data/docs/PaginationMeta.md +20 -0
  37. data/docs/PaginationMetaLinks.md +24 -0
  38. data/docs/PaginationMetaMeta.md +28 -0
  39. data/docs/Post.md +36 -0
  40. data/docs/PostContent.md +24 -0
  41. data/docs/PostInput.md +34 -0
  42. data/docs/PostStatus.md +15 -0
  43. data/docs/PostVersion.md +24 -0
  44. data/docs/PostsApi.md +659 -0
  45. data/docs/Receipt.md +36 -0
  46. data/docs/ReceiptInput.md +34 -0
  47. data/docs/ReceiptUpdateInput.md +32 -0
  48. data/docs/ReceiptsApi.md +421 -0
  49. data/docs/RemoveUserFromWorkspaceRequest.md +18 -0
  50. data/docs/SchedulePostRequest.md +18 -0
  51. data/docs/ScheduleResult.md +20 -0
  52. data/docs/Subscription.md +32 -0
  53. data/docs/SubscriptionInput.md +24 -0
  54. data/docs/SubscriptionStatus.md +15 -0
  55. data/docs/SubscriptionUpdateInput.md +24 -0
  56. data/docs/SubscriptionsApi.md +699 -0
  57. data/docs/Tag.md +24 -0
  58. data/docs/TagInput.md +20 -0
  59. data/docs/TagsApi.md +357 -0
  60. data/docs/UpdateMediaRequest.md +18 -0
  61. data/docs/UploadChunk200Response.md +18 -0
  62. data/docs/User.md +28 -0
  63. data/docs/UserInput.md +26 -0
  64. data/docs/UserUpdateInput.md +26 -0
  65. data/docs/UsersApi.md +419 -0
  66. data/docs/Workspace.md +28 -0
  67. data/docs/WorkspaceInput.md +24 -0
  68. data/docs/WorkspaceUserInput.md +24 -0
  69. data/docs/WorkspacesApi.md +637 -0
  70. data/git_push.sh +57 -0
  71. data/lib/postboost/api/accounts_api.rb +154 -0
  72. data/lib/postboost/api/media_api.rb +836 -0
  73. data/lib/postboost/api/posts_api.rb +673 -0
  74. data/lib/postboost/api/receipts_api.rb +409 -0
  75. data/lib/postboost/api/subscriptions_api.rb +689 -0
  76. data/lib/postboost/api/tags_api.rb +367 -0
  77. data/lib/postboost/api/users_api.rb +406 -0
  78. data/lib/postboost/api/workspaces_api.rb +640 -0
  79. data/lib/postboost/api_client.rb +394 -0
  80. data/lib/postboost/api_error.rb +58 -0
  81. data/lib/postboost/configuration.rb +308 -0
  82. data/lib/postboost/models/account.rb +321 -0
  83. data/lib/postboost/models/add_generic_subscription_request.rb +274 -0
  84. data/lib/postboost/models/change_subscription_plan_request.rb +303 -0
  85. data/lib/postboost/models/checkout_subscription200_response.rb +214 -0
  86. data/lib/postboost/models/checkout_subscription_request.rb +280 -0
  87. data/lib/postboost/models/delete_media_bulk_request.rb +224 -0
  88. data/lib/postboost/models/delete_mode.rb +41 -0
  89. data/lib/postboost/models/delete_post_request.rb +249 -0
  90. data/lib/postboost/models/delete_posts_bulk_request.rb +269 -0
  91. data/lib/postboost/models/delete_receipts_bulk_request.rb +223 -0
  92. data/lib/postboost/models/delete_result.rb +232 -0
  93. data/lib/postboost/models/delete_user400_response.rb +223 -0
  94. data/lib/postboost/models/delete_users_bulk_request.rb +223 -0
  95. data/lib/postboost/models/delete_workspaces_bulk_request.rb +223 -0
  96. data/lib/postboost/models/get_remote_upload_status200_response.rb +258 -0
  97. data/lib/postboost/models/initiate_chunked_upload200_response.rb +232 -0
  98. data/lib/postboost/models/initiate_chunked_upload_request.rb +273 -0
  99. data/lib/postboost/models/initiate_remote_upload200_response.rb +105 -0
  100. data/lib/postboost/models/initiate_remote_upload200_response_one_of.rb +214 -0
  101. data/lib/postboost/models/initiate_remote_upload_request.rb +250 -0
  102. data/lib/postboost/models/list_accounts200_response.rb +216 -0
  103. data/lib/postboost/models/list_media200_response.rb +241 -0
  104. data/lib/postboost/models/list_posts200_response.rb +241 -0
  105. data/lib/postboost/models/list_receipts200_response.rb +241 -0
  106. data/lib/postboost/models/list_tags200_response.rb +216 -0
  107. data/lib/postboost/models/list_users200_response.rb +241 -0
  108. data/lib/postboost/models/list_workspaces200_response.rb +241 -0
  109. data/lib/postboost/models/media.rb +320 -0
  110. data/lib/postboost/models/pagination_meta.rb +223 -0
  111. data/lib/postboost/models/pagination_meta_links.rb +241 -0
  112. data/lib/postboost/models/pagination_meta_meta.rb +259 -0
  113. data/lib/postboost/models/post.rb +323 -0
  114. data/lib/postboost/models/post_content.rb +247 -0
  115. data/lib/postboost/models/post_input.rb +324 -0
  116. data/lib/postboost/models/post_status.rb +41 -0
  117. data/lib/postboost/models/post_version.rb +267 -0
  118. data/lib/postboost/models/receipt.rb +295 -0
  119. data/lib/postboost/models/receipt_input.rb +335 -0
  120. data/lib/postboost/models/receipt_update_input.rb +312 -0
  121. data/lib/postboost/models/remove_user_from_workspace_request.rb +221 -0
  122. data/lib/postboost/models/schedule_post_request.rb +221 -0
  123. data/lib/postboost/models/schedule_result.rb +223 -0
  124. data/lib/postboost/models/subscription.rb +299 -0
  125. data/lib/postboost/models/subscription_input.rb +285 -0
  126. data/lib/postboost/models/subscription_status.rb +44 -0
  127. data/lib/postboost/models/subscription_update_input.rb +279 -0
  128. data/lib/postboost/models/tag.rb +241 -0
  129. data/lib/postboost/models/tag_input.rb +237 -0
  130. data/lib/postboost/models/update_media_request.rb +222 -0
  131. data/lib/postboost/models/upload_chunk200_response.rb +215 -0
  132. data/lib/postboost/models/user.rb +259 -0
  133. data/lib/postboost/models/user_input.rb +304 -0
  134. data/lib/postboost/models/user_update_input.rb +272 -0
  135. data/lib/postboost/models/workspace.rb +293 -0
  136. data/lib/postboost/models/workspace_input.rb +315 -0
  137. data/lib/postboost/models/workspace_user_input.rb +303 -0
  138. data/lib/postboost/version.rb +15 -0
  139. data/lib/postboost.rb +103 -0
  140. data/postboost.gemspec +39 -0
  141. data/spec/api/accounts_api_spec.rb +60 -0
  142. data/spec/api/media_api_spec.rb +182 -0
  143. data/spec/api/posts_api_spec.rb +152 -0
  144. data/spec/api/receipts_api_spec.rb +103 -0
  145. data/spec/api/subscriptions_api_spec.rb +151 -0
  146. data/spec/api/tags_api_spec.rb +95 -0
  147. data/spec/api/users_api_spec.rb +102 -0
  148. data/spec/api/workspaces_api_spec.rb +142 -0
  149. data/spec/models/account_spec.rb +88 -0
  150. data/spec/models/add_generic_subscription_request_spec.rb +48 -0
  151. data/spec/models/change_subscription_plan_request_spec.rb +58 -0
  152. data/spec/models/checkout_subscription200_response_spec.rb +36 -0
  153. data/spec/models/checkout_subscription_request_spec.rb +52 -0
  154. data/spec/models/delete_media_bulk_request_spec.rb +36 -0
  155. data/spec/models/delete_mode_spec.rb +30 -0
  156. data/spec/models/delete_post_request_spec.rb +42 -0
  157. data/spec/models/delete_posts_bulk_request_spec.rb +48 -0
  158. data/spec/models/delete_receipts_bulk_request_spec.rb +36 -0
  159. data/spec/models/delete_result_spec.rb +48 -0
  160. data/spec/models/delete_user400_response_spec.rb +42 -0
  161. data/spec/models/delete_users_bulk_request_spec.rb +36 -0
  162. data/spec/models/delete_workspaces_bulk_request_spec.rb +36 -0
  163. data/spec/models/get_remote_upload_status200_response_spec.rb +46 -0
  164. data/spec/models/initiate_chunked_upload200_response_spec.rb +48 -0
  165. data/spec/models/initiate_chunked_upload_request_spec.rb +48 -0
  166. data/spec/models/initiate_remote_upload200_response_one_of_spec.rb +36 -0
  167. data/spec/models/initiate_remote_upload200_response_spec.rb +32 -0
  168. data/spec/models/initiate_remote_upload_request_spec.rb +42 -0
  169. data/spec/models/list_accounts200_response_spec.rb +36 -0
  170. data/spec/models/list_media200_response_spec.rb +48 -0
  171. data/spec/models/list_posts200_response_spec.rb +48 -0
  172. data/spec/models/list_receipts200_response_spec.rb +48 -0
  173. data/spec/models/list_tags200_response_spec.rb +36 -0
  174. data/spec/models/list_users200_response_spec.rb +48 -0
  175. data/spec/models/list_workspaces200_response_spec.rb +48 -0
  176. data/spec/models/media_spec.rb +88 -0
  177. data/spec/models/pagination_meta_links_spec.rb +54 -0
  178. data/spec/models/pagination_meta_meta_spec.rb +66 -0
  179. data/spec/models/pagination_meta_spec.rb +42 -0
  180. data/spec/models/post_content_spec.rb +54 -0
  181. data/spec/models/post_input_spec.rb +84 -0
  182. data/spec/models/post_spec.rb +90 -0
  183. data/spec/models/post_status_spec.rb +30 -0
  184. data/spec/models/post_version_spec.rb +54 -0
  185. data/spec/models/receipt_input_spec.rb +84 -0
  186. data/spec/models/receipt_spec.rb +90 -0
  187. data/spec/models/receipt_update_input_spec.rb +78 -0
  188. data/spec/models/remove_user_from_workspace_request_spec.rb +36 -0
  189. data/spec/models/schedule_post_request_spec.rb +36 -0
  190. data/spec/models/schedule_result_spec.rb +42 -0
  191. data/spec/models/subscription_input_spec.rb +54 -0
  192. data/spec/models/subscription_spec.rb +78 -0
  193. data/spec/models/subscription_status_spec.rb +30 -0
  194. data/spec/models/subscription_update_input_spec.rb +54 -0
  195. data/spec/models/tag_input_spec.rb +42 -0
  196. data/spec/models/tag_spec.rb +54 -0
  197. data/spec/models/update_media_request_spec.rb +36 -0
  198. data/spec/models/upload_chunk200_response_spec.rb +36 -0
  199. data/spec/models/user_input_spec.rb +60 -0
  200. data/spec/models/user_spec.rb +66 -0
  201. data/spec/models/user_update_input_spec.rb +60 -0
  202. data/spec/models/workspace_input_spec.rb +58 -0
  203. data/spec/models/workspace_spec.rb +70 -0
  204. data/spec/models/workspace_user_input_spec.rb +58 -0
  205. data/spec/spec_helper.rb +111 -0
  206. metadata +358 -0
@@ -0,0 +1,241 @@
1
+ =begin
2
+ #PostBoost API
3
+
4
+ #The PostBoost REST API lets you publish, schedule, and analyze social media posts across 8+ platforms from a single integration. No OAuth apps to maintain — PostBoost handles platform authorization for you. ## Base URL All workspace-scoped endpoints are prefixed with `/{workspaceUuid}`. Panel/admin endpoints are prefixed with `/panel`. ## Authentication All requests require a Bearer token in the `Authorization` header. Generate tokens in your PostBoost dashboard under **Settings → Access Tokens**. ``` Authorization: Bearer YOUR_API_TOKEN ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hi@postboost.co
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PostBoost
17
+ class ListUsers200Response
18
+ attr_accessor :links
19
+
20
+ attr_accessor :meta
21
+
22
+ attr_accessor :data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'links' => :'links',
28
+ :'meta' => :'meta',
29
+ :'data' => :'data'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'links' => :'PaginationMetaLinks',
42
+ :'meta' => :'PaginationMetaMeta',
43
+ :'data' => :'Array<User>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # List of class defined in allOf (OpenAPI v3)
54
+ def self.openapi_all_of
55
+ [
56
+ :'PaginationMeta'
57
+ ]
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::ListUsers200Response` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::ListUsers200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'links')
76
+ self.links = attributes[:'links']
77
+ end
78
+
79
+ if attributes.key?(:'meta')
80
+ self.meta = attributes[:'meta']
81
+ end
82
+
83
+ if attributes.key?(:'data')
84
+ if (value = attributes[:'data']).is_a?(Array)
85
+ self.data = value
86
+ end
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ links == o.links &&
111
+ meta == o.meta &&
112
+ data == o.data
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [links, meta, data].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = PostBoost.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end
@@ -0,0 +1,241 @@
1
+ =begin
2
+ #PostBoost API
3
+
4
+ #The PostBoost REST API lets you publish, schedule, and analyze social media posts across 8+ platforms from a single integration. No OAuth apps to maintain — PostBoost handles platform authorization for you. ## Base URL All workspace-scoped endpoints are prefixed with `/{workspaceUuid}`. Panel/admin endpoints are prefixed with `/panel`. ## Authentication All requests require a Bearer token in the `Authorization` header. Generate tokens in your PostBoost dashboard under **Settings → Access Tokens**. ``` Authorization: Bearer YOUR_API_TOKEN ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hi@postboost.co
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PostBoost
17
+ class ListWorkspaces200Response
18
+ attr_accessor :links
19
+
20
+ attr_accessor :meta
21
+
22
+ attr_accessor :data
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'links' => :'links',
28
+ :'meta' => :'meta',
29
+ :'data' => :'data'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'links' => :'PaginationMetaLinks',
42
+ :'meta' => :'PaginationMetaMeta',
43
+ :'data' => :'Array<Workspace>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # List of class defined in allOf (OpenAPI v3)
54
+ def self.openapi_all_of
55
+ [
56
+ :'PaginationMeta'
57
+ ]
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::ListWorkspaces200Response` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::ListWorkspaces200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'links')
76
+ self.links = attributes[:'links']
77
+ end
78
+
79
+ if attributes.key?(:'meta')
80
+ self.meta = attributes[:'meta']
81
+ end
82
+
83
+ if attributes.key?(:'data')
84
+ if (value = attributes[:'data']).is_a?(Array)
85
+ self.data = value
86
+ end
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ links == o.links &&
111
+ meta == o.meta &&
112
+ data == o.data
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [links, meta, data].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = PostBoost.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end