postboost 1.0.0 → 1.8.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.
- checksums.yaml +4 -4
- data/README.md +119 -0
- data/docs/AIApi.md +439 -0
- data/docs/AICredits.md +22 -0
- data/docs/Account.md +14 -8
- data/docs/AccountAnalytics.md +28 -0
- data/docs/AccountAnalyticsInitialSync.md +20 -0
- data/docs/AccountSchedule.md +22 -0
- data/docs/AccountsApi.md +15 -5
- data/docs/AddPostToQueueRequest.md +18 -0
- data/docs/AnalyticsApi.md +401 -0
- data/docs/AnalyticsPeriod.md +24 -0
- data/docs/AnalyticsSummary.md +20 -0
- data/docs/AnalyticsSummaryData.md +38 -0
- data/docs/ApprovePostRequest.md +24 -0
- data/docs/BestPostingTimes.md +20 -0
- data/docs/BestPostingTimesTimesInner.md +24 -0
- data/docs/BlogToSocial200Response.md +18 -0
- data/docs/BlogToSocial429Response.md +18 -0
- data/docs/BlogToSocialCaption.md +28 -0
- data/docs/BlogToSocialInput.md +42 -0
- data/docs/BlogToSocialMedia.md +20 -0
- data/docs/BlogToSocialResponse.md +30 -0
- data/docs/CancelSubscription422Response.md +20 -0
- data/docs/CancelSubscription422ResponseErrors.md +18 -0
- data/docs/CancelSubscriptionRequest.md +18 -0
- data/docs/CompleteChunkedUploadRequest.md +20 -0
- data/docs/CreateMediaFolderRequest.md +20 -0
- data/docs/CreateMention201Response.md +18 -0
- data/docs/DeleteMediaBulkRequest.md +1 -1
- data/docs/DeleteMediaBulkRequestItemsInner.md +49 -0
- data/docs/DeleteMediaFolderRequest.md +18 -0
- data/docs/DeleteResult.md +3 -3
- data/docs/ImageAltText200Response.md +18 -0
- data/docs/ImageAltTextInput.md +18 -0
- data/docs/ImageAltTextResponse.md +24 -0
- data/docs/ImageEditInput.md +28 -0
- data/docs/ImageGenerate200Response.md +18 -0
- data/docs/ImageGenerate429Response.md +18 -0
- data/docs/ImageGenerateInput.md +36 -0
- data/docs/ImageGenerationResponse.md +30 -0
- data/docs/ImagePrompt200Response.md +18 -0
- data/docs/ImagePrompt429Response.md +18 -0
- data/docs/ImagePromptInput.md +28 -0
- data/docs/ImagePromptResponse.md +18 -0
- data/docs/ImageVariations200Response.md +18 -0
- data/docs/ImageVariationsInput.md +24 -0
- data/docs/ImageVariationsResponse.md +26 -0
- data/docs/{InitiateChunkedUpload200Response.md → InitiateChunkedUpload201Response.md} +2 -2
- data/docs/{InitiateRemoteUpload200Response.md → InitiateRemoteUpload201Response.md} +7 -7
- data/docs/{InitiateRemoteUpload200ResponseOneOf.md → InitiateRemoteUpload201ResponseOneOf.md} +2 -2
- data/docs/InitiateRemoteUploadRequest.md +3 -1
- data/docs/ListMediaFolders200Response.md +18 -0
- data/docs/ListMentions200Response.md +22 -0
- data/docs/ListMyWorkspaces200Response.md +18 -0
- data/docs/Media.md +22 -8
- data/docs/MediaApi.md +340 -26
- data/docs/MediaFolder.md +24 -0
- data/docs/MediaFolderInput.md +20 -0
- data/docs/MediaFolderRef.md +20 -0
- data/docs/Mention.md +28 -0
- data/docs/MentionIdentity.md +24 -0
- data/docs/MentionIdentityInput.md +26 -0
- data/docs/MentionInput.md +22 -0
- data/docs/MentionsApi.md +375 -0
- data/docs/Post.md +10 -8
- data/docs/PostAnalytics.md +22 -0
- data/docs/PostInput.md +3 -1
- data/docs/PostVersion.md +2 -0
- data/docs/PostingTimeSlot.md +22 -0
- data/docs/PostingTimes.md +32 -0
- data/docs/PostingTimesBestInner.md +24 -0
- data/docs/PostingTimesDayIntervalsInnerInner.md +28 -0
- data/docs/PostingTimesDaysInner.md +24 -0
- data/docs/PostsApi.md +174 -14
- data/docs/PublicWorkspace.md +24 -0
- data/docs/PublicWorkspacePivot.md +22 -0
- data/docs/PublishProgress.md +22 -0
- data/docs/Receipt.md +8 -8
- data/docs/ReceiptsApi.md +15 -1
- data/docs/RemoveGenericSubscription422Response.md +18 -0
- data/docs/RetryPostAccountResult.md +22 -0
- data/docs/SchedulePostRequest.md +9 -1
- data/docs/ScheduleResult.md +4 -2
- data/docs/Subscription.md +5 -5
- data/docs/SubscriptionsApi.md +27 -5
- data/docs/Tag.md +4 -4
- data/docs/TagsApi.md +10 -0
- data/docs/UpdateMediaRequest.md +6 -2
- data/docs/{UploadChunk200Response.md → UploadChunk201Response.md} +2 -2
- data/docs/User.md +7 -5
- data/docs/UsersApi.md +15 -1
- data/docs/Workspace.md +8 -6
- data/docs/WorkspaceInput.md +1 -1
- data/docs/WorkspacesApi.md +156 -3
- data/lib/postboost/api/accounts_api.rb +16 -4
- data/lib/postboost/api/ai_api.rb +466 -0
- data/lib/postboost/api/analytics_api.rb +425 -0
- data/lib/postboost/api/media_api.rb +365 -22
- data/lib/postboost/api/mentions_api.rb +386 -0
- data/lib/postboost/api/posts_api.rb +176 -12
- data/lib/postboost/api/receipts_api.rb +17 -2
- data/lib/postboost/api/subscriptions_api.rb +28 -3
- data/lib/postboost/api/tags_api.rb +12 -2
- data/lib/postboost/api/users_api.rb +17 -2
- data/lib/postboost/api/workspaces_api.rb +139 -2
- data/lib/postboost/api_client.rb +2 -2
- data/lib/postboost/api_error.rb +2 -2
- data/lib/postboost/configuration.rb +2 -2
- data/lib/postboost/models/account.rb +120 -3
- data/lib/postboost/models/account_analytics.rb +308 -0
- data/lib/postboost/models/account_analytics_initial_sync.rb +231 -0
- data/lib/postboost/models/account_schedule.rb +255 -0
- data/lib/postboost/models/add_generic_subscription_request.rb +2 -2
- data/lib/postboost/models/add_post_to_queue_request.rb +215 -0
- data/lib/postboost/models/ai_credits.rb +256 -0
- data/lib/postboost/models/analytics_period.rb +270 -0
- data/lib/postboost/models/analytics_summary.rb +237 -0
- data/lib/postboost/models/analytics_summary_data.rb +327 -0
- data/lib/postboost/models/approve_post_request.rb +247 -0
- data/lib/postboost/models/best_posting_times.rb +240 -0
- data/lib/postboost/models/best_posting_times_times_inner.rb +269 -0
- data/lib/postboost/models/blog_to_social200_response.rb +214 -0
- data/lib/postboost/models/blog_to_social429_response.rb +214 -0
- data/lib/postboost/models/blog_to_social_caption.rb +265 -0
- data/lib/postboost/models/blog_to_social_input.rb +536 -0
- data/lib/postboost/models/blog_to_social_media.rb +226 -0
- data/lib/postboost/models/blog_to_social_response.rb +276 -0
- data/lib/postboost/models/cancel_subscription422_response.rb +223 -0
- data/lib/postboost/models/cancel_subscription422_response_errors.rb +216 -0
- data/lib/postboost/models/cancel_subscription_request.rb +217 -0
- data/lib/postboost/models/change_subscription_plan_request.rb +2 -2
- data/lib/postboost/models/checkout_subscription200_response.rb +2 -2
- data/lib/postboost/models/checkout_subscription_request.rb +2 -2
- data/lib/postboost/models/complete_chunked_upload_request.rb +243 -0
- data/lib/postboost/models/create_media_folder_request.rb +258 -0
- data/lib/postboost/models/create_mention201_response.rb +214 -0
- data/lib/postboost/models/delete_media_bulk_request.rb +23 -4
- data/lib/postboost/models/{initiate_remote_upload200_response.rb → delete_media_bulk_request_items_inner.rb} +5 -5
- data/lib/postboost/models/delete_media_folder_request.rb +216 -0
- data/lib/postboost/models/delete_mode.rb +2 -2
- data/lib/postboost/models/delete_post_request.rb +2 -2
- data/lib/postboost/models/delete_posts_bulk_request.rb +2 -2
- data/lib/postboost/models/delete_receipts_bulk_request.rb +2 -2
- data/lib/postboost/models/delete_result.rb +23 -2
- data/lib/postboost/models/delete_user400_response.rb +2 -2
- data/lib/postboost/models/delete_users_bulk_request.rb +2 -2
- data/lib/postboost/models/delete_workspaces_bulk_request.rb +2 -2
- data/lib/postboost/models/get_remote_upload_status200_response.rb +2 -2
- data/lib/postboost/models/image_alt_text200_response.rb +221 -0
- data/lib/postboost/models/image_alt_text_input.rb +221 -0
- data/lib/postboost/models/image_alt_text_response.rb +262 -0
- data/lib/postboost/models/image_edit_input.rb +375 -0
- data/lib/postboost/models/image_generate200_response.rb +221 -0
- data/lib/postboost/models/image_generate429_response.rb +214 -0
- data/lib/postboost/models/image_generate_input.rb +447 -0
- data/lib/postboost/models/image_generation_response.rb +305 -0
- data/lib/postboost/models/image_prompt200_response.rb +221 -0
- data/lib/postboost/models/image_prompt429_response.rb +214 -0
- data/lib/postboost/models/image_prompt_input.rb +345 -0
- data/lib/postboost/models/image_prompt_response.rb +221 -0
- data/lib/postboost/models/image_variations200_response.rb +221 -0
- data/lib/postboost/models/image_variations_input.rb +328 -0
- data/lib/postboost/models/image_variations_response.rb +280 -0
- data/lib/postboost/models/{initiate_chunked_upload200_response.rb → initiate_chunked_upload201_response.rb} +5 -5
- data/lib/postboost/models/initiate_chunked_upload_request.rb +2 -2
- data/lib/postboost/models/initiate_remote_upload201_response.rb +105 -0
- data/lib/postboost/models/{initiate_remote_upload200_response_one_of.rb → initiate_remote_upload201_response_one_of.rb} +5 -5
- data/lib/postboost/models/initiate_remote_upload_request.rb +16 -6
- data/lib/postboost/models/list_accounts200_response.rb +2 -2
- data/lib/postboost/models/list_media200_response.rb +2 -2
- data/lib/postboost/models/list_media_folders200_response.rb +216 -0
- data/lib/postboost/models/list_mentions200_response.rb +241 -0
- data/lib/postboost/models/list_my_workspaces200_response.rb +216 -0
- data/lib/postboost/models/list_posts200_response.rb +2 -2
- data/lib/postboost/models/list_receipts200_response.rb +2 -2
- data/lib/postboost/models/list_tags200_response.rb +2 -2
- data/lib/postboost/models/list_users200_response.rb +2 -2
- data/lib/postboost/models/list_workspaces200_response.rb +2 -2
- data/lib/postboost/models/media.rb +128 -3
- data/lib/postboost/models/media_folder.rb +271 -0
- data/lib/postboost/models/media_folder_input.rb +244 -0
- data/lib/postboost/models/media_folder_ref.rb +237 -0
- data/lib/postboost/models/mention.rb +290 -0
- data/lib/postboost/models/mention_identity.rb +257 -0
- data/lib/postboost/models/mention_identity_input.rb +325 -0
- data/lib/postboost/models/mention_input.rb +279 -0
- data/lib/postboost/models/pagination_meta.rb +2 -2
- data/lib/postboost/models/pagination_meta_links.rb +2 -2
- data/lib/postboost/models/pagination_meta_meta.rb +2 -2
- data/lib/postboost/models/post.rb +69 -3
- data/lib/postboost/models/post_analytics.rb +252 -0
- data/lib/postboost/models/post_content.rb +2 -2
- data/lib/postboost/models/post_input.rb +16 -3
- data/lib/postboost/models/post_status.rb +6 -3
- data/lib/postboost/models/post_version.rb +32 -3
- data/lib/postboost/models/posting_time_slot.rb +315 -0
- data/lib/postboost/models/posting_times.rb +362 -0
- data/lib/postboost/models/posting_times_best_inner.rb +269 -0
- data/lib/postboost/models/posting_times_day_intervals_inner_inner.rb +370 -0
- data/lib/postboost/models/posting_times_days_inner.rb +366 -0
- data/lib/postboost/models/public_workspace.rb +262 -0
- data/lib/postboost/models/public_workspace_pivot.rb +267 -0
- data/lib/postboost/models/publish_progress.rb +254 -0
- data/lib/postboost/models/receipt.rb +58 -2
- data/lib/postboost/models/receipt_input.rb +2 -2
- data/lib/postboost/models/receipt_update_input.rb +2 -2
- data/lib/postboost/models/remove_generic_subscription422_response.rb +214 -0
- data/lib/postboost/models/remove_user_from_workspace_request.rb +2 -2
- data/lib/postboost/models/retry_post_account_result.rb +275 -0
- data/lib/postboost/models/schedule_post_request.rb +48 -6
- data/lib/postboost/models/schedule_result.rb +23 -6
- data/lib/postboost/models/subscription.rb +37 -2
- data/lib/postboost/models/subscription_input.rb +2 -2
- data/lib/postboost/models/subscription_status.rb +2 -2
- data/lib/postboost/models/subscription_update_input.rb +2 -2
- data/lib/postboost/models/tag.rb +30 -2
- data/lib/postboost/models/tag_input.rb +2 -2
- data/lib/postboost/models/update_media_request.rb +61 -11
- data/lib/postboost/models/{upload_chunk200_response.rb → upload_chunk201_response.rb} +5 -5
- data/lib/postboost/models/user.rb +48 -3
- data/lib/postboost/models/user_input.rb +2 -2
- data/lib/postboost/models/user_update_input.rb +2 -2
- data/lib/postboost/models/workspace.rb +42 -3
- data/lib/postboost/models/workspace_input.rb +3 -9
- data/lib/postboost/models/workspace_user_input.rb +2 -2
- data/lib/postboost/version.rb +3 -3
- data/lib/postboost.rb +70 -6
- data/postboost.gemspec +3 -3
- data/spec/api/accounts_api_spec.rb +7 -3
- data/spec/api/ai_api_spec.rb +113 -0
- data/spec/api/analytics_api_spec.rb +113 -0
- data/spec/api/media_api_spec.rb +73 -10
- data/spec/api/mentions_api_spec.rb +103 -0
- data/spec/api/posts_api_spec.rb +38 -6
- data/spec/api/receipts_api_spec.rb +9 -2
- data/spec/api/subscriptions_api_spec.rb +12 -2
- data/spec/api/tags_api_spec.rb +7 -2
- data/spec/api/users_api_spec.rb +9 -2
- data/spec/api/workspaces_api_spec.rb +33 -2
- data/spec/models/account_analytics_initial_sync_spec.rb +42 -0
- data/spec/models/account_analytics_spec.rb +66 -0
- data/spec/models/account_schedule_spec.rb +48 -0
- data/spec/models/account_spec.rb +24 -2
- data/spec/models/add_generic_subscription_request_spec.rb +2 -2
- data/spec/models/add_post_to_queue_request_spec.rb +36 -0
- data/spec/models/ai_credits_spec.rb +48 -0
- data/spec/models/analytics_period_spec.rb +54 -0
- data/spec/models/analytics_summary_data_spec.rb +96 -0
- data/spec/models/analytics_summary_spec.rb +42 -0
- data/spec/models/approve_post_request_spec.rb +54 -0
- data/spec/models/best_posting_times_spec.rb +42 -0
- data/spec/models/best_posting_times_times_inner_spec.rb +54 -0
- data/spec/models/blog_to_social200_response_spec.rb +36 -0
- data/spec/models/blog_to_social429_response_spec.rb +36 -0
- data/spec/models/blog_to_social_caption_spec.rb +66 -0
- data/spec/models/blog_to_social_input_spec.rb +128 -0
- data/spec/models/blog_to_social_media_spec.rb +42 -0
- data/spec/models/blog_to_social_response_spec.rb +72 -0
- data/spec/models/cancel_subscription422_response_errors_spec.rb +36 -0
- data/spec/models/cancel_subscription422_response_spec.rb +42 -0
- data/spec/models/cancel_subscription_request_spec.rb +36 -0
- data/spec/models/change_subscription_plan_request_spec.rb +2 -2
- data/spec/models/checkout_subscription200_response_spec.rb +2 -2
- data/spec/models/checkout_subscription_request_spec.rb +2 -2
- data/spec/models/complete_chunked_upload_request_spec.rb +42 -0
- data/spec/models/create_media_folder_request_spec.rb +42 -0
- data/spec/models/create_mention201_response_spec.rb +36 -0
- data/spec/models/delete_media_bulk_request_items_inner_spec.rb +32 -0
- data/spec/models/delete_media_bulk_request_spec.rb +2 -2
- data/spec/models/delete_media_folder_request_spec.rb +36 -0
- data/spec/models/delete_mode_spec.rb +2 -2
- data/spec/models/delete_post_request_spec.rb +2 -2
- data/spec/models/delete_posts_bulk_request_spec.rb +2 -2
- data/spec/models/delete_receipts_bulk_request_spec.rb +2 -2
- data/spec/models/delete_result_spec.rb +2 -2
- data/spec/models/delete_user400_response_spec.rb +2 -2
- data/spec/models/delete_users_bulk_request_spec.rb +2 -2
- data/spec/models/delete_workspaces_bulk_request_spec.rb +2 -2
- data/spec/models/get_remote_upload_status200_response_spec.rb +2 -2
- data/spec/models/image_alt_text200_response_spec.rb +36 -0
- data/spec/models/image_alt_text_input_spec.rb +36 -0
- data/spec/models/image_alt_text_response_spec.rb +54 -0
- data/spec/models/image_edit_input_spec.rb +74 -0
- data/spec/models/image_generate200_response_spec.rb +36 -0
- data/spec/models/image_generate429_response_spec.rb +36 -0
- data/spec/models/image_generate_input_spec.rb +102 -0
- data/spec/models/image_generation_response_spec.rb +72 -0
- data/spec/models/image_prompt200_response_spec.rb +36 -0
- data/spec/models/image_prompt429_response_spec.rb +36 -0
- data/spec/models/image_prompt_input_spec.rb +70 -0
- data/spec/models/image_prompt_response_spec.rb +36 -0
- data/spec/models/image_variations200_response_spec.rb +36 -0
- data/spec/models/image_variations_input_spec.rb +62 -0
- data/spec/models/image_variations_response_spec.rb +60 -0
- data/spec/models/initiate_chunked_upload201_response_spec.rb +48 -0
- data/spec/models/initiate_chunked_upload_request_spec.rb +2 -2
- data/spec/models/initiate_remote_upload201_response_one_of_spec.rb +36 -0
- data/spec/models/initiate_remote_upload201_response_spec.rb +32 -0
- data/spec/models/initiate_remote_upload_request_spec.rb +8 -2
- data/spec/models/list_accounts200_response_spec.rb +2 -2
- data/spec/models/list_media200_response_spec.rb +2 -2
- data/spec/models/list_media_folders200_response_spec.rb +36 -0
- data/spec/models/list_mentions200_response_spec.rb +48 -0
- data/spec/models/list_my_workspaces200_response_spec.rb +36 -0
- data/spec/models/list_posts200_response_spec.rb +2 -2
- data/spec/models/list_receipts200_response_spec.rb +2 -2
- data/spec/models/list_tags200_response_spec.rb +2 -2
- data/spec/models/list_users200_response_spec.rb +2 -2
- data/spec/models/list_workspaces200_response_spec.rb +2 -2
- data/spec/models/media_folder_input_spec.rb +42 -0
- data/spec/models/media_folder_ref_spec.rb +42 -0
- data/spec/models/media_folder_spec.rb +54 -0
- data/spec/models/media_spec.rb +44 -2
- data/spec/models/mention_identity_input_spec.rb +60 -0
- data/spec/models/mention_identity_spec.rb +54 -0
- data/spec/models/mention_input_spec.rb +48 -0
- data/spec/models/mention_spec.rb +66 -0
- data/spec/models/pagination_meta_links_spec.rb +2 -2
- data/spec/models/pagination_meta_meta_spec.rb +2 -2
- data/spec/models/pagination_meta_spec.rb +2 -2
- data/spec/models/post_analytics_spec.rb +48 -0
- data/spec/models/post_content_spec.rb +2 -2
- data/spec/models/post_input_spec.rb +8 -2
- data/spec/models/post_spec.rb +8 -2
- data/spec/models/post_status_spec.rb +2 -2
- data/spec/models/post_version_spec.rb +8 -2
- data/spec/models/posting_time_slot_spec.rb +52 -0
- data/spec/models/posting_times_best_inner_spec.rb +54 -0
- data/spec/models/posting_times_day_intervals_inner_inner_spec.rb +70 -0
- data/spec/models/posting_times_days_inner_spec.rb +58 -0
- data/spec/models/posting_times_spec.rb +78 -0
- data/spec/models/public_workspace_pivot_spec.rb +52 -0
- data/spec/models/public_workspace_spec.rb +54 -0
- data/spec/models/publish_progress_spec.rb +48 -0
- data/spec/models/receipt_input_spec.rb +2 -2
- data/spec/models/receipt_spec.rb +2 -2
- data/spec/models/receipt_update_input_spec.rb +2 -2
- data/spec/models/remove_generic_subscription422_response_spec.rb +36 -0
- data/spec/models/remove_user_from_workspace_request_spec.rb +2 -2
- data/spec/models/retry_post_account_result_spec.rb +48 -0
- data/spec/models/schedule_post_request_spec.rb +26 -2
- data/spec/models/schedule_result_spec.rb +8 -2
- data/spec/models/subscription_input_spec.rb +2 -2
- data/spec/models/subscription_spec.rb +2 -2
- data/spec/models/subscription_status_spec.rb +2 -2
- data/spec/models/subscription_update_input_spec.rb +2 -2
- data/spec/models/tag_input_spec.rb +2 -2
- data/spec/models/tag_spec.rb +2 -2
- data/spec/models/update_media_request_spec.rb +14 -2
- data/spec/models/upload_chunk201_response_spec.rb +36 -0
- data/spec/models/user_input_spec.rb +2 -2
- data/spec/models/user_spec.rb +8 -2
- data/spec/models/user_update_input_spec.rb +2 -2
- data/spec/models/workspace_input_spec.rb +2 -2
- data/spec/models/workspace_spec.rb +8 -2
- data/spec/models/workspace_user_input_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +331 -75
- data/git_push.sh +0 -57
- data/spec/models/initiate_chunked_upload200_response_spec.rb +0 -48
- data/spec/models/initiate_remote_upload200_response_one_of_spec.rb +0 -36
- data/spec/models/initiate_remote_upload200_response_spec.rb +0 -32
- data/spec/models/upload_chunk200_response_spec.rb +0 -36
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#PostBoost API
|
|
3
|
+
|
|
4
|
+
#The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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`. ## Plan access Every workspace-scoped endpoint returns `403` when the workspace's plan does not include API access (capability `api`). ## Dates and times Post dates and times (`date`, `time`, `accounts_schedule`) are read in the request's `timezone` when one is given, otherwise in the workspace timezone. ## 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.8.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
|
+
# At least one of `url` or (`title` + `excerpt`) must be provided. If both are given, direct values take priority over the scraped URL content.
|
|
18
|
+
class BlogToSocialInput
|
|
19
|
+
# Blog post URL to scrape. Required if `title` and `excerpt` are not provided.
|
|
20
|
+
attr_accessor :url
|
|
21
|
+
|
|
22
|
+
# Blog post title. Required if `url` is not provided.
|
|
23
|
+
attr_accessor :title
|
|
24
|
+
|
|
25
|
+
# Blog post summary or excerpt. Required if `url` is not provided.
|
|
26
|
+
attr_accessor :excerpt
|
|
27
|
+
|
|
28
|
+
# Featured image URL for the blog post. When `create_post` is `true`, the image is imported into the workspace media library and attached to the draft post. If omitted in URL mode, the scraper attempts to extract the `og:image` meta tag.
|
|
29
|
+
attr_accessor :image_url
|
|
30
|
+
|
|
31
|
+
# Target social media platforms. Only connected accounts matching these platforms are used. If omitted, all connected accounts in the workspace are targeted.
|
|
32
|
+
attr_accessor :platforms
|
|
33
|
+
|
|
34
|
+
# Specific account IDs to generate captions for. Takes precedence over `platforms` when both are provided.
|
|
35
|
+
attr_accessor :account_ids
|
|
36
|
+
|
|
37
|
+
# Writing tone for all generated captions.
|
|
38
|
+
attr_accessor :tone
|
|
39
|
+
|
|
40
|
+
# Desired length of the generated captions.
|
|
41
|
+
attr_accessor :content_length
|
|
42
|
+
|
|
43
|
+
# Hashtag quantity: none (0), few (1-3), some (3-5), many (5+).
|
|
44
|
+
attr_accessor :hashtags
|
|
45
|
+
|
|
46
|
+
# Call-to-action type appended to each caption.
|
|
47
|
+
attr_accessor :cta
|
|
48
|
+
|
|
49
|
+
# Output language as an ISO 639-1 code (e.g. `en`, `de`, `fr`). Use `auto` to match the blog post's language automatically.
|
|
50
|
+
attr_accessor :language
|
|
51
|
+
|
|
52
|
+
# Additional instructions appended to the AI prompt (e.g. \"always mention our free tier\").
|
|
53
|
+
attr_accessor :custom_instructions
|
|
54
|
+
|
|
55
|
+
# When `true`, creates a draft post in the workspace with per-account caption versions. If an image is available, it is imported and attached to the post.
|
|
56
|
+
attr_accessor :create_post
|
|
57
|
+
|
|
58
|
+
class EnumAttributeValidator
|
|
59
|
+
attr_reader :datatype
|
|
60
|
+
attr_reader :allowable_values
|
|
61
|
+
|
|
62
|
+
def initialize(datatype, allowable_values)
|
|
63
|
+
@allowable_values = allowable_values.map do |value|
|
|
64
|
+
case datatype.to_s
|
|
65
|
+
when /Integer/i
|
|
66
|
+
value.to_i
|
|
67
|
+
when /Float/i
|
|
68
|
+
value.to_f
|
|
69
|
+
else
|
|
70
|
+
value
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def valid?(value)
|
|
76
|
+
!value || allowable_values.include?(value)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
81
|
+
def self.attribute_map
|
|
82
|
+
{
|
|
83
|
+
:'url' => :'url',
|
|
84
|
+
:'title' => :'title',
|
|
85
|
+
:'excerpt' => :'excerpt',
|
|
86
|
+
:'image_url' => :'image_url',
|
|
87
|
+
:'platforms' => :'platforms',
|
|
88
|
+
:'account_ids' => :'account_ids',
|
|
89
|
+
:'tone' => :'tone',
|
|
90
|
+
:'content_length' => :'content_length',
|
|
91
|
+
:'hashtags' => :'hashtags',
|
|
92
|
+
:'cta' => :'cta',
|
|
93
|
+
:'language' => :'language',
|
|
94
|
+
:'custom_instructions' => :'custom_instructions',
|
|
95
|
+
:'create_post' => :'create_post'
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Returns all the JSON keys this model knows about
|
|
100
|
+
def self.acceptable_attributes
|
|
101
|
+
attribute_map.values
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Attribute type mapping.
|
|
105
|
+
def self.openapi_types
|
|
106
|
+
{
|
|
107
|
+
:'url' => :'String',
|
|
108
|
+
:'title' => :'String',
|
|
109
|
+
:'excerpt' => :'String',
|
|
110
|
+
:'image_url' => :'String',
|
|
111
|
+
:'platforms' => :'Array<String>',
|
|
112
|
+
:'account_ids' => :'Array<Integer>',
|
|
113
|
+
:'tone' => :'String',
|
|
114
|
+
:'content_length' => :'String',
|
|
115
|
+
:'hashtags' => :'String',
|
|
116
|
+
:'cta' => :'String',
|
|
117
|
+
:'language' => :'String',
|
|
118
|
+
:'custom_instructions' => :'String',
|
|
119
|
+
:'create_post' => :'Boolean'
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# List of attributes with nullable: true
|
|
124
|
+
def self.openapi_nullable
|
|
125
|
+
Set.new([
|
|
126
|
+
])
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Initializes the object
|
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
131
|
+
def initialize(attributes = {})
|
|
132
|
+
if (!attributes.is_a?(Hash))
|
|
133
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PostBoost::BlogToSocialInput` initialize method"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
137
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
138
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
139
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PostBoost::BlogToSocialInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
140
|
+
end
|
|
141
|
+
h[k.to_sym] = v
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'url')
|
|
145
|
+
self.url = attributes[:'url']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'title')
|
|
149
|
+
self.title = attributes[:'title']
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if attributes.key?(:'excerpt')
|
|
153
|
+
self.excerpt = attributes[:'excerpt']
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if attributes.key?(:'image_url')
|
|
157
|
+
self.image_url = attributes[:'image_url']
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if attributes.key?(:'platforms')
|
|
161
|
+
if (value = attributes[:'platforms']).is_a?(Array)
|
|
162
|
+
self.platforms = value
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if attributes.key?(:'account_ids')
|
|
167
|
+
if (value = attributes[:'account_ids']).is_a?(Array)
|
|
168
|
+
self.account_ids = value
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'tone')
|
|
173
|
+
self.tone = attributes[:'tone']
|
|
174
|
+
else
|
|
175
|
+
self.tone = 'engaging'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if attributes.key?(:'content_length')
|
|
179
|
+
self.content_length = attributes[:'content_length']
|
|
180
|
+
else
|
|
181
|
+
self.content_length = 'medium'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if attributes.key?(:'hashtags')
|
|
185
|
+
self.hashtags = attributes[:'hashtags']
|
|
186
|
+
else
|
|
187
|
+
self.hashtags = 'few'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if attributes.key?(:'cta')
|
|
191
|
+
self.cta = attributes[:'cta']
|
|
192
|
+
else
|
|
193
|
+
self.cta = 'none'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
if attributes.key?(:'language')
|
|
197
|
+
self.language = attributes[:'language']
|
|
198
|
+
else
|
|
199
|
+
self.language = 'auto'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if attributes.key?(:'custom_instructions')
|
|
203
|
+
self.custom_instructions = attributes[:'custom_instructions']
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if attributes.key?(:'create_post')
|
|
207
|
+
self.create_post = attributes[:'create_post']
|
|
208
|
+
else
|
|
209
|
+
self.create_post = false
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
214
|
+
# @return Array for valid properties with the reasons
|
|
215
|
+
def list_invalid_properties
|
|
216
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
217
|
+
invalid_properties = Array.new
|
|
218
|
+
if !@url.nil? && @url.to_s.length > 2000
|
|
219
|
+
invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 2000.')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
if !@title.nil? && @title.to_s.length > 500
|
|
223
|
+
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 500.')
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
if !@excerpt.nil? && @excerpt.to_s.length > 5000
|
|
227
|
+
invalid_properties.push('invalid value for "excerpt", the character length must be smaller than or equal to 5000.')
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
if !@image_url.nil? && @image_url.to_s.length > 2000
|
|
231
|
+
invalid_properties.push('invalid value for "image_url", the character length must be smaller than or equal to 2000.')
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
if !@language.nil? && @language.to_s.length > 10
|
|
235
|
+
invalid_properties.push('invalid value for "language", the character length must be smaller than or equal to 10.')
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
if !@custom_instructions.nil? && @custom_instructions.to_s.length > 500
|
|
239
|
+
invalid_properties.push('invalid value for "custom_instructions", the character length must be smaller than or equal to 500.')
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
invalid_properties
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Check to see if the all the properties in the model are valid
|
|
246
|
+
# @return true if the model is valid
|
|
247
|
+
def valid?
|
|
248
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
249
|
+
return false if !@url.nil? && @url.to_s.length > 2000
|
|
250
|
+
return false if !@title.nil? && @title.to_s.length > 500
|
|
251
|
+
return false if !@excerpt.nil? && @excerpt.to_s.length > 5000
|
|
252
|
+
return false if !@image_url.nil? && @image_url.to_s.length > 2000
|
|
253
|
+
tone_validator = EnumAttributeValidator.new('String', ["neutral", "friendly", "formal", "edgy", "engaging", "casual", "professional", "humorous", "inspirational", "conversational"])
|
|
254
|
+
return false unless tone_validator.valid?(@tone)
|
|
255
|
+
content_length_validator = EnumAttributeValidator.new('String', ["short", "medium", "long"])
|
|
256
|
+
return false unless content_length_validator.valid?(@content_length)
|
|
257
|
+
hashtags_validator = EnumAttributeValidator.new('String', ["none", "few", "some", "many"])
|
|
258
|
+
return false unless hashtags_validator.valid?(@hashtags)
|
|
259
|
+
cta_validator = EnumAttributeValidator.new('String', ["none", "question", "link", "subscribe", "follow", "share", "learn_more", "signup", "buy", "download"])
|
|
260
|
+
return false unless cta_validator.valid?(@cta)
|
|
261
|
+
return false if !@language.nil? && @language.to_s.length > 10
|
|
262
|
+
return false if !@custom_instructions.nil? && @custom_instructions.to_s.length > 500
|
|
263
|
+
true
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Custom attribute writer method with validation
|
|
267
|
+
# @param [Object] url Value to be assigned
|
|
268
|
+
def url=(url)
|
|
269
|
+
if url.nil?
|
|
270
|
+
fail ArgumentError, 'url cannot be nil'
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if url.to_s.length > 2000
|
|
274
|
+
fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2000.'
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
@url = url
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Custom attribute writer method with validation
|
|
281
|
+
# @param [Object] title Value to be assigned
|
|
282
|
+
def title=(title)
|
|
283
|
+
if title.nil?
|
|
284
|
+
fail ArgumentError, 'title cannot be nil'
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
if title.to_s.length > 500
|
|
288
|
+
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 500.'
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
@title = title
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Custom attribute writer method with validation
|
|
295
|
+
# @param [Object] excerpt Value to be assigned
|
|
296
|
+
def excerpt=(excerpt)
|
|
297
|
+
if excerpt.nil?
|
|
298
|
+
fail ArgumentError, 'excerpt cannot be nil'
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
if excerpt.to_s.length > 5000
|
|
302
|
+
fail ArgumentError, 'invalid value for "excerpt", the character length must be smaller than or equal to 5000.'
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
@excerpt = excerpt
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Custom attribute writer method with validation
|
|
309
|
+
# @param [Object] image_url Value to be assigned
|
|
310
|
+
def image_url=(image_url)
|
|
311
|
+
if image_url.nil?
|
|
312
|
+
fail ArgumentError, 'image_url cannot be nil'
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
if image_url.to_s.length > 2000
|
|
316
|
+
fail ArgumentError, 'invalid value for "image_url", the character length must be smaller than or equal to 2000.'
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
@image_url = image_url
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
323
|
+
# @param [Object] tone Object to be assigned
|
|
324
|
+
def tone=(tone)
|
|
325
|
+
validator = EnumAttributeValidator.new('String', ["neutral", "friendly", "formal", "edgy", "engaging", "casual", "professional", "humorous", "inspirational", "conversational"])
|
|
326
|
+
unless validator.valid?(tone)
|
|
327
|
+
fail ArgumentError, "invalid value for \"tone\", must be one of #{validator.allowable_values}."
|
|
328
|
+
end
|
|
329
|
+
@tone = tone
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
333
|
+
# @param [Object] content_length Object to be assigned
|
|
334
|
+
def content_length=(content_length)
|
|
335
|
+
validator = EnumAttributeValidator.new('String', ["short", "medium", "long"])
|
|
336
|
+
unless validator.valid?(content_length)
|
|
337
|
+
fail ArgumentError, "invalid value for \"content_length\", must be one of #{validator.allowable_values}."
|
|
338
|
+
end
|
|
339
|
+
@content_length = content_length
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
343
|
+
# @param [Object] hashtags Object to be assigned
|
|
344
|
+
def hashtags=(hashtags)
|
|
345
|
+
validator = EnumAttributeValidator.new('String', ["none", "few", "some", "many"])
|
|
346
|
+
unless validator.valid?(hashtags)
|
|
347
|
+
fail ArgumentError, "invalid value for \"hashtags\", must be one of #{validator.allowable_values}."
|
|
348
|
+
end
|
|
349
|
+
@hashtags = hashtags
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
353
|
+
# @param [Object] cta Object to be assigned
|
|
354
|
+
def cta=(cta)
|
|
355
|
+
validator = EnumAttributeValidator.new('String', ["none", "question", "link", "subscribe", "follow", "share", "learn_more", "signup", "buy", "download"])
|
|
356
|
+
unless validator.valid?(cta)
|
|
357
|
+
fail ArgumentError, "invalid value for \"cta\", must be one of #{validator.allowable_values}."
|
|
358
|
+
end
|
|
359
|
+
@cta = cta
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Custom attribute writer method with validation
|
|
363
|
+
# @param [Object] language Value to be assigned
|
|
364
|
+
def language=(language)
|
|
365
|
+
if language.nil?
|
|
366
|
+
fail ArgumentError, 'language cannot be nil'
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
if language.to_s.length > 10
|
|
370
|
+
fail ArgumentError, 'invalid value for "language", the character length must be smaller than or equal to 10.'
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
@language = language
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# Custom attribute writer method with validation
|
|
377
|
+
# @param [Object] custom_instructions Value to be assigned
|
|
378
|
+
def custom_instructions=(custom_instructions)
|
|
379
|
+
if custom_instructions.nil?
|
|
380
|
+
fail ArgumentError, 'custom_instructions cannot be nil'
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
if custom_instructions.to_s.length > 500
|
|
384
|
+
fail ArgumentError, 'invalid value for "custom_instructions", the character length must be smaller than or equal to 500.'
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
@custom_instructions = custom_instructions
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# Checks equality by comparing each attribute.
|
|
391
|
+
# @param [Object] Object to be compared
|
|
392
|
+
def ==(o)
|
|
393
|
+
return true if self.equal?(o)
|
|
394
|
+
self.class == o.class &&
|
|
395
|
+
url == o.url &&
|
|
396
|
+
title == o.title &&
|
|
397
|
+
excerpt == o.excerpt &&
|
|
398
|
+
image_url == o.image_url &&
|
|
399
|
+
platforms == o.platforms &&
|
|
400
|
+
account_ids == o.account_ids &&
|
|
401
|
+
tone == o.tone &&
|
|
402
|
+
content_length == o.content_length &&
|
|
403
|
+
hashtags == o.hashtags &&
|
|
404
|
+
cta == o.cta &&
|
|
405
|
+
language == o.language &&
|
|
406
|
+
custom_instructions == o.custom_instructions &&
|
|
407
|
+
create_post == o.create_post
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
# @see the `==` method
|
|
411
|
+
# @param [Object] Object to be compared
|
|
412
|
+
def eql?(o)
|
|
413
|
+
self == o
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# Calculates hash code according to all attributes.
|
|
417
|
+
# @return [Integer] Hash code
|
|
418
|
+
def hash
|
|
419
|
+
[url, title, excerpt, image_url, platforms, account_ids, tone, content_length, hashtags, cta, language, custom_instructions, create_post].hash
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
# Builds the object from hash
|
|
423
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
424
|
+
# @return [Object] Returns the model itself
|
|
425
|
+
def self.build_from_hash(attributes)
|
|
426
|
+
return nil unless attributes.is_a?(Hash)
|
|
427
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
428
|
+
transformed_hash = {}
|
|
429
|
+
openapi_types.each_pair do |key, type|
|
|
430
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
431
|
+
transformed_hash["#{key}"] = nil
|
|
432
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
433
|
+
# check to ensure the input is an array given that the attribute
|
|
434
|
+
# is documented as an array but the input is not
|
|
435
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
436
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
437
|
+
end
|
|
438
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
439
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
new(transformed_hash)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
# Deserializes the data based on type
|
|
446
|
+
# @param string type Data type
|
|
447
|
+
# @param string value Value to be deserialized
|
|
448
|
+
# @return [Object] Deserialized data
|
|
449
|
+
def self._deserialize(type, value)
|
|
450
|
+
case type.to_sym
|
|
451
|
+
when :Time
|
|
452
|
+
Time.parse(value)
|
|
453
|
+
when :Date
|
|
454
|
+
Date.parse(value)
|
|
455
|
+
when :String
|
|
456
|
+
value.to_s
|
|
457
|
+
when :Integer
|
|
458
|
+
value.to_i
|
|
459
|
+
when :Float
|
|
460
|
+
value.to_f
|
|
461
|
+
when :Boolean
|
|
462
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
463
|
+
true
|
|
464
|
+
else
|
|
465
|
+
false
|
|
466
|
+
end
|
|
467
|
+
when :Object
|
|
468
|
+
# generic object (usually a Hash), return directly
|
|
469
|
+
value
|
|
470
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
471
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
472
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
473
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
474
|
+
k_type = Regexp.last_match[:k_type]
|
|
475
|
+
v_type = Regexp.last_match[:v_type]
|
|
476
|
+
{}.tap do |hash|
|
|
477
|
+
value.each do |k, v|
|
|
478
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
else # model
|
|
482
|
+
# models (e.g. Pet) or oneOf
|
|
483
|
+
klass = PostBoost.const_get(type)
|
|
484
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
# Returns the string representation of the object
|
|
489
|
+
# @return [String] String presentation of the object
|
|
490
|
+
def to_s
|
|
491
|
+
to_hash.to_s
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
495
|
+
# @return [Hash] Returns the object in the form of hash
|
|
496
|
+
def to_body
|
|
497
|
+
to_hash
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
# Returns the object in the form of hash
|
|
501
|
+
# @return [Hash] Returns the object in the form of hash
|
|
502
|
+
def to_hash
|
|
503
|
+
hash = {}
|
|
504
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
505
|
+
value = self.send(attr)
|
|
506
|
+
if value.nil?
|
|
507
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
508
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
hash[param] = _to_hash(value)
|
|
512
|
+
end
|
|
513
|
+
hash
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
# Outputs non-array value in the form of hash
|
|
517
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
518
|
+
# @param [Object] value Any valid value
|
|
519
|
+
# @return [Hash] Returns the value in the form of hash
|
|
520
|
+
def _to_hash(value)
|
|
521
|
+
if value.is_a?(Array)
|
|
522
|
+
value.compact.map { |v| _to_hash(v) }
|
|
523
|
+
elsif value.is_a?(Hash)
|
|
524
|
+
{}.tap do |hash|
|
|
525
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
526
|
+
end
|
|
527
|
+
elsif value.respond_to? :to_hash
|
|
528
|
+
value.to_hash
|
|
529
|
+
else
|
|
530
|
+
value
|
|
531
|
+
end
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
end
|