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,224 @@
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 DeleteMediaBulkRequest
18
+ # Array of media IDs to delete.
19
+ attr_accessor :items
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'items' => :'items'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'items' => :'Array<Integer>'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::DeleteMediaBulkRequest` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::DeleteMediaBulkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'items')
62
+ if (value = attributes[:'items']).is_a?(Array)
63
+ self.items = value
64
+ end
65
+ else
66
+ self.items = nil
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
74
+ invalid_properties = Array.new
75
+ if @items.nil?
76
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ return false if @items.nil?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ items == o.items
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [items].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ attributes = attributes.transform_keys(&:to_sym)
116
+ transformed_hash = {}
117
+ openapi_types.each_pair do |key, type|
118
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
119
+ transformed_hash["#{key}"] = nil
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[attribute_map[key]].is_a?(Array)
124
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
125
+ end
126
+ elsif !attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
128
+ end
129
+ end
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = PostBoost.const_get(type)
172
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -0,0 +1,41 @@
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 DeleteMode
18
+ APP_ONLY = "app_only".freeze
19
+ APP_AND_SOCIAL = "app_and_social".freeze
20
+ SOCIAL_ONLY = "social_only".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [APP_ONLY, APP_AND_SOCIAL, SOCIAL_ONLY].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if DeleteMode.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #DeleteMode"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,249 @@
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 DeletePostRequest
18
+ attr_accessor :trash
19
+
20
+ attr_accessor :delete_mode
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
+ :'trash' => :'trash',
48
+ :'delete_mode' => :'delete_mode'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'trash' => :'Boolean',
61
+ :'delete_mode' => :'DeleteMode'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::DeletePostRequest` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::DeletePostRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'trash')
87
+ self.trash = attributes[:'trash']
88
+ else
89
+ self.trash = false
90
+ end
91
+
92
+ if attributes.key?(:'delete_mode')
93
+ self.delete_mode = attributes[:'delete_mode']
94
+ else
95
+ self.delete_mode = 'app_only'
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ trash == o.trash &&
120
+ delete_mode == o.delete_mode
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [trash, delete_mode].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = PostBoost.const_get(type)
197
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end