=begin PureCloud Platform API With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more. OpenAPI spec version: v2 Contact: DeveloperEvangelists@inin.com Generated by: https://github.com/swagger-api/swagger-codegen.git License: ININ http://www.inin.com Terms of Service: https://developer.mypurecloud.com/tos =end # Common files require 'purecloud/api_client' require 'purecloud/api_error' require 'purecloud/version' require 'purecloud/configuration' # Models require 'purecloud/models/adfs' require 'purecloud/models/actions' require 'purecloud/models/acw_settings' require 'purecloud/models/agent' require 'purecloud/models/agent_activity' require 'purecloud/models/agent_activity_entity_listing' require 'purecloud/models/agent_evaluator_activity' require 'purecloud/models/aggregate_data_container' require 'purecloud/models/aggregate_metric_data' require 'purecloud/models/aggregate_query_response' require 'purecloud/models/aggregation_query' require 'purecloud/models/aggregation_range' require 'purecloud/models/aggregation_result' require 'purecloud/models/aggregation_result_entry' require 'purecloud/models/analytics_conversation' require 'purecloud/models/analytics_conversation_query_response' require 'purecloud/models/analytics_conversation_segment' require 'purecloud/models/analytics_evaluation' require 'purecloud/models/analytics_participant' require 'purecloud/models/analytics_property' require 'purecloud/models/analytics_query_aggregation' require 'purecloud/models/analytics_query_clause' require 'purecloud/models/analytics_query_filter' require 'purecloud/models/analytics_query_predicate' require 'purecloud/models/analytics_session' require 'purecloud/models/annotation' require 'purecloud/models/archive_retention' require 'purecloud/models/attachment' require 'purecloud/models/attribute' require 'purecloud/models/attribute_entity_listing' require 'purecloud/models/attribute_filter_item' require 'purecloud/models/attribute_query_request' require 'purecloud/models/audit_change' require 'purecloud/models/audit_entity' require 'purecloud/models/audit_entity_reference' require 'purecloud/models/audit_facet' require 'purecloud/models/audit_filter' require 'purecloud/models/audit_message' require 'purecloud/models/audit_search_result' require 'purecloud/models/audit_user' require 'purecloud/models/available_language_list' require 'purecloud/models/available_topic' require 'purecloud/models/available_topic_entity_listing' require 'purecloud/models/bullseye' require 'purecloud/models/calibration' require 'purecloud/models/calibration_assignment' require 'purecloud/models/calibration_entity_listing' require 'purecloud/models/call' require 'purecloud/models/call_command' require 'purecloud/models/call_conversation' require 'purecloud/models/call_conversation_entity_listing' require 'purecloud/models/call_forwarding' require 'purecloud/models/call_media_participant' require 'purecloud/models/call_media_policy' require 'purecloud/models/call_media_policy_conditions' require 'purecloud/models/call_record' require 'purecloud/models/callable_contacts_diagnostic' require 'purecloud/models/callable_time' require 'purecloud/models/callable_time_set' require 'purecloud/models/callable_time_set_entity_listing' require 'purecloud/models/callback' require 'purecloud/models/callback_conversation' require 'purecloud/models/callback_conversation_entity_listing' require 'purecloud/models/callback_identifier' require 'purecloud/models/callback_media_participant' require 'purecloud/models/campaign' require 'purecloud/models/campaign_diagnostics' require 'purecloud/models/campaign_entity_listing' require 'purecloud/models/campaign_progress' require 'purecloud/models/campaign_schedule' require 'purecloud/models/campaign_sequence' require 'purecloud/models/campaign_sequence_entity_listing' require 'purecloud/models/campaign_stats' require 'purecloud/models/campaign_time_slot' require 'purecloud/models/certificate' require 'purecloud/models/certificate_authority_entity_listing' require 'purecloud/models/certificate_details' require 'purecloud/models/change' require 'purecloud/models/channel' require 'purecloud/models/channel_entity_listing' require 'purecloud/models/channel_topic' require 'purecloud/models/channel_topic_entity_listing' require 'purecloud/models/chat' require 'purecloud/models/chat_conversation' require 'purecloud/models/chat_conversation_entity_listing' require 'purecloud/models/chat_media_participant' require 'purecloud/models/chat_media_policy' require 'purecloud/models/chat_media_policy_conditions' require 'purecloud/models/chat_message' require 'purecloud/models/chat_message_user' require 'purecloud/models/command_status' require 'purecloud/models/command_status_entity_listing' require 'purecloud/models/condition' require 'purecloud/models/connect_rate' require 'purecloud/models/consult_transfer' require 'purecloud/models/consult_transfer_response' require 'purecloud/models/consult_transfer_update' require 'purecloud/models/contact' require 'purecloud/models/contact_callback_request' require 'purecloud/models/contact_list' require 'purecloud/models/contact_list_entity_listing' require 'purecloud/models/contact_phone_number_column' require 'purecloud/models/contact_sort' require 'purecloud/models/content_attribute_filter_item' require 'purecloud/models/content_facet_filter_item' require 'purecloud/models/content_filter_item' require 'purecloud/models/content_query_request' require 'purecloud/models/content_sort_item' require 'purecloud/models/conversation' require 'purecloud/models/conversation_chat' require 'purecloud/models/conversation_entity_listing' require 'purecloud/models/conversation_query' require 'purecloud/models/cover_sheet' require 'purecloud/models/create_call_request' require 'purecloud/models/create_call_response' require 'purecloud/models/create_callback_command' require 'purecloud/models/create_callback_response' require 'purecloud/models/create_share_request' require 'purecloud/models/create_share_request_member' require 'purecloud/models/create_share_response' require 'purecloud/models/create_user' require 'purecloud/models/customer_interaction_center' require 'purecloud/models/did' require 'purecloud/models/did_entity_listing' require 'purecloud/models/did_pool' require 'purecloud/models/did_pool_entity_listing' require 'purecloud/models/default_greeting_list' require 'purecloud/models/delete_retention' require 'purecloud/models/destination' require 'purecloud/models/detail' require 'purecloud/models/dialer_action' require 'purecloud/models/dialer_audit_request' require 'purecloud/models/dialer_contact' require 'purecloud/models/dialer_contact_entity_listing' require 'purecloud/models/dialer_preview' require 'purecloud/models/dialer_rule' require 'purecloud/models/digit_length' require 'purecloud/models/disconnect_reason' require 'purecloud/models/dnc_list' require 'purecloud/models/dnc_list_entity_listing' require 'purecloud/models/document' require 'purecloud/models/document_attribute' require 'purecloud/models/document_audit' require 'purecloud/models/document_audit_entity_listing' require 'purecloud/models/document_entity_listing' require 'purecloud/models/document_thumbnail' require 'purecloud/models/document_update' require 'purecloud/models/document_upload' require 'purecloud/models/domain_capabilities' require 'purecloud/models/domain_certificate_authority' require 'purecloud/models/domain_edge_software_update_dto' require 'purecloud/models/domain_edge_software_version_dto' require 'purecloud/models/domain_entity' require 'purecloud/models/domain_entity_listing' require 'purecloud/models/domain_entity_listing_evaluation_form' require 'purecloud/models/domain_entity_listing_query_result' require 'purecloud/models/domain_logical_interface' require 'purecloud/models/domain_network_address' require 'purecloud/models/domain_network_command_response' require 'purecloud/models/domain_network_route' require 'purecloud/models/domain_org_role_difference' require 'purecloud/models/domain_organization_product' require 'purecloud/models/domain_organization_role' require 'purecloud/models/domain_permission' require 'purecloud/models/domain_permission_collection' require 'purecloud/models/domain_permission_policy' require 'purecloud/models/domain_physical_capabilities' require 'purecloud/models/domain_physical_interface' require 'purecloud/models/domain_resource_condition_node' require 'purecloud/models/domain_resource_condition_value' require 'purecloud/models/domain_role' require 'purecloud/models/domain_schema_reference' require 'purecloud/models/download_response' require 'purecloud/models/duration_condition' require 'purecloud/models/edge' require 'purecloud/models/edge_auto_update_config' require 'purecloud/models/edge_entity_listing' require 'purecloud/models/edge_group' require 'purecloud/models/edge_group_entity_listing' require 'purecloud/models/edge_interface' require 'purecloud/models/edge_line' require 'purecloud/models/edge_line_entity_listing' require 'purecloud/models/edge_logs_job' require 'purecloud/models/edge_logs_job_file' require 'purecloud/models/edge_logs_job_request' require 'purecloud/models/edge_logs_job_response' require 'purecloud/models/edge_logs_job_upload_request' require 'purecloud/models/edge_version_information' require 'purecloud/models/edge_version_report' require 'purecloud/models/email' require 'purecloud/models/email_address' require 'purecloud/models/email_attachment' require 'purecloud/models/email_conversation' require 'purecloud/models/email_conversation_entity_listing' require 'purecloud/models/email_media_participant' require 'purecloud/models/email_media_policy' require 'purecloud/models/email_media_policy_conditions' require 'purecloud/models/email_message' require 'purecloud/models/email_message_listing' require 'purecloud/models/email_setup' require 'purecloud/models/encryption_key' require 'purecloud/models/encryption_key_entity_listing' require 'purecloud/models/endpoint' require 'purecloud/models/endpoint_entity_listing' require 'purecloud/models/entry' require 'purecloud/models/error_body' require 'purecloud/models/error_details' require 'purecloud/models/estimated_wait_time_predictions' require 'purecloud/models/evaluation' require 'purecloud/models/evaluation_assignment' require 'purecloud/models/evaluation_entity_listing' require 'purecloud/models/evaluation_form' require 'purecloud/models/evaluation_form_and_scoring_set' require 'purecloud/models/evaluation_form_entity_listing' require 'purecloud/models/evaluation_scoring_set' require 'purecloud/models/evaluator_activity' require 'purecloud/models/evaluator_activity_entity_listing' require 'purecloud/models/expansion_criterium' require 'purecloud/models/export_uri' require 'purecloud/models/extension' require 'purecloud/models/extension_entity_listing' require 'purecloud/models/extension_pool' require 'purecloud/models/extension_pool_entity_listing' require 'purecloud/models/facet_entry' require 'purecloud/models/facet_info' require 'purecloud/models/facet_key_attribute' require 'purecloud/models/facet_statistics' require 'purecloud/models/facet_term' require 'purecloud/models/fax_document' require 'purecloud/models/fax_document_entity_listing' require 'purecloud/models/fax_send_request' require 'purecloud/models/fax_send_response' require 'purecloud/models/fax_summary' require 'purecloud/models/geolocation' require 'purecloud/models/geolocation_settings' require 'purecloud/models/greeting' require 'purecloud/models/greeting_audio_file' require 'purecloud/models/greeting_media_info' require 'purecloud/models/greeting_owner' require 'purecloud/models/group' require 'purecloud/models/group_entity_listing' require 'purecloud/models/group_members_update' require 'purecloud/models/group_search_criteria' require 'purecloud/models/group_search_request' require 'purecloud/models/groups_search_response' require 'purecloud/models/import_status' require 'purecloud/models/inbound_domain' require 'purecloud/models/inbound_domain_entity_listing' require 'purecloud/models/inbound_route' require 'purecloud/models/inbound_route_entity_listing' require 'purecloud/models/initiate_screen_recording' require 'purecloud/models/interaction_stats_alert' require 'purecloud/models/interaction_stats_alert_container' require 'purecloud/models/interaction_stats_rule' require 'purecloud/models/interaction_stats_rule_container' require 'purecloud/models/json_node' require 'purecloud/models/json_node_search_response' require 'purecloud/models/key_rotation_schedule' require 'purecloud/models/keyword' require 'purecloud/models/keyword_set' require 'purecloud/models/keyword_set_entity_listing' require 'purecloud/models/language' require 'purecloud/models/language_entity_listing' require 'purecloud/models/library' require 'purecloud/models/library_entity_listing' require 'purecloud/models/line' require 'purecloud/models/line_base' require 'purecloud/models/line_base_entity_listing' require 'purecloud/models/line_entity_listing' require 'purecloud/models/line_status' require 'purecloud/models/location' require 'purecloud/models/location_address' require 'purecloud/models/location_emergency_number' require 'purecloud/models/location_search_criteria' require 'purecloud/models/location_search_request' require 'purecloud/models/locations_search_response' require 'purecloud/models/lock_info' require 'purecloud/models/logical_interface_entity_listing' require 'purecloud/models/max_participants' require 'purecloud/models/media_participant_request' require 'purecloud/models/media_policies' require 'purecloud/models/media_result' require 'purecloud/models/media_setting' require 'purecloud/models/media_summary' require 'purecloud/models/media_summary_detail' require 'purecloud/models/member_entity' require 'purecloud/models/metabase' require 'purecloud/models/metered_evaluation_assignment' require 'purecloud/models/number' require 'purecloud/models/number_plan' require 'purecloud/models/numeric_range' require 'purecloud/models/o_auth_client' require 'purecloud/models/o_auth_client_entity_listing' require 'purecloud/models/o_auth_provider' require 'purecloud/models/o_auth_provider_entity_listing' require 'purecloud/models/observation_data_container' require 'purecloud/models/observation_query' require 'purecloud/models/observation_query_response' require 'purecloud/models/okta' require 'purecloud/models/one_login' require 'purecloud/models/org_media_utilization' require 'purecloud/models/organization' require 'purecloud/models/organization_presence' require 'purecloud/models/organization_presence_entity_listing' require 'purecloud/models/organization_product_entity_listing' require 'purecloud/models/organization_role_entity_listing' require 'purecloud/models/orphan_recording' require 'purecloud/models/orphan_recording_listing' require 'purecloud/models/out_of_office' require 'purecloud/models/outbound_route' require 'purecloud/models/outbound_route_entity_listing' require 'purecloud/models/pin_configuration' require 'purecloud/models/paging_spec' require 'purecloud/models/parameter' require 'purecloud/models/parsed_certificate' require 'purecloud/models/participant' require 'purecloud/models/participant_attributes' require 'purecloud/models/permission_collection_entity_listing' require 'purecloud/models/phone' require 'purecloud/models/phone_base' require 'purecloud/models/phone_base_entity_listing' require 'purecloud/models/phone_capabilities' require 'purecloud/models/phone_column' require 'purecloud/models/phone_entity_listing' require 'purecloud/models/phone_meta_base_entity_listing' require 'purecloud/models/phone_number_column' require 'purecloud/models/phone_number_status' require 'purecloud/models/phone_status' require 'purecloud/models/phones_reboot' require 'purecloud/models/physical_interface_entity_listing' require 'purecloud/models/policy' require 'purecloud/models/policy_actions' require 'purecloud/models/policy_conditions' require 'purecloud/models/policy_entity_listing' require 'purecloud/models/policy_error_message' require 'purecloud/models/policy_errors' require 'purecloud/models/prediction_results' require 'purecloud/models/presence_query_response' require 'purecloud/models/property_index_request' require 'purecloud/models/provision_info' require 'purecloud/models/pure_cloud' require 'purecloud/models/qualifier_mapping_observation_query_response' require 'purecloud/models/quality_audit' require 'purecloud/models/quality_audit_page' require 'purecloud/models/query_facet_info' require 'purecloud/models/query_request' require 'purecloud/models/query_result' require 'purecloud/models/query_results' require 'purecloud/models/question_group' require 'purecloud/models/question_group_score' require 'purecloud/models/question_score' require 'purecloud/models/queue' require 'purecloud/models/queue_entity_listing' require 'purecloud/models/queue_member' require 'purecloud/models/queue_utilization_diagnostic' require 'purecloud/models/reaction' require 'purecloud/models/recording' require 'purecloud/models/recording_email_message' require 'purecloud/models/recording_settings' require 'purecloud/models/replace_request' require 'purecloud/models/replace_response' require 'purecloud/models/report_meta_data' require 'purecloud/models/report_meta_data_entity_listing' require 'purecloud/models/report_run_entry' require 'purecloud/models/report_run_entry_entity_domain_listing' require 'purecloud/models/report_schedule' require 'purecloud/models/report_schedule_entity_listing' require 'purecloud/models/resource_condition_node' require 'purecloud/models/resource_condition_value' require 'purecloud/models/resource_permission_policy' require 'purecloud/models/response' require 'purecloud/models/response_entity_list' require 'purecloud/models/response_entity_listing' require 'purecloud/models/response_filter' require 'purecloud/models/response_query_request' require 'purecloud/models/response_query_results' require 'purecloud/models/response_set' require 'purecloud/models/response_set_entity_listing' require 'purecloud/models/response_text' require 'purecloud/models/rest_error_detail' require 'purecloud/models/retention_duration' require 'purecloud/models/ring' require 'purecloud/models/routing_data' require 'purecloud/models/routing_skill' require 'purecloud/models/routing_status' require 'purecloud/models/rule_set' require 'purecloud/models/rule_set_entity_listing' require 'purecloud/models/run_now_response' require 'purecloud/models/salesforce' require 'purecloud/models/schedule_interval' require 'purecloud/models/schema_category' require 'purecloud/models/schema_category_entity_listing' require 'purecloud/models/schema_reference_entity_listing' require 'purecloud/models/screen_recording_session' require 'purecloud/models/screen_recording_session_listing' require 'purecloud/models/search_aggregation' require 'purecloud/models/search_criteria' require 'purecloud/models/search_request' require 'purecloud/models/security_profile' require 'purecloud/models/security_profile_entity_listing' require 'purecloud/models/segment' require 'purecloud/models/sequence_schedule' require 'purecloud/models/server_date' require 'purecloud/models/service_context' require 'purecloud/models/service_level' require 'purecloud/models/share' require 'purecloud/models/share_entity_listing' require 'purecloud/models/shared_entity' require 'purecloud/models/site' require 'purecloud/models/site_entity_listing' require 'purecloud/models/skill_entity_listing' require 'purecloud/models/skills_to_remove' require 'purecloud/models/social_expression' require 'purecloud/models/sort_item' require 'purecloud/models/station' require 'purecloud/models/station_entity_listing' require 'purecloud/models/statistical_response' require 'purecloud/models/statistical_summary' require 'purecloud/models/street_address' require 'purecloud/models/subscriber_response' require 'purecloud/models/suggest_search_criteria' require 'purecloud/models/suggest_search_request' require 'purecloud/models/system_presence' require 'purecloud/models/tag_query_request' require 'purecloud/models/tag_value' require 'purecloud/models/tag_value_entity_listing' require 'purecloud/models/term_attribute' require 'purecloud/models/time_allowed' require 'purecloud/models/time_interval' require 'purecloud/models/time_slot' require 'purecloud/models/time_zone' require 'purecloud/models/time_zone_entity_listing' require 'purecloud/models/transfer_request' require 'purecloud/models/trunk' require 'purecloud/models/trunk_base' require 'purecloud/models/trunk_base_assignment' require 'purecloud/models/trunk_entity_listing' require 'purecloud/models/trunk_metabase_entity_listing' require 'purecloud/models/trunk_recording_enabled_count' require 'purecloud/models/unread_metric' require 'purecloud/models/unread_status' require 'purecloud/models/uri_reference' require 'purecloud/models/usage' require 'purecloud/models/usage_item' require 'purecloud/models/user' require 'purecloud/models/user_authorization' require 'purecloud/models/user_conversation_summary' require 'purecloud/models/user_entity_listing' require 'purecloud/models/user_image' require 'purecloud/models/user_me' require 'purecloud/models/user_param' require 'purecloud/models/user_presence' require 'purecloud/models/user_queue' require 'purecloud/models/user_queue_entity_listing' require 'purecloud/models/user_recording' require 'purecloud/models/user_recording_entity_listing' require 'purecloud/models/user_routing_skill' require 'purecloud/models/user_search_criteria' require 'purecloud/models/user_search_request' require 'purecloud/models/user_skill_entity_listing' require 'purecloud/models/user_station' require 'purecloud/models/user_stations' require 'purecloud/models/users_entity_listing' require 'purecloud/models/users_search_response' require 'purecloud/models/utilization' require 'purecloud/models/validate_address_request' require 'purecloud/models/validate_address_response' require 'purecloud/models/video' require 'purecloud/models/voicemail_mailbox_info' require 'purecloud/models/voicemail_media_info' require 'purecloud/models/voicemail_message' require 'purecloud/models/voicemail_message_entity_listing' require 'purecloud/models/voicemail_organization_policy' require 'purecloud/models/voicemail_user_policy' require 'purecloud/models/workspace' require 'purecloud/models/workspace_create' require 'purecloud/models/workspace_entity_listing' require 'purecloud/models/workspace_member' require 'purecloud/models/workspace_member_entity_listing' require 'purecloud/models/workspace_summary' require 'purecloud/models/wrap_up_code_mapping' require 'purecloud/models/wrapup' require 'purecloud/models/wrapup_code' require 'purecloud/models/wrapup_code_entity_listing' # APIs require 'purecloud/api/alerting_api' require 'purecloud/api/analytics_api' require 'purecloud/api/attributes_api' require 'purecloud/api/authorization_api' require 'purecloud/api/configuration_api' require 'purecloud/api/content_management_api' require 'purecloud/api/conversations_api' require 'purecloud/api/fax_api' require 'purecloud/api/geolocation_api' require 'purecloud/api/greetings_api' require 'purecloud/api/groups_api' require 'purecloud/api/identity_provider_api' require 'purecloud/api/languages_api' require 'purecloud/api/locations_api' require 'purecloud/api/notifications_api' require 'purecloud/api/o_auth_api' require 'purecloud/api/organization_api' require 'purecloud/api/outbound_api' require 'purecloud/api/presence_api' require 'purecloud/api/quality_api' require 'purecloud/api/recording_api' require 'purecloud/api/response_management_api' require 'purecloud/api/routing_api' require 'purecloud/api/search_api' require 'purecloud/api/stations_api' require 'purecloud/api/suggest_api' require 'purecloud/api/telephony_providers_edge_api' require 'purecloud/api/tokens_api' require 'purecloud/api/user_recordings_api' require 'purecloud/api/users_api' require 'purecloud/api/utilities_api' require 'purecloud/api/voicemail_api' module PureCloud class << self # Customize default settings for the SDK using block. # PureCloud.configure do |config| # config.username = "xxx" # config.password = "xxx" # end # If no block given, return the default Configuration object. def configure if block_given? yield(Configuration.default) else Configuration.default end end end end require 'rest_client' require 'json' require 'base64' module PureCloud class << self # Authenticates to PureCloud using the client credientals OAuth grant. # # @param client_id OAuth client id # @param client_secret OAuth client secret # @param environment PureCloud environment (mypurecloud.com, mypurecloud.ie, mypurecloud.com.au, etc) def authenticate_with_client_credentials(client_id, client_secret, environment = nil) environment ||= "mypurecloud.com" self.configure.host = 'api.' + environment; basic = Base64.strict_encode64("#{client_id}:#{client_secret}") tokenData = JSON.parse RestClient.post("https://login.#{environment}/token", {:grant_type => 'client_credentials'}, :Authorization => "Basic " + basic, 'content-type'=> 'application/x-www-form-urlencoded', :accept => :json) self.configure.access_token = tokenData["access_token"] end # Retrieves an Access token given an authorization code (authorization code grant) # # @param auth_code Authorization code from the OAuth redirec # @param client_id OAuth client id # @param client_secret OAuth client secret # @param client_secret OAuth redirect URI # @param environment (Optional) PureCloud environment (mypurecloud.com, mypurecloud.ie, mypurecloud.com.au, etc) def get_access_token_from_auth_code(auth_code, client_id, client_secret, redirect_uri, environment = nil) environment ||= "mypurecloud.com" tokenFormData = { "grant_type" => "authorization_code", "code" => auth_code, "redirect_uri" => redirect_uri } tokenResponse =JSON.parse RestClient.post "https://#{client_id}:#{client_secret}@login.#{environment}/token", tokenFormData return tokenResponse['access_token']; end end end