rcs 1.0.18 → 2.0.0.pre.rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/environment.rb +1 -1
- data/lib/rcs/brands/client.rb +631 -0
- data/lib/rcs/brands/types/autofill_brand_schema_options.rb +61 -0
- data/lib/rcs/brands/types/brand_contact.rb +84 -0
- data/lib/rcs/campaigns/client.rb +44 -0
- data/lib/rcs/campaigns/dlc/client.rb +480 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords.rb +99 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_help.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_opt_in.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_opt_out.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_links.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_options.rb +110 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_use_case.rb +76 -0
- data/lib/rcs/campaigns/rcs/client.rb +457 -0
- data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +155 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent.rb +140 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_emails_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_phones_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_websites_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_links.rb +74 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_opt_in.rb +75 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_opt_out.rb +76 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_use_case.rb +75 -0
- data/lib/rcs/campaigns/toll_free/client.rb +429 -0
- data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +130 -0
- data/lib/rcs/campaigns/toll_free/types/upsert_toll_free_schema_opt_in.rb +86 -0
- data/lib/rcs/campaigns/toll_free/types/upsert_toll_free_schema_use_case.rb +75 -0
- data/lib/rcs/contacts/client.rb +275 -0
- data/lib/rcs/conversations/client.rb +273 -0
- data/lib/rcs/message/client.rb +30 -0
- data/lib/rcs/message/sms/client.rb +96 -0
- data/lib/rcs/messages/client.rb +192 -0
- data/lib/rcs/messages/mms/client.rb +98 -0
- data/lib/rcs/messages/rcs/client.rb +94 -0
- data/lib/rcs/messages/send/client.rb +318 -0
- data/lib/rcs/messages/send/types/send_mms_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_mms_schema_options.rb +108 -0
- data/lib/rcs/messages/send/types/send_rcs_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_sms_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_sms_schema_options.rb +81 -0
- data/lib/rcs/messages/types/message_reaction_schema_options.rb +71 -0
- data/lib/rcs/phone_numbers/campaign/client.rb +179 -0
- data/lib/rcs/phone_numbers/client.rb +359 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_level.rb +16 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_options.rb +93 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_options_enhanced_contact_info.rb +64 -0
- data/lib/rcs/phone_numbers/types/phone_numbers_get_response.rb +58 -0
- data/lib/rcs/phone_numbers/types/search_schema_location.rb +96 -0
- data/lib/rcs/phone_numbers/types/search_schema_number.rb +81 -0
- data/lib/rcs/phone_numbers/types/search_schema_options.rb +62 -0
- data/lib/rcs/phone_numbers/webhook/client.rb +191 -0
- data/lib/rcs/status/client.rb +30 -0
- data/lib/rcs/status/get/client.rb +367 -0
- data/lib/rcs/tools/client.rb +32 -199
- data/lib/rcs/tools/contact_card/client.rb +285 -0
- data/lib/rcs/tools/contact_card/types/get_v_card_schema_options.rb +67 -0
- data/lib/rcs/tools/file/client.rb +138 -0
- data/lib/rcs/tools/file/types/file_upload_schema_options.rb +70 -0
- data/lib/rcs/tools/file/types/file_upload_schema_options_download.rb +66 -0
- data/lib/rcs/tools/url/client.rb +245 -0
- data/lib/rcs/types/advanced_phone_information.rb +147 -0
- data/lib/rcs/types/advanced_phone_information_carrier.rb +90 -0
- data/lib/rcs/types/advanced_phone_information_contact.rb +146 -0
- data/lib/rcs/types/advanced_phone_information_location.rb +142 -0
- data/lib/rcs/types/advanced_phone_information_location_coordinates.rb +73 -0
- data/lib/rcs/types/advanced_phone_information_location_country.rb +77 -0
- data/lib/rcs/types/advanced_phone_information_type.rb +97 -0
- data/lib/rcs/types/advanced_phone_information_type_recommendation.rb +15 -0
- data/lib/rcs/types/agent.rb +68 -0
- data/lib/rcs/types/attach_webhook_params.rb +60 -0
- data/lib/rcs/types/attach_webhook_response_webhook.rb +86 -0
- data/lib/rcs/types/attach_webhook_schema_name.rb +88 -0
- data/lib/rcs/types/attach_webhook_schema_webhook_id.rb +77 -0
- data/lib/rcs/types/attached_phone_number_result.rb +75 -0
- data/lib/rcs/types/autofill_campaign_params.rb +69 -0
- data/lib/rcs/types/autofill_dlc_campaign_response.rb +169 -0
- data/lib/rcs/types/autofill_dlc_response_keywords.rb +95 -0
- data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +70 -0
- data/lib/rcs/{send/types/send_sms_response.rb → types/autofill_dlc_response_keywords_opt_in.rb} +18 -17
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +70 -0
- data/lib/rcs/types/autofill_dlc_response_links.rb +70 -0
- data/lib/rcs/types/autofill_dlc_response_options.rb +106 -0
- data/lib/rcs/types/autofill_dlc_response_use_case.rb +72 -0
- data/lib/rcs/types/bad_request_error_body.rb +44 -45
- data/lib/rcs/types/basic_phone_information.rb +127 -0
- data/lib/rcs/{company/types/company_register_response_brand.rb → types/basic_phone_information_contact.rb} +12 -21
- data/lib/rcs/types/basic_phone_information_location.rb +74 -0
- data/lib/rcs/types/basic_phone_information_location_country.rb +75 -0
- data/lib/rcs/types/brand_status.rb +92 -0
- data/lib/rcs/types/brand_status_enum.rb +21 -0
- data/lib/rcs/types/buy_response_capabilities.rb +77 -0
- data/lib/rcs/types/campaign_enum.rb +15 -0
- data/lib/rcs/types/campaign_query.rb +69 -0
- data/lib/rcs/{company/types/company_register_request_company_id.rb → types/campaign_submission_result.rb} +15 -16
- data/lib/rcs/types/campaign_validation_response_errors_item.rb +76 -0
- data/lib/rcs/types/campaign_validation_result.rb +71 -0
- data/lib/rcs/types/click_action.rb +73 -0
- data/lib/rcs/types/click_action_data.rb +56 -0
- data/lib/rcs/types/click_action_data_metadata.rb +69 -0
- data/lib/rcs/types/company_sector_enum.rb +26 -0
- data/lib/rcs/types/company_type_enum.rb +14 -0
- data/lib/rcs/types/configured_webhook.rb +85 -0
- data/lib/rcs/types/contact.rb +105 -0
- data/lib/rcs/types/contact_id.rb +57 -0
- data/lib/rcs/types/conversation.rb +146 -0
- data/lib/rcs/types/conversation_contact.rb +68 -0
- data/lib/rcs/types/conversation_list.rb +79 -0
- data/lib/rcs/types/conversation_sender.rb +60 -0
- data/lib/rcs/types/create_url_options.rb +61 -0
- data/lib/rcs/types/detached_phone_number_result.rb +75 -0
- data/lib/rcs/types/detached_webhook_info.rb +74 -0
- data/lib/rcs/types/detailed_phone_number_enum.rb +25 -0
- data/lib/rcs/types/dlc_assignment_status_enum.rb +19 -0
- data/lib/rcs/types/dlc_campaign_status.rb +107 -0
- data/lib/rcs/types/dlc_campaign_use_case_enum.rb +35 -0
- data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +194 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords.rb +94 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +72 -0
- data/lib/rcs/{send/types/send_mms_response.rb → types/dlc_with_extended_brand_and_status_keywords_opt_in.rb} +20 -17
- data/lib/rcs/{send/types/send_rcs_response.rb → types/dlc_with_extended_brand_and_status_keywords_opt_out.rb} +20 -17
- data/lib/rcs/types/dlc_with_extended_brand_and_status_links.rb +70 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_options.rb +106 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_use_case.rb +72 -0
- data/lib/rcs/types/enhanced_contact.rb +9 -0
- data/lib/rcs/types/enhanced_contact_item.rb +104 -0
- data/lib/rcs/types/error.rb +61 -0
- data/lib/rcs/types/extended_brand.rb +194 -0
- data/lib/rcs/types/extended_brand_with_vetting.rb +226 -0
- data/lib/rcs/types/extended_rcs_campaign.rb +173 -0
- data/lib/rcs/{company/types/company_register_request.rb → types/get_conversation_params.rb} +13 -12
- data/lib/rcs/types/get_conversation_request_id.rb +58 -0
- data/lib/rcs/types/get_conversation_request_recipient.rb +72 -0
- data/lib/rcs/types/get_dlc_campaign_status_response_updates.rb +96 -0
- data/lib/rcs/types/get_toll_free_campaign_status_response_updates.rb +92 -0
- data/lib/rcs/types/inbound_button.rb +56 -0
- data/lib/rcs/types/link_click_event.rb +465 -0
- data/lib/rcs/{company/types/company_update_response.rb → types/location_share_action.rb} +19 -19
- data/lib/rcs/types/location_share_action_data.rb +89 -0
- data/lib/rcs/types/message.rb +174 -0
- data/lib/rcs/types/message_content.rb +85 -0
- data/lib/rcs/types/message_method_enum.rb +12 -0
- data/lib/rcs/types/message_protocol_enum.rb +12 -0
- data/lib/rcs/types/message_schedule.rb +94 -0
- data/lib/rcs/types/message_status_enum.rb +16 -0
- data/lib/rcs/types/message_volume_enum.rb +20 -0
- data/lib/rcs/types/messaging_profile_enum.rb +11 -0
- data/lib/rcs/types/mms_content.rb +74 -0
- data/lib/rcs/types/mms_validation_response_segments.rb +85 -0
- data/lib/rcs/types/mms_validation_response_segments_value_item.rb +75 -0
- data/lib/rcs/types/mms_validation_result.rb +82 -0
- data/lib/rcs/types/nullable_contact.rb +84 -0
- data/lib/rcs/types/number_format.rb +79 -0
- data/lib/rcs/types/opt_in_method_enum.rb +13 -0
- data/lib/rcs/types/optional_brand_info.rb +145 -0
- data/lib/rcs/types/optional_contact.rb +83 -0
- data/lib/rcs/types/optional_contacts.rb +84 -0
- data/lib/rcs/types/phone.rb +101 -0
- data/lib/rcs/types/phone_capabilities.rb +75 -0
- data/lib/rcs/types/phone_enum.rb +13 -0
- data/lib/rcs/types/phone_feature_enum.rb +18 -0
- data/lib/rcs/types/phone_number_campaign_attach_failed_item.rb +67 -0
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item.rb +75 -0
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +78 -0
- data/lib/rcs/types/phone_number_campaign_detach_failed_item.rb +67 -0
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item.rb +75 -0
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +78 -0
- data/lib/rcs/types/phone_number_cost.rb +75 -0
- data/lib/rcs/types/phone_number_details.rb +110 -0
- data/lib/rcs/types/phone_number_enum.rb +18 -0
- data/lib/rcs/types/phone_number_region.rb +91 -0
- data/lib/rcs/types/phone_number_status.rb +90 -0
- data/lib/rcs/types/phone_number_status_enum.rb +16 -0
- data/lib/rcs/types/pinnacle_file_upload_metadata.rb +84 -0
- data/lib/rcs/types/pinnacle_url_config.rb +71 -0
- data/lib/rcs/types/profile_status_enum.rb +17 -0
- data/lib/rcs/types/purchased_number.rb +75 -0
- data/lib/rcs/types/rcs.rb +70 -0
- data/lib/rcs/types/rcs_base.rb +82 -0
- data/lib/rcs/types/rcs_base_options.rb +100 -0
- data/lib/rcs/types/rcs_button_call.rb +68 -0
- data/lib/rcs/types/rcs_button_content.rb +148 -0
- data/lib/rcs/types/rcs_button_open_url.rb +68 -0
- data/lib/rcs/types/rcs_button_request_user_location.rb +58 -0
- data/lib/rcs/types/rcs_button_schedule_event.rb +98 -0
- data/lib/rcs/types/rcs_button_send_location.rb +74 -0
- data/lib/rcs/types/rcs_button_send_location_lat_long.rb +68 -0
- data/lib/rcs/types/rcs_button_trigger.rb +78 -0
- data/lib/rcs/types/rcs_campaign.rb +143 -0
- data/lib/rcs/types/rcs_campaign_opt_in_method_enum.rb +15 -0
- data/lib/rcs/types/rcs_campaign_schema_agent.rb +134 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_emails_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_phones_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_websites_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +134 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_emails_item.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_phones_item.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_websites_item.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_links.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_opt_in.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_opt_out.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_use_case.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_links.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_opt_in.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_opt_out.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_use_case.rb +71 -0
- data/lib/rcs/types/rcs_campaign_status.rb +86 -0
- data/lib/rcs/types/rcs_campaign_use_case_enum.rb +23 -0
- data/lib/rcs/types/rcs_card.rb +110 -0
- data/lib/rcs/types/rcs_cards.rb +79 -0
- data/lib/rcs/types/rcs_cards_cards_item.rb +88 -0
- data/lib/rcs/types/rcs_cards_content.rb +79 -0
- data/lib/rcs/types/rcs_cards_content_cards_item.rb +94 -0
- data/lib/rcs/types/rcs_content.rb +72 -0
- data/lib/rcs/types/rcs_media.rb +110 -0
- data/lib/rcs/types/rcs_media_content.rb +81 -0
- data/lib/rcs/types/rcs_media_details_content.rb +77 -0
- data/lib/rcs/types/rcs_text.rb +106 -0
- data/lib/rcs/types/rcs_text_content.rb +72 -0
- data/lib/rcs/types/rcs_validate_content.rb +70 -0
- data/lib/rcs/{company/types/company_register_response.rb → types/rcs_validate_content_media.rb} +19 -21
- data/lib/rcs/types/rcs_validation_result.rb +76 -0
- data/lib/rcs/types/reaction_result.rb +67 -0
- data/lib/rcs/types/scheduled_messaage.rb +73 -0
- data/lib/rcs/types/scheduled_send_response_config.rb +89 -0
- data/lib/rcs/types/send_sms_response_segments.rb +69 -0
- data/lib/rcs/types/send_sms_response_segments_encoding.rb +11 -0
- data/lib/rcs/types/sent_mms_details.rb +102 -0
- data/lib/rcs/types/sent_rcs_details.rb +105 -0
- data/lib/rcs/types/sent_sms_details.rb +108 -0
- data/lib/rcs/types/shortened_url.rb +77 -0
- data/lib/rcs/types/shortened_url_with_click_data.rb +90 -0
- data/lib/rcs/types/sms_content.rb +58 -0
- data/lib/rcs/types/sms_validation_response_segments.rb +80 -0
- data/lib/rcs/types/sms_validation_response_segments_gsm_7.rb +75 -0
- data/lib/rcs/types/sms_validation_response_segments_utf_16.rb +68 -0
- data/lib/rcs/types/sms_validation_response_total.rb +75 -0
- data/lib/rcs/types/sms_validation_result.rb +102 -0
- data/lib/rcs/types/sub_use_case_enum.rb +19 -0
- data/lib/rcs/types/submission_results.rb +57 -0
- data/lib/rcs/types/successful_conversation_update.rb +58 -0
- data/lib/rcs/types/toll_free_campaign.rb +118 -0
- data/lib/rcs/types/toll_free_campaign_schema_opt_in.rb +78 -0
- data/lib/rcs/types/toll_free_campaign_schema_use_case.rb +71 -0
- data/lib/rcs/types/toll_free_campaign_status.rb +91 -0
- data/lib/rcs/types/toll_free_campaign_use_case_enum.rb +52 -0
- data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +155 -0
- data/lib/rcs/types/toll_free_status_enum.rb +20 -0
- data/lib/rcs/types/tracking.rb +17 -0
- data/lib/rcs/types/updated_contact_id.rb +57 -0
- data/lib/rcs/types/upload_results.rb +80 -0
- data/lib/rcs/types/v_card_address_schema_type_item.rb +15 -0
- data/lib/rcs/types/v_card_data.rb +237 -0
- data/lib/rcs/types/v_card_data_file.rb +74 -0
- data/lib/rcs/types/v_card_data_file_metadata.rb +62 -0
- data/lib/rcs/types/v_card_email_schema_type_item.rb +21 -0
- data/lib/rcs/types/v_card_geo.rb +70 -0
- data/lib/rcs/types/v_card_name.rb +98 -0
- data/lib/rcs/types/v_card_organization.rb +70 -0
- data/lib/rcs/types/v_card_phone_schema_type_item.rb +21 -0
- data/lib/rcs/types/validate_campaign_params.rb +69 -0
- data/lib/rcs/types/validation_error_details.rb +76 -0
- data/lib/rcs/types/validation_results.rb +71 -0
- data/lib/rcs/types/vcard.rb +215 -0
- data/lib/rcs/types/vcard_address.rb +130 -0
- data/lib/rcs/types/vcard_content.rb +223 -0
- data/lib/rcs/types/vcard_email.rb +70 -0
- data/lib/rcs/types/vcard_phone.rb +70 -0
- data/lib/rcs/types/vcard_resource.rb +71 -0
- data/lib/rcs/types/vetting_feedback.rb +81 -0
- data/lib/rcs/types/vetting_history.rb +98 -0
- data/lib/rcs/types/vetting_history_vetting_status.rb +13 -0
- data/lib/rcs/types/vetting_results.rb +57 -0
- data/lib/rcs/types/webhook_event_enum.rb +13 -0
- data/lib/rcs/types/webhook_result.rb +64 -0
- data/lib/rcs/{company/types/company_update_response_brand.rb → types/webhooks.rb} +25 -17
- data/lib/rcs/types/zod_error.rb +73 -0
- data/lib/rcs/webhooks/client.rb +93 -0
- data/lib/rcs.rb +67 -83
- data/lib/requests.rb +4 -4
- data/lib/types_export.rb +252 -46
- metadata +278 -52
- data/lib/rcs/company/client.rb +0 -375
- data/lib/rcs/company/types/company_register_request_company.rb +0 -128
- data/lib/rcs/send/client.rb +0 -382
- data/lib/rcs/send/types/rcs_fallback.rb +0 -84
- data/lib/rcs/tools/types/tools_shorten_url_response.rb +0 -70
- data/lib/rcs/tools/types/tools_upload_url_response.rb +0 -69
- data/lib/rcs/types/action.rb +0 -154
- data/lib/rcs/types/action_lat_long.rb +0 -68
- data/lib/rcs/types/action_type.rb +0 -16
- data/lib/rcs/types/additional_email.rb +0 -65
- data/lib/rcs/types/additional_phone_number.rb +0 -65
- data/lib/rcs/types/additional_website.rb +0 -65
- data/lib/rcs/types/card.rb +0 -90
- data/lib/rcs/types/company.rb +0 -319
- data/lib/rcs/types/company_additional_emails_item.rb +0 -67
- data/lib/rcs/types/company_additional_phone_numbers_item.rb +0 -67
- data/lib/rcs/types/company_additional_websites_item.rb +0 -67
- data/lib/rcs/types/company_category.rb +0 -20
- data/lib/rcs/types/company_contact.rb +0 -117
- data/lib/rcs/types/company_details.rb +0 -120
- data/lib/rcs/types/forbidden_error_body.rb +0 -57
- data/lib/rcs/types/inbound_action_message.rb +0 -117
- data/lib/rcs/types/inbound_location_message.rb +0 -106
- data/lib/rcs/types/inbound_location_message_coordinates.rb +0 -65
- data/lib/rcs/types/inbound_media_message.rb +0 -112
- data/lib/rcs/types/inbound_message.rb +0 -88
- data/lib/rcs/types/inbound_message_message_type.rb +0 -10
- data/lib/rcs/types/inbound_message_metadata.rb +0 -79
- data/lib/rcs/types/inbound_text_message.rb +0 -100
- data/lib/rcs/types/internal_server_error_body.rb +0 -57
- data/lib/rcs/types/media_payload.rb +0 -65
- data/lib/rcs/types/message_metadata.rb +0 -56
- data/lib/rcs/types/messaging.rb +0 -95
- data/lib/rcs/types/optionals.rb +0 -99
- data/lib/rcs/types/payment_required_error_body.rb +0 -57
- data/lib/rcs/types/point_of_contact.rb +0 -72
- data/lib/rcs/types/rcs_functionalities.rb +0 -117
- data/lib/rcs/types/sender_metadata.rb +0 -74
- data/lib/rcs/types/unauthorized_error_body.rb +0 -57
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
module Messages
|
8
|
+
module Types
|
9
|
+
class MessageReactionSchemaOptions
|
10
|
+
# @return [Boolean] By default, only messages sent with the `options.tracking` field can be
|
11
|
+
# precisely reacted to. <br>
|
12
|
+
# Set `options.force` to true to bypass this restriction (may react to a different
|
13
|
+
# message). <br>
|
14
|
+
# For MMS and RCS, only messages containing text can be tracked. Otherwise,
|
15
|
+
# `options.force` is ignored.
|
16
|
+
attr_reader :force
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param force [Boolean] By default, only messages sent with the `options.tracking` field can be
|
26
|
+
# precisely reacted to. <br>
|
27
|
+
# Set `options.force` to true to bypass this restriction (may react to a different
|
28
|
+
# message). <br>
|
29
|
+
# For MMS and RCS, only messages containing text can be tracked. Otherwise,
|
30
|
+
# `options.force` is ignored.
|
31
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
32
|
+
# @return [Pinnacle::Messages::Types::MessageReactionSchemaOptions]
|
33
|
+
def initialize(force: OMIT, additional_properties: nil)
|
34
|
+
@force = force if force != OMIT
|
35
|
+
@additional_properties = additional_properties
|
36
|
+
@_field_set = { "force": force }.reject do |_k, v|
|
37
|
+
v == OMIT
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deserialize a JSON object to an instance of MessageReactionSchemaOptions
|
42
|
+
#
|
43
|
+
# @param json_object [String]
|
44
|
+
# @return [Pinnacle::Messages::Types::MessageReactionSchemaOptions]
|
45
|
+
def self.from_json(json_object:)
|
46
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
47
|
+
parsed_json = JSON.parse(json_object)
|
48
|
+
force = parsed_json["force"]
|
49
|
+
new(force: force, additional_properties: struct)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Serialize an instance of MessageReactionSchemaOptions to a JSON object
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
def to_json(*_args)
|
56
|
+
@_field_set&.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
60
|
+
# hash and check each fields type against the current object's property
|
61
|
+
# definitions.
|
62
|
+
#
|
63
|
+
# @param obj [Object]
|
64
|
+
# @return [Void]
|
65
|
+
def self.validate_raw(obj:)
|
66
|
+
obj.force&.is_a?(Boolean) != false || raise("Passed value for field obj.force is not the expected type, validation failed.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "../../types/messaging_profile_enum"
|
5
|
+
require_relative "../../types/attached_phone_number_result"
|
6
|
+
require_relative "../../types/detached_phone_number_result"
|
7
|
+
require "async"
|
8
|
+
|
9
|
+
module Pinnacle
|
10
|
+
module PhoneNumbers
|
11
|
+
class CampaignClient
|
12
|
+
# @return [Pinnacle::RequestClient]
|
13
|
+
attr_reader :request_client
|
14
|
+
|
15
|
+
# @param request_client [Pinnacle::RequestClient]
|
16
|
+
# @return [Pinnacle::PhoneNumbers::CampaignClient]
|
17
|
+
def initialize(request_client:)
|
18
|
+
@request_client = request_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# Link a phone number to a specific campaign.
|
22
|
+
#
|
23
|
+
# @param phones [Array<String>] List of phone number (E.164 format).
|
24
|
+
# @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
|
25
|
+
# @param campaign_id [Integer] Campaign's identifier.
|
26
|
+
# @param request_options [Pinnacle::RequestOptions]
|
27
|
+
# @return [Pinnacle::Types::AttachedPhoneNumberResult]
|
28
|
+
# @example
|
29
|
+
# api = Pinnacle::Client.new(
|
30
|
+
# base_url: "https://api.example.com",
|
31
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
32
|
+
# api_key: "YOUR_API_KEY"
|
33
|
+
# )
|
34
|
+
# api.phone_numbers.campaign.attach(
|
35
|
+
# phones: ["+14155550123", "+14155559876", "+14155550111"],
|
36
|
+
# campaign_type: TOLL_FREE,
|
37
|
+
# campaign_id: 101
|
38
|
+
# )
|
39
|
+
def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
|
40
|
+
response = @request_client.conn.post do |req|
|
41
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
42
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
43
|
+
req.headers = {
|
44
|
+
**(req.headers || {}),
|
45
|
+
**@request_client.get_headers,
|
46
|
+
**(request_options&.additional_headers || {})
|
47
|
+
}.compact
|
48
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
49
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
50
|
+
end
|
51
|
+
req.body = {
|
52
|
+
**(request_options&.additional_body_parameters || {}),
|
53
|
+
phones: phones,
|
54
|
+
campaignType: campaign_type,
|
55
|
+
campaignId: campaign_id
|
56
|
+
}.compact
|
57
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/attach-campaign"
|
58
|
+
end
|
59
|
+
Pinnacle::Types::AttachedPhoneNumberResult.from_json(json_object: response.body)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Remove the association between a phone number and its attached campaign.
|
63
|
+
#
|
64
|
+
# @param phones [Array<String>] List of phone numbers (E.164 format).
|
65
|
+
# @param request_options [Pinnacle::RequestOptions]
|
66
|
+
# @return [Pinnacle::Types::DetachedPhoneNumberResult]
|
67
|
+
# @example
|
68
|
+
# api = Pinnacle::Client.new(
|
69
|
+
# base_url: "https://api.example.com",
|
70
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
71
|
+
# api_key: "YOUR_API_KEY"
|
72
|
+
# )
|
73
|
+
# api.phone_numbers.campaign.detach(phones: ["+14155559876", "14155550111"])
|
74
|
+
def detach(phones:, request_options: nil)
|
75
|
+
response = @request_client.conn.delete do |req|
|
76
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
77
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
78
|
+
req.headers = {
|
79
|
+
**(req.headers || {}),
|
80
|
+
**@request_client.get_headers,
|
81
|
+
**(request_options&.additional_headers || {})
|
82
|
+
}.compact
|
83
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
84
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
85
|
+
end
|
86
|
+
req.body = { **(request_options&.additional_body_parameters || {}), phones: phones }.compact
|
87
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/detach-campaign"
|
88
|
+
end
|
89
|
+
Pinnacle::Types::DetachedPhoneNumberResult.from_json(json_object: response.body)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
class AsyncCampaignClient
|
94
|
+
# @return [Pinnacle::AsyncRequestClient]
|
95
|
+
attr_reader :request_client
|
96
|
+
|
97
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
98
|
+
# @return [Pinnacle::PhoneNumbers::AsyncCampaignClient]
|
99
|
+
def initialize(request_client:)
|
100
|
+
@request_client = request_client
|
101
|
+
end
|
102
|
+
|
103
|
+
# Link a phone number to a specific campaign.
|
104
|
+
#
|
105
|
+
# @param phones [Array<String>] List of phone number (E.164 format).
|
106
|
+
# @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
|
107
|
+
# @param campaign_id [Integer] Campaign's identifier.
|
108
|
+
# @param request_options [Pinnacle::RequestOptions]
|
109
|
+
# @return [Pinnacle::Types::AttachedPhoneNumberResult]
|
110
|
+
# @example
|
111
|
+
# api = Pinnacle::Client.new(
|
112
|
+
# base_url: "https://api.example.com",
|
113
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
114
|
+
# api_key: "YOUR_API_KEY"
|
115
|
+
# )
|
116
|
+
# api.phone_numbers.campaign.attach(
|
117
|
+
# phones: ["+14155550123", "+14155559876", "+14155550111"],
|
118
|
+
# campaign_type: TOLL_FREE,
|
119
|
+
# campaign_id: 101
|
120
|
+
# )
|
121
|
+
def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
|
122
|
+
Async do
|
123
|
+
response = @request_client.conn.post do |req|
|
124
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
125
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
126
|
+
req.headers = {
|
127
|
+
**(req.headers || {}),
|
128
|
+
**@request_client.get_headers,
|
129
|
+
**(request_options&.additional_headers || {})
|
130
|
+
}.compact
|
131
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
132
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
133
|
+
end
|
134
|
+
req.body = {
|
135
|
+
**(request_options&.additional_body_parameters || {}),
|
136
|
+
phones: phones,
|
137
|
+
campaignType: campaign_type,
|
138
|
+
campaignId: campaign_id
|
139
|
+
}.compact
|
140
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/attach-campaign"
|
141
|
+
end
|
142
|
+
Pinnacle::Types::AttachedPhoneNumberResult.from_json(json_object: response.body)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Remove the association between a phone number and its attached campaign.
|
147
|
+
#
|
148
|
+
# @param phones [Array<String>] List of phone numbers (E.164 format).
|
149
|
+
# @param request_options [Pinnacle::RequestOptions]
|
150
|
+
# @return [Pinnacle::Types::DetachedPhoneNumberResult]
|
151
|
+
# @example
|
152
|
+
# api = Pinnacle::Client.new(
|
153
|
+
# base_url: "https://api.example.com",
|
154
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
155
|
+
# api_key: "YOUR_API_KEY"
|
156
|
+
# )
|
157
|
+
# api.phone_numbers.campaign.detach(phones: ["+14155559876", "14155550111"])
|
158
|
+
def detach(phones:, request_options: nil)
|
159
|
+
Async do
|
160
|
+
response = @request_client.conn.delete do |req|
|
161
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
162
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
163
|
+
req.headers = {
|
164
|
+
**(req.headers || {}),
|
165
|
+
**@request_client.get_headers,
|
166
|
+
**(request_options&.additional_headers || {})
|
167
|
+
}.compact
|
168
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
169
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
170
|
+
end
|
171
|
+
req.body = { **(request_options&.additional_body_parameters || {}), phones: phones }.compact
|
172
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/detach-campaign"
|
173
|
+
end
|
174
|
+
Pinnacle::Types::DetachedPhoneNumberResult.from_json(json_object: response.body)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,359 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "../types/phone_feature_enum"
|
5
|
+
require_relative "types/search_schema_location"
|
6
|
+
require_relative "types/search_schema_number"
|
7
|
+
require_relative "types/search_schema_options"
|
8
|
+
require_relative "../types/phone_enum"
|
9
|
+
require_relative "../types/phone_number_details"
|
10
|
+
require "json"
|
11
|
+
require_relative "../types/purchased_number"
|
12
|
+
require_relative "types/phone_details_schema_level"
|
13
|
+
require_relative "types/phone_details_schema_options"
|
14
|
+
require_relative "types/phone_numbers_get_response"
|
15
|
+
require_relative "campaign/client"
|
16
|
+
require_relative "webhook/client"
|
17
|
+
require "async"
|
18
|
+
|
19
|
+
module Pinnacle
|
20
|
+
class PhoneNumbersClient
|
21
|
+
# @return [Pinnacle::RequestClient]
|
22
|
+
attr_reader :request_client
|
23
|
+
# @return [Pinnacle::PhoneNumbers::CampaignClient]
|
24
|
+
attr_reader :campaign
|
25
|
+
# @return [Pinnacle::PhoneNumbers::WebhookClient]
|
26
|
+
attr_reader :webhook
|
27
|
+
|
28
|
+
# @param request_client [Pinnacle::RequestClient]
|
29
|
+
# @return [Pinnacle::PhoneNumbersClient]
|
30
|
+
def initialize(request_client:)
|
31
|
+
@request_client = request_client
|
32
|
+
@campaign = Pinnacle::PhoneNumbers::CampaignClient.new(request_client: request_client)
|
33
|
+
@webhook = Pinnacle::PhoneNumbers::WebhookClient.new(request_client: request_client)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Search for available phone numbers that match your exact criteria.
|
37
|
+
#
|
38
|
+
# @param features [Array<Pinnacle::Types::PhoneFeatureEnum>]
|
39
|
+
# @param location [Hash] Filter your search by geographic location to find numbers in specific regions.
|
40
|
+
# <br>
|
41
|
+
# Toll-free numbers ignore city and state filters.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaLocation, as a Hash
|
42
|
+
# * :city (String)
|
43
|
+
# * :country_code (String)
|
44
|
+
# * :national_destination_code (String)
|
45
|
+
# * :state (String)
|
46
|
+
# @param phone_number_digit_filters [Hash] Filter your search by digit pattern.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaNumber, as a Hash
|
47
|
+
# * :contains (String)
|
48
|
+
# * :ends_with (String)
|
49
|
+
# * :starts_with (String)
|
50
|
+
# @param options [Hash] Extra search settings to control how many results you get.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaOptions, as a Hash
|
51
|
+
# * :limit (Integer)
|
52
|
+
# @param type [Array<Pinnacle::Types::PhoneEnum>] Types of phone numbers to return in your search.
|
53
|
+
# @param request_options [Pinnacle::RequestOptions]
|
54
|
+
# @return [Array<Pinnacle::Types::PhoneNumberDetails>]
|
55
|
+
# @example
|
56
|
+
# api = Pinnacle::Client.new(
|
57
|
+
# base_url: "https://api.example.com",
|
58
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
59
|
+
# api_key: "YOUR_API_KEY"
|
60
|
+
# )
|
61
|
+
# api.phone_numbers.search(
|
62
|
+
# features: [SMS, MMS],
|
63
|
+
# location: { city: "New York", national_destination_code: "212" },
|
64
|
+
# phone_number_digit_filters: { contains: "514", starts_with: "45" },
|
65
|
+
# options: { limit: 4 },
|
66
|
+
# type: [LOCAL]
|
67
|
+
# )
|
68
|
+
def search(type:, features: nil, location: nil, phone_number_digit_filters: nil, options: nil, request_options: nil)
|
69
|
+
response = @request_client.conn.post do |req|
|
70
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
71
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
72
|
+
req.headers = {
|
73
|
+
**(req.headers || {}),
|
74
|
+
**@request_client.get_headers,
|
75
|
+
**(request_options&.additional_headers || {})
|
76
|
+
}.compact
|
77
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
78
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
79
|
+
end
|
80
|
+
req.body = {
|
81
|
+
**(request_options&.additional_body_parameters || {}),
|
82
|
+
features: features,
|
83
|
+
location: location,
|
84
|
+
number: phone_number_digit_filters,
|
85
|
+
options: options,
|
86
|
+
type: type
|
87
|
+
}.compact
|
88
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/search"
|
89
|
+
end
|
90
|
+
parsed_json = JSON.parse(response.body)
|
91
|
+
parsed_json&.map do |item|
|
92
|
+
item = item.to_json
|
93
|
+
Pinnacle::Types::PhoneNumberDetails.from_json(json_object: item)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Purchase one or more phone numbers found through the [search
|
98
|
+
# endpoint](./search). <br>
|
99
|
+
# Billing uses your account credits and the numbers are ready for immediate use.
|
100
|
+
#
|
101
|
+
# @param numbers [Array<String>] List of phone numbers you want to purchase, each in international E.164 format.
|
102
|
+
# <br>
|
103
|
+
# All specified numbers must be currently available and will be validated for
|
104
|
+
# availability before processing the purchase. <br>
|
105
|
+
# If any number in the request is unavailable or invalid, no purchases will be
|
106
|
+
# made and the request will be voided.
|
107
|
+
# @param request_options [Pinnacle::RequestOptions]
|
108
|
+
# @return [Array<Pinnacle::Types::PurchasedNumber>]
|
109
|
+
# @example
|
110
|
+
# api = Pinnacle::Client.new(
|
111
|
+
# base_url: "https://api.example.com",
|
112
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
113
|
+
# api_key: "YOUR_API_KEY"
|
114
|
+
# )
|
115
|
+
# api.phone_numbers.buy(numbers: ["+18559491727"])
|
116
|
+
def buy(numbers:, request_options: nil)
|
117
|
+
response = @request_client.conn.post do |req|
|
118
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
119
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
120
|
+
req.headers = {
|
121
|
+
**(req.headers || {}),
|
122
|
+
**@request_client.get_headers,
|
123
|
+
**(request_options&.additional_headers || {})
|
124
|
+
}.compact
|
125
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
126
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
127
|
+
end
|
128
|
+
req.body = { **(request_options&.additional_body_parameters || {}), numbers: numbers }.compact
|
129
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/buy"
|
130
|
+
end
|
131
|
+
parsed_json = JSON.parse(response.body)
|
132
|
+
parsed_json&.map do |item|
|
133
|
+
item = item.to_json
|
134
|
+
Pinnacle::Types::PurchasedNumber.from_json(json_object: item)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Retrieve information about any phone number.
|
139
|
+
#
|
140
|
+
# @param phone [String] Phone number you want to analyze in E.164 format.
|
141
|
+
# @param level [Pinnacle::PhoneNumbers::Types::PhoneDetailsSchemaLevel] Choose how much detail you want in your results:
|
142
|
+
# - `basic`: Receive essential info like carrier, location, and format.
|
143
|
+
# - `advanced`: Receive a deeper analysis including fraud risk, detailed location,
|
144
|
+
# and enhanced contact info.
|
145
|
+
# @param options [Hash] Customize your lookup with additional options.Request of type Pinnacle::PhoneNumbers::Types::PhoneDetailsSchemaOptions, as a Hash
|
146
|
+
# * :force (Boolean)
|
147
|
+
# * :risk (Boolean)
|
148
|
+
# * :enhanced_contact_info (Hash)
|
149
|
+
# * :context (String)
|
150
|
+
# @param request_options [Pinnacle::RequestOptions]
|
151
|
+
# @return [Pinnacle::Types::BasicPhoneInformation, Pinnacle::Types::AdvancedPhoneInformation]
|
152
|
+
# @example
|
153
|
+
# api = Pinnacle::Client.new(
|
154
|
+
# base_url: "https://api.example.com",
|
155
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
156
|
+
# api_key: "YOUR_API_KEY"
|
157
|
+
# )
|
158
|
+
# api.phone_numbers.get(
|
159
|
+
# phone: "+11234567890",
|
160
|
+
# level: ADVANCED,
|
161
|
+
# options: { risk: true, enhanced_contact_info: { context: "This is my friend from JZ. He has done a lot in the crypto space." } }
|
162
|
+
# )
|
163
|
+
def get(phone:, level:, options: nil, request_options: nil)
|
164
|
+
response = @request_client.conn.post do |req|
|
165
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
166
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
167
|
+
req.headers = {
|
168
|
+
**(req.headers || {}),
|
169
|
+
**@request_client.get_headers,
|
170
|
+
**(request_options&.additional_headers || {})
|
171
|
+
}.compact
|
172
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
173
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
174
|
+
end
|
175
|
+
req.body = {
|
176
|
+
**(request_options&.additional_body_parameters || {}),
|
177
|
+
phone: phone,
|
178
|
+
level: level,
|
179
|
+
options: options
|
180
|
+
}.compact
|
181
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/details"
|
182
|
+
end
|
183
|
+
Pinnacle::PhoneNumbers::Types::PhoneNumbersGetResponse.from_json(json_object: response.body)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class AsyncPhoneNumbersClient
|
188
|
+
# @return [Pinnacle::AsyncRequestClient]
|
189
|
+
attr_reader :request_client
|
190
|
+
# @return [Pinnacle::PhoneNumbers::AsyncCampaignClient]
|
191
|
+
attr_reader :campaign
|
192
|
+
# @return [Pinnacle::PhoneNumbers::AsyncWebhookClient]
|
193
|
+
attr_reader :webhook
|
194
|
+
|
195
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
196
|
+
# @return [Pinnacle::AsyncPhoneNumbersClient]
|
197
|
+
def initialize(request_client:)
|
198
|
+
@request_client = request_client
|
199
|
+
@campaign = Pinnacle::PhoneNumbers::AsyncCampaignClient.new(request_client: request_client)
|
200
|
+
@webhook = Pinnacle::PhoneNumbers::AsyncWebhookClient.new(request_client: request_client)
|
201
|
+
end
|
202
|
+
|
203
|
+
# Search for available phone numbers that match your exact criteria.
|
204
|
+
#
|
205
|
+
# @param features [Array<Pinnacle::Types::PhoneFeatureEnum>]
|
206
|
+
# @param location [Hash] Filter your search by geographic location to find numbers in specific regions.
|
207
|
+
# <br>
|
208
|
+
# Toll-free numbers ignore city and state filters.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaLocation, as a Hash
|
209
|
+
# * :city (String)
|
210
|
+
# * :country_code (String)
|
211
|
+
# * :national_destination_code (String)
|
212
|
+
# * :state (String)
|
213
|
+
# @param phone_number_digit_filters [Hash] Filter your search by digit pattern.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaNumber, as a Hash
|
214
|
+
# * :contains (String)
|
215
|
+
# * :ends_with (String)
|
216
|
+
# * :starts_with (String)
|
217
|
+
# @param options [Hash] Extra search settings to control how many results you get.Request of type Pinnacle::PhoneNumbers::Types::SearchSchemaOptions, as a Hash
|
218
|
+
# * :limit (Integer)
|
219
|
+
# @param type [Array<Pinnacle::Types::PhoneEnum>] Types of phone numbers to return in your search.
|
220
|
+
# @param request_options [Pinnacle::RequestOptions]
|
221
|
+
# @return [Array<Pinnacle::Types::PhoneNumberDetails>]
|
222
|
+
# @example
|
223
|
+
# api = Pinnacle::Client.new(
|
224
|
+
# base_url: "https://api.example.com",
|
225
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
226
|
+
# api_key: "YOUR_API_KEY"
|
227
|
+
# )
|
228
|
+
# api.phone_numbers.search(
|
229
|
+
# features: [SMS, MMS],
|
230
|
+
# location: { city: "New York", national_destination_code: "212" },
|
231
|
+
# phone_number_digit_filters: { contains: "514", starts_with: "45" },
|
232
|
+
# options: { limit: 4 },
|
233
|
+
# type: [LOCAL]
|
234
|
+
# )
|
235
|
+
def search(type:, features: nil, location: nil, phone_number_digit_filters: nil, options: nil, request_options: nil)
|
236
|
+
Async do
|
237
|
+
response = @request_client.conn.post do |req|
|
238
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
239
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
240
|
+
req.headers = {
|
241
|
+
**(req.headers || {}),
|
242
|
+
**@request_client.get_headers,
|
243
|
+
**(request_options&.additional_headers || {})
|
244
|
+
}.compact
|
245
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
246
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
247
|
+
end
|
248
|
+
req.body = {
|
249
|
+
**(request_options&.additional_body_parameters || {}),
|
250
|
+
features: features,
|
251
|
+
location: location,
|
252
|
+
number: phone_number_digit_filters,
|
253
|
+
options: options,
|
254
|
+
type: type
|
255
|
+
}.compact
|
256
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/search"
|
257
|
+
end
|
258
|
+
parsed_json = JSON.parse(response.body)
|
259
|
+
parsed_json&.map do |item|
|
260
|
+
item = item.to_json
|
261
|
+
Pinnacle::Types::PhoneNumberDetails.from_json(json_object: item)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# Purchase one or more phone numbers found through the [search
|
267
|
+
# endpoint](./search). <br>
|
268
|
+
# Billing uses your account credits and the numbers are ready for immediate use.
|
269
|
+
#
|
270
|
+
# @param numbers [Array<String>] List of phone numbers you want to purchase, each in international E.164 format.
|
271
|
+
# <br>
|
272
|
+
# All specified numbers must be currently available and will be validated for
|
273
|
+
# availability before processing the purchase. <br>
|
274
|
+
# If any number in the request is unavailable or invalid, no purchases will be
|
275
|
+
# made and the request will be voided.
|
276
|
+
# @param request_options [Pinnacle::RequestOptions]
|
277
|
+
# @return [Array<Pinnacle::Types::PurchasedNumber>]
|
278
|
+
# @example
|
279
|
+
# api = Pinnacle::Client.new(
|
280
|
+
# base_url: "https://api.example.com",
|
281
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
282
|
+
# api_key: "YOUR_API_KEY"
|
283
|
+
# )
|
284
|
+
# api.phone_numbers.buy(numbers: ["+18559491727"])
|
285
|
+
def buy(numbers:, request_options: nil)
|
286
|
+
Async do
|
287
|
+
response = @request_client.conn.post do |req|
|
288
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
289
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
290
|
+
req.headers = {
|
291
|
+
**(req.headers || {}),
|
292
|
+
**@request_client.get_headers,
|
293
|
+
**(request_options&.additional_headers || {})
|
294
|
+
}.compact
|
295
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
296
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
297
|
+
end
|
298
|
+
req.body = { **(request_options&.additional_body_parameters || {}), numbers: numbers }.compact
|
299
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/buy"
|
300
|
+
end
|
301
|
+
parsed_json = JSON.parse(response.body)
|
302
|
+
parsed_json&.map do |item|
|
303
|
+
item = item.to_json
|
304
|
+
Pinnacle::Types::PurchasedNumber.from_json(json_object: item)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# Retrieve information about any phone number.
|
310
|
+
#
|
311
|
+
# @param phone [String] Phone number you want to analyze in E.164 format.
|
312
|
+
# @param level [Pinnacle::PhoneNumbers::Types::PhoneDetailsSchemaLevel] Choose how much detail you want in your results:
|
313
|
+
# - `basic`: Receive essential info like carrier, location, and format.
|
314
|
+
# - `advanced`: Receive a deeper analysis including fraud risk, detailed location,
|
315
|
+
# and enhanced contact info.
|
316
|
+
# @param options [Hash] Customize your lookup with additional options.Request of type Pinnacle::PhoneNumbers::Types::PhoneDetailsSchemaOptions, as a Hash
|
317
|
+
# * :force (Boolean)
|
318
|
+
# * :risk (Boolean)
|
319
|
+
# * :enhanced_contact_info (Hash)
|
320
|
+
# * :context (String)
|
321
|
+
# @param request_options [Pinnacle::RequestOptions]
|
322
|
+
# @return [Pinnacle::Types::BasicPhoneInformation, Pinnacle::Types::AdvancedPhoneInformation]
|
323
|
+
# @example
|
324
|
+
# api = Pinnacle::Client.new(
|
325
|
+
# base_url: "https://api.example.com",
|
326
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
327
|
+
# api_key: "YOUR_API_KEY"
|
328
|
+
# )
|
329
|
+
# api.phone_numbers.get(
|
330
|
+
# phone: "+11234567890",
|
331
|
+
# level: ADVANCED,
|
332
|
+
# options: { risk: true, enhanced_contact_info: { context: "This is my friend from JZ. He has done a lot in the crypto space." } }
|
333
|
+
# )
|
334
|
+
def get(phone:, level:, options: nil, request_options: nil)
|
335
|
+
Async do
|
336
|
+
response = @request_client.conn.post do |req|
|
337
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
338
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
339
|
+
req.headers = {
|
340
|
+
**(req.headers || {}),
|
341
|
+
**@request_client.get_headers,
|
342
|
+
**(request_options&.additional_headers || {})
|
343
|
+
}.compact
|
344
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
345
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
346
|
+
end
|
347
|
+
req.body = {
|
348
|
+
**(request_options&.additional_body_parameters || {}),
|
349
|
+
phone: phone,
|
350
|
+
level: level,
|
351
|
+
options: options
|
352
|
+
}.compact
|
353
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/phone-numbers/details"
|
354
|
+
end
|
355
|
+
Pinnacle::PhoneNumbers::Types::PhoneNumbersGetResponse.from_json(json_object: response.body)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pinnacle
|
4
|
+
module PhoneNumbers
|
5
|
+
module Types
|
6
|
+
# Choose how much detail you want in your results:
|
7
|
+
# - `basic`: Receive essential info like carrier, location, and format.
|
8
|
+
# - `advanced`: Receive a deeper analysis including fraud risk, detailed location,
|
9
|
+
# and enhanced contact info.
|
10
|
+
class PhoneDetailsSchemaLevel
|
11
|
+
BASIC = "basic"
|
12
|
+
ADVANCED = "advanced"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|