constant_contact_client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +56 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +72 -0
- data/LICENSE +29 -0
- data/README.md +201 -0
- data/Rakefile +10 -0
- data/constant_contact_client.gemspec +39 -0
- data/docs/AccountServicesApi.md +593 -0
- data/docs/BulkActivitiesApi.md +1035 -0
- data/docs/ContactListsApi.md +461 -0
- data/docs/ContactTagsApi.md +382 -0
- data/docs/ContactsApi.md +701 -0
- data/docs/ContactsCustomFieldsApi.md +375 -0
- data/docs/ContactsReportingApi.md +244 -0
- data/docs/EmailCampaignsABTestsApi.md +227 -0
- data/docs/EmailCampaignsApi.md +826 -0
- data/docs/EmailReportingApi.md +925 -0
- data/docs/EmailSchedulingApi.md +447 -0
- data/docs/LandingPagesReportingApi.md +481 -0
- data/docs/SegmentsApi.md +452 -0
- data/lib/constant_contact_client/api/account_services_api.rb +546 -0
- data/lib/constant_contact_client/api/bulk_activities_api.rb +983 -0
- data/lib/constant_contact_client/api/contact_lists_api.rb +449 -0
- data/lib/constant_contact_client/api/contact_tags_api.rb +356 -0
- data/lib/constant_contact_client/api/contacts_api.rb +676 -0
- data/lib/constant_contact_client/api/contacts_custom_fields_api.rb +356 -0
- data/lib/constant_contact_client/api/contacts_reporting_api.rb +255 -0
- data/lib/constant_contact_client/api/email_campaigns_ab_tests_api.rb +220 -0
- data/lib/constant_contact_client/api/email_campaigns_api.rb +766 -0
- data/lib/constant_contact_client/api/email_reporting_api.rb +812 -0
- data/lib/constant_contact_client/api/email_scheduling_api.rb +418 -0
- data/lib/constant_contact_client/api/landing_pages_reporting_api.rb +436 -0
- data/lib/constant_contact_client/api/segments_api.rb +425 -0
- data/lib/constant_contact_client/api_client.rb +394 -0
- data/lib/constant_contact_client/api_error.rb +58 -0
- data/lib/constant_contact_client/configuration.rb +305 -0
- data/lib/constant_contact_client/models/ab_test_data.rb +256 -0
- data/lib/constant_contact_client/models/access_token_response.rb +265 -0
- data/lib/constant_contact_client/models/account_cancellation.rb +226 -0
- data/lib/constant_contact_client/models/account_email_create_response.rb +273 -0
- data/lib/constant_contact_client/models/account_email_input.rb +234 -0
- data/lib/constant_contact_client/models/account_physical_address.rb +409 -0
- data/lib/constant_contact_client/models/account_suspension.rb +289 -0
- data/lib/constant_contact_client/models/activities.rb +226 -0
- data/lib/constant_contact_client/models/activity.rb +316 -0
- data/lib/constant_contact_client/models/activity_delete_custom_fields.rb +297 -0
- data/lib/constant_contact_client/models/activity_delete_list_response.rb +276 -0
- data/lib/constant_contact_client/models/activity_delete_lists_response.rb +305 -0
- data/lib/constant_contact_client/models/activity_delete_status.rb +306 -0
- data/lib/constant_contact_client/models/activity_errors.rb +215 -0
- data/lib/constant_contact_client/models/activity_export_status.rb +306 -0
- data/lib/constant_contact_client/models/activity_generic.rb +299 -0
- data/lib/constant_contact_client/models/activity_generic_status.rb +225 -0
- data/lib/constant_contact_client/models/activity_import.rb +316 -0
- data/lib/constant_contact_client/models/activity_links.rb +223 -0
- data/lib/constant_contact_client/models/activity_lists_membership.rb +305 -0
- data/lib/constant_contact_client/models/activity_reference.rb +225 -0
- data/lib/constant_contact_client/models/activity_status.rb +275 -0
- data/lib/constant_contact_client/models/activity_status_export_link.rb +223 -0
- data/lib/constant_contact_client/models/activity_status_link.rb +214 -0
- data/lib/constant_contact_client/models/activity_tagging.rb +319 -0
- data/lib/constant_contact_client/models/activity_tagging_status.rb +226 -0
- data/lib/constant_contact_client/models/add_account_email_address201_response.rb +273 -0
- data/lib/constant_contact_client/models/add_account_email_address_request.rb +234 -0
- data/lib/constant_contact_client/models/api_error_schema_inner.rb +225 -0
- data/lib/constant_contact_client/models/authorization_error_schema.rb +225 -0
- data/lib/constant_contact_client/models/bounces_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/bounces_tracking_activity.rb +347 -0
- data/lib/constant_contact_client/models/bulk_email_campaign_summaries_page.rb +249 -0
- data/lib/constant_contact_client/models/bulk_email_campaign_summaries_percents.rb +255 -0
- data/lib/constant_contact_client/models/bulk_email_campaign_summary.rb +272 -0
- data/lib/constant_contact_client/models/campaign_activity_stats_query_result_email.rb +229 -0
- data/lib/constant_contact_client/models/campaign_activity_stats_result_generic_stats_email_activity.rb +244 -0
- data/lib/constant_contact_client/models/campaign_activity_summary.rb +341 -0
- data/lib/constant_contact_client/models/campaign_stats_query_result_email.rb +229 -0
- data/lib/constant_contact_client/models/campaign_stats_result_generic_stats_email_percents_email.rb +243 -0
- data/lib/constant_contact_client/models/clicks_tracking_activities_page.rb +233 -0
- data/lib/constant_contact_client/models/clicks_tracking_activity.rb +364 -0
- data/lib/constant_contact_client/models/company_logo.rb +235 -0
- data/lib/constant_contact_client/models/contact_campaign_activities_summary.rb +250 -0
- data/lib/constant_contact_client/models/contact_create_or_update_input.rb +503 -0
- data/lib/constant_contact_client/models/contact_create_or_update_response.rb +225 -0
- data/lib/constant_contact_client/models/contact_custom_field.rb +259 -0
- data/lib/constant_contact_client/models/contact_delete.rb +267 -0
- data/lib/constant_contact_client/models/contact_list.rb +301 -0
- data/lib/constant_contact_client/models/contact_list_array.rb +235 -0
- data/lib/constant_contact_client/models/contact_list_put_post.rb +291 -0
- data/lib/constant_contact_client/models/contact_open_and_click_rates.rb +274 -0
- data/lib/constant_contact_client/models/contact_post_request.rb +575 -0
- data/lib/constant_contact_client/models/contact_put_request.rb +582 -0
- data/lib/constant_contact_client/models/contact_resource.rb +635 -0
- data/lib/constant_contact_client/models/contact_tracking_activities_page.rb +227 -0
- data/lib/constant_contact_client/models/contact_tracking_activity.rb +270 -0
- data/lib/constant_contact_client/models/contact_xref.rb +226 -0
- data/lib/constant_contact_client/models/contact_xrefs.rb +236 -0
- data/lib/constant_contact_client/models/contacts.rb +246 -0
- data/lib/constant_contact_client/models/contacts_counts.rb +265 -0
- data/lib/constant_contact_client/models/contacts_export.rb +300 -0
- data/lib/constant_contact_client/models/contacts_json_import.rb +281 -0
- data/lib/constant_contact_client/models/create_contact_request.rb +575 -0
- data/lib/constant_contact_client/models/create_contact_request_email_address.rb +252 -0
- data/lib/constant_contact_client/models/create_csv_import_activity201_response.rb +316 -0
- data/lib/constant_contact_client/models/create_csv_import_activity201_response_links.rb +214 -0
- data/lib/constant_contact_client/models/create_csv_import_activity201_response_status.rb +255 -0
- data/lib/constant_contact_client/models/create_delete_activity201_response.rb +306 -0
- data/lib/constant_contact_client/models/create_delete_activity201_response_links.rb +214 -0
- data/lib/constant_contact_client/models/create_delete_activity201_response_links_self.rb +215 -0
- data/lib/constant_contact_client/models/create_delete_activity201_response_status.rb +235 -0
- data/lib/constant_contact_client/models/create_delete_activity_request.rb +267 -0
- data/lib/constant_contact_client/models/create_email_campaign200_response.rb +306 -0
- data/lib/constant_contact_client/models/create_email_campaign200_response_campaign_activities_inner.rb +225 -0
- data/lib/constant_contact_client/models/create_email_campaign_request.rb +260 -0
- data/lib/constant_contact_client/models/create_email_campaign_request_email_campaign_activities_inner.rb +402 -0
- data/lib/constant_contact_client/models/create_email_campaign_request_email_campaign_activities_inner_physical_address_in_footer.rb +347 -0
- data/lib/constant_contact_client/models/create_export_activity201_response.rb +306 -0
- data/lib/constant_contact_client/models/create_export_activity201_response_status.rb +225 -0
- data/lib/constant_contact_client/models/create_export_activity_request.rb +300 -0
- data/lib/constant_contact_client/models/create_import_json_activity_request.rb +281 -0
- data/lib/constant_contact_client/models/create_import_json_activity_request_import_data_inner.rb +1315 -0
- data/lib/constant_contact_client/models/create_list_add_activity_request.rb +268 -0
- data/lib/constant_contact_client/models/create_list_add_activity_request_exclude.rb +217 -0
- data/lib/constant_contact_client/models/create_list_add_activity_request_source.rb +331 -0
- data/lib/constant_contact_client/models/create_list_delete_activity201_response.rb +305 -0
- data/lib/constant_contact_client/models/create_list_delete_activity201_response_links.rb +214 -0
- data/lib/constant_contact_client/models/create_list_delete_activity201_response_links_self.rb +215 -0
- data/lib/constant_contact_client/models/create_list_delete_activity201_response_status.rb +215 -0
- data/lib/constant_contact_client/models/create_list_delete_activity_request.rb +243 -0
- data/lib/constant_contact_client/models/create_list_remove_activity201_response.rb +305 -0
- data/lib/constant_contact_client/models/create_list_remove_activity201_response_status.rb +235 -0
- data/lib/constant_contact_client/models/create_list_remove_activity_request.rb +268 -0
- data/lib/constant_contact_client/models/create_list_remove_activity_request_exclude.rb +217 -0
- data/lib/constant_contact_client/models/create_list_remove_activity_request_source.rb +321 -0
- data/lib/constant_contact_client/models/create_or_update_contact200_response.rb +225 -0
- data/lib/constant_contact_client/models/create_or_update_contact_custom_field.rb +244 -0
- data/lib/constant_contact_client/models/create_or_update_contact_request.rb +503 -0
- data/lib/constant_contact_client/models/create_or_update_contact_request_custom_fields_inner.rb +244 -0
- data/lib/constant_contact_client/models/create_or_update_contact_request_street_address.rb +367 -0
- data/lib/constant_contact_client/models/create_resend_email_campaign201_response.rb +255 -0
- data/lib/constant_contact_client/models/create_resend_email_campaign_request.rb +242 -0
- data/lib/constant_contact_client/models/create_segment201_response.rb +274 -0
- data/lib/constant_contact_client/models/create_segment_request.rb +258 -0
- data/lib/constant_contact_client/models/create_tag_delete_activity_request.rb +243 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity201_response.rb +319 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity201_response_links.rb +223 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity201_response_links_results.rb +215 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity201_response_links_self.rb +214 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity201_response_status.rb +226 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity_request.rb +268 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity_request_exclude.rb +218 -0
- data/lib/constant_contact_client/models/create_tag_remove_activity_request_source.rb +319 -0
- data/lib/constant_contact_client/models/cross_reference.rb +235 -0
- data/lib/constant_contact_client/models/cross_reference_response.rb +217 -0
- data/lib/constant_contact_client/models/custom_field_id100.rb +243 -0
- data/lib/constant_contact_client/models/custom_field_input.rb +258 -0
- data/lib/constant_contact_client/models/custom_field_resource.rb +318 -0
- data/lib/constant_contact_client/models/custom_fields.rb +245 -0
- data/lib/constant_contact_client/models/customer.rb +352 -0
- data/lib/constant_contact_client/models/customer_put.rb +334 -0
- data/lib/constant_contact_client/models/delete_list202_response.rb +276 -0
- data/lib/constant_contact_client/models/delete_tag202_response.rb +299 -0
- data/lib/constant_contact_client/models/delete_tag202_response_activity_errors_inner.rb +215 -0
- data/lib/constant_contact_client/models/delete_tag202_response_links.rb +214 -0
- data/lib/constant_contact_client/models/delete_tag202_response_links_self.rb +215 -0
- data/lib/constant_contact_client/models/delete_tag202_response_status.rb +225 -0
- data/lib/constant_contact_client/models/device_flow_response.rb +265 -0
- data/lib/constant_contact_client/models/did_not_opens_tracking_activities_page.rb +233 -0
- data/lib/constant_contact_client/models/did_not_opens_tracking_activity.rb +320 -0
- data/lib/constant_contact_client/models/email_address.rb +351 -0
- data/lib/constant_contact_client/models/email_address_post.rb +252 -0
- data/lib/constant_contact_client/models/email_address_put.rb +341 -0
- data/lib/constant_contact_client/models/email_campaign.rb +306 -0
- data/lib/constant_contact_client/models/email_campaign_activity.rb +405 -0
- data/lib/constant_contact_client/models/email_campaign_activity_input.rb +402 -0
- data/lib/constant_contact_client/models/email_campaign_activity_preview.rb +285 -0
- data/lib/constant_contact_client/models/email_campaign_complete.rb +260 -0
- data/lib/constant_contact_client/models/email_campaign_name.rb +241 -0
- data/lib/constant_contact_client/models/email_campaigns.rb +294 -0
- data/lib/constant_contact_client/models/email_link_click_count.rb +265 -0
- data/lib/constant_contact_client/models/email_links.rb +227 -0
- data/lib/constant_contact_client/models/email_physical_address.rb +346 -0
- data/lib/constant_contact_client/models/email_schedule_input.rb +222 -0
- data/lib/constant_contact_client/models/email_test_send_input.rb +253 -0
- data/lib/constant_contact_client/models/emails_link.rb +214 -0
- data/lib/constant_contact_client/models/emails_paging_links.rb +214 -0
- data/lib/constant_contact_client/models/file_object.rb +384 -0
- data/lib/constant_contact_client/models/file_status_array_inner.rb +235 -0
- data/lib/constant_contact_client/models/forwards_tracking_activities_page.rb +233 -0
- data/lib/constant_contact_client/models/forwards_tracking_activity.rb +320 -0
- data/lib/constant_contact_client/models/get_ab_test_email_campaign200_response.rb +256 -0
- data/lib/constant_contact_client/models/get_account_details200_response.rb +352 -0
- data/lib/constant_contact_client/models/get_account_details200_response_company_logo.rb +236 -0
- data/lib/constant_contact_client/models/get_account_details200_response_physical_address.rb +409 -0
- data/lib/constant_contact_client/models/get_activity_by_id200_response.rb +316 -0
- data/lib/constant_contact_client/models/get_all_account_email_addresses200_response_inner.rb +317 -0
- data/lib/constant_contact_client/models/get_all_activities200_response.rb +226 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_activities_inner.rb +316 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_activities_inner_links.rb +223 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_activities_inner_links_results.rb +215 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_activities_inner_links_self.rb +215 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_activities_inner_status.rb +275 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_links.rb +214 -0
- data/lib/constant_contact_client/models/get_all_activities200_response_links_next.rb +214 -0
- data/lib/constant_contact_client/models/get_all_contacts200_response.rb +246 -0
- data/lib/constant_contact_client/models/get_all_custom_fields200_response.rb +245 -0
- data/lib/constant_contact_client/models/get_all_email_campaigns200_response.rb +225 -0
- data/lib/constant_contact_client/models/get_all_email_campaigns200_response_campaigns_inner.rb +294 -0
- data/lib/constant_contact_client/models/get_all_email_campaigns200_response_links.rb +214 -0
- data/lib/constant_contact_client/models/get_all_lists200_response.rb +235 -0
- data/lib/constant_contact_client/models/get_all_segments200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_all_segments200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_all_segments200_response_links_next.rb +223 -0
- data/lib/constant_contact_client/models/get_all_segments200_response_segments_inner.rb +245 -0
- data/lib/constant_contact_client/models/get_all_tags200_response.rb +226 -0
- data/lib/constant_contact_client/models/get_all_tags200_response_links.rb +215 -0
- data/lib/constant_contact_client/models/get_all_tags200_response_links_next.rb +224 -0
- data/lib/constant_contact_client/models/get_all_tags200_response_links_next_next.rb +223 -0
- data/lib/constant_contact_client/models/get_bounces_report200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_bounces_report200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_bounces_report200_response_tracking_activities_inner.rb +347 -0
- data/lib/constant_contact_client/models/get_campaign_activity_link_report200_response.rb +227 -0
- data/lib/constant_contact_client/models/get_campaign_activity_link_report200_response_link_click_counts_inner.rb +265 -0
- data/lib/constant_contact_client/models/get_clicks_report200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_clicks_report200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_clicks_report200_response_tracking_activities_inner.rb +364 -0
- data/lib/constant_contact_client/models/get_contact_adds200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_contact_adds200_response_tracking_activities_inner.rb +329 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response.rb +635 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_custom_fields_inner.rb +259 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_email_address.rb +351 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_notes_inner.rb +255 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_phone_numbers_inner.rb +294 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_sms_channel.rb +278 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_sms_channel_sms_channel_consents_inner.rb +285 -0
- data/lib/constant_contact_client/models/get_contact_by_id200_response_street_addresses_inner.rb +397 -0
- data/lib/constant_contact_client/models/get_contact_counts200_response.rb +265 -0
- data/lib/constant_contact_client/models/get_contact_id_xrefs200_response.rb +236 -0
- data/lib/constant_contact_client/models/get_contact_id_xrefs200_response_xrefs_inner.rb +226 -0
- data/lib/constant_contact_client/models/get_contact_open_click_rate_report200_response.rb +274 -0
- data/lib/constant_contact_client/models/get_contact_tracking_count_report200_response.rb +250 -0
- data/lib/constant_contact_client/models/get_contact_tracking_count_report200_response_campaign_activities_inner.rb +341 -0
- data/lib/constant_contact_client/models/get_contact_tracking_count_report200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_contact_tracking_report200_response.rb +227 -0
- data/lib/constant_contact_client/models/get_contact_tracking_report200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_contact_tracking_report200_response_links_next.rb +223 -0
- data/lib/constant_contact_client/models/get_contact_tracking_report200_response_tracking_activities_inner.rb +270 -0
- data/lib/constant_contact_client/models/get_custom_field200_response.rb +318 -0
- data/lib/constant_contact_client/models/get_did_not_opens_report200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_did_not_opens_report200_response_tracking_activities_inner.rb +320 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity200_response.rb +405 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb +520 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity200_response_physical_address_in_footer.rb +347 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_preview200_response.rb +285 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_report200_response.rb +229 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_report200_response_results_inner.rb +244 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_report200_response_results_inner_stats.rb +476 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_schedule200_response_inner.rb +215 -0
- data/lib/constant_contact_client/models/get_email_campaign_activity_send_history200_response_inner.rb +298 -0
- data/lib/constant_contact_client/models/get_email_campaign_report200_response.rb +249 -0
- data/lib/constant_contact_client/models/get_email_campaign_report200_response_aggregate_percents.rb +256 -0
- data/lib/constant_contact_client/models/get_email_campaign_report200_response_bulk_email_campaign_summaries_inner.rb +272 -0
- data/lib/constant_contact_client/models/get_email_campaign_report200_response_bulk_email_campaign_summaries_inner_unique_counts.rb +342 -0
- data/lib/constant_contact_client/models/get_email_campaign_xrefs200_response.rb +217 -0
- data/lib/constant_contact_client/models/get_email_campaign_xrefs200_response_xrefs_inner.rb +235 -0
- data/lib/constant_contact_client/models/get_email_opens_report200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_email_opens_report200_response_tracking_activities_inner.rb +330 -0
- data/lib/constant_contact_client/models/get_email_sends_report200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_email_sends_report200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_email_sends_report200_response_tracking_activities_inner.rb +320 -0
- data/lib/constant_contact_client/models/get_email_stats_report200_response.rb +229 -0
- data/lib/constant_contact_client/models/get_email_stats_report200_response_errors_inner.rb +225 -0
- data/lib/constant_contact_client/models/get_email_stats_report200_response_results_inner.rb +243 -0
- data/lib/constant_contact_client/models/get_email_stats_report200_response_results_inner_percents.rb +296 -0
- data/lib/constant_contact_client/models/get_email_stats_report200_response_results_inner_stats.rb +396 -0
- data/lib/constant_contact_client/models/get_forwards_report200_response.rb +233 -0
- data/lib/constant_contact_client/models/get_forwards_report200_response_tracking_activities_inner.rb +320 -0
- data/lib/constant_contact_client/models/get_list200_response.rb +301 -0
- data/lib/constant_contact_client/models/get_list_id_xrefs200_response.rb +236 -0
- data/lib/constant_contact_client/models/get_list_id_xrefs200_response_xrefs_inner.rb +226 -0
- data/lib/constant_contact_client/models/get_optouts_report200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_optouts_report200_response_tracking_activities_inner.rb +330 -0
- data/lib/constant_contact_client/models/get_resend_email_campaign200_response_inner.rb +265 -0
- data/lib/constant_contact_client/models/get_sms_engagement_history200_response_inner.rb +255 -0
- data/lib/constant_contact_client/models/get_sms_engagement_history200_response_inner_history_details.rb +316 -0
- data/lib/constant_contact_client/models/get_tag200_response.rb +265 -0
- data/lib/constant_contact_client/models/get_unique_contact_clicks200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_unique_contact_clicks200_response_links.rb +222 -0
- data/lib/constant_contact_client/models/get_unique_contact_clicks200_response_links_next.rb +223 -0
- data/lib/constant_contact_client/models/get_unique_contact_clicks200_response_tracking_activities_inner.rb +366 -0
- data/lib/constant_contact_client/models/get_unique_contact_clicks200_response_tracking_activities_inner_sms_channel.rb +246 -0
- data/lib/constant_contact_client/models/get_unique_contact_opens200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_unique_contact_opens200_response_tracking_activities_inner.rb +339 -0
- data/lib/constant_contact_client/models/get_unique_contact_sms_opt_ins200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_unique_contact_sms_opt_ins200_response_tracking_activities_inner.rb +329 -0
- data/lib/constant_contact_client/models/get_unique_contact_updates200_response.rb +240 -0
- data/lib/constant_contact_client/models/get_unique_contact_updates200_response_tracking_activities_inner.rb +329 -0
- data/lib/constant_contact_client/models/get_user_privileges200_response_inner.rb +225 -0
- data/lib/constant_contact_client/models/headers_object.rb +225 -0
- data/lib/constant_contact_client/models/history_details.rb +316 -0
- data/lib/constant_contact_client/models/json_import_contact.rb +1315 -0
- data/lib/constant_contact_client/models/link.rb +214 -0
- data/lib/constant_contact_client/models/links.rb +221 -0
- data/lib/constant_contact_client/models/list_activity_add_contacts.rb +268 -0
- data/lib/constant_contact_client/models/list_activity_remove_contacts.rb +268 -0
- data/lib/constant_contact_client/models/list_id_list100.rb +243 -0
- data/lib/constant_contact_client/models/list_input.rb +263 -0
- data/lib/constant_contact_client/models/list_xref.rb +226 -0
- data/lib/constant_contact_client/models/list_xrefs.rb +236 -0
- data/lib/constant_contact_client/models/lpreporting_links.rb +221 -0
- data/lib/constant_contact_client/models/lpreporting_next.rb +222 -0
- data/lib/constant_contact_client/models/model_next.rb +222 -0
- data/lib/constant_contact_client/models/my_library_file_collection_inner.rb +384 -0
- data/lib/constant_contact_client/models/my_library_file_collection_inner_thumbnail.rb +235 -0
- data/lib/constant_contact_client/models/note.rb +255 -0
- data/lib/constant_contact_client/models/o_auth_error.rb +223 -0
- data/lib/constant_contact_client/models/opens_tracking_activities_page.rb +233 -0
- data/lib/constant_contact_client/models/opens_tracking_activity.rb +330 -0
- data/lib/constant_contact_client/models/optouts_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/optouts_tracking_activity.rb +330 -0
- data/lib/constant_contact_client/models/p_contact_add_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/p_contact_add_tracking_activity.rb +329 -0
- data/lib/constant_contact_client/models/p_contact_click_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/p_contact_click_tracking_activity.rb +366 -0
- data/lib/constant_contact_client/models/p_contact_open_tracking_activity.rb +339 -0
- data/lib/constant_contact_client/models/p_contact_opens_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/p_contact_sms_opt_in_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/p_contact_sms_opt_in_tracking_activity.rb +329 -0
- data/lib/constant_contact_client/models/p_contact_update_tracking_activities_page.rb +240 -0
- data/lib/constant_contact_client/models/p_contact_update_tracking_activity.rb +329 -0
- data/lib/constant_contact_client/models/paged_email_campaign_response.rb +225 -0
- data/lib/constant_contact_client/models/pagination_links.rb +214 -0
- data/lib/constant_contact_client/models/pagination_links_next.rb +215 -0
- data/lib/constant_contact_client/models/paging_links.rb +214 -0
- data/lib/constant_contact_client/models/partner_account.rb +233 -0
- data/lib/constant_contact_client/models/partner_account_links.rb +215 -0
- data/lib/constant_contact_client/models/partner_account_operations_request.rb +286 -0
- data/lib/constant_contact_client/models/partner_account_operations_request_account_operation_headers_inner.rb +225 -0
- data/lib/constant_contact_client/models/partner_account_operations_request_account_operation_path_parameters_inner.rb +225 -0
- data/lib/constant_contact_client/models/partner_account_operations_request_account_operation_query_parameters_inner.rb +225 -0
- data/lib/constant_contact_client/models/partner_account_site_owner_list_inner.rb +265 -0
- data/lib/constant_contact_client/models/partners_link.rb +214 -0
- data/lib/constant_contact_client/models/patch_email_campaign_name_request.rb +241 -0
- data/lib/constant_contact_client/models/path_param_object.rb +225 -0
- data/lib/constant_contact_client/models/percents_email.rb +295 -0
- data/lib/constant_contact_client/models/phone_number.rb +294 -0
- data/lib/constant_contact_client/models/phone_number_put.rb +244 -0
- data/lib/constant_contact_client/models/plan_info.rb +236 -0
- data/lib/constant_contact_client/models/plan_tiers_object.rb +248 -0
- data/lib/constant_contact_client/models/plan_tiers_object_current_tiers_inner.rb +278 -0
- data/lib/constant_contact_client/models/post_custom_field_delete201_response.rb +297 -0
- data/lib/constant_contact_client/models/post_custom_field_delete_request.rb +243 -0
- data/lib/constant_contact_client/models/post_tag_request.rb +260 -0
- data/lib/constant_contact_client/models/provision.rb +723 -0
- data/lib/constant_contact_client/models/provision_response.rb +225 -0
- data/lib/constant_contact_client/models/put_tag_request.rb +250 -0
- data/lib/constant_contact_client/models/query_param_object.rb +225 -0
- data/lib/constant_contact_client/models/reporting_links.rb +221 -0
- data/lib/constant_contact_client/models/reporting_next.rb +222 -0
- data/lib/constant_contact_client/models/resend_to_non_openers_input.rb +242 -0
- data/lib/constant_contact_client/models/resend_to_non_openers_object.rb +255 -0
- data/lib/constant_contact_client/models/schedule_email_campaign_activity_request.rb +222 -0
- data/lib/constant_contact_client/models/segment_data.rb +258 -0
- data/lib/constant_contact_client/models/segment_detail.rb +274 -0
- data/lib/constant_contact_client/models/segment_master.rb +245 -0
- data/lib/constant_contact_client/models/segment_name.rb +222 -0
- data/lib/constant_contact_client/models/segments_dto.rb +233 -0
- data/lib/constant_contact_client/models/sends_tracking_activities_page.rb +233 -0
- data/lib/constant_contact_client/models/sends_tracking_activity.rb +320 -0
- data/lib/constant_contact_client/models/sms_channel_consent_details.rb +285 -0
- data/lib/constant_contact_client/models/sso_user.rb +439 -0
- data/lib/constant_contact_client/models/stats_email.rb +395 -0
- data/lib/constant_contact_client/models/stats_email_activity.rb +475 -0
- data/lib/constant_contact_client/models/stats_error.rb +225 -0
- data/lib/constant_contact_client/models/street_address.rb +397 -0
- data/lib/constant_contact_client/models/street_address_put.rb +367 -0
- data/lib/constant_contact_client/models/tag.rb +265 -0
- data/lib/constant_contact_client/models/tag_add_remove_contacts.rb +268 -0
- data/lib/constant_contact_client/models/tag_id_list500_limit.rb +243 -0
- data/lib/constant_contact_client/models/tag_post.rb +260 -0
- data/lib/constant_contact_client/models/tag_put.rb +250 -0
- data/lib/constant_contact_client/models/tags.rb +226 -0
- data/lib/constant_contact_client/models/tags_activity_links.rb +214 -0
- data/lib/constant_contact_client/models/tags_links.rb +223 -0
- data/lib/constant_contact_client/models/tags_paging_links.rb +214 -0
- data/lib/constant_contact_client/models/test_send_email_campaign_activity_request.rb +253 -0
- data/lib/constant_contact_client/models/tier_object.rb +278 -0
- data/lib/constant_contact_client/models/tracking_activity_sms_channel_dto.rb +245 -0
- data/lib/constant_contact_client/models/unique_email_counts.rb +341 -0
- data/lib/constant_contact_client/models/update_account_request.rb +334 -0
- data/lib/constant_contact_client/models/update_contact_request.rb +582 -0
- data/lib/constant_contact_client/models/update_contact_request_email_address.rb +341 -0
- data/lib/constant_contact_client/models/update_contact_request_phone_numbers_inner.rb +244 -0
- data/lib/constant_contact_client/models/update_contact_request_street_addresses_inner.rb +367 -0
- data/lib/constant_contact_client/models/update_custom_field_request.rb +258 -0
- data/lib/constant_contact_client/models/update_list200_response.rb +291 -0
- data/lib/constant_contact_client/models/update_list_request.rb +263 -0
- data/lib/constant_contact_client/models/update_segment_name_request.rb +222 -0
- data/lib/constant_contact_client/models/webhooks_subscription_body.rb +215 -0
- data/lib/constant_contact_client/models/webhooks_subscription_collection_inner.rb +245 -0
- data/lib/constant_contact_client/models/webhooks_subscription_put_resp.rb +225 -0
- data/lib/constant_contact_client/models/webhooks_subscription_response.rb +245 -0
- data/lib/constant_contact_client/models/webhooks_test_send.rb +245 -0
- data/lib/constant_contact_client/version.rb +15 -0
- data/lib/constant_contact_client.rb +417 -0
- data/spec/spec_helper.rb +111 -0
- metadata +488 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Constant Contact API v3
|
|
3
|
+
|
|
4
|
+
#Swagger build version 3.0.2475
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.101
|
|
7
|
+
Contact: webservices@constantcontact.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 7.2.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'logger'
|
|
16
|
+
require 'tempfile'
|
|
17
|
+
require 'time'
|
|
18
|
+
require 'typhoeus'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
module ConstantContactClient
|
|
22
|
+
class ApiClient
|
|
23
|
+
# The Configuration object holding settings to be used in the API client.
|
|
24
|
+
attr_accessor :config
|
|
25
|
+
|
|
26
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
|
27
|
+
#
|
|
28
|
+
# @return [Hash]
|
|
29
|
+
attr_accessor :default_headers
|
|
30
|
+
|
|
31
|
+
# Initializes the ApiClient
|
|
32
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
33
|
+
def initialize(config = Configuration.default)
|
|
34
|
+
@config = config
|
|
35
|
+
@user_agent = "ConstantContactApiRuby/1.0.0"
|
|
36
|
+
@default_headers = {
|
|
37
|
+
'Content-Type' => 'application/json',
|
|
38
|
+
'User-Agent' => @user_agent
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.default
|
|
43
|
+
@@default ||= ApiClient.new
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Call an API with given options.
|
|
47
|
+
#
|
|
48
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
|
50
|
+
def call_api(http_method, path, opts = {})
|
|
51
|
+
request = build_request(http_method, path, opts)
|
|
52
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
|
53
|
+
response = request.run
|
|
54
|
+
|
|
55
|
+
if @config.debugging
|
|
56
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
unless response.success?
|
|
60
|
+
if response.timed_out?
|
|
61
|
+
fail ApiError.new('Connection timed out')
|
|
62
|
+
elsif response.code == 0
|
|
63
|
+
# Errors from libcurl will be made visible here
|
|
64
|
+
fail ApiError.new(:code => 0,
|
|
65
|
+
:message => response.return_message)
|
|
66
|
+
else
|
|
67
|
+
fail ApiError.new(:code => response.code,
|
|
68
|
+
:response_headers => response.headers,
|
|
69
|
+
:response_body => response.body),
|
|
70
|
+
response.status_message
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if opts[:return_type] == 'File'
|
|
75
|
+
data = tempfile
|
|
76
|
+
elsif opts[:return_type]
|
|
77
|
+
data = deserialize(response, opts[:return_type])
|
|
78
|
+
else
|
|
79
|
+
data = nil
|
|
80
|
+
end
|
|
81
|
+
return data, response.code, response.headers
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Builds the HTTP request
|
|
85
|
+
#
|
|
86
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
|
87
|
+
# @param [String] path URL path (e.g. /account/new)
|
|
88
|
+
# @option opts [Hash] :header_params Header parameters
|
|
89
|
+
# @option opts [Hash] :query_params Query parameters
|
|
90
|
+
# @option opts [Hash] :form_params Query parameters
|
|
91
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
|
92
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
|
93
|
+
def build_request(http_method, path, opts = {})
|
|
94
|
+
url = build_request_url(path, opts)
|
|
95
|
+
http_method = http_method.to_sym.downcase
|
|
96
|
+
|
|
97
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
98
|
+
query_params = opts[:query_params] || {}
|
|
99
|
+
form_params = opts[:form_params] || {}
|
|
100
|
+
follow_location = opts[:follow_location] || true
|
|
101
|
+
|
|
102
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
|
103
|
+
|
|
104
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
|
105
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
|
106
|
+
|
|
107
|
+
req_opts = {
|
|
108
|
+
:method => http_method,
|
|
109
|
+
:headers => header_params,
|
|
110
|
+
:params => query_params,
|
|
111
|
+
:params_encoding => @config.params_encoding,
|
|
112
|
+
:timeout => @config.timeout,
|
|
113
|
+
:ssl_verifypeer => @config.verify_ssl,
|
|
114
|
+
:ssl_verifyhost => _verify_ssl_host,
|
|
115
|
+
:sslcert => @config.cert_file,
|
|
116
|
+
:sslkey => @config.key_file,
|
|
117
|
+
:verbose => @config.debugging,
|
|
118
|
+
:followlocation => follow_location
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# set custom cert, if provided
|
|
122
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
|
123
|
+
|
|
124
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
|
125
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
|
126
|
+
req_opts.update :body => req_body
|
|
127
|
+
if @config.debugging
|
|
128
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
Typhoeus::Request.new(url, req_opts)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Builds the HTTP request body
|
|
136
|
+
#
|
|
137
|
+
# @param [Hash] header_params Header parameters
|
|
138
|
+
# @param [Hash] form_params Query parameters
|
|
139
|
+
# @param [Object] body HTTP body (JSON/XML)
|
|
140
|
+
# @return [String] HTTP body data in the form of string
|
|
141
|
+
def build_request_body(header_params, form_params, body)
|
|
142
|
+
# http form
|
|
143
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
|
144
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
|
145
|
+
data = {}
|
|
146
|
+
form_params.each do |key, value|
|
|
147
|
+
case value
|
|
148
|
+
when ::File, ::Array, nil
|
|
149
|
+
# let typhoeus handle File, Array and nil parameters
|
|
150
|
+
data[key] = value
|
|
151
|
+
else
|
|
152
|
+
data[key] = value.to_s
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
elsif body
|
|
156
|
+
data = body.is_a?(String) ? body : body.to_json
|
|
157
|
+
else
|
|
158
|
+
data = nil
|
|
159
|
+
end
|
|
160
|
+
data
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
164
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
165
|
+
# The response body is written to the file in chunks in order to handle files which
|
|
166
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
167
|
+
# process can use.
|
|
168
|
+
#
|
|
169
|
+
# @see Configuration#temp_folder_path
|
|
170
|
+
#
|
|
171
|
+
# @return [Tempfile] the tempfile generated
|
|
172
|
+
def download_file(request)
|
|
173
|
+
tempfile = nil
|
|
174
|
+
encoding = nil
|
|
175
|
+
request.on_headers do |response|
|
|
176
|
+
content_disposition = response.headers['Content-Disposition']
|
|
177
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
178
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
179
|
+
prefix = sanitize_filename(filename)
|
|
180
|
+
else
|
|
181
|
+
prefix = 'download-'
|
|
182
|
+
end
|
|
183
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
184
|
+
encoding = response.body.encoding
|
|
185
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
186
|
+
end
|
|
187
|
+
request.on_body do |chunk|
|
|
188
|
+
chunk.force_encoding(encoding)
|
|
189
|
+
tempfile.write(chunk)
|
|
190
|
+
end
|
|
191
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
|
192
|
+
request.run
|
|
193
|
+
if tempfile
|
|
194
|
+
tempfile.close
|
|
195
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
196
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
197
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
198
|
+
"explicitly with `tempfile.delete`"
|
|
199
|
+
else
|
|
200
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
tempfile
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Check if the given MIME is a JSON MIME.
|
|
207
|
+
# JSON MIME examples:
|
|
208
|
+
# application/json
|
|
209
|
+
# application/json; charset=UTF8
|
|
210
|
+
# APPLICATION/JSON
|
|
211
|
+
# */*
|
|
212
|
+
# @param [String] mime MIME
|
|
213
|
+
# @return [Boolean] True if the MIME is application/json
|
|
214
|
+
def json_mime?(mime)
|
|
215
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Deserialize the response to the given return type.
|
|
219
|
+
#
|
|
220
|
+
# @param [Response] response HTTP response
|
|
221
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
|
222
|
+
def deserialize(response, return_type)
|
|
223
|
+
body = response.body
|
|
224
|
+
return nil if body.nil? || body.empty?
|
|
225
|
+
|
|
226
|
+
# return response body directly for String return type
|
|
227
|
+
return body.to_s if return_type == 'String'
|
|
228
|
+
|
|
229
|
+
# ensuring a default content type
|
|
230
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
|
231
|
+
|
|
232
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
|
233
|
+
|
|
234
|
+
begin
|
|
235
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
|
236
|
+
rescue JSON::ParserError => e
|
|
237
|
+
if %w(String Date Time).include?(return_type)
|
|
238
|
+
data = body
|
|
239
|
+
else
|
|
240
|
+
raise e
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
convert_to_type data, return_type
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Convert data to the given return type.
|
|
248
|
+
# @param [Object] data Data to be converted
|
|
249
|
+
# @param [String] return_type Return type
|
|
250
|
+
# @return [Mixed] Data in a particular type
|
|
251
|
+
def convert_to_type(data, return_type)
|
|
252
|
+
return nil if data.nil?
|
|
253
|
+
case return_type
|
|
254
|
+
when 'String'
|
|
255
|
+
data.to_s
|
|
256
|
+
when 'Integer'
|
|
257
|
+
data.to_i
|
|
258
|
+
when 'Float'
|
|
259
|
+
data.to_f
|
|
260
|
+
when 'Boolean'
|
|
261
|
+
data == true
|
|
262
|
+
when 'Time'
|
|
263
|
+
# parse date time (expecting ISO 8601 format)
|
|
264
|
+
Time.parse data
|
|
265
|
+
when 'Date'
|
|
266
|
+
# parse date time (expecting ISO 8601 format)
|
|
267
|
+
Date.parse data
|
|
268
|
+
when 'Object'
|
|
269
|
+
# generic object (usually a Hash), return directly
|
|
270
|
+
data
|
|
271
|
+
when /\AArray<(.+)>\z/
|
|
272
|
+
# e.g. Array<Pet>
|
|
273
|
+
sub_type = $1
|
|
274
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
|
275
|
+
when /\AHash\<String, (.+)\>\z/
|
|
276
|
+
# e.g. Hash<String, Integer>
|
|
277
|
+
sub_type = $1
|
|
278
|
+
{}.tap do |hash|
|
|
279
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
280
|
+
end
|
|
281
|
+
else
|
|
282
|
+
# models (e.g. Pet) or oneOf
|
|
283
|
+
klass = ConstantContactClient.const_get(return_type)
|
|
284
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Sanitize filename by removing path.
|
|
289
|
+
# e.g. ../../sun.gif becomes sun.gif
|
|
290
|
+
#
|
|
291
|
+
# @param [String] filename the filename to be sanitized
|
|
292
|
+
# @return [String] the sanitized filename
|
|
293
|
+
def sanitize_filename(filename)
|
|
294
|
+
filename.gsub(/.*[\/\\]/, '')
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def build_request_url(path, opts = {})
|
|
298
|
+
# Add leading and trailing slashes to path
|
|
299
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
|
300
|
+
@config.base_url(opts[:operation]) + path
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Update header and query params based on authentication settings.
|
|
304
|
+
#
|
|
305
|
+
# @param [Hash] header_params Header parameters
|
|
306
|
+
# @param [Hash] query_params Query parameters
|
|
307
|
+
# @param [String] auth_names Authentication scheme name
|
|
308
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
|
309
|
+
Array(auth_names).each do |auth_name|
|
|
310
|
+
auth_setting = @config.auth_settings[auth_name]
|
|
311
|
+
next unless auth_setting
|
|
312
|
+
case auth_setting[:in]
|
|
313
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
|
314
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
|
315
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Sets user agent in HTTP header
|
|
321
|
+
#
|
|
322
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
|
323
|
+
def user_agent=(user_agent)
|
|
324
|
+
@user_agent = user_agent
|
|
325
|
+
@default_headers['User-Agent'] = @user_agent
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Return Accept header based on an array of accepts provided.
|
|
329
|
+
# @param [Array] accepts array for Accept
|
|
330
|
+
# @return [String] the Accept header (e.g. application/json)
|
|
331
|
+
def select_header_accept(accepts)
|
|
332
|
+
return nil if accepts.nil? || accepts.empty?
|
|
333
|
+
# use JSON when present, otherwise use all of the provided
|
|
334
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
|
335
|
+
json_accept || accepts.join(',')
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# Return Content-Type header based on an array of content types provided.
|
|
339
|
+
# @param [Array] content_types array for Content-Type
|
|
340
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
|
341
|
+
def select_header_content_type(content_types)
|
|
342
|
+
# return nil by default
|
|
343
|
+
return if content_types.nil? || content_types.empty?
|
|
344
|
+
# use JSON when present, otherwise use the first one
|
|
345
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
|
346
|
+
json_content_type || content_types.first
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
|
350
|
+
# @param [Object] model object to be converted into JSON string
|
|
351
|
+
# @return [String] JSON string representation of the object
|
|
352
|
+
def object_to_http_body(model)
|
|
353
|
+
return model if model.nil? || model.is_a?(String)
|
|
354
|
+
local_body = nil
|
|
355
|
+
if model.is_a?(Array)
|
|
356
|
+
local_body = model.map { |m| object_to_hash(m) }
|
|
357
|
+
else
|
|
358
|
+
local_body = object_to_hash(model)
|
|
359
|
+
end
|
|
360
|
+
local_body.to_json
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Convert object(non-array) to hash.
|
|
364
|
+
# @param [Object] obj object to be converted into JSON string
|
|
365
|
+
# @return [String] JSON string representation of the object
|
|
366
|
+
def object_to_hash(obj)
|
|
367
|
+
if obj.respond_to?(:to_hash)
|
|
368
|
+
obj.to_hash
|
|
369
|
+
else
|
|
370
|
+
obj
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# Build parameter value according to the given collection format.
|
|
375
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
|
376
|
+
def build_collection_param(param, collection_format)
|
|
377
|
+
case collection_format
|
|
378
|
+
when :csv
|
|
379
|
+
param.join(',')
|
|
380
|
+
when :ssv
|
|
381
|
+
param.join(' ')
|
|
382
|
+
when :tsv
|
|
383
|
+
param.join("\t")
|
|
384
|
+
when :pipes
|
|
385
|
+
param.join('|')
|
|
386
|
+
when :multi
|
|
387
|
+
# return the array directly as typhoeus will handle it as expected
|
|
388
|
+
param
|
|
389
|
+
else
|
|
390
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Constant Contact API v3
|
|
3
|
+
|
|
4
|
+
#Swagger build version 3.0.2475
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.101
|
|
7
|
+
Contact: webservices@constantcontact.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 7.2.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module ConstantContactClient
|
|
14
|
+
class ApiError < StandardError
|
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
|
16
|
+
|
|
17
|
+
# Usage examples:
|
|
18
|
+
# ApiError.new
|
|
19
|
+
# ApiError.new("message")
|
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
|
22
|
+
def initialize(arg = nil)
|
|
23
|
+
if arg.is_a? Hash
|
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
|
25
|
+
super(arg[:message] || arg['message'])
|
|
26
|
+
else
|
|
27
|
+
super arg
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
arg.each do |k, v|
|
|
31
|
+
instance_variable_set "@#{k}", v
|
|
32
|
+
end
|
|
33
|
+
else
|
|
34
|
+
super arg
|
|
35
|
+
@message = arg
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Override to_s to display a friendly error message
|
|
40
|
+
def to_s
|
|
41
|
+
message
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def message
|
|
45
|
+
if @message.nil?
|
|
46
|
+
msg = "Error message: the server returns an error"
|
|
47
|
+
else
|
|
48
|
+
msg = @message
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
msg += "\nHTTP status code: #{code}" if code
|
|
52
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
|
53
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
|
54
|
+
|
|
55
|
+
msg
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|