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,315 @@
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 WorkspaceInput
18
+ attr_accessor :name
19
+
20
+ attr_accessor :hex_color
21
+
22
+ attr_accessor :owner_id
23
+
24
+ attr_accessor :access_status
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
+ :'name' => :'name',
52
+ :'hex_color' => :'hex_color',
53
+ :'owner_id' => :'owner_id',
54
+ :'access_status' => :'access_status'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'name' => :'String',
67
+ :'hex_color' => :'String',
68
+ :'owner_id' => :'Integer',
69
+ :'access_status' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::WorkspaceInput` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::WorkspaceInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'name')
95
+ self.name = attributes[:'name']
96
+ else
97
+ self.name = nil
98
+ end
99
+
100
+ if attributes.key?(:'hex_color')
101
+ self.hex_color = attributes[:'hex_color']
102
+ else
103
+ self.hex_color = nil
104
+ end
105
+
106
+ if attributes.key?(:'owner_id')
107
+ self.owner_id = attributes[:'owner_id']
108
+ end
109
+
110
+ if attributes.key?(:'access_status')
111
+ self.access_status = attributes[:'access_status']
112
+ else
113
+ self.access_status = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @name.nil?
123
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
124
+ end
125
+
126
+ if @name.to_s.length > 60
127
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 60.')
128
+ end
129
+
130
+ if @hex_color.nil?
131
+ invalid_properties.push('invalid value for "hex_color", hex_color cannot be nil.')
132
+ end
133
+
134
+ if @access_status.nil?
135
+ invalid_properties.push('invalid value for "access_status", access_status cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if @name.nil?
146
+ return false if @name.to_s.length > 60
147
+ return false if @hex_color.nil?
148
+ return false if @access_status.nil?
149
+ access_status_validator = EnumAttributeValidator.new('String', ["subscription", "unlimited", "locked"])
150
+ return false unless access_status_validator.valid?(@access_status)
151
+ true
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] name Value to be assigned
156
+ def name=(name)
157
+ if name.nil?
158
+ fail ArgumentError, 'name cannot be nil'
159
+ end
160
+
161
+ if name.to_s.length > 60
162
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 60.'
163
+ end
164
+
165
+ @name = name
166
+ end
167
+
168
+ # Custom attribute writer method checking allowed values (enum).
169
+ # @param [Object] access_status Object to be assigned
170
+ def access_status=(access_status)
171
+ validator = EnumAttributeValidator.new('String', ["subscription", "unlimited", "locked"])
172
+ unless validator.valid?(access_status)
173
+ fail ArgumentError, "invalid value for \"access_status\", must be one of #{validator.allowable_values}."
174
+ end
175
+ @access_status = access_status
176
+ end
177
+
178
+ # Checks equality by comparing each attribute.
179
+ # @param [Object] Object to be compared
180
+ def ==(o)
181
+ return true if self.equal?(o)
182
+ self.class == o.class &&
183
+ name == o.name &&
184
+ hex_color == o.hex_color &&
185
+ owner_id == o.owner_id &&
186
+ access_status == o.access_status
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [name, hex_color, owner_id, access_status].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ return nil unless attributes.is_a?(Hash)
206
+ attributes = attributes.transform_keys(&:to_sym)
207
+ transformed_hash = {}
208
+ openapi_types.each_pair do |key, type|
209
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
210
+ transformed_hash["#{key}"] = nil
211
+ elsif type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[attribute_map[key]].is_a?(Array)
215
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
216
+ end
217
+ elsif !attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
219
+ end
220
+ end
221
+ new(transformed_hash)
222
+ end
223
+
224
+ # Deserializes the data based on type
225
+ # @param string type Data type
226
+ # @param string value Value to be deserialized
227
+ # @return [Object] Deserialized data
228
+ def self._deserialize(type, value)
229
+ case type.to_sym
230
+ when :Time
231
+ Time.parse(value)
232
+ when :Date
233
+ Date.parse(value)
234
+ when :String
235
+ value.to_s
236
+ when :Integer
237
+ value.to_i
238
+ when :Float
239
+ value.to_f
240
+ when :Boolean
241
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
242
+ true
243
+ else
244
+ false
245
+ end
246
+ when :Object
247
+ # generic object (usually a Hash), return directly
248
+ value
249
+ when /\AArray<(?<inner_type>.+)>\z/
250
+ inner_type = Regexp.last_match[:inner_type]
251
+ value.map { |v| _deserialize(inner_type, v) }
252
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
253
+ k_type = Regexp.last_match[:k_type]
254
+ v_type = Regexp.last_match[:v_type]
255
+ {}.tap do |hash|
256
+ value.each do |k, v|
257
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
258
+ end
259
+ end
260
+ else # model
261
+ # models (e.g. Pet) or oneOf
262
+ klass = PostBoost.const_get(type)
263
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ if value.nil?
286
+ is_nullable = self.class.openapi_nullable.include?(attr)
287
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
+ end
289
+
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+
313
+ end
314
+
315
+ end
@@ -0,0 +1,303 @@
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 WorkspaceUserInput
18
+ attr_accessor :user_id
19
+
20
+ attr_accessor :role
21
+
22
+ attr_accessor :can_approve
23
+
24
+ attr_accessor :is_owner
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
+ :'user_id' => :'user_id',
52
+ :'role' => :'role',
53
+ :'can_approve' => :'can_approve',
54
+ :'is_owner' => :'is_owner'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'user_id' => :'Integer',
67
+ :'role' => :'String',
68
+ :'can_approve' => :'Boolean',
69
+ :'is_owner' => :'Boolean'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::WorkspaceUserInput` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::WorkspaceUserInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'user_id')
95
+ self.user_id = attributes[:'user_id']
96
+ else
97
+ self.user_id = nil
98
+ end
99
+
100
+ if attributes.key?(:'role')
101
+ self.role = attributes[:'role']
102
+ else
103
+ self.role = nil
104
+ end
105
+
106
+ if attributes.key?(:'can_approve')
107
+ self.can_approve = attributes[:'can_approve']
108
+ else
109
+ self.can_approve = nil
110
+ end
111
+
112
+ if attributes.key?(:'is_owner')
113
+ self.is_owner = attributes[:'is_owner']
114
+ else
115
+ self.is_owner = nil
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ if @user_id.nil?
125
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
126
+ end
127
+
128
+ if @role.nil?
129
+ invalid_properties.push('invalid value for "role", role cannot be nil.')
130
+ end
131
+
132
+ if @can_approve.nil?
133
+ invalid_properties.push('invalid value for "can_approve", can_approve cannot be nil.')
134
+ end
135
+
136
+ if @is_owner.nil?
137
+ invalid_properties.push('invalid value for "is_owner", is_owner cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @user_id.nil?
148
+ return false if @role.nil?
149
+ role_validator = EnumAttributeValidator.new('String', ["admin", "member", "viewer"])
150
+ return false unless role_validator.valid?(@role)
151
+ return false if @can_approve.nil?
152
+ return false if @is_owner.nil?
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method checking allowed values (enum).
157
+ # @param [Object] role Object to be assigned
158
+ def role=(role)
159
+ validator = EnumAttributeValidator.new('String', ["admin", "member", "viewer"])
160
+ unless validator.valid?(role)
161
+ fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
162
+ end
163
+ @role = role
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ user_id == o.user_id &&
172
+ role == o.role &&
173
+ can_approve == o.can_approve &&
174
+ is_owner == o.is_owner
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Integer] Hash code
185
+ def hash
186
+ [user_id, role, can_approve, is_owner].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def self.build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ attributes = attributes.transform_keys(&:to_sym)
195
+ transformed_hash = {}
196
+ openapi_types.each_pair do |key, type|
197
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[attribute_map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
204
+ end
205
+ elsif !attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
+ end
208
+ end
209
+ new(transformed_hash)
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def self._deserialize(type, value)
217
+ case type.to_sym
218
+ when :Time
219
+ Time.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ # models (e.g. Pet) or oneOf
250
+ klass = PostBoost.const_get(type)
251
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.openapi_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ end
@@ -0,0 +1,15 @@
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
+ module PostBoost
14
+ VERSION = '1.0.0'
15
+ end