sunshine-conversations-client 9.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG_RB.md +12 -0
- data/Gemfile +9 -0
- data/LICENSE +176 -0
- data/README.md +456 -0
- data/Rakefile +10 -0
- data/docs/AcceptControlBody.md +17 -0
- data/docs/Action.md +41 -0
- data/docs/ActionSubset.md +39 -0
- data/docs/ActivitiesApi.md +71 -0
- data/docs/Activity.md +21 -0
- data/docs/ActivityAllOf.md +19 -0
- data/docs/ActivityPost.md +19 -0
- data/docs/ActivityPostAllOf.md +17 -0
- data/docs/ActivityTypes.md +17 -0
- data/docs/Android.md +23 -0
- data/docs/AndroidAllOf.md +23 -0
- data/docs/AndroidUpdate.md +23 -0
- data/docs/AndroidUpdateAllOf.md +21 -0
- data/docs/ApiKey.md +21 -0
- data/docs/App.md +23 -0
- data/docs/AppCreateBody.md +21 -0
- data/docs/AppKey.md +21 -0
- data/docs/AppKeyCreateBody.md +17 -0
- data/docs/AppKeyListResponse.md +17 -0
- data/docs/AppKeyResponse.md +17 -0
- data/docs/AppKeysApi.md +250 -0
- data/docs/AppListFilter.md +17 -0
- data/docs/AppListResponse.md +21 -0
- data/docs/AppResponse.md +17 -0
- data/docs/AppSettings.md +31 -0
- data/docs/AppSubSchema.md +17 -0
- data/docs/AppUpdateBody.md +21 -0
- data/docs/Apple.md +23 -0
- data/docs/AppleAllOf.md +23 -0
- data/docs/AppleUpdate.md +16 -0
- data/docs/AppsApi.md +309 -0
- data/docs/AttachmentDeleteBody.md +17 -0
- data/docs/AttachmentMediaTokenBody.md +17 -0
- data/docs/AttachmentMediaTokenResponse.md +17 -0
- data/docs/AttachmentResponse.md +17 -0
- data/docs/AttachmentSchema.md +19 -0
- data/docs/AttachmentUploadBody.md +17 -0
- data/docs/AttachmentsApi.md +254 -0
- data/docs/Author.md +25 -0
- data/docs/AuthorWebhook.md +21 -0
- data/docs/Buy.md +25 -0
- data/docs/CarouselMessage.md +23 -0
- data/docs/CarouselMessageDisplaySettings.md +17 -0
- data/docs/Client.md +37 -0
- data/docs/ClientAssociation.md +19 -0
- data/docs/ClientCreate.md +21 -0
- data/docs/ClientListResponse.md +21 -0
- data/docs/ClientResponse.md +17 -0
- data/docs/ClientType.md +16 -0
- data/docs/ClientsApi.md +199 -0
- data/docs/Confirmation.md +19 -0
- data/docs/Content.md +41 -0
- data/docs/Conversation.md +37 -0
- data/docs/ConversationAllOf.md +29 -0
- data/docs/ConversationCreateBody.md +27 -0
- data/docs/ConversationCreateEvent.md +23 -0
- data/docs/ConversationCreateEventAllOf.md +17 -0
- data/docs/ConversationCreateEventAllOfPayload.md +25 -0
- data/docs/ConversationListFilter.md +19 -0
- data/docs/ConversationListResponse.md +21 -0
- data/docs/ConversationMessageDeliveryChannelEvent.md +23 -0
- data/docs/ConversationMessageDeliveryChannelEventAllOf.md +17 -0
- data/docs/ConversationMessageDeliveryFailureEvent.md +23 -0
- data/docs/ConversationMessageDeliveryFailureEventAllOf.md +17 -0
- data/docs/ConversationMessageDeliveryPayload.md +27 -0
- data/docs/ConversationMessageDeliveryPayloadDestination.md +19 -0
- data/docs/ConversationMessageDeliveryPayloadExternalMessages.md +17 -0
- data/docs/ConversationMessageDeliveryPayloadMessage.md +17 -0
- data/docs/ConversationMessageDeliveryUserEvent.md +23 -0
- data/docs/ConversationMessageEvent.md +23 -0
- data/docs/ConversationMessageEventAllOf.md +17 -0
- data/docs/ConversationMessageEventAllOfPayload.md +21 -0
- data/docs/ConversationPostbackEvent.md +23 -0
- data/docs/ConversationPostbackEventAllOf.md +17 -0
- data/docs/ConversationPostbackEventAllOfPayload.md +23 -0
- data/docs/ConversationReadEvent.md +23 -0
- data/docs/ConversationReadEventAllOf.md +17 -0
- data/docs/ConversationReadEventAllOfPayload.md +19 -0
- data/docs/ConversationResponse.md +17 -0
- data/docs/ConversationTruncated.md +23 -0
- data/docs/ConversationType.md +16 -0
- data/docs/ConversationTypingEvent.md +23 -0
- data/docs/ConversationTypingEventAllOf.md +17 -0
- data/docs/ConversationTypingEventAllOfPayload.md +19 -0
- data/docs/ConversationUpdateBody.md +23 -0
- data/docs/ConversationsApi.md +319 -0
- data/docs/Custom.md +19 -0
- data/docs/CustomAllOf.md +19 -0
- data/docs/CustomIntegrationApiKeysApi.md +258 -0
- data/docs/CustomUpdate.md +16 -0
- data/docs/Destination.md +19 -0
- data/docs/Device.md +35 -0
- data/docs/EventSubSchema.md +21 -0
- data/docs/ExtraChannelOptions.md +17 -0
- data/docs/ExtraChannelOptionsMessenger.md +19 -0
- data/docs/Field.md +35 -0
- data/docs/FileMessage.md +25 -0
- data/docs/FormMessage.md +21 -0
- data/docs/FormResponseMessage.md +21 -0
- data/docs/ImageMessage.md +23 -0
- data/docs/InlineObject.md +23 -0
- data/docs/Integration.md +23 -0
- data/docs/IntegrationApiKey.md +17 -0
- data/docs/IntegrationApiKeyListResponse.md +17 -0
- data/docs/IntegrationApiKeyResponse.md +17 -0
- data/docs/IntegrationId.md +17 -0
- data/docs/IntegrationListFilter.md +17 -0
- data/docs/IntegrationListResponse.md +21 -0
- data/docs/IntegrationResponse.md +17 -0
- data/docs/IntegrationType.md +17 -0
- data/docs/IntegrationUpdate.md +71 -0
- data/docs/IntegrationUpdateBase.md +17 -0
- data/docs/IntegrationsApi.md +319 -0
- data/docs/Ios.md +27 -0
- data/docs/IosAllOf.md +27 -0
- data/docs/IosUpdate.md +27 -0
- data/docs/IosUpdateAllOf.md +25 -0
- data/docs/Item.md +29 -0
- data/docs/Line.md +31 -0
- data/docs/LineAllOf.md +31 -0
- data/docs/LineUpdate.md +16 -0
- data/docs/Link.md +27 -0
- data/docs/Links.md +19 -0
- data/docs/ListMessage.md +21 -0
- data/docs/LocationMessage.md +23 -0
- data/docs/LocationMessageCoordinates.md +19 -0
- data/docs/LocationMessageLocation.md +19 -0
- data/docs/LocationRequest.md +21 -0
- data/docs/Mailgun.md +27 -0
- data/docs/MailgunAllOf.md +27 -0
- data/docs/MailgunUpdate.md +21 -0
- data/docs/MailgunUpdateAllOf.md +19 -0
- data/docs/MatchCriteria.md +27 -0
- data/docs/MatchCriteriaBase.md +21 -0
- data/docs/MatchCriteriaMailgun.md +25 -0
- data/docs/MatchCriteriaMailgunAllOf.md +21 -0
- data/docs/MatchCriteriaMessagebird.md +23 -0
- data/docs/MatchCriteriaMessagebirdAllOf.md +19 -0
- data/docs/MatchCriteriaTwilio.md +23 -0
- data/docs/MatchCriteriaTwilioAllOf.md +19 -0
- data/docs/MatchCriteriaWhatsapp.md +23 -0
- data/docs/MatchCriteriaWhatsappAllOf.md +19 -0
- data/docs/Message.md +31 -0
- data/docs/MessageBirdUpdate.md +16 -0
- data/docs/MessageListResponse.md +21 -0
- data/docs/MessageOverride.md +23 -0
- data/docs/MessageOverrideApple.md +17 -0
- data/docs/MessageOverrideLine.md +17 -0
- data/docs/MessageOverrideMessenger.md +17 -0
- data/docs/MessageOverridePayload.md +17 -0
- data/docs/MessageOverrideWhatsapp.md +17 -0
- data/docs/MessagePost.md +27 -0
- data/docs/MessagePostResponse.md +17 -0
- data/docs/MessageWebhook.md +31 -0
- data/docs/Messagebird.md +25 -0
- data/docs/MessagebirdAllOf.md +25 -0
- data/docs/MessagesApi.md +260 -0
- data/docs/Messenger.md +23 -0
- data/docs/MessengerAllOf.md +23 -0
- data/docs/MessengerUpdate.md +19 -0
- data/docs/MessengerUpdateAllOf.md +17 -0
- data/docs/Meta.md +21 -0
- data/docs/OAuthEndpointsApi.md +168 -0
- data/docs/OfferControlBody.md +19 -0
- data/docs/Page.md +21 -0
- data/docs/Participant.md +27 -0
- data/docs/ParticipantJoinBody.md +16 -0
- data/docs/ParticipantLeaveBody.md +21 -0
- data/docs/ParticipantLeaveBodyParticipantId.md +17 -0
- data/docs/ParticipantLeaveBodyUserExternalId.md +17 -0
- data/docs/ParticipantLeaveBodyUserId.md +17 -0
- data/docs/ParticipantListResponse.md +21 -0
- data/docs/ParticipantResponse.md +17 -0
- data/docs/ParticipantSubSchema.md +21 -0
- data/docs/ParticipantWithUserExternalId.md +19 -0
- data/docs/ParticipantWithUserId.md +19 -0
- data/docs/ParticipantsApi.md +199 -0
- data/docs/PassControlBody.md +19 -0
- data/docs/Postback.md +23 -0
- data/docs/PostbackWebhook.md +19 -0
- data/docs/PrechatCapture.md +23 -0
- data/docs/Profile.md +23 -0
- data/docs/QuotedMessage.md +21 -0
- data/docs/QuotedMessageExternalMessageId.md +19 -0
- data/docs/QuotedMessageMessage.md +19 -0
- data/docs/Referral.md +19 -0
- data/docs/ReferralDetails.md +21 -0
- data/docs/Reply.md +25 -0
- data/docs/Source.md +27 -0
- data/docs/SourceWebhook.md +27 -0
- data/docs/Status.md +16 -0
- data/docs/Switchboard.md +21 -0
- data/docs/SwitchboardAcceptControl.md +23 -0
- data/docs/SwitchboardAcceptControlAllOf.md +17 -0
- data/docs/SwitchboardAcceptControlAllOfPayload.md +19 -0
- data/docs/SwitchboardAcceptControlFailure.md +23 -0
- data/docs/SwitchboardAcceptControlFailureAllOf.md +17 -0
- data/docs/SwitchboardAcceptControlFailureAllOfPayload.md +21 -0
- data/docs/SwitchboardActionsApi.md +197 -0
- data/docs/SwitchboardIntegration.md +29 -0
- data/docs/SwitchboardIntegrationCreateBody.md +27 -0
- data/docs/SwitchboardIntegrationListResponse.md +17 -0
- data/docs/SwitchboardIntegrationResponse.md +17 -0
- data/docs/SwitchboardIntegrationUpdateBody.md +27 -0
- data/docs/SwitchboardIntegrationWebhook.md +23 -0
- data/docs/SwitchboardIntegrationsApi.md +260 -0
- data/docs/SwitchboardListResponse.md +17 -0
- data/docs/SwitchboardOfferControl.md +23 -0
- data/docs/SwitchboardOfferControlAllOf.md +17 -0
- data/docs/SwitchboardOfferControlAllOfPayload.md +19 -0
- data/docs/SwitchboardOfferControlFailure.md +23 -0
- data/docs/SwitchboardPassControl.md +23 -0
- data/docs/SwitchboardPassControlAllOf.md +17 -0
- data/docs/SwitchboardPassControlAllOfPayload.md +19 -0
- data/docs/SwitchboardPassControlFailure.md +23 -0
- data/docs/SwitchboardResponse.md +17 -0
- data/docs/SwitchboardUpdateBody.md +19 -0
- data/docs/SwitchboardsApi.md +250 -0
- data/docs/Target.md +17 -0
- data/docs/Telegram.md +23 -0
- data/docs/TelegramAllOf.md +23 -0
- data/docs/TelegramUpdate.md +16 -0
- data/docs/TextMessage.md +21 -0
- data/docs/Twilio.md +23 -0
- data/docs/TwilioAllOf.md +23 -0
- data/docs/TwilioUpdate.md +16 -0
- data/docs/Twitter.md +29 -0
- data/docs/TwitterAllOf.md +29 -0
- data/docs/TwitterUpdate.md +16 -0
- data/docs/User.md +25 -0
- data/docs/UserAllOf.md +21 -0
- data/docs/UserCreateBody.md +23 -0
- data/docs/UserMergeEvent.md +23 -0
- data/docs/UserMergeEventAllOf.md +17 -0
- data/docs/UserMergeEventAllOfPayload.md +21 -0
- data/docs/UserMergeEventAllOfPayloadMergedConversations.md +19 -0
- data/docs/UserMergeEventAllOfPayloadMergedUsers.md +19 -0
- data/docs/UserResponse.md +17 -0
- data/docs/UserTruncated.md +19 -0
- data/docs/UserUpdateBody.md +21 -0
- data/docs/UsersApi.md +315 -0
- data/docs/Viber.md +23 -0
- data/docs/ViberAllOf.md +23 -0
- data/docs/ViberUpdate.md +16 -0
- data/docs/Web.md +47 -0
- data/docs/WebAllOf.md +47 -0
- data/docs/WebUpdate.md +47 -0
- data/docs/WebUpdateAllOf.md +45 -0
- data/docs/Webhook.md +29 -0
- data/docs/WebhookBody.md +23 -0
- data/docs/WebhookCreateBody.md +16 -0
- data/docs/WebhookListResponse.md +17 -0
- data/docs/WebhookResponse.md +17 -0
- data/docs/WebhookSubSchema.md +19 -0
- data/docs/WebhooksApi.md +323 -0
- data/docs/Webview.md +33 -0
- data/docs/WhatsAppUpdate.md +23 -0
- data/docs/WhatsAppUpdateAllOf.md +21 -0
- data/docs/Whatsapp.md +25 -0
- data/docs/WhatsappAllOf.md +25 -0
- data/lib/sunshine-conversations-client.rb +306 -0
- data/lib/sunshine-conversations-client/api/activities_api.rb +95 -0
- data/lib/sunshine-conversations-client/api/app_keys_api.rb +287 -0
- data/lib/sunshine-conversations-client/api/apps_api.rb +339 -0
- data/lib/sunshine-conversations-client/api/attachments_api.rb +305 -0
- data/lib/sunshine-conversations-client/api/clients_api.rb +240 -0
- data/lib/sunshine-conversations-client/api/conversations_api.rb +373 -0
- data/lib/sunshine-conversations-client/api/custom_integration_api_keys_api.rb +311 -0
- data/lib/sunshine-conversations-client/api/integrations_api.rb +369 -0
- data/lib/sunshine-conversations-client/api/messages_api.rb +308 -0
- data/lib/sunshine-conversations-client/api/o_auth_endpoints_api.rb +213 -0
- data/lib/sunshine-conversations-client/api/participants_api.rb +242 -0
- data/lib/sunshine-conversations-client/api/switchboard_actions_api.rb +247 -0
- data/lib/sunshine-conversations-client/api/switchboard_integrations_api.rb +319 -0
- data/lib/sunshine-conversations-client/api/switchboards_api.rb +287 -0
- data/lib/sunshine-conversations-client/api/users_api.rb +369 -0
- data/lib/sunshine-conversations-client/api/webhooks_api.rb +393 -0
- data/lib/sunshine-conversations-client/api_client.rb +348 -0
- data/lib/sunshine-conversations-client/api_error.rb +54 -0
- data/lib/sunshine-conversations-client/configuration.rb +284 -0
- data/lib/sunshine-conversations-client/models/accept_control_body.rb +204 -0
- data/lib/sunshine-conversations-client/models/action.rb +421 -0
- data/lib/sunshine-conversations-client/models/action_subset.rb +409 -0
- data/lib/sunshine-conversations-client/models/activity.rb +265 -0
- data/lib/sunshine-conversations-client/models/activity_all_of.rb +213 -0
- data/lib/sunshine-conversations-client/models/activity_post.rb +266 -0
- data/lib/sunshine-conversations-client/models/activity_post_all_of.rb +204 -0
- data/lib/sunshine-conversations-client/models/activity_types.rb +238 -0
- data/lib/sunshine-conversations-client/models/android.rb +280 -0
- data/lib/sunshine-conversations-client/models/android_all_of.rb +268 -0
- data/lib/sunshine-conversations-client/models/android_update.rb +299 -0
- data/lib/sunshine-conversations-client/models/android_update_all_of.rb +256 -0
- data/lib/sunshine-conversations-client/models/api_key.rb +225 -0
- data/lib/sunshine-conversations-client/models/app.rb +234 -0
- data/lib/sunshine-conversations-client/models/app_create_body.rb +229 -0
- data/lib/sunshine-conversations-client/models/app_key.rb +224 -0
- data/lib/sunshine-conversations-client/models/app_key_create_body.rb +209 -0
- data/lib/sunshine-conversations-client/models/app_key_list_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/app_key_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/app_list_filter.rb +204 -0
- data/lib/sunshine-conversations-client/models/app_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/app_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/app_settings.rb +290 -0
- data/lib/sunshine-conversations-client/models/app_sub_schema.rb +205 -0
- data/lib/sunshine-conversations-client/models/app_update_body.rb +224 -0
- data/lib/sunshine-conversations-client/models/apple.rb +263 -0
- data/lib/sunshine-conversations-client/models/apple_all_of.rb +252 -0
- data/lib/sunshine-conversations-client/models/apple_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/attachment_delete_body.rb +209 -0
- data/lib/sunshine-conversations-client/models/attachment_media_token_body.rb +208 -0
- data/lib/sunshine-conversations-client/models/attachment_media_token_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/attachment_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/attachment_schema.rb +214 -0
- data/lib/sunshine-conversations-client/models/attachment_upload_body.rb +208 -0
- data/lib/sunshine-conversations-client/models/author.rb +284 -0
- data/lib/sunshine-conversations-client/models/author_webhook.rb +264 -0
- data/lib/sunshine-conversations-client/models/buy.rb +262 -0
- data/lib/sunshine-conversations-client/models/carousel_message.rb +245 -0
- data/lib/sunshine-conversations-client/models/carousel_message_display_settings.rb +239 -0
- data/lib/sunshine-conversations-client/models/client.rb +345 -0
- data/lib/sunshine-conversations-client/models/client_association.rb +213 -0
- data/lib/sunshine-conversations-client/models/client_create.rb +236 -0
- data/lib/sunshine-conversations-client/models/client_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/client_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/client_type.rb +42 -0
- data/lib/sunshine-conversations-client/models/confirmation.rb +254 -0
- data/lib/sunshine-conversations-client/models/content.rb +380 -0
- data/lib/sunshine-conversations-client/models/conversation.rb +366 -0
- data/lib/sunshine-conversations-client/models/conversation_all_of.rb +317 -0
- data/lib/sunshine-conversations-client/models/conversation_create_body.rb +308 -0
- data/lib/sunshine-conversations-client/models/conversation_create_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_create_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_create_event_all_of_payload.rb +281 -0
- data/lib/sunshine-conversations-client/models/conversation_list_filter.rb +214 -0
- data/lib/sunshine-conversations-client/models/conversation_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_channel_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_channel_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_failure_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_failure_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_payload.rb +253 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_payload_destination.rb +215 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_payload_external_messages.rb +204 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_payload_message.rb +205 -0
- data/lib/sunshine-conversations-client/models/conversation_message_delivery_user_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_message_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_message_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_message_event_all_of_payload.rb +224 -0
- data/lib/sunshine-conversations-client/models/conversation_postback_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_postback_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_postback_event_all_of_payload.rb +235 -0
- data/lib/sunshine-conversations-client/models/conversation_read_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_read_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_read_event_all_of_payload.rb +215 -0
- data/lib/sunshine-conversations-client/models/conversation_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/conversation_truncated.rb +235 -0
- data/lib/sunshine-conversations-client/models/conversation_type.rb +33 -0
- data/lib/sunshine-conversations-client/models/conversation_typing_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/conversation_typing_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/conversation_typing_event_all_of_payload.rb +215 -0
- data/lib/sunshine-conversations-client/models/conversation_update_body.rb +285 -0
- data/lib/sunshine-conversations-client/models/custom.rb +232 -0
- data/lib/sunshine-conversations-client/models/custom_all_of.rb +220 -0
- data/lib/sunshine-conversations-client/models/custom_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/destination.rb +239 -0
- data/lib/sunshine-conversations-client/models/device.rb +343 -0
- data/lib/sunshine-conversations-client/models/event_sub_schema.rb +224 -0
- data/lib/sunshine-conversations-client/models/extra_channel_options.rb +204 -0
- data/lib/sunshine-conversations-client/models/extra_channel_options_messenger.rb +251 -0
- data/lib/sunshine-conversations-client/models/field.rb +522 -0
- data/lib/sunshine-conversations-client/models/file_message.rb +256 -0
- data/lib/sunshine-conversations-client/models/form_message.rb +236 -0
- data/lib/sunshine-conversations-client/models/form_response_message.rb +236 -0
- data/lib/sunshine-conversations-client/models/image_message.rb +245 -0
- data/lib/sunshine-conversations-client/models/inline_object.rb +254 -0
- data/lib/sunshine-conversations-client/models/integration.rb +260 -0
- data/lib/sunshine-conversations-client/models/integration_api_key.rb +209 -0
- data/lib/sunshine-conversations-client/models/integration_api_key_list_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/integration_api_key_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/integration_id.rb +204 -0
- data/lib/sunshine-conversations-client/models/integration_list_filter.rb +204 -0
- data/lib/sunshine-conversations-client/models/integration_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/integration_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/integration_type.rb +204 -0
- data/lib/sunshine-conversations-client/models/integration_update.rb +619 -0
- data/lib/sunshine-conversations-client/models/integration_update_base.rb +229 -0
- data/lib/sunshine-conversations-client/models/ios.rb +284 -0
- data/lib/sunshine-conversations-client/models/ios_all_of.rb +272 -0
- data/lib/sunshine-conversations-client/models/ios_update.rb +303 -0
- data/lib/sunshine-conversations-client/models/ios_update_all_of.rb +260 -0
- data/lib/sunshine-conversations-client/models/item.rb +381 -0
- data/lib/sunshine-conversations-client/models/line.rb +313 -0
- data/lib/sunshine-conversations-client/models/line_all_of.rb +302 -0
- data/lib/sunshine-conversations-client/models/line_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/link.rb +272 -0
- data/lib/sunshine-conversations-client/models/links.rb +215 -0
- data/lib/sunshine-conversations-client/models/list_message.rb +235 -0
- data/lib/sunshine-conversations-client/models/location_message.rb +245 -0
- data/lib/sunshine-conversations-client/models/location_message_coordinates.rb +225 -0
- data/lib/sunshine-conversations-client/models/location_message_location.rb +215 -0
- data/lib/sunshine-conversations-client/models/location_request.rb +238 -0
- data/lib/sunshine-conversations-client/models/mailgun.rb +356 -0
- data/lib/sunshine-conversations-client/models/mailgun_all_of.rb +345 -0
- data/lib/sunshine-conversations-client/models/mailgun_update.rb +273 -0
- data/lib/sunshine-conversations-client/models/mailgun_update_all_of.rb +230 -0
- data/lib/sunshine-conversations-client/models/match_criteria.rb +312 -0
- data/lib/sunshine-conversations-client/models/match_criteria_base.rb +237 -0
- data/lib/sunshine-conversations-client/models/match_criteria_mailgun.rb +273 -0
- data/lib/sunshine-conversations-client/models/match_criteria_mailgun_all_of.rb +234 -0
- data/lib/sunshine-conversations-client/models/match_criteria_messagebird.rb +261 -0
- data/lib/sunshine-conversations-client/models/match_criteria_messagebird_all_of.rb +222 -0
- data/lib/sunshine-conversations-client/models/match_criteria_twilio.rb +261 -0
- data/lib/sunshine-conversations-client/models/match_criteria_twilio_all_of.rb +222 -0
- data/lib/sunshine-conversations-client/models/match_criteria_whatsapp.rb +261 -0
- data/lib/sunshine-conversations-client/models/match_criteria_whatsapp_all_of.rb +222 -0
- data/lib/sunshine-conversations-client/models/message.rb +274 -0
- data/lib/sunshine-conversations-client/models/message_bird_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/message_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/message_override.rb +253 -0
- data/lib/sunshine-conversations-client/models/message_override_apple.rb +203 -0
- data/lib/sunshine-conversations-client/models/message_override_line.rb +203 -0
- data/lib/sunshine-conversations-client/models/message_override_messenger.rb +203 -0
- data/lib/sunshine-conversations-client/models/message_override_payload.rb +204 -0
- data/lib/sunshine-conversations-client/models/message_override_whatsapp.rb +203 -0
- data/lib/sunshine-conversations-client/models/message_post.rb +263 -0
- data/lib/sunshine-conversations-client/models/message_post_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/message_webhook.rb +274 -0
- data/lib/sunshine-conversations-client/models/messagebird.rb +330 -0
- data/lib/sunshine-conversations-client/models/messagebird_all_of.rb +319 -0
- data/lib/sunshine-conversations-client/models/messenger.rb +263 -0
- data/lib/sunshine-conversations-client/models/messenger_all_of.rb +252 -0
- data/lib/sunshine-conversations-client/models/messenger_update.rb +247 -0
- data/lib/sunshine-conversations-client/models/messenger_update_all_of.rb +204 -0
- data/lib/sunshine-conversations-client/models/meta.rb +225 -0
- data/lib/sunshine-conversations-client/models/offer_control_body.rb +219 -0
- data/lib/sunshine-conversations-client/models/page.rb +250 -0
- data/lib/sunshine-conversations-client/models/participant.rb +255 -0
- data/lib/sunshine-conversations-client/models/participant_join_body.rb +205 -0
- data/lib/sunshine-conversations-client/models/participant_leave_body.rb +249 -0
- data/lib/sunshine-conversations-client/models/participant_leave_body_participant_id.rb +204 -0
- data/lib/sunshine-conversations-client/models/participant_leave_body_user_external_id.rb +204 -0
- data/lib/sunshine-conversations-client/models/participant_leave_body_user_id.rb +204 -0
- data/lib/sunshine-conversations-client/models/participant_list_response.rb +221 -0
- data/lib/sunshine-conversations-client/models/participant_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/participant_sub_schema.rb +244 -0
- data/lib/sunshine-conversations-client/models/participant_with_user_external_id.rb +214 -0
- data/lib/sunshine-conversations-client/models/participant_with_user_id.rb +214 -0
- data/lib/sunshine-conversations-client/models/pass_control_body.rb +219 -0
- data/lib/sunshine-conversations-client/models/postback.rb +252 -0
- data/lib/sunshine-conversations-client/models/postback_webhook.rb +215 -0
- data/lib/sunshine-conversations-client/models/prechat_capture.rb +239 -0
- data/lib/sunshine-conversations-client/models/profile.rb +335 -0
- data/lib/sunshine-conversations-client/models/quoted_message.rb +249 -0
- data/lib/sunshine-conversations-client/models/quoted_message_external_message_id.rb +216 -0
- data/lib/sunshine-conversations-client/models/quoted_message_message.rb +215 -0
- data/lib/sunshine-conversations-client/models/referral.rb +214 -0
- data/lib/sunshine-conversations-client/models/referral_details.rb +226 -0
- data/lib/sunshine-conversations-client/models/reply.rb +260 -0
- data/lib/sunshine-conversations-client/models/source.rb +265 -0
- data/lib/sunshine-conversations-client/models/source_webhook.rb +258 -0
- data/lib/sunshine-conversations-client/models/status.rb +34 -0
- data/lib/sunshine-conversations-client/models/switchboard.rb +234 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control_all_of_payload.rb +216 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control_failure.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control_failure_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_accept_control_failure_all_of_payload.rb +226 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration.rb +333 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration_create_body.rb +302 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration_list_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration_update_body.rb +294 -0
- data/lib/sunshine-conversations-client/models/switchboard_integration_webhook.rb +249 -0
- data/lib/sunshine-conversations-client/models/switchboard_list_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_offer_control.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_offer_control_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_offer_control_all_of_payload.rb +216 -0
- data/lib/sunshine-conversations-client/models/switchboard_offer_control_failure.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_pass_control.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_pass_control_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/switchboard_pass_control_all_of_payload.rb +216 -0
- data/lib/sunshine-conversations-client/models/switchboard_pass_control_failure.rb +241 -0
- data/lib/sunshine-conversations-client/models/switchboard_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/switchboard_update_body.rb +214 -0
- data/lib/sunshine-conversations-client/models/target.rb +210 -0
- data/lib/sunshine-conversations-client/models/telegram.rb +272 -0
- data/lib/sunshine-conversations-client/models/telegram_all_of.rb +261 -0
- data/lib/sunshine-conversations-client/models/telegram_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/text_message.rb +245 -0
- data/lib/sunshine-conversations-client/models/twilio.rb +301 -0
- data/lib/sunshine-conversations-client/models/twilio_all_of.rb +290 -0
- data/lib/sunshine-conversations-client/models/twilio_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/twitter.rb +419 -0
- data/lib/sunshine-conversations-client/models/twitter_all_of.rb +408 -0
- data/lib/sunshine-conversations-client/models/twitter_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/user.rb +250 -0
- data/lib/sunshine-conversations-client/models/user_all_of.rb +221 -0
- data/lib/sunshine-conversations-client/models/user_create_body.rb +267 -0
- data/lib/sunshine-conversations-client/models/user_merge_event.rb +241 -0
- data/lib/sunshine-conversations-client/models/user_merge_event_all_of.rb +203 -0
- data/lib/sunshine-conversations-client/models/user_merge_event_all_of_payload.rb +225 -0
- data/lib/sunshine-conversations-client/models/user_merge_event_all_of_payload_merged_conversations.rb +215 -0
- data/lib/sunshine-conversations-client/models/user_merge_event_all_of_payload_merged_users.rb +215 -0
- data/lib/sunshine-conversations-client/models/user_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/user_truncated.rb +215 -0
- data/lib/sunshine-conversations-client/models/user_update_body.rb +223 -0
- data/lib/sunshine-conversations-client/models/viber.rb +272 -0
- data/lib/sunshine-conversations-client/models/viber_all_of.rb +261 -0
- data/lib/sunshine-conversations-client/models/viber_update.rb +205 -0
- data/lib/sunshine-conversations-client/models/web.rb +383 -0
- data/lib/sunshine-conversations-client/models/web_all_of.rb +372 -0
- data/lib/sunshine-conversations-client/models/web_update.rb +402 -0
- data/lib/sunshine-conversations-client/models/web_update_all_of.rb +360 -0
- data/lib/sunshine-conversations-client/models/webhook.rb +277 -0
- data/lib/sunshine-conversations-client/models/webhook_body.rb +237 -0
- data/lib/sunshine-conversations-client/models/webhook_create_body.rb +205 -0
- data/lib/sunshine-conversations-client/models/webhook_list_response.rb +203 -0
- data/lib/sunshine-conversations-client/models/webhook_response.rb +204 -0
- data/lib/sunshine-conversations-client/models/webhook_sub_schema.rb +215 -0
- data/lib/sunshine-conversations-client/models/webview.rb +339 -0
- data/lib/sunshine-conversations-client/models/whats_app_update.rb +272 -0
- data/lib/sunshine-conversations-client/models/whats_app_update_all_of.rb +229 -0
- data/lib/sunshine-conversations-client/models/whatsapp.rb +268 -0
- data/lib/sunshine-conversations-client/models/whatsapp_all_of.rb +257 -0
- data/lib/sunshine-conversations-client/version.rb +12 -0
- data/spec/api_client_spec.rb +223 -0
- data/spec/configuration_spec.rb +39 -0
- data/spec/spec_helper.rb +108 -0
- data/sunshine-conversations-client.gemspec +36 -0
- metadata +641 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
=begin
|
2
|
+
#Sunshine Conversations API
|
3
|
+
|
4
|
+
The version of the OpenAPI document: 9.1.0
|
5
|
+
|
6
|
+
Generated by: https://openapi-generator.tech
|
7
|
+
OpenAPI Generator version: 4.3.1
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'cgi'
|
11
|
+
|
12
|
+
module SunshineConversationsClient
|
13
|
+
class WebhooksApi
|
14
|
+
attr_accessor :api_client
|
15
|
+
|
16
|
+
def initialize(api_client = ApiClient.default)
|
17
|
+
@api_client = api_client
|
18
|
+
end
|
19
|
+
# Create Webhook
|
20
|
+
# Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
21
|
+
# @param app_id [String] Identifies the app.
|
22
|
+
# @param integration_id [String] The id of the integration.
|
23
|
+
# @param webhook_create_body [WebhookCreateBody]
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @return [WebhookResponse]
|
26
|
+
def create_webhook(app_id, integration_id, webhook_create_body, opts = {})
|
27
|
+
data, _status_code, _headers = create_webhook_with_http_info(app_id, integration_id, webhook_create_body, opts)
|
28
|
+
data
|
29
|
+
end
|
30
|
+
|
31
|
+
# Create Webhook
|
32
|
+
# Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
33
|
+
# @param app_id [String] Identifies the app.
|
34
|
+
# @param integration_id [String] The id of the integration.
|
35
|
+
# @param webhook_create_body [WebhookCreateBody]
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers
|
38
|
+
def create_webhook_with_http_info(app_id, integration_id, webhook_create_body, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
|
41
|
+
end
|
42
|
+
# verify the required parameter 'app_id' is set
|
43
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling WebhooksApi.create_webhook"
|
45
|
+
end
|
46
|
+
# verify the required parameter 'integration_id' is set
|
47
|
+
if @api_client.config.client_side_validation && integration_id.nil?
|
48
|
+
fail ArgumentError, "Missing the required parameter 'integration_id' when calling WebhooksApi.create_webhook"
|
49
|
+
end
|
50
|
+
# verify the required parameter 'webhook_create_body' is set
|
51
|
+
if @api_client.config.client_side_validation && webhook_create_body.nil?
|
52
|
+
fail ArgumentError, "Missing the required parameter 'webhook_create_body' when calling WebhooksApi.create_webhook"
|
53
|
+
end
|
54
|
+
# resource path
|
55
|
+
local_var_path = '/v2/apps/{appId}/integrations/{integrationId}/webhooks'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
|
56
|
+
|
57
|
+
# query parameters
|
58
|
+
query_params = opts[:query_params] || {}
|
59
|
+
|
60
|
+
# header parameters
|
61
|
+
header_params = opts[:header_params] || {}
|
62
|
+
# HTTP header 'Accept' (if needed)
|
63
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
64
|
+
# HTTP header 'Content-Type'
|
65
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
66
|
+
|
67
|
+
# form parameters
|
68
|
+
form_params = opts[:form_params] || {}
|
69
|
+
|
70
|
+
# http body (model)
|
71
|
+
post_body = opts[:body] || @api_client.object_to_http_body(webhook_create_body)
|
72
|
+
|
73
|
+
# return_type
|
74
|
+
return_type = opts[:return_type] || 'WebhookResponse'
|
75
|
+
|
76
|
+
# auth_names
|
77
|
+
auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']
|
78
|
+
|
79
|
+
new_options = opts.merge(
|
80
|
+
:header_params => header_params,
|
81
|
+
:query_params => query_params,
|
82
|
+
:form_params => form_params,
|
83
|
+
:body => post_body,
|
84
|
+
:auth_names => auth_names,
|
85
|
+
:return_type => return_type
|
86
|
+
)
|
87
|
+
|
88
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
89
|
+
if @api_client.config.debugging
|
90
|
+
@api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
91
|
+
end
|
92
|
+
return data, status_code, headers
|
93
|
+
end
|
94
|
+
|
95
|
+
# Delete Webhook
|
96
|
+
# Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
97
|
+
# @param app_id [String] Identifies the app.
|
98
|
+
# @param integration_id [String] The id of the integration.
|
99
|
+
# @param webhook_id [String] The id of the webhook.
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @return [Object]
|
102
|
+
def delete_webhook(app_id, integration_id, webhook_id, opts = {})
|
103
|
+
data, _status_code, _headers = delete_webhook_with_http_info(app_id, integration_id, webhook_id, opts)
|
104
|
+
data
|
105
|
+
end
|
106
|
+
|
107
|
+
# Delete Webhook
|
108
|
+
# Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
109
|
+
# @param app_id [String] Identifies the app.
|
110
|
+
# @param integration_id [String] The id of the integration.
|
111
|
+
# @param webhook_id [String] The id of the webhook.
|
112
|
+
# @param [Hash] opts the optional parameters
|
113
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
114
|
+
def delete_webhook_with_http_info(app_id, integration_id, webhook_id, opts = {})
|
115
|
+
if @api_client.config.debugging
|
116
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
|
117
|
+
end
|
118
|
+
# verify the required parameter 'app_id' is set
|
119
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
120
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling WebhooksApi.delete_webhook"
|
121
|
+
end
|
122
|
+
# verify the required parameter 'integration_id' is set
|
123
|
+
if @api_client.config.client_side_validation && integration_id.nil?
|
124
|
+
fail ArgumentError, "Missing the required parameter 'integration_id' when calling WebhooksApi.delete_webhook"
|
125
|
+
end
|
126
|
+
# verify the required parameter 'webhook_id' is set
|
127
|
+
if @api_client.config.client_side_validation && webhook_id.nil?
|
128
|
+
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.delete_webhook"
|
129
|
+
end
|
130
|
+
# resource path
|
131
|
+
local_var_path = '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)).sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s))
|
132
|
+
|
133
|
+
# query parameters
|
134
|
+
query_params = opts[:query_params] || {}
|
135
|
+
|
136
|
+
# header parameters
|
137
|
+
header_params = opts[:header_params] || {}
|
138
|
+
# HTTP header 'Accept' (if needed)
|
139
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
140
|
+
|
141
|
+
# form parameters
|
142
|
+
form_params = opts[:form_params] || {}
|
143
|
+
|
144
|
+
# http body (model)
|
145
|
+
post_body = opts[:body]
|
146
|
+
|
147
|
+
# return_type
|
148
|
+
return_type = opts[:return_type] || 'Object'
|
149
|
+
|
150
|
+
# auth_names
|
151
|
+
auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']
|
152
|
+
|
153
|
+
new_options = opts.merge(
|
154
|
+
:header_params => header_params,
|
155
|
+
:query_params => query_params,
|
156
|
+
:form_params => form_params,
|
157
|
+
:body => post_body,
|
158
|
+
:auth_names => auth_names,
|
159
|
+
:return_type => return_type
|
160
|
+
)
|
161
|
+
|
162
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
163
|
+
if @api_client.config.debugging
|
164
|
+
@api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
165
|
+
end
|
166
|
+
return data, status_code, headers
|
167
|
+
end
|
168
|
+
|
169
|
+
# Get Webhook
|
170
|
+
# Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
171
|
+
# @param app_id [String] Identifies the app.
|
172
|
+
# @param integration_id [String] The id of the integration.
|
173
|
+
# @param webhook_id [String] The id of the webhook.
|
174
|
+
# @param [Hash] opts the optional parameters
|
175
|
+
# @return [WebhookResponse]
|
176
|
+
def get_webhook(app_id, integration_id, webhook_id, opts = {})
|
177
|
+
data, _status_code, _headers = get_webhook_with_http_info(app_id, integration_id, webhook_id, opts)
|
178
|
+
data
|
179
|
+
end
|
180
|
+
|
181
|
+
# Get Webhook
|
182
|
+
# Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
183
|
+
# @param app_id [String] Identifies the app.
|
184
|
+
# @param integration_id [String] The id of the integration.
|
185
|
+
# @param webhook_id [String] The id of the webhook.
|
186
|
+
# @param [Hash] opts the optional parameters
|
187
|
+
# @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers
|
188
|
+
def get_webhook_with_http_info(app_id, integration_id, webhook_id, opts = {})
|
189
|
+
if @api_client.config.debugging
|
190
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...'
|
191
|
+
end
|
192
|
+
# verify the required parameter 'app_id' is set
|
193
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
194
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling WebhooksApi.get_webhook"
|
195
|
+
end
|
196
|
+
# verify the required parameter 'integration_id' is set
|
197
|
+
if @api_client.config.client_side_validation && integration_id.nil?
|
198
|
+
fail ArgumentError, "Missing the required parameter 'integration_id' when calling WebhooksApi.get_webhook"
|
199
|
+
end
|
200
|
+
# verify the required parameter 'webhook_id' is set
|
201
|
+
if @api_client.config.client_side_validation && webhook_id.nil?
|
202
|
+
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.get_webhook"
|
203
|
+
end
|
204
|
+
# resource path
|
205
|
+
local_var_path = '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)).sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s))
|
206
|
+
|
207
|
+
# query parameters
|
208
|
+
query_params = opts[:query_params] || {}
|
209
|
+
|
210
|
+
# header parameters
|
211
|
+
header_params = opts[:header_params] || {}
|
212
|
+
# HTTP header 'Accept' (if needed)
|
213
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
214
|
+
|
215
|
+
# form parameters
|
216
|
+
form_params = opts[:form_params] || {}
|
217
|
+
|
218
|
+
# http body (model)
|
219
|
+
post_body = opts[:body]
|
220
|
+
|
221
|
+
# return_type
|
222
|
+
return_type = opts[:return_type] || 'WebhookResponse'
|
223
|
+
|
224
|
+
# auth_names
|
225
|
+
auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']
|
226
|
+
|
227
|
+
new_options = opts.merge(
|
228
|
+
:header_params => header_params,
|
229
|
+
:query_params => query_params,
|
230
|
+
:form_params => form_params,
|
231
|
+
:body => post_body,
|
232
|
+
:auth_names => auth_names,
|
233
|
+
:return_type => return_type
|
234
|
+
)
|
235
|
+
|
236
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
237
|
+
if @api_client.config.debugging
|
238
|
+
@api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
239
|
+
end
|
240
|
+
return data, status_code, headers
|
241
|
+
end
|
242
|
+
|
243
|
+
# List Webhooks
|
244
|
+
# Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration.
|
245
|
+
# @param app_id [String] Identifies the app.
|
246
|
+
# @param integration_id [String] The id of the integration.
|
247
|
+
# @param [Hash] opts the optional parameters
|
248
|
+
# @return [WebhookListResponse]
|
249
|
+
def list_webhooks(app_id, integration_id, opts = {})
|
250
|
+
data, _status_code, _headers = list_webhooks_with_http_info(app_id, integration_id, opts)
|
251
|
+
data
|
252
|
+
end
|
253
|
+
|
254
|
+
# List Webhooks
|
255
|
+
# Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration.
|
256
|
+
# @param app_id [String] Identifies the app.
|
257
|
+
# @param integration_id [String] The id of the integration.
|
258
|
+
# @param [Hash] opts the optional parameters
|
259
|
+
# @return [Array<(WebhookListResponse, Integer, Hash)>] WebhookListResponse data, response status code and response headers
|
260
|
+
def list_webhooks_with_http_info(app_id, integration_id, opts = {})
|
261
|
+
if @api_client.config.debugging
|
262
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
|
263
|
+
end
|
264
|
+
# verify the required parameter 'app_id' is set
|
265
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
266
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling WebhooksApi.list_webhooks"
|
267
|
+
end
|
268
|
+
# verify the required parameter 'integration_id' is set
|
269
|
+
if @api_client.config.client_side_validation && integration_id.nil?
|
270
|
+
fail ArgumentError, "Missing the required parameter 'integration_id' when calling WebhooksApi.list_webhooks"
|
271
|
+
end
|
272
|
+
# resource path
|
273
|
+
local_var_path = '/v2/apps/{appId}/integrations/{integrationId}/webhooks'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
|
274
|
+
|
275
|
+
# query parameters
|
276
|
+
query_params = opts[:query_params] || {}
|
277
|
+
|
278
|
+
# header parameters
|
279
|
+
header_params = opts[:header_params] || {}
|
280
|
+
# HTTP header 'Accept' (if needed)
|
281
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
282
|
+
|
283
|
+
# form parameters
|
284
|
+
form_params = opts[:form_params] || {}
|
285
|
+
|
286
|
+
# http body (model)
|
287
|
+
post_body = opts[:body]
|
288
|
+
|
289
|
+
# return_type
|
290
|
+
return_type = opts[:return_type] || 'WebhookListResponse'
|
291
|
+
|
292
|
+
# auth_names
|
293
|
+
auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']
|
294
|
+
|
295
|
+
new_options = opts.merge(
|
296
|
+
:header_params => header_params,
|
297
|
+
:query_params => query_params,
|
298
|
+
:form_params => form_params,
|
299
|
+
:body => post_body,
|
300
|
+
:auth_names => auth_names,
|
301
|
+
:return_type => return_type
|
302
|
+
)
|
303
|
+
|
304
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
305
|
+
if @api_client.config.debugging
|
306
|
+
@api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
307
|
+
end
|
308
|
+
return data, status_code, headers
|
309
|
+
end
|
310
|
+
|
311
|
+
# Update Webhook
|
312
|
+
# Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
313
|
+
# @param app_id [String] Identifies the app.
|
314
|
+
# @param integration_id [String] The id of the integration.
|
315
|
+
# @param webhook_id [String] The id of the webhook.
|
316
|
+
# @param webhook_body [WebhookBody]
|
317
|
+
# @param [Hash] opts the optional parameters
|
318
|
+
# @return [WebhookResponse]
|
319
|
+
def update_webhook(app_id, integration_id, webhook_id, webhook_body, opts = {})
|
320
|
+
data, _status_code, _headers = update_webhook_with_http_info(app_id, integration_id, webhook_id, webhook_body, opts)
|
321
|
+
data
|
322
|
+
end
|
323
|
+
|
324
|
+
# Update Webhook
|
325
|
+
# Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration.
|
326
|
+
# @param app_id [String] Identifies the app.
|
327
|
+
# @param integration_id [String] The id of the integration.
|
328
|
+
# @param webhook_id [String] The id of the webhook.
|
329
|
+
# @param webhook_body [WebhookBody]
|
330
|
+
# @param [Hash] opts the optional parameters
|
331
|
+
# @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers
|
332
|
+
def update_webhook_with_http_info(app_id, integration_id, webhook_id, webhook_body, opts = {})
|
333
|
+
if @api_client.config.debugging
|
334
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
|
335
|
+
end
|
336
|
+
# verify the required parameter 'app_id' is set
|
337
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
338
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling WebhooksApi.update_webhook"
|
339
|
+
end
|
340
|
+
# verify the required parameter 'integration_id' is set
|
341
|
+
if @api_client.config.client_side_validation && integration_id.nil?
|
342
|
+
fail ArgumentError, "Missing the required parameter 'integration_id' when calling WebhooksApi.update_webhook"
|
343
|
+
end
|
344
|
+
# verify the required parameter 'webhook_id' is set
|
345
|
+
if @api_client.config.client_side_validation && webhook_id.nil?
|
346
|
+
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.update_webhook"
|
347
|
+
end
|
348
|
+
# verify the required parameter 'webhook_body' is set
|
349
|
+
if @api_client.config.client_side_validation && webhook_body.nil?
|
350
|
+
fail ArgumentError, "Missing the required parameter 'webhook_body' when calling WebhooksApi.update_webhook"
|
351
|
+
end
|
352
|
+
# resource path
|
353
|
+
local_var_path = '/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)).sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s))
|
354
|
+
|
355
|
+
# query parameters
|
356
|
+
query_params = opts[:query_params] || {}
|
357
|
+
|
358
|
+
# header parameters
|
359
|
+
header_params = opts[:header_params] || {}
|
360
|
+
# HTTP header 'Accept' (if needed)
|
361
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
362
|
+
# HTTP header 'Content-Type'
|
363
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
364
|
+
|
365
|
+
# form parameters
|
366
|
+
form_params = opts[:form_params] || {}
|
367
|
+
|
368
|
+
# http body (model)
|
369
|
+
post_body = opts[:body] || @api_client.object_to_http_body(webhook_body)
|
370
|
+
|
371
|
+
# return_type
|
372
|
+
return_type = opts[:return_type] || 'WebhookResponse'
|
373
|
+
|
374
|
+
# auth_names
|
375
|
+
auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']
|
376
|
+
|
377
|
+
new_options = opts.merge(
|
378
|
+
:header_params => header_params,
|
379
|
+
:query_params => query_params,
|
380
|
+
:form_params => form_params,
|
381
|
+
:body => post_body,
|
382
|
+
:auth_names => auth_names,
|
383
|
+
:return_type => return_type
|
384
|
+
)
|
385
|
+
|
386
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
387
|
+
if @api_client.config.debugging
|
388
|
+
@api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
389
|
+
end
|
390
|
+
return data, status_code, headers
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
@@ -0,0 +1,348 @@
|
|
1
|
+
=begin
|
2
|
+
#Sunshine Conversations API
|
3
|
+
|
4
|
+
The version of the OpenAPI document: 9.1.0
|
5
|
+
|
6
|
+
Generated by: https://openapi-generator.tech
|
7
|
+
OpenAPI Generator version: 4.3.1
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'json'
|
12
|
+
require 'logger'
|
13
|
+
require 'tempfile'
|
14
|
+
require 'time'
|
15
|
+
require 'typhoeus'
|
16
|
+
|
17
|
+
module SunshineConversationsClient
|
18
|
+
class ApiClient
|
19
|
+
# The Configuration object holding settings to be used in the API client.
|
20
|
+
attr_accessor :config
|
21
|
+
|
22
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
23
|
+
#
|
24
|
+
# @return [Hash]
|
25
|
+
attr_accessor :default_headers
|
26
|
+
|
27
|
+
# Initializes the ApiClient
|
28
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
29
|
+
def initialize(config = Configuration.default)
|
30
|
+
@config = config
|
31
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
32
|
+
@default_headers = {
|
33
|
+
'Content-Type' => 'application/json',
|
34
|
+
'User-Agent' => @user_agent
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.default
|
39
|
+
@@default ||= ApiClient.new
|
40
|
+
end
|
41
|
+
|
42
|
+
# Call an API with given options.
|
43
|
+
#
|
44
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
45
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
46
|
+
def call_api(http_method, path, opts = {})
|
47
|
+
request = build_request(http_method, path, opts)
|
48
|
+
response = request.run
|
49
|
+
|
50
|
+
if @config.debugging
|
51
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
52
|
+
end
|
53
|
+
|
54
|
+
unless response.success?
|
55
|
+
if response.timed_out?
|
56
|
+
fail ApiError.new('Connection timed out')
|
57
|
+
elsif response.code == 0
|
58
|
+
# Errors from libcurl will be made visible here
|
59
|
+
fail ApiError.new(:code => 0,
|
60
|
+
:message => response.return_message)
|
61
|
+
else
|
62
|
+
fail ApiError.new(:code => response.code,
|
63
|
+
:response_headers => response.headers,
|
64
|
+
:response_body => response.body),
|
65
|
+
response.status_message
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if opts[:return_type]
|
70
|
+
data = deserialize(response, opts[:return_type])
|
71
|
+
else
|
72
|
+
data = nil
|
73
|
+
end
|
74
|
+
return data, response.code, response.headers
|
75
|
+
end
|
76
|
+
|
77
|
+
# Builds the HTTP request
|
78
|
+
#
|
79
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
80
|
+
# @param [String] path URL path (e.g. /account/new)
|
81
|
+
# @option opts [Hash] :header_params Header parameters
|
82
|
+
# @option opts [Hash] :query_params Query parameters
|
83
|
+
# @option opts [Hash] :form_params Query parameters
|
84
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
85
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
86
|
+
def build_request(http_method, path, opts = {})
|
87
|
+
url = build_request_url(path)
|
88
|
+
http_method = http_method.to_sym.downcase
|
89
|
+
|
90
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
91
|
+
query_params = opts[:query_params] || {}
|
92
|
+
form_params = opts[:form_params] || {}
|
93
|
+
|
94
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
95
|
+
|
96
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
97
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
98
|
+
|
99
|
+
req_opts = {
|
100
|
+
:method => http_method,
|
101
|
+
:headers => header_params,
|
102
|
+
:params => query_params,
|
103
|
+
:params_encoding => @config.params_encoding,
|
104
|
+
:timeout => @config.timeout,
|
105
|
+
:ssl_verifypeer => @config.verify_ssl,
|
106
|
+
:ssl_verifyhost => _verify_ssl_host,
|
107
|
+
:sslcert => @config.cert_file,
|
108
|
+
:sslkey => @config.key_file,
|
109
|
+
:verbose => @config.debugging
|
110
|
+
}
|
111
|
+
|
112
|
+
# set custom cert, if provided
|
113
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
114
|
+
|
115
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
116
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
117
|
+
req_opts.update :body => req_body
|
118
|
+
if @config.debugging
|
119
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
request = Typhoeus::Request.new(url, req_opts)
|
124
|
+
download_file(request) if opts[:return_type] == 'File'
|
125
|
+
request
|
126
|
+
end
|
127
|
+
|
128
|
+
# Builds the HTTP request body
|
129
|
+
#
|
130
|
+
# @param [Hash] header_params Header parameters
|
131
|
+
# @param [Hash] form_params Query parameters
|
132
|
+
# @param [Object] body HTTP body (JSON/XML)
|
133
|
+
# @return [String] HTTP body data in the form of string
|
134
|
+
def build_request_body(header_params, form_params, body)
|
135
|
+
# http form
|
136
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
137
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
138
|
+
data = {}
|
139
|
+
form_params.each do |key, value|
|
140
|
+
case value
|
141
|
+
when ::File, ::Array, nil
|
142
|
+
# let typhoeus handle File, Array and nil parameters
|
143
|
+
data[key] = value
|
144
|
+
else
|
145
|
+
data[key] = value.to_s
|
146
|
+
end
|
147
|
+
end
|
148
|
+
elsif body
|
149
|
+
data = body.is_a?(String) ? body : body.to_json
|
150
|
+
else
|
151
|
+
data = nil
|
152
|
+
end
|
153
|
+
data
|
154
|
+
end
|
155
|
+
|
156
|
+
# Check if the given MIME is a JSON MIME.
|
157
|
+
# JSON MIME examples:
|
158
|
+
# application/json
|
159
|
+
# application/json; charset=UTF8
|
160
|
+
# APPLICATION/JSON
|
161
|
+
# */*
|
162
|
+
# @param [String] mime MIME
|
163
|
+
# @return [Boolean] True if the MIME is application/json
|
164
|
+
def json_mime?(mime)
|
165
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
166
|
+
end
|
167
|
+
|
168
|
+
# Deserialize the response to the given return type.
|
169
|
+
#
|
170
|
+
# @param [Response] response HTTP response
|
171
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
172
|
+
def deserialize(response, return_type)
|
173
|
+
body = response.body
|
174
|
+
|
175
|
+
# handle file downloading - return the File instance processed in request callbacks
|
176
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
177
|
+
return @tempfile if return_type == 'File'
|
178
|
+
|
179
|
+
return nil if body.nil? || body.empty?
|
180
|
+
|
181
|
+
# return response body directly for String return type
|
182
|
+
return body if return_type == 'String'
|
183
|
+
|
184
|
+
# ensuring a default content type
|
185
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
186
|
+
|
187
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
188
|
+
|
189
|
+
begin
|
190
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
191
|
+
rescue JSON::ParserError => e
|
192
|
+
if %w(String Date Time).include?(return_type)
|
193
|
+
data = body
|
194
|
+
else
|
195
|
+
raise e
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
convert_to_type data, return_type
|
200
|
+
end
|
201
|
+
|
202
|
+
# Convert data to the given return type.
|
203
|
+
# @param [Object] data Data to be converted
|
204
|
+
# @param [String] return_type Return type
|
205
|
+
# @return [Mixed] Data in a particular type
|
206
|
+
def convert_to_type(data, return_type)
|
207
|
+
return nil if data.nil?
|
208
|
+
case return_type
|
209
|
+
when 'String'
|
210
|
+
data.to_s
|
211
|
+
when 'Integer'
|
212
|
+
data.to_i
|
213
|
+
when 'Float'
|
214
|
+
data.to_f
|
215
|
+
when 'Boolean'
|
216
|
+
data == true
|
217
|
+
when 'Time'
|
218
|
+
# parse date time (expecting ISO 8601 format)
|
219
|
+
Time.parse data
|
220
|
+
when 'Date'
|
221
|
+
# parse date time (expecting ISO 8601 format)
|
222
|
+
Date.parse data
|
223
|
+
when 'Object'
|
224
|
+
# generic object (usually a Hash), return directly
|
225
|
+
data
|
226
|
+
when /\AArray<(.+)>\z/
|
227
|
+
# e.g. Array<Pet>
|
228
|
+
sub_type = $1
|
229
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
230
|
+
when /\AHash\<String, (.+)\>\z/
|
231
|
+
# e.g. Hash<String, Integer>
|
232
|
+
sub_type = $1
|
233
|
+
{}.tap do |hash|
|
234
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
235
|
+
end
|
236
|
+
else
|
237
|
+
# models, e.g. Pet
|
238
|
+
SunshineConversationsClient.const_get(return_type).build_from_hash(data)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Sanitize filename by removing path.
|
243
|
+
# e.g. ../../sun.gif becomes sun.gif
|
244
|
+
#
|
245
|
+
# @param [String] filename the filename to be sanitized
|
246
|
+
# @return [String] the sanitized filename
|
247
|
+
def sanitize_filename(filename)
|
248
|
+
filename.gsub(/.*[\/\\]/, '')
|
249
|
+
end
|
250
|
+
|
251
|
+
def build_request_url(path, opts = {})
|
252
|
+
# Add leading and trailing slashes to path
|
253
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
254
|
+
@config.base_url(opts[:operation]) + path
|
255
|
+
end
|
256
|
+
|
257
|
+
# Update hearder and query params based on authentication settings.
|
258
|
+
#
|
259
|
+
# @param [Hash] header_params Header parameters
|
260
|
+
# @param [Hash] query_params Query parameters
|
261
|
+
# @param [String] auth_names Authentication scheme name
|
262
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
263
|
+
Array(auth_names).each do |auth_name|
|
264
|
+
auth_setting = @config.auth_settings[auth_name]
|
265
|
+
next unless (auth_setting && auth_setting[:value])
|
266
|
+
case auth_setting[:in]
|
267
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
268
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
269
|
+
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
# Sets user agent in HTTP header
|
275
|
+
#
|
276
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
277
|
+
def user_agent=(user_agent)
|
278
|
+
@user_agent = user_agent
|
279
|
+
@default_headers['User-Agent'] = @user_agent
|
280
|
+
end
|
281
|
+
|
282
|
+
# Return Accept header based on an array of accepts provided.
|
283
|
+
# @param [Array] accepts array for Accept
|
284
|
+
# @return [String] the Accept header (e.g. application/json)
|
285
|
+
def select_header_accept(accepts)
|
286
|
+
return nil if accepts.nil? || accepts.empty?
|
287
|
+
# use JSON when present, otherwise use all of the provided
|
288
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
289
|
+
json_accept || accepts.join(',')
|
290
|
+
end
|
291
|
+
|
292
|
+
# Return Content-Type header based on an array of content types provided.
|
293
|
+
# @param [Array] content_types array for Content-Type
|
294
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
295
|
+
def select_header_content_type(content_types)
|
296
|
+
# use application/json by default
|
297
|
+
return 'application/json' if content_types.nil? || content_types.empty?
|
298
|
+
# use JSON when present, otherwise use the first one
|
299
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
300
|
+
json_content_type || content_types.first
|
301
|
+
end
|
302
|
+
|
303
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
304
|
+
# @param [Object] model object to be converted into JSON string
|
305
|
+
# @return [String] JSON string representation of the object
|
306
|
+
def object_to_http_body(model)
|
307
|
+
return model if model.nil? || model.is_a?(String)
|
308
|
+
local_body = nil
|
309
|
+
if model.is_a?(Array)
|
310
|
+
local_body = model.map { |m| object_to_hash(m) }
|
311
|
+
else
|
312
|
+
local_body = object_to_hash(model)
|
313
|
+
end
|
314
|
+
local_body.to_json
|
315
|
+
end
|
316
|
+
|
317
|
+
# Convert object(non-array) to hash.
|
318
|
+
# @param [Object] obj object to be converted into JSON string
|
319
|
+
# @return [String] JSON string representation of the object
|
320
|
+
def object_to_hash(obj)
|
321
|
+
if obj.respond_to?(:to_hash)
|
322
|
+
obj.to_hash
|
323
|
+
else
|
324
|
+
obj
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
# Build parameter value according to the given collection format.
|
329
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
330
|
+
def build_collection_param(param, collection_format)
|
331
|
+
case collection_format
|
332
|
+
when :csv
|
333
|
+
param.join(',')
|
334
|
+
when :ssv
|
335
|
+
param.join(' ')
|
336
|
+
when :tsv
|
337
|
+
param.join("\t")
|
338
|
+
when :pipes
|
339
|
+
param.join('|')
|
340
|
+
when :multi
|
341
|
+
# return the array directly as typhoeus will handle it as expected
|
342
|
+
param
|
343
|
+
else
|
344
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|