-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
# Common files
-
1
require 'bandwidth-sdk/api_client'
-
1
require 'bandwidth-sdk/api_error'
-
1
require 'bandwidth-sdk/api_model_base'
-
1
require 'bandwidth-sdk/version'
-
1
require 'bandwidth-sdk/configuration'
-
-
# Models
-
1
require 'bandwidth-sdk/models/account_statistics'
-
1
require 'bandwidth-sdk/models/additional_denial_reason'
-
1
require 'bandwidth-sdk/models/address'
-
1
require 'bandwidth-sdk/models/answer_callback'
-
1
require 'bandwidth-sdk/models/async_lookup_request'
-
1
require 'bandwidth-sdk/models/blocked_webhook'
-
1
require 'bandwidth-sdk/models/bridge_complete_callback'
-
1
require 'bandwidth-sdk/models/bridge_target_complete_callback'
-
1
require 'bandwidth-sdk/models/brtc_error'
-
1
require 'bandwidth-sdk/models/brtc_error_response'
-
1
require 'bandwidth-sdk/models/brtc_error_source'
-
1
require 'bandwidth-sdk/models/brtc_link'
-
1
require 'bandwidth-sdk/models/business_entity_type_enum'
-
1
require 'bandwidth-sdk/models/business_registration_type_enum'
-
1
require 'bandwidth-sdk/models/call_direction_enum'
-
1
require 'bandwidth-sdk/models/call_recording_metadata'
-
1
require 'bandwidth-sdk/models/call_state'
-
1
require 'bandwidth-sdk/models/call_state_enum'
-
1
require 'bandwidth-sdk/models/call_transcription'
-
1
require 'bandwidth-sdk/models/call_transcription_detected_language_enum'
-
1
require 'bandwidth-sdk/models/call_transcription_metadata'
-
1
require 'bandwidth-sdk/models/call_transcription_response'
-
1
require 'bandwidth-sdk/models/call_transcription_track_enum'
-
1
require 'bandwidth-sdk/models/callback'
-
1
require 'bandwidth-sdk/models/callback_method_enum'
-
1
require 'bandwidth-sdk/models/card_width_enum'
-
1
require 'bandwidth-sdk/models/code_request'
-
1
require 'bandwidth-sdk/models/completed_lookup_status_enum'
-
1
require 'bandwidth-sdk/models/conference'
-
1
require 'bandwidth-sdk/models/conference_completed_callback'
-
1
require 'bandwidth-sdk/models/conference_created_callback'
-
1
require 'bandwidth-sdk/models/conference_member'
-
1
require 'bandwidth-sdk/models/conference_member_exit_callback'
-
1
require 'bandwidth-sdk/models/conference_member_join_callback'
-
1
require 'bandwidth-sdk/models/conference_recording_available_callback'
-
1
require 'bandwidth-sdk/models/conference_recording_metadata'
-
1
require 'bandwidth-sdk/models/conference_redirect_callback'
-
1
require 'bandwidth-sdk/models/conference_state_enum'
-
1
require 'bandwidth-sdk/models/contact'
-
1
require 'bandwidth-sdk/models/create_async_bulk_lookup_response'
-
1
require 'bandwidth-sdk/models/create_async_bulk_lookup_response_data'
-
1
require 'bandwidth-sdk/models/create_call'
-
1
require 'bandwidth-sdk/models/create_call_response'
-
1
require 'bandwidth-sdk/models/create_endpoint_request_base'
-
1
require 'bandwidth-sdk/models/create_endpoint_response'
-
1
require 'bandwidth-sdk/models/create_endpoint_response_data'
-
1
require 'bandwidth-sdk/models/create_message_request_error'
-
1
require 'bandwidth-sdk/models/create_multi_channel_message_response'
-
1
require 'bandwidth-sdk/models/create_sync_lookup_response'
-
1
require 'bandwidth-sdk/models/create_sync_lookup_response_data'
-
1
require 'bandwidth-sdk/models/create_web_rtc_connection_request'
-
1
require 'bandwidth-sdk/models/deactivation_event_enum'
-
1
require 'bandwidth-sdk/models/device'
-
1
require 'bandwidth-sdk/models/device_status_enum'
-
1
require 'bandwidth-sdk/models/disconnect_callback'
-
1
require 'bandwidth-sdk/models/diversion'
-
1
require 'bandwidth-sdk/models/dtmf_callback'
-
1
require 'bandwidth-sdk/models/endpoint'
-
1
require 'bandwidth-sdk/models/endpoint_direction_enum'
-
1
require 'bandwidth-sdk/models/endpoint_event'
-
1
require 'bandwidth-sdk/models/endpoint_event_type_enum'
-
1
require 'bandwidth-sdk/models/endpoint_response'
-
1
require 'bandwidth-sdk/models/endpoint_status_enum'
-
1
require 'bandwidth-sdk/models/endpoint_type_enum'
-
1
require 'bandwidth-sdk/models/endpoints'
-
1
require 'bandwidth-sdk/models/error_object'
-
1
require 'bandwidth-sdk/models/error_source'
-
1
require 'bandwidth-sdk/models/failure_webhook'
-
1
require 'bandwidth-sdk/models/field_error'
-
1
require 'bandwidth-sdk/models/file_format_enum'
-
1
require 'bandwidth-sdk/models/gather_callback'
-
1
require 'bandwidth-sdk/models/get_async_bulk_lookup_response'
-
1
require 'bandwidth-sdk/models/get_async_bulk_lookup_response_data'
-
1
require 'bandwidth-sdk/models/in_progress_lookup_status_enum'
-
1
require 'bandwidth-sdk/models/inbound_callback'
-
1
require 'bandwidth-sdk/models/inbound_callback_message'
-
1
require 'bandwidth-sdk/models/inbound_callback_type_enum'
-
1
require 'bandwidth-sdk/models/initiate_callback'
-
1
require 'bandwidth-sdk/models/latest_message_delivery_status_enum'
-
1
require 'bandwidth-sdk/models/line_type_enum'
-
1
require 'bandwidth-sdk/models/link'
-
1
require 'bandwidth-sdk/models/link_schema'
-
1
require 'bandwidth-sdk/models/links_object'
-
1
require 'bandwidth-sdk/models/list_endpoints_response'
-
1
require 'bandwidth-sdk/models/list_message_direction_enum'
-
1
require 'bandwidth-sdk/models/list_message_item'
-
1
require 'bandwidth-sdk/models/lookup_error_response'
-
1
require 'bandwidth-sdk/models/lookup_error_schema'
-
1
require 'bandwidth-sdk/models/lookup_error_schema_meta'
-
1
require 'bandwidth-sdk/models/lookup_result'
-
1
require 'bandwidth-sdk/models/machine_detection_complete_callback'
-
1
require 'bandwidth-sdk/models/machine_detection_configuration'
-
1
require 'bandwidth-sdk/models/machine_detection_mode_enum'
-
1
require 'bandwidth-sdk/models/machine_detection_result'
-
1
require 'bandwidth-sdk/models/media'
-
1
require 'bandwidth-sdk/models/message'
-
1
require 'bandwidth-sdk/models/message_direction_enum'
-
1
require 'bandwidth-sdk/models/message_request'
-
1
require 'bandwidth-sdk/models/message_status_enum'
-
1
require 'bandwidth-sdk/models/message_type_enum'
-
1
require 'bandwidth-sdk/models/messages_list'
-
1
require 'bandwidth-sdk/models/messaging_code_response'
-
1
require 'bandwidth-sdk/models/messaging_request_error'
-
1
require 'bandwidth-sdk/models/mfa_forbidden_request_error'
-
1
require 'bandwidth-sdk/models/mfa_request_error'
-
1
require 'bandwidth-sdk/models/mfa_unauthorized_request_error'
-
1
require 'bandwidth-sdk/models/mms_message_content'
-
1
require 'bandwidth-sdk/models/mms_message_content_file'
-
1
require 'bandwidth-sdk/models/multi_channel_action'
-
1
require 'bandwidth-sdk/models/multi_channel_action_calendar_event'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_mms_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_mms_response_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_object_base'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_owner_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_request_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_response_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_sms_object'
-
1
require 'bandwidth-sdk/models/multi_channel_channel_list_sms_response_object'
-
1
require 'bandwidth-sdk/models/multi_channel_error'
-
1
require 'bandwidth-sdk/models/multi_channel_message_channel_enum'
-
1
require 'bandwidth-sdk/models/multi_channel_message_content'
-
1
require 'bandwidth-sdk/models/multi_channel_message_request'
-
1
require 'bandwidth-sdk/models/multi_channel_message_response_data'
-
1
require 'bandwidth-sdk/models/opt_in_workflow'
-
1
require 'bandwidth-sdk/models/page'
-
1
require 'bandwidth-sdk/models/page_info'
-
1
require 'bandwidth-sdk/models/priority_enum'
-
1
require 'bandwidth-sdk/models/product_type_enum'
-
1
require 'bandwidth-sdk/models/rbm_action_base'
-
1
require 'bandwidth-sdk/models/rbm_action_dial'
-
1
require 'bandwidth-sdk/models/rbm_action_open_url'
-
1
require 'bandwidth-sdk/models/rbm_action_type_enum'
-
1
require 'bandwidth-sdk/models/rbm_action_view_location'
-
1
require 'bandwidth-sdk/models/rbm_card_content'
-
1
require 'bandwidth-sdk/models/rbm_card_content_media'
-
1
require 'bandwidth-sdk/models/rbm_location_response'
-
1
require 'bandwidth-sdk/models/rbm_media_height_enum'
-
1
require 'bandwidth-sdk/models/rbm_message_carousel_card'
-
1
require 'bandwidth-sdk/models/rbm_message_content_file'
-
1
require 'bandwidth-sdk/models/rbm_message_content_rich_card'
-
1
require 'bandwidth-sdk/models/rbm_message_content_text'
-
1
require 'bandwidth-sdk/models/rbm_message_media'
-
1
require 'bandwidth-sdk/models/rbm_open_url_enum'
-
1
require 'bandwidth-sdk/models/rbm_standalone_card'
-
1
require 'bandwidth-sdk/models/rbm_suggestion_response'
-
1
require 'bandwidth-sdk/models/rbm_web_view_enum'
-
1
require 'bandwidth-sdk/models/recording_available_callback'
-
1
require 'bandwidth-sdk/models/recording_complete_callback'
-
1
require 'bandwidth-sdk/models/recording_state_enum'
-
1
require 'bandwidth-sdk/models/recording_transcription_metadata'
-
1
require 'bandwidth-sdk/models/recording_transcriptions'
-
1
require 'bandwidth-sdk/models/redirect_callback'
-
1
require 'bandwidth-sdk/models/redirect_method_enum'
-
1
require 'bandwidth-sdk/models/sip_connection_metadata'
-
1
require 'bandwidth-sdk/models/sip_credentials'
-
1
require 'bandwidth-sdk/models/sms_message_content'
-
1
require 'bandwidth-sdk/models/standalone_card_orientation_enum'
-
1
require 'bandwidth-sdk/models/status_callback'
-
1
require 'bandwidth-sdk/models/status_callback_message'
-
1
require 'bandwidth-sdk/models/status_callback_type_enum'
-
1
require 'bandwidth-sdk/models/stir_shaken'
-
1
require 'bandwidth-sdk/models/sync_lookup_request'
-
1
require 'bandwidth-sdk/models/telephone_number'
-
1
require 'bandwidth-sdk/models/tfv_basic_authentication'
-
1
require 'bandwidth-sdk/models/tfv_callback_status_enum'
-
1
require 'bandwidth-sdk/models/tfv_error'
-
1
require 'bandwidth-sdk/models/tfv_status'
-
1
require 'bandwidth-sdk/models/tfv_status_enum'
-
1
require 'bandwidth-sdk/models/tfv_submission_info'
-
1
require 'bandwidth-sdk/models/tfv_submission_wrapper'
-
1
require 'bandwidth-sdk/models/thumbnail_alignment_enum'
-
1
require 'bandwidth-sdk/models/transcribe_recording'
-
1
require 'bandwidth-sdk/models/transcription'
-
1
require 'bandwidth-sdk/models/transcription_available_callback'
-
1
require 'bandwidth-sdk/models/transfer_answer_callback'
-
1
require 'bandwidth-sdk/models/transfer_complete_callback'
-
1
require 'bandwidth-sdk/models/transfer_disconnect_callback'
-
1
require 'bandwidth-sdk/models/update_call'
-
1
require 'bandwidth-sdk/models/update_call_recording'
-
1
require 'bandwidth-sdk/models/update_conference'
-
1
require 'bandwidth-sdk/models/update_conference_member'
-
1
require 'bandwidth-sdk/models/verification_denial_webhook'
-
1
require 'bandwidth-sdk/models/verification_request'
-
1
require 'bandwidth-sdk/models/verification_update_request'
-
1
require 'bandwidth-sdk/models/verification_webhook'
-
1
require 'bandwidth-sdk/models/verify_code_request'
-
1
require 'bandwidth-sdk/models/verify_code_response'
-
1
require 'bandwidth-sdk/models/voice_api_error'
-
1
require 'bandwidth-sdk/models/voice_code_response'
-
1
require 'bandwidth-sdk/models/webhook_subscription'
-
1
require 'bandwidth-sdk/models/webhook_subscription_basic_authentication'
-
1
require 'bandwidth-sdk/models/webhook_subscription_error'
-
1
require 'bandwidth-sdk/models/webhook_subscription_request_schema'
-
1
require 'bandwidth-sdk/models/webhook_subscription_type_enum'
-
1
require 'bandwidth-sdk/models/webhook_subscriptions_list_body'
-
-
# BXML
-
1
require 'bandwidth-sdk/models/bxml/root'
-
1
require 'bandwidth-sdk/models/bxml/bxml'
-
1
require 'bandwidth-sdk/models/bxml/response'
-
1
require 'bandwidth-sdk/models/bxml/verb'
-
1
require 'bandwidth-sdk/models/bxml/nestable_verb'
-
1
require 'bandwidth-sdk/models/bxml/verbs/bridge'
-
1
require 'bandwidth-sdk/models/bxml/verbs/conference'
-
1
require 'bandwidth-sdk/models/bxml/verbs/custom_param'
-
1
require 'bandwidth-sdk/models/bxml/verbs/forward'
-
1
require 'bandwidth-sdk/models/bxml/verbs/gather'
-
1
require 'bandwidth-sdk/models/bxml/verbs/hangup'
-
1
require 'bandwidth-sdk/models/bxml/verbs/pause_recording'
-
1
require 'bandwidth-sdk/models/bxml/verbs/pause'
-
1
require 'bandwidth-sdk/models/bxml/verbs/phone_number'
-
1
require 'bandwidth-sdk/models/bxml/verbs/play_audio'
-
1
require 'bandwidth-sdk/models/bxml/verbs/record'
-
1
require 'bandwidth-sdk/models/bxml/verbs/redirect'
-
1
require 'bandwidth-sdk/models/bxml/verbs/resume_recording'
-
1
require 'bandwidth-sdk/models/bxml/verbs/ring'
-
1
require 'bandwidth-sdk/models/bxml/verbs/send_dtmf'
-
1
require 'bandwidth-sdk/models/bxml/verbs/sip_uri'
-
1
require 'bandwidth-sdk/models/bxml/verbs/speak_sentence'
-
1
require 'bandwidth-sdk/models/bxml/verbs/start_gather'
-
1
require 'bandwidth-sdk/models/bxml/verbs/start_recording'
-
1
require 'bandwidth-sdk/models/bxml/verbs/start_stream'
-
1
require 'bandwidth-sdk/models/bxml/verbs/start_transcription'
-
1
require 'bandwidth-sdk/models/bxml/verbs/stop_gather'
-
1
require 'bandwidth-sdk/models/bxml/verbs/stop_recording'
-
1
require 'bandwidth-sdk/models/bxml/verbs/stop_stream'
-
1
require 'bandwidth-sdk/models/bxml/verbs/stop_transcription'
-
1
require 'bandwidth-sdk/models/bxml/verbs/stream_param'
-
1
require 'bandwidth-sdk/models/bxml/verbs/tag'
-
1
require 'bandwidth-sdk/models/bxml/verbs/transfer'
-
-
# APIs
-
1
require 'bandwidth-sdk/api/calls_api'
-
1
require 'bandwidth-sdk/api/conferences_api'
-
1
require 'bandwidth-sdk/api/endpoints_api'
-
1
require 'bandwidth-sdk/api/mfa_api'
-
1
require 'bandwidth-sdk/api/media_api'
-
1
require 'bandwidth-sdk/api/messages_api'
-
1
require 'bandwidth-sdk/api/multi_channel_api'
-
1
require 'bandwidth-sdk/api/phone_number_lookup_api'
-
1
require 'bandwidth-sdk/api/recordings_api'
-
1
require 'bandwidth-sdk/api/statistics_api'
-
1
require 'bandwidth-sdk/api/toll_free_verification_api'
-
1
require 'bandwidth-sdk/api/transcriptions_api'
-
-
1
module Bandwidth
-
1
class << self
-
# Customize default settings for the SDK using block.
-
# Bandwidth.configure do |config|
-
# config.username = "xxx"
-
# config.password = "xxx"
-
# end
-
# If no block given, return the default Configuration object.
-
1
def configure
-
13
if block_given?
-
13
yield(Configuration.default)
-
else
-
Configuration.default
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class CallsApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
2
@api_client = api_client
-
end
-
# Create Call
-
# Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param create_call [CreateCall] JSON object containing information to create an outbound call
-
# @param [Hash] opts the optional parameters
-
# @return [CreateCallResponse]
-
1
def create_call(account_id, create_call, opts = {})
-
2
data, _status_code, _headers = create_call_with_http_info(account_id, create_call, opts)
-
data
-
end
-
-
# Create Call
-
# Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param create_call [CreateCall] JSON object containing information to create an outbound call
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CreateCallResponse, Integer, Hash)>] CreateCallResponse data, response status code and response headers
-
1
def create_call_with_http_info(account_id, create_call, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: CallsApi.create_call ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.create_call"
-
end
-
# verify the required parameter 'create_call' is set
-
2
if @api_client.config.client_side_validation && create_call.nil?
-
1
fail ArgumentError, "Missing the required parameter 'create_call' when calling CallsApi.create_call"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_call)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CreateCallResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"CallsApi.create_call",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: CallsApi#create_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Call State Information
-
# Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [CallState]
-
1
def get_call_state(account_id, call_id, opts = {})
-
2
data, _status_code, _headers = get_call_state_with_http_info(account_id, call_id, opts)
-
data
-
end
-
-
# Get Call State Information
-
# Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CallState, Integer, Hash)>] CallState data, response status code and response headers
-
1
def get_call_state_with_http_info(account_id, call_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: CallsApi.get_call_state ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.get_call_state"
-
end
-
# verify the required parameter 'call_id' is set
-
2
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling CallsApi.get_call_state"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CallState'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"CallsApi.get_call_state",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: CallsApi#get_call_state\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Calls
-
# Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :to Filter results by the `to` field.
-
# @option opts [String] :from Filter results by the `from` field.
-
# @option opts [String] :min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format).
-
# @option opts [String] :max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format).
-
# @option opts [String] :disconnect_cause Filter results to calls with specified call Disconnect Cause.
-
# @option opts [Integer] :page_size Specifies the max number of calls that will be returned. (default to 1000)
-
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
-
# @return [Array<CallState>]
-
1
def list_calls(account_id, opts = {})
-
data, _status_code, _headers = list_calls_with_http_info(account_id, opts)
-
data
-
end
-
-
# Get Calls
-
# Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :to Filter results by the `to` field.
-
# @option opts [String] :from Filter results by the `from` field.
-
# @option opts [String] :min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format).
-
# @option opts [String] :max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format).
-
# @option opts [String] :disconnect_cause Filter results to calls with specified call Disconnect Cause.
-
# @option opts [Integer] :page_size Specifies the max number of calls that will be returned. (default to 1000)
-
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
-
# @return [Array<(Array<CallState>, Integer, Hash)>] Array<CallState> data, response status code and response headers
-
1
def list_calls_with_http_info(account_id, opts = {})
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug 'Calling API: CallsApi.list_calls ...'
-
end
-
# verify the required parameter 'account_id' is set
-
1
if @api_client.config.client_side_validation && account_id.nil?
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.list_calls"
-
end
-
1
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
-
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CallsApi.list_calls, must be smaller than or equal to 10000.'
-
end
-
-
1
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
-
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CallsApi.list_calls, must be greater than or equal to 1.'
-
end
-
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
1
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
-
1
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
-
1
query_params[:'minStartTime'] = opts[:'min_start_time'] if !opts[:'min_start_time'].nil?
-
1
query_params[:'maxStartTime'] = opts[:'max_start_time'] if !opts[:'max_start_time'].nil?
-
1
query_params[:'disconnectCause'] = opts[:'disconnect_cause'] if !opts[:'disconnect_cause'].nil?
-
1
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
-
1
query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].nil?
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<CallState>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"CallsApi.list_calls",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: CallsApi#list_calls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Call
-
# Interrupts and redirects a call to a different URL that should return a BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param update_call [UpdateCall] JSON object containing information to redirect an existing call to a new BXML document
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_call(account_id, call_id, update_call, opts = {})
-
3
update_call_with_http_info(account_id, call_id, update_call, opts)
-
nil
-
end
-
-
# Update Call
-
# Interrupts and redirects a call to a different URL that should return a BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param update_call [UpdateCall] JSON object containing information to redirect an existing call to a new BXML document
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_call_with_http_info(account_id, call_id, update_call, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: CallsApi.update_call ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.update_call"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling CallsApi.update_call"
-
end
-
# verify the required parameter 'update_call' is set
-
2
if @api_client.config.client_side_validation && update_call.nil?
-
1
fail ArgumentError, "Missing the required parameter 'update_call' when calling CallsApi.update_call"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_call)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"CallsApi.update_call",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: CallsApi#update_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Call BXML
-
# Interrupts and replaces an active call's BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_call_bxml(account_id, call_id, body, opts = {})
-
3
update_call_bxml_with_http_info(account_id, call_id, body, opts)
-
nil
-
end
-
-
# Update Call BXML
-
# Interrupts and replaces an active call's BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_call_bxml_with_http_info(account_id, call_id, body, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: CallsApi.update_call_bxml ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.update_call_bxml"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling CallsApi.update_call_bxml"
-
end
-
# verify the required parameter 'body' is set
-
2
if @api_client.config.client_side_validation && body.nil?
-
1
fail ArgumentError, "Missing the required parameter 'body' when calling CallsApi.update_call_bxml"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/bxml'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/xml'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"CallsApi.update_call_bxml",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: CallsApi#update_call_bxml\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class ConferencesApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Download Conference Recording
-
# Downloads the specified recording file.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [File]
-
1
def download_conference_recording(account_id, conference_id, recording_id, opts = {})
-
3
data, _status_code, _headers = download_conference_recording_with_http_info(account_id, conference_id, recording_id, opts)
-
data
-
end
-
-
# Download Conference Recording
-
# Downloads the specified recording file.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
-
1
def download_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.download_conference_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.download_conference_recording"
-
end
-
# verify the required parameter 'conference_id' is set
-
3
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.download_conference_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling ConferencesApi.download_conference_recording"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['audio/vnd.wave', 'audio/mpeg', 'application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'File'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.download_conference_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#download_conference_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Conference Information
-
# Returns information about the specified conference.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Conference]
-
1
def get_conference(account_id, conference_id, opts = {})
-
2
data, _status_code, _headers = get_conference_with_http_info(account_id, conference_id, opts)
-
data
-
end
-
-
# Get Conference Information
-
# Returns information about the specified conference.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Conference, Integer, Hash)>] Conference data, response status code and response headers
-
1
def get_conference_with_http_info(account_id, conference_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.get_conference"
-
end
-
# verify the required parameter 'conference_id' is set
-
2
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Conference'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.get_conference",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#get_conference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Conference Member
-
# Returns information about the specified conference member.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param member_id [String] Programmable Voice API Conference Member ID.
-
# @param [Hash] opts the optional parameters
-
# @return [ConferenceMember]
-
1
def get_conference_member(account_id, conference_id, member_id, opts = {})
-
3
data, _status_code, _headers = get_conference_member_with_http_info(account_id, conference_id, member_id, opts)
-
data
-
end
-
-
# Get Conference Member
-
# Returns information about the specified conference member.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param member_id [String] Programmable Voice API Conference Member ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(ConferenceMember, Integer, Hash)>] ConferenceMember data, response status code and response headers
-
1
def get_conference_member_with_http_info(account_id, conference_id, member_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference_member ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.get_conference_member"
-
end
-
# verify the required parameter 'conference_id' is set
-
3
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference_member"
-
end
-
# verify the required parameter 'member_id' is set
-
2
if @api_client.config.client_side_validation && member_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'member_id' when calling ConferencesApi.get_conference_member"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'ConferenceMember'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.get_conference_member",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#get_conference_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Conference Recording Information
-
# Returns metadata for the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [ConferenceRecordingMetadata]
-
1
def get_conference_recording(account_id, conference_id, recording_id, opts = {})
-
3
data, _status_code, _headers = get_conference_recording_with_http_info(account_id, conference_id, recording_id, opts)
-
data
-
end
-
-
# Get Conference Recording Information
-
# Returns metadata for the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(ConferenceRecordingMetadata, Integer, Hash)>] ConferenceRecordingMetadata data, response status code and response headers
-
1
def get_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.get_conference_recording"
-
end
-
# verify the required parameter 'conference_id' is set
-
3
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling ConferencesApi.get_conference_recording"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'ConferenceRecordingMetadata'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.get_conference_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#get_conference_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Conference Recordings
-
# Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<ConferenceRecordingMetadata>]
-
1
def list_conference_recordings(account_id, conference_id, opts = {})
-
2
data, _status_code, _headers = list_conference_recordings_with_http_info(account_id, conference_id, opts)
-
data
-
end
-
-
# Get Conference Recordings
-
# Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Array<ConferenceRecordingMetadata>, Integer, Hash)>] Array<ConferenceRecordingMetadata> data, response status code and response headers
-
1
def list_conference_recordings_with_http_info(account_id, conference_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: ConferencesApi.list_conference_recordings ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.list_conference_recordings"
-
end
-
# verify the required parameter 'conference_id' is set
-
2
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.list_conference_recordings"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/recordings'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<ConferenceRecordingMetadata>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.list_conference_recordings",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#list_conference_recordings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Conferences
-
# Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :name Filter results by the `name` field.
-
# @option opts [String] :min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format).
-
# @option opts [String] :max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format).
-
# @option opts [Integer] :page_size Specifies the max number of conferences that will be returned. (default to 1000)
-
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
-
# @return [Array<Conference>]
-
1
def list_conferences(account_id, opts = {})
-
3
data, _status_code, _headers = list_conferences_with_http_info(account_id, opts)
-
data
-
end
-
-
# Get Conferences
-
# Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :name Filter results by the `name` field.
-
# @option opts [String] :min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format).
-
# @option opts [String] :max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format).
-
# @option opts [Integer] :page_size Specifies the max number of conferences that will be returned. (default to 1000)
-
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
-
# @return [Array<(Array<Conference>, Integer, Hash)>] Array<Conference> data, response status code and response headers
-
1
def list_conferences_with_http_info(account_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.list_conferences ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.list_conferences"
-
end
-
3
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
-
1
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ConferencesApi.list_conferences, must be smaller than or equal to 1000.'
-
end
-
-
2
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
-
1
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ConferencesApi.list_conferences, must be greater than or equal to 1.'
-
end
-
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
1
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
-
1
query_params[:'minCreatedTime'] = opts[:'min_created_time'] if !opts[:'min_created_time'].nil?
-
1
query_params[:'maxCreatedTime'] = opts[:'max_created_time'] if !opts[:'max_created_time'].nil?
-
1
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
-
1
query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].nil?
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<Conference>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.list_conferences",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#list_conferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Conference
-
# Update the conference state.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param update_conference [UpdateConference]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_conference(account_id, conference_id, update_conference, opts = {})
-
3
update_conference_with_http_info(account_id, conference_id, update_conference, opts)
-
nil
-
end
-
-
# Update Conference
-
# Update the conference state.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param update_conference [UpdateConference]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_conference_with_http_info(account_id, conference_id, update_conference, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.update_conference ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.update_conference"
-
end
-
# verify the required parameter 'conference_id' is set
-
3
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.update_conference"
-
end
-
# verify the required parameter 'update_conference' is set
-
2
if @api_client.config.client_side_validation && update_conference.nil?
-
1
fail ArgumentError, "Missing the required parameter 'update_conference' when calling ConferencesApi.update_conference"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_conference)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.update_conference",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#update_conference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Conference BXML
-
# Update the conference BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_conference_bxml(account_id, conference_id, body, opts = {})
-
3
update_conference_bxml_with_http_info(account_id, conference_id, body, opts)
-
nil
-
end
-
-
# Update Conference BXML
-
# Update the conference BXML document.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_conference_bxml_with_http_info(account_id, conference_id, body, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: ConferencesApi.update_conference_bxml ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.update_conference_bxml"
-
end
-
# verify the required parameter 'conference_id' is set
-
3
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.update_conference_bxml"
-
end
-
# verify the required parameter 'body' is set
-
2
if @api_client.config.client_side_validation && body.nil?
-
1
fail ArgumentError, "Missing the required parameter 'body' when calling ConferencesApi.update_conference_bxml"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/bxml'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/xml'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.update_conference_bxml",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#update_conference_bxml\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Conference Member
-
# Updates settings for a particular conference member.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param member_id [String] Programmable Voice API Conference Member ID.
-
# @param update_conference_member [UpdateConferenceMember]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_conference_member(account_id, conference_id, member_id, update_conference_member, opts = {})
-
4
update_conference_member_with_http_info(account_id, conference_id, member_id, update_conference_member, opts)
-
nil
-
end
-
-
# Update Conference Member
-
# Updates settings for a particular conference member.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param conference_id [String] Programmable Voice API Conference ID.
-
# @param member_id [String] Programmable Voice API Conference Member ID.
-
# @param update_conference_member [UpdateConferenceMember]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_conference_member_with_http_info(account_id, conference_id, member_id, update_conference_member, opts = {})
-
5
if @api_client.config.debugging
-
5
@api_client.config.logger.debug 'Calling API: ConferencesApi.update_conference_member ...'
-
end
-
# verify the required parameter 'account_id' is set
-
5
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling ConferencesApi.update_conference_member"
-
end
-
# verify the required parameter 'conference_id' is set
-
4
if @api_client.config.client_side_validation && conference_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'conference_id' when calling ConferencesApi.update_conference_member"
-
end
-
# verify the required parameter 'member_id' is set
-
3
if @api_client.config.client_side_validation && member_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'member_id' when calling ConferencesApi.update_conference_member"
-
end
-
# verify the required parameter 'update_conference_member' is set
-
2
if @api_client.config.client_side_validation && update_conference_member.nil?
-
1
fail ArgumentError, "Missing the required parameter 'update_conference_member' when calling ConferencesApi.update_conference_member"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'memberId' + '}', CGI.escape(member_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_conference_member)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"ConferencesApi.update_conference_member",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: ConferencesApi#update_conference_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class EndpointsApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Create Endpoint
-
# Creates a new Endpoint for the specified account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param body [CreateWebRtcConnectionRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [CreateEndpointResponse]
-
1
def create_endpoint(account_id, body, opts = {})
-
2
data, _status_code, _headers = create_endpoint_with_http_info(account_id, body, opts)
-
data
-
end
-
-
# Create Endpoint
-
# Creates a new Endpoint for the specified account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param body [CreateWebRtcConnectionRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CreateEndpointResponse, Integer, Hash)>] CreateEndpointResponse data, response status code and response headers
-
1
def create_endpoint_with_http_info(account_id, body, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: EndpointsApi.create_endpoint ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling EndpointsApi.create_endpoint"
-
end
-
# verify the required parameter 'body' is set
-
2
if @api_client.config.client_side_validation && body.nil?
-
1
fail ArgumentError, "Missing the required parameter 'body' when calling EndpointsApi.create_endpoint"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/endpoints'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CreateEndpointResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"EndpointsApi.create_endpoint",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: EndpointsApi#create_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Delete Endpoint
-
# Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_endpoint(account_id, endpoint_id, opts = {})
-
2
delete_endpoint_with_http_info(account_id, endpoint_id, opts)
-
nil
-
end
-
-
# Delete Endpoint
-
# Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_endpoint_with_http_info(account_id, endpoint_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: EndpointsApi.delete_endpoint ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling EndpointsApi.delete_endpoint"
-
end
-
# verify the required parameter 'endpoint_id' is set
-
2
if @api_client.config.client_side_validation && endpoint_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling EndpointsApi.delete_endpoint"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/endpoints/{endpointId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'endpointId' + '}', CGI.escape(endpoint_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"EndpointsApi.delete_endpoint",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: EndpointsApi#delete_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Endpoint
-
# Returns information about the specified endpoint.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param [Hash] opts the optional parameters
-
# @return [EndpointResponse]
-
1
def get_endpoint(account_id, endpoint_id, opts = {})
-
2
data, _status_code, _headers = get_endpoint_with_http_info(account_id, endpoint_id, opts)
-
data
-
end
-
-
# Get Endpoint
-
# Returns information about the specified endpoint.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(EndpointResponse, Integer, Hash)>] EndpointResponse data, response status code and response headers
-
1
def get_endpoint_with_http_info(account_id, endpoint_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: EndpointsApi.get_endpoint ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling EndpointsApi.get_endpoint"
-
end
-
# verify the required parameter 'endpoint_id' is set
-
2
if @api_client.config.client_side_validation && endpoint_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling EndpointsApi.get_endpoint"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/endpoints/{endpointId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'endpointId' + '}', CGI.escape(endpoint_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'EndpointResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"EndpointsApi.get_endpoint",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: EndpointsApi#get_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Endpoints
-
# Returns a list of endpoints associated with the specified account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [EndpointTypeEnum] :type The type of endpoint.
-
# @option opts [EndpointStatusEnum] :status The status of the endpoint.
-
# @option opts [String] :after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response.
-
# @option opts [Integer] :limit The maximum number of endpoints to return in the response. (default to 100)
-
# @return [ListEndpointsResponse]
-
1
def list_endpoints(account_id, opts = {})
-
1
data, _status_code, _headers = list_endpoints_with_http_info(account_id, opts)
-
data
-
end
-
-
# List Endpoints
-
# Returns a list of endpoints associated with the specified account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [EndpointTypeEnum] :type The type of endpoint.
-
# @option opts [EndpointStatusEnum] :status The status of the endpoint.
-
# @option opts [String] :after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response.
-
# @option opts [Integer] :limit The maximum number of endpoints to return in the response. (default to 100)
-
# @return [Array<(ListEndpointsResponse, Integer, Hash)>] ListEndpointsResponse data, response status code and response headers
-
1
def list_endpoints_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: EndpointsApi.list_endpoints ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling EndpointsApi.list_endpoints"
-
end
-
1
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
-
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EndpointsApi.list_endpoints, must be smaller than or equal to 1000.'
-
end
-
-
1
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
-
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EndpointsApi.list_endpoints, must be greater than or equal to 1.'
-
end
-
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/endpoints'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
1
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
-
1
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
-
1
query_params[:'afterCursor'] = opts[:'after_cursor'] if !opts[:'after_cursor'].nil?
-
1
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'ListEndpointsResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"EndpointsApi.list_endpoints",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: EndpointsApi#list_endpoints\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Endpoint BXML
-
# Updates the BXML for the specified endpoint.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_endpoint_bxml(account_id, endpoint_id, body, opts = {})
-
3
update_endpoint_bxml_with_http_info(account_id, endpoint_id, body, opts)
-
nil
-
end
-
-
# Update Endpoint BXML
-
# Updates the BXML for the specified endpoint.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param endpoint_id [String] BRTC Endpoint ID.
-
# @param body [String]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_endpoint_bxml_with_http_info(account_id, endpoint_id, body, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: EndpointsApi.update_endpoint_bxml ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling EndpointsApi.update_endpoint_bxml"
-
end
-
# verify the required parameter 'endpoint_id' is set
-
3
if @api_client.config.client_side_validation && endpoint_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling EndpointsApi.update_endpoint_bxml"
-
end
-
# verify the required parameter 'body' is set
-
2
if @api_client.config.client_side_validation && body.nil?
-
1
fail ArgumentError, "Missing the required parameter 'body' when calling EndpointsApi.update_endpoint_bxml"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/endpoints/{endpointId}/bxml'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'endpointId' + '}', CGI.escape(endpoint_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/xml'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"EndpointsApi.update_endpoint_bxml",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: EndpointsApi#update_endpoint_bxml\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class MediaApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Delete Media
-
# Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_media(account_id, media_id, opts = {})
-
2
delete_media_with_http_info(account_id, media_id, opts)
-
nil
-
end
-
-
# Delete Media
-
# Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_media_with_http_info(account_id, media_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MediaApi.delete_media ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.delete_media"
-
end
-
# verify the required parameter 'media_id' is set
-
2
if @api_client.config.client_side_validation && media_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.delete_media"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/media/{mediaId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'mediaId' + '}', CGI.escape(media_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MediaApi.delete_media",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MediaApi#delete_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Media
-
# Downloads a media file you previously uploaded.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param [Hash] opts the optional parameters
-
# @return [File]
-
1
def get_media(account_id, media_id, opts = {})
-
2
data, _status_code, _headers = get_media_with_http_info(account_id, media_id, opts)
-
data
-
end
-
-
# Get Media
-
# Downloads a media file you previously uploaded.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
-
1
def get_media_with_http_info(account_id, media_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MediaApi.get_media ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.get_media"
-
end
-
# verify the required parameter 'media_id' is set
-
2
if @api_client.config.client_side_validation && media_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.get_media"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/media/{mediaId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'mediaId' + '}', CGI.escape(media_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'File'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MediaApi.get_media",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MediaApi#get_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Media
-
# Gets a list of your media files. No query parameters are supported.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :continuation_token Continuation token used to retrieve subsequent media.
-
# @return [Array<Media>]
-
1
def list_media(account_id, opts = {})
-
1
data, _status_code, _headers = list_media_with_http_info(account_id, opts)
-
data
-
end
-
-
# List Media
-
# Gets a list of your media files. No query parameters are supported.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :continuation_token Continuation token used to retrieve subsequent media.
-
# @return [Array<(Array<Media>, Integer, Hash)>] Array<Media> data, response status code and response headers
-
1
def list_media_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: MediaApi.list_media ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.list_media"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
1
header_params[:'Continuation-Token'] = opts[:'continuation_token'] if !opts[:'continuation_token'].nil?
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<Media>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MediaApi.list_media",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MediaApi#list_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Upload Media
-
# Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823220-what-mms-file-types-are-supported).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param body [File]
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :content_type The media type of the entity-body.
-
# @option opts [String] :cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.
-
# @return [nil]
-
1
def upload_media(account_id, media_id, body, opts = {})
-
3
upload_media_with_http_info(account_id, media_id, body, opts)
-
nil
-
end
-
-
# Upload Media
-
# Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823220-what-mms-file-types-are-supported).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param media_id [String] Media ID to retrieve.
-
# @param body [File]
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :content_type The media type of the entity-body.
-
# @option opts [String] :cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def upload_media_with_http_info(account_id, media_id, body, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: MediaApi.upload_media ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.upload_media"
-
end
-
# verify the required parameter 'media_id' is set
-
3
if @api_client.config.client_side_validation && media_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.upload_media"
-
end
-
# verify the required parameter 'body' is set
-
2
if @api_client.config.client_side_validation && body.nil?
-
1
fail ArgumentError, "Missing the required parameter 'body' when calling MediaApi.upload_media"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/media/{mediaId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'mediaId' + '}', CGI.escape(media_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json', 'application/ogg', 'application/pdf', 'application/rtf', 'application/zip', 'application/x-tar', 'application/xml', 'application/gzip', 'application/x-bzip2', 'application/x-gzip', 'application/smil', 'application/javascript', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/flac', 'audio/webm', 'audio/wav', 'audio/amr', 'audio/3gpp', 'image/bmp', 'image/gif', 'image/heic', 'image/heif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/svg+xml', 'image/tiff', 'image/webp', 'image/x-icon', 'text/css', 'text/csv', 'text/calendar', 'text/html', 'text/plain', 'text/javascript', 'text/vcard', 'text/vnd.wap.wml', 'text/xml', 'video/avi', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/quicktime', 'video/webm', 'video/x-ms-wmv', 'video/x-flv'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
1
header_params[:'Content-Type'] = opts[:'content_type'] if !opts[:'content_type'].nil?
-
1
header_params[:'Cache-Control'] = opts[:'cache_control'] if !opts[:'cache_control'].nil?
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MediaApi.upload_media",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MediaApi#upload_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class MessagesApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Create Message
-
# Endpoint for sending text messages and picture messages using V2 messaging.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param message_request [MessageRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [Message]
-
1
def create_message(account_id, message_request, opts = {})
-
2
data, _status_code, _headers = create_message_with_http_info(account_id, message_request, opts)
-
data
-
end
-
-
# Create Message
-
# Endpoint for sending text messages and picture messages using V2 messaging.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param message_request [MessageRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Message, Integer, Hash)>] Message data, response status code and response headers
-
1
def create_message_with_http_info(account_id, message_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MessagesApi.create_message ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.create_message"
-
end
-
# verify the required parameter 'message_request' is set
-
2
if @api_client.config.client_side_validation && message_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'message_request' when calling MessagesApi.create_message"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/messages'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(message_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Message'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MessagesApi.create_message",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MessagesApi#create_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Messages
-
# Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
-
# @option opts [String] :source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
-
# @option opts [String] :destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
-
# @option opts [MessageStatusEnum] :message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED.
-
# @option opts [ListMessageDirectionEnum] :message_direction The direction of the message. One of INBOUND OUTBOUND.
-
# @option opts [String] :carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T).
-
# @option opts [MessageTypeEnum] :message_type The type of message. Either sms or mms.
-
# @option opts [Integer] :error_code The error code of the message.
-
# @option opts [String] :from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
-
# @option opts [String] :to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
-
# @option opts [String] :campaign_id The campaign ID of the message.
-
# @option opts [Integer] :from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [Boolean] :bw_queued A boolean value indicating whether the message is queued in the Bandwidth network.
-
# @option opts [ProductTypeEnum] :product Messaging product associated with the message.
-
# @option opts [String] :location Location Id associated with the message.
-
# @option opts [Boolean] :carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [Integer] :from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [String] :calling_number_country_a3 Calling number country in A3 format.
-
# @option opts [String] :called_number_country_a3 Called number country in A3 format.
-
# @option opts [Integer] :from_segment_count Segment count (start range).
-
# @option opts [Integer] :to_segment_count Segment count (end range).
-
# @option opts [Integer] :from_message_size Message size (start range).
-
# @option opts [Integer] :to_message_size Message size (end range).
-
# @option opts [String] :sort The field and direction to sort by combined with a colon. Direction is either asc or desc.
-
# @option opts [String] :page_token A base64 encoded value used for pagination of results.
-
# @option opts [Integer] :limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000.
-
# @option opts [Boolean] :limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results.
-
# @return [MessagesList]
-
1
def list_messages(account_id, opts = {})
-
1
data, _status_code, _headers = list_messages_with_http_info(account_id, opts)
-
data
-
end
-
-
# List Messages
-
# Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
-
# @option opts [String] :source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
-
# @option opts [String] :destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
-
# @option opts [MessageStatusEnum] :message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED.
-
# @option opts [ListMessageDirectionEnum] :message_direction The direction of the message. One of INBOUND OUTBOUND.
-
# @option opts [String] :carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T).
-
# @option opts [MessageTypeEnum] :message_type The type of message. Either sms or mms.
-
# @option opts [Integer] :error_code The error code of the message.
-
# @option opts [String] :from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
-
# @option opts [String] :to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
-
# @option opts [String] :campaign_id The campaign ID of the message.
-
# @option opts [Integer] :from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [Boolean] :bw_queued A boolean value indicating whether the message is queued in the Bandwidth network.
-
# @option opts [ProductTypeEnum] :product Messaging product associated with the message.
-
# @option opts [String] :location Location Id associated with the message.
-
# @option opts [Boolean] :carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [Integer] :from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
-
# @option opts [String] :calling_number_country_a3 Calling number country in A3 format.
-
# @option opts [String] :called_number_country_a3 Called number country in A3 format.
-
# @option opts [Integer] :from_segment_count Segment count (start range).
-
# @option opts [Integer] :to_segment_count Segment count (end range).
-
# @option opts [Integer] :from_message_size Message size (start range).
-
# @option opts [Integer] :to_message_size Message size (end range).
-
# @option opts [String] :sort The field and direction to sort by combined with a colon. Direction is either asc or desc.
-
# @option opts [String] :page_token A base64 encoded value used for pagination of results.
-
# @option opts [Integer] :limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000.
-
# @option opts [Boolean] :limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results.
-
# @return [Array<(MessagesList, Integer, Hash)>] MessagesList data, response status code and response headers
-
1
def list_messages_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: MessagesApi.list_messages ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MessagesApi.list_messages"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/messages'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
1
query_params[:'messageId'] = opts[:'message_id'] if !opts[:'message_id'].nil?
-
1
query_params[:'sourceTn'] = opts[:'source_tn'] if !opts[:'source_tn'].nil?
-
1
query_params[:'destinationTn'] = opts[:'destination_tn'] if !opts[:'destination_tn'].nil?
-
1
query_params[:'messageStatus'] = opts[:'message_status'] if !opts[:'message_status'].nil?
-
1
query_params[:'messageDirection'] = opts[:'message_direction'] if !opts[:'message_direction'].nil?
-
1
query_params[:'carrierName'] = opts[:'carrier_name'] if !opts[:'carrier_name'].nil?
-
1
query_params[:'messageType'] = opts[:'message_type'] if !opts[:'message_type'].nil?
-
1
query_params[:'errorCode'] = opts[:'error_code'] if !opts[:'error_code'].nil?
-
1
query_params[:'fromDateTime'] = opts[:'from_date_time'] if !opts[:'from_date_time'].nil?
-
1
query_params[:'toDateTime'] = opts[:'to_date_time'] if !opts[:'to_date_time'].nil?
-
1
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
-
1
query_params[:'fromBwLatency'] = opts[:'from_bw_latency'] if !opts[:'from_bw_latency'].nil?
-
1
query_params[:'bwQueued'] = opts[:'bw_queued'] if !opts[:'bw_queued'].nil?
-
1
query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?
-
1
query_params[:'location'] = opts[:'location'] if !opts[:'location'].nil?
-
1
query_params[:'carrierQueued'] = opts[:'carrier_queued'] if !opts[:'carrier_queued'].nil?
-
1
query_params[:'fromCarrierLatency'] = opts[:'from_carrier_latency'] if !opts[:'from_carrier_latency'].nil?
-
1
query_params[:'callingNumberCountryA3'] = opts[:'calling_number_country_a3'] if !opts[:'calling_number_country_a3'].nil?
-
1
query_params[:'calledNumberCountryA3'] = opts[:'called_number_country_a3'] if !opts[:'called_number_country_a3'].nil?
-
1
query_params[:'fromSegmentCount'] = opts[:'from_segment_count'] if !opts[:'from_segment_count'].nil?
-
1
query_params[:'toSegmentCount'] = opts[:'to_segment_count'] if !opts[:'to_segment_count'].nil?
-
1
query_params[:'fromMessageSize'] = opts[:'from_message_size'] if !opts[:'from_message_size'].nil?
-
1
query_params[:'toMessageSize'] = opts[:'to_message_size'] if !opts[:'to_message_size'].nil?
-
1
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
-
1
query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].nil?
-
1
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
-
1
query_params[:'limitTotalCount'] = opts[:'limit_total_count'] if !opts[:'limit_total_count'].nil?
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'MessagesList'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MessagesApi.list_messages",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MessagesApi#list_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class MFAApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Messaging Authentication Code
-
# Send an MFA code via text message (SMS).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param code_request [CodeRequest] MFA code request body.
-
# @param [Hash] opts the optional parameters
-
# @return [MessagingCodeResponse]
-
1
def generate_messaging_code(account_id, code_request, opts = {})
-
2
data, _status_code, _headers = generate_messaging_code_with_http_info(account_id, code_request, opts)
-
data
-
end
-
-
# Messaging Authentication Code
-
# Send an MFA code via text message (SMS).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param code_request [CodeRequest] MFA code request body.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(MessagingCodeResponse, Integer, Hash)>] MessagingCodeResponse data, response status code and response headers
-
1
def generate_messaging_code_with_http_info(account_id, code_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MFAApi.generate_messaging_code ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MFAApi.generate_messaging_code"
-
end
-
# verify the required parameter 'code_request' is set
-
2
if @api_client.config.client_side_validation && code_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'code_request' when calling MFAApi.generate_messaging_code"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/code/messaging'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(code_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'MessagingCodeResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MFAApi.generate_messaging_code",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MFAApi#generate_messaging_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Voice Authentication Code
-
# Send an MFA Code via a phone call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param code_request [CodeRequest] MFA code request body.
-
# @param [Hash] opts the optional parameters
-
# @return [VoiceCodeResponse]
-
1
def generate_voice_code(account_id, code_request, opts = {})
-
2
data, _status_code, _headers = generate_voice_code_with_http_info(account_id, code_request, opts)
-
data
-
end
-
-
# Voice Authentication Code
-
# Send an MFA Code via a phone call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param code_request [CodeRequest] MFA code request body.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(VoiceCodeResponse, Integer, Hash)>] VoiceCodeResponse data, response status code and response headers
-
1
def generate_voice_code_with_http_info(account_id, code_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MFAApi.generate_voice_code ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MFAApi.generate_voice_code"
-
end
-
# verify the required parameter 'code_request' is set
-
2
if @api_client.config.client_side_validation && code_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'code_request' when calling MFAApi.generate_voice_code"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/code/voice'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(code_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'VoiceCodeResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MFAApi.generate_voice_code",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MFAApi#generate_voice_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Verify Authentication Code
-
# Verify a previously sent MFA code.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param verify_code_request [VerifyCodeRequest] MFA code verify request body.
-
# @param [Hash] opts the optional parameters
-
# @return [VerifyCodeResponse]
-
1
def verify_code(account_id, verify_code_request, opts = {})
-
2
data, _status_code, _headers = verify_code_with_http_info(account_id, verify_code_request, opts)
-
data
-
end
-
-
# Verify Authentication Code
-
# Verify a previously sent MFA code.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param verify_code_request [VerifyCodeRequest] MFA code verify request body.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(VerifyCodeResponse, Integer, Hash)>] VerifyCodeResponse data, response status code and response headers
-
1
def verify_code_with_http_info(account_id, verify_code_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MFAApi.verify_code ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MFAApi.verify_code"
-
end
-
# verify the required parameter 'verify_code_request' is set
-
2
if @api_client.config.client_side_validation && verify_code_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'verify_code_request' when calling MFAApi.verify_code"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/code/verify'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(verify_code_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'VerifyCodeResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MFAApi.verify_code",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MFAApi#verify_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class MultiChannelApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Create Multi-Channel Message
-
# Endpoint for sending Multi-Channel messages.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param multi_channel_message_request [MultiChannelMessageRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [CreateMultiChannelMessageResponse]
-
1
def create_multi_channel_message(account_id, multi_channel_message_request, opts = {})
-
2
data, _status_code, _headers = create_multi_channel_message_with_http_info(account_id, multi_channel_message_request, opts)
-
data
-
end
-
-
# Create Multi-Channel Message
-
# Endpoint for sending Multi-Channel messages.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param multi_channel_message_request [MultiChannelMessageRequest]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CreateMultiChannelMessageResponse, Integer, Hash)>] CreateMultiChannelMessageResponse data, response status code and response headers
-
1
def create_multi_channel_message_with_http_info(account_id, multi_channel_message_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: MultiChannelApi.create_multi_channel_message ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling MultiChannelApi.create_multi_channel_message"
-
end
-
# verify the required parameter 'multi_channel_message_request' is set
-
2
if @api_client.config.client_side_validation && multi_channel_message_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'multi_channel_message_request' when calling MultiChannelApi.create_multi_channel_message"
-
end
-
# resource path
-
1
local_var_path = '/users/{accountId}/messages/multiChannel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(multi_channel_message_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CreateMultiChannelMessageResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"MultiChannelApi.create_multi_channel_message",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: MultiChannelApi#create_multi_channel_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class PhoneNumberLookupApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Create Asynchronous Bulk Number Lookup
-
# Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results.
-
# @param account_id [String]
-
# @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request.
-
# @param [Hash] opts the optional parameters
-
# @return [CreateAsyncBulkLookupResponse]
-
1
def create_async_bulk_lookup(account_id, async_lookup_request, opts = {})
-
2
data, _status_code, _headers = create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts)
-
data
-
end
-
-
# Create Asynchronous Bulk Number Lookup
-
# Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results.
-
# @param account_id [String]
-
# @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CreateAsyncBulkLookupResponse, Integer, Hash)>] CreateAsyncBulkLookupResponse data, response status code and response headers
-
1
def create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_async_bulk_lookup ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_async_bulk_lookup"
-
end
-
# verify the required parameter 'async_lookup_request' is set
-
2
if @api_client.config.client_side_validation && async_lookup_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'async_lookup_request' when calling PhoneNumberLookupApi.create_async_bulk_lookup"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(async_lookup_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CreateAsyncBulkLookupResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"PhoneNumberLookupApi.create_async_bulk_lookup",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Create Synchronous Number Lookup
-
# Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request.
-
# @param account_id [String]
-
# @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request.
-
# @param [Hash] opts the optional parameters
-
# @return [CreateSyncLookupResponse]
-
1
def create_sync_lookup(account_id, sync_lookup_request, opts = {})
-
2
data, _status_code, _headers = create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts)
-
data
-
end
-
-
# Create Synchronous Number Lookup
-
# Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request.
-
# @param account_id [String]
-
# @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CreateSyncLookupResponse, Integer, Hash)>] CreateSyncLookupResponse data, response status code and response headers
-
1
def create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_sync_lookup ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_sync_lookup"
-
end
-
# verify the required parameter 'sync_lookup_request' is set
-
2
if @api_client.config.client_side_validation && sync_lookup_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'sync_lookup_request' when calling PhoneNumberLookupApi.create_sync_lookup"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumberLookup'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(sync_lookup_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CreateSyncLookupResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"PhoneNumberLookupApi.create_sync_lookup",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_sync_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Asynchronous Bulk Number Lookup
-
# Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results.
-
# @param account_id [String]
-
# @param request_id [String]
-
# @param [Hash] opts the optional parameters
-
# @return [GetAsyncBulkLookupResponse]
-
1
def get_async_bulk_lookup(account_id, request_id, opts = {})
-
2
data, _status_code, _headers = get_async_bulk_lookup_with_http_info(account_id, request_id, opts)
-
data
-
end
-
-
# Get Asynchronous Bulk Number Lookup
-
# Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results.
-
# @param account_id [String]
-
# @param request_id [String]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(GetAsyncBulkLookupResponse, Integer, Hash)>] GetAsyncBulkLookupResponse data, response status code and response headers
-
1
def get_async_bulk_lookup_with_http_info(account_id, request_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.get_async_bulk_lookup ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup"
-
end
-
# verify the required parameter 'request_id' is set
-
2
if @api_client.config.client_side_validation && request_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'request_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'GetAsyncBulkLookupResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"PhoneNumberLookupApi.get_async_bulk_lookup",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: PhoneNumberLookupApi#get_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class RecordingsApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Delete Recording
-
# Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_recording(account_id, call_id, recording_id, opts = {})
-
3
delete_recording_with_http_info(account_id, call_id, recording_id, opts)
-
nil
-
end
-
-
# Delete Recording
-
# Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_recording_with_http_info(account_id, call_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.delete_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.delete_recording"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.delete_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.delete_recording"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.delete_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#delete_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Delete Recording Media
-
# Deletes the specified recording's media.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_recording_media(account_id, call_id, recording_id, opts = {})
-
3
delete_recording_media_with_http_info(account_id, call_id, recording_id, opts)
-
nil
-
end
-
-
# Delete Recording Media
-
# Deletes the specified recording's media.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_recording_media_with_http_info(account_id, call_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.delete_recording_media ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.delete_recording_media"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.delete_recording_media"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.delete_recording_media"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.delete_recording_media",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#delete_recording_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Delete Transcription
-
# Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_recording_transcription(account_id, call_id, recording_id, opts = {})
-
3
delete_recording_transcription_with_http_info(account_id, call_id, recording_id, opts)
-
nil
-
end
-
-
# Delete Transcription
-
# Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_recording_transcription_with_http_info(account_id, call_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.delete_recording_transcription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.delete_recording_transcription"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.delete_recording_transcription"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.delete_recording_transcription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.delete_recording_transcription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#delete_recording_transcription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Download Recording
-
# Downloads the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [File]
-
1
def download_call_recording(account_id, call_id, recording_id, opts = {})
-
3
data, _status_code, _headers = download_call_recording_with_http_info(account_id, call_id, recording_id, opts)
-
data
-
end
-
-
# Download Recording
-
# Downloads the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
-
1
def download_call_recording_with_http_info(account_id, call_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.download_call_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.download_call_recording"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.download_call_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.download_call_recording"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['audio/vnd.wave', 'audio/mpeg', 'application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'File'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.download_call_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#download_call_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Call Recording
-
# Returns metadata for the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [CallRecordingMetadata]
-
1
def get_call_recording(account_id, call_id, recording_id, opts = {})
-
3
data, _status_code, _headers = get_call_recording_with_http_info(account_id, call_id, recording_id, opts)
-
data
-
end
-
-
# Get Call Recording
-
# Returns metadata for the specified recording.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CallRecordingMetadata, Integer, Hash)>] CallRecordingMetadata data, response status code and response headers
-
1
def get_call_recording_with_http_info(account_id, call_id, recording_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: RecordingsApi.get_call_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.get_call_recording"
-
end
-
# verify the required parameter 'call_id' is set
-
2
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.get_call_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
1
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.get_call_recording"
-
end
-
# resource path
-
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
query_params = opts[:query_params] || {}
-
-
# header parameters
-
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
post_body = opts[:debug_body]
-
-
# return_type
-
return_type = opts[:debug_return_type] || 'CallRecordingMetadata'
-
-
# auth_names
-
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
new_options = opts.merge(
-
:operation => :"RecordingsApi.get_call_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
if @api_client.config.debugging
-
@api_client.config.logger.debug "API called: RecordingsApi#get_call_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
return data, status_code, headers
-
end
-
-
# Get Transcription
-
# Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [RecordingTranscriptions]
-
1
def get_recording_transcription(account_id, call_id, recording_id, opts = {})
-
3
data, _status_code, _headers = get_recording_transcription_with_http_info(account_id, call_id, recording_id, opts)
-
data
-
end
-
-
# Get Transcription
-
# Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(RecordingTranscriptions, Integer, Hash)>] RecordingTranscriptions data, response status code and response headers
-
1
def get_recording_transcription_with_http_info(account_id, call_id, recording_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.get_recording_transcription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.get_recording_transcription"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.get_recording_transcription"
-
end
-
# verify the required parameter 'recording_id' is set
-
2
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.get_recording_transcription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'RecordingTranscriptions'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.get_recording_transcription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#get_recording_transcription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Call Recordings
-
# Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :to Filter results by the `to` field.
-
# @option opts [String] :from Filter results by the `from` field.
-
# @option opts [String] :min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format).
-
# @option opts [String] :max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format).
-
# @return [Array<CallRecordingMetadata>]
-
1
def list_account_call_recordings(account_id, opts = {})
-
1
data, _status_code, _headers = list_account_call_recordings_with_http_info(account_id, opts)
-
data
-
end
-
-
# Get Call Recordings
-
# Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @option opts [String] :to Filter results by the `to` field.
-
# @option opts [String] :from Filter results by the `from` field.
-
# @option opts [String] :min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format).
-
# @option opts [String] :max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format).
-
# @return [Array<(Array<CallRecordingMetadata>, Integer, Hash)>] Array<CallRecordingMetadata> data, response status code and response headers
-
1
def list_account_call_recordings_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: RecordingsApi.list_account_call_recordings ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.list_account_call_recordings"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/recordings'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
1
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
-
1
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
-
1
query_params[:'minStartTime'] = opts[:'min_start_time'] if !opts[:'min_start_time'].nil?
-
1
query_params[:'maxStartTime'] = opts[:'max_start_time'] if !opts[:'max_start_time'].nil?
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<CallRecordingMetadata>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.list_account_call_recordings",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#list_account_call_recordings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Call Recordings
-
# Returns a (potentially empty) list of metadata for the recordings that took place during the specified call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<CallRecordingMetadata>]
-
1
def list_call_recordings(account_id, call_id, opts = {})
-
2
data, _status_code, _headers = list_call_recordings_with_http_info(account_id, call_id, opts)
-
data
-
end
-
-
# List Call Recordings
-
# Returns a (potentially empty) list of metadata for the recordings that took place during the specified call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Array<CallRecordingMetadata>, Integer, Hash)>] Array<CallRecordingMetadata> data, response status code and response headers
-
1
def list_call_recordings_with_http_info(account_id, call_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: RecordingsApi.list_call_recordings ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.list_call_recordings"
-
end
-
# verify the required parameter 'call_id' is set
-
2
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.list_call_recordings"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<CallRecordingMetadata>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.list_call_recordings",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#list_call_recordings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Create Transcription Request
-
# Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param transcribe_recording [TranscribeRecording]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def transcribe_call_recording(account_id, call_id, recording_id, transcribe_recording, opts = {})
-
4
transcribe_call_recording_with_http_info(account_id, call_id, recording_id, transcribe_recording, opts)
-
nil
-
end
-
-
# Create Transcription Request
-
# Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param recording_id [String] Programmable Voice API Recording ID.
-
# @param transcribe_recording [TranscribeRecording]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def transcribe_call_recording_with_http_info(account_id, call_id, recording_id, transcribe_recording, opts = {})
-
5
if @api_client.config.debugging
-
5
@api_client.config.logger.debug 'Calling API: RecordingsApi.transcribe_call_recording ...'
-
end
-
# verify the required parameter 'account_id' is set
-
5
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.transcribe_call_recording"
-
end
-
# verify the required parameter 'call_id' is set
-
4
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.transcribe_call_recording"
-
end
-
# verify the required parameter 'recording_id' is set
-
3
if @api_client.config.client_side_validation && recording_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'recording_id' when calling RecordingsApi.transcribe_call_recording"
-
end
-
# verify the required parameter 'transcribe_recording' is set
-
2
if @api_client.config.client_side_validation && transcribe_recording.nil?
-
1
fail ArgumentError, "Missing the required parameter 'transcribe_recording' when calling RecordingsApi.transcribe_call_recording"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(transcribe_recording)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.transcribe_call_recording",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#transcribe_call_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Recording
-
# Pause or resume a recording on an active phone call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param update_call_recording [UpdateCallRecording]
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_call_recording_state(account_id, call_id, update_call_recording, opts = {})
-
3
update_call_recording_state_with_http_info(account_id, call_id, update_call_recording, opts)
-
nil
-
end
-
-
# Update Recording
-
# Pause or resume a recording on an active phone call.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param update_call_recording [UpdateCallRecording]
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_call_recording_state_with_http_info(account_id, call_id, update_call_recording, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: RecordingsApi.update_call_recording_state ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling RecordingsApi.update_call_recording_state"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling RecordingsApi.update_call_recording_state"
-
end
-
# verify the required parameter 'update_call_recording' is set
-
2
if @api_client.config.client_side_validation && update_call_recording.nil?
-
1
fail ArgumentError, "Missing the required parameter 'update_call_recording' when calling RecordingsApi.update_call_recording_state"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/recording'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_call_recording)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"RecordingsApi.update_call_recording_state",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: RecordingsApi#update_call_recording_state\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class StatisticsApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Get Account Statistics
-
# Returns details about the current state of the account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @return [AccountStatistics]
-
1
def get_statistics(account_id, opts = {})
-
1
data, _status_code, _headers = get_statistics_with_http_info(account_id, opts)
-
data
-
end
-
-
# Get Account Statistics
-
# Returns details about the current state of the account.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(AccountStatistics, Integer, Hash)>] AccountStatistics data, response status code and response headers
-
1
def get_statistics_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: StatisticsApi.get_statistics ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling StatisticsApi.get_statistics"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/statistics'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'AccountStatistics'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"StatisticsApi.get_statistics",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: StatisticsApi#get_statistics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class TollFreeVerificationApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Create Webhook Subscription
-
# Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
-
# @param [Hash] opts the optional parameters
-
# @return [WebhookSubscription]
-
1
def create_webhook_subscription(account_id, webhook_subscription_request_schema, opts = {})
-
2
data, _status_code, _headers = create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema, opts)
-
data
-
end
-
-
# Create Webhook Subscription
-
# Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers
-
1
def create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.create_webhook_subscription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.create_webhook_subscription"
-
end
-
# verify the required parameter 'webhook_subscription_request_schema' is set
-
2
if @api_client.config.client_side_validation && webhook_subscription_request_schema.nil?
-
1
fail ArgumentError, "Missing the required parameter 'webhook_subscription_request_schema' when calling TollFreeVerificationApi.create_webhook_subscription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_subscription_request_schema)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'WebhookSubscription'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.create_webhook_subscription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#create_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Delete a Toll-Free Verification Submission
-
# Delete a toll-free verification submission for a toll-free number.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_verification_request(account_id, phone_number, opts = {})
-
2
delete_verification_request_with_http_info(account_id, phone_number, opts)
-
nil
-
end
-
-
# Delete a Toll-Free Verification Submission
-
# Delete a toll-free verification submission for a toll-free number.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_verification_request_with_http_info(account_id, phone_number, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.delete_verification_request ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.delete_verification_request"
-
end
-
# verify the required parameter 'phone_number' is set
-
2
if @api_client.config.client_side_validation && phone_number.nil?
-
1
fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.delete_verification_request"
-
end
-
1
if @api_client.config.client_side_validation && phone_number.to_s.length > 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be smaller than or equal to 12.'
-
end
-
-
1
if @api_client.config.client_side_validation && phone_number.to_s.length < 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be greater than or equal to 12.'
-
end
-
-
1
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
1
if @api_client.config.client_side_validation && phone_number !~ pattern
-
fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.delete_verification_request, must conform to the pattern #{pattern}."
-
end
-
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.delete_verification_request",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#delete_verification_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Delete Webhook Subscription
-
# Delete a webhook subscription by ID.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param id [String] Webhook subscription ID
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_webhook_subscription(account_id, id, opts = {})
-
2
delete_webhook_subscription_with_http_info(account_id, id, opts)
-
nil
-
end
-
-
# Delete Webhook Subscription
-
# Delete a webhook subscription by ID.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param id [String] Webhook subscription ID
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_webhook_subscription_with_http_info(account_id, id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.delete_webhook_subscription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.delete_webhook_subscription"
-
end
-
# verify the required parameter 'id' is set
-
2
if @api_client.config.client_side_validation && id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'id' when calling TollFreeVerificationApi.delete_webhook_subscription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.delete_webhook_subscription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#delete_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Toll-Free Verification Status
-
# Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param [Hash] opts the optional parameters
-
# @return [TfvStatus]
-
1
def get_toll_free_verification_status(account_id, phone_number, opts = {})
-
2
data, _status_code, _headers = get_toll_free_verification_status_with_http_info(account_id, phone_number, opts)
-
data
-
end
-
-
# Get Toll-Free Verification Status
-
# Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(TfvStatus, Integer, Hash)>] TfvStatus data, response status code and response headers
-
1
def get_toll_free_verification_status_with_http_info(account_id, phone_number, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.get_toll_free_verification_status ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.get_toll_free_verification_status"
-
end
-
# verify the required parameter 'phone_number' is set
-
2
if @api_client.config.client_side_validation && phone_number.nil?
-
1
fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.get_toll_free_verification_status"
-
end
-
1
if @api_client.config.client_side_validation && phone_number.to_s.length > 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be smaller than or equal to 12.'
-
end
-
-
1
if @api_client.config.client_side_validation && phone_number.to_s.length < 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be greater than or equal to 12.'
-
end
-
-
1
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
1
if @api_client.config.client_side_validation && phone_number !~ pattern
-
fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.get_toll_free_verification_status, must conform to the pattern #{pattern}."
-
end
-
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'TfvStatus'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.get_toll_free_verification_status",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#get_toll_free_verification_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Toll-Free Use Cases
-
# Lists valid toll-free use cases.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<String>]
-
1
def list_toll_free_use_cases(opts = {})
-
data, _status_code, _headers = list_toll_free_use_cases_with_http_info(opts)
-
data
-
end
-
-
# List Toll-Free Use Cases
-
# Lists valid toll-free use cases.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Array<String>, Integer, Hash)>] Array<String> data, response status code and response headers
-
1
def list_toll_free_use_cases_with_http_info(opts = {})
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.list_toll_free_use_cases ...'
-
end
-
# resource path
-
1
local_var_path = '/tollFreeVerification/useCases'
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<String>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.list_toll_free_use_cases",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#list_toll_free_use_cases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Webhook Subscriptions
-
# Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @return [WebhookSubscriptionsListBody]
-
1
def list_webhook_subscriptions(account_id, opts = {})
-
1
data, _status_code, _headers = list_webhook_subscriptions_with_http_info(account_id, opts)
-
data
-
end
-
-
# List Webhook Subscriptions
-
# Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(WebhookSubscriptionsListBody, Integer, Hash)>] WebhookSubscriptionsListBody data, response status code and response headers
-
1
def list_webhook_subscriptions_with_http_info(account_id, opts = {})
-
2
if @api_client.config.debugging
-
2
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.list_webhook_subscriptions ...'
-
end
-
# verify the required parameter 'account_id' is set
-
2
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.list_webhook_subscriptions"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'WebhookSubscriptionsListBody'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.list_webhook_subscriptions",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#list_webhook_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Request Toll-Free Verification
-
# Submit a request for verification of a toll-free phone number.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param verification_request [VerificationRequest] Request for verification of a toll-free phone number.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def request_toll_free_verification(account_id, verification_request, opts = {})
-
2
request_toll_free_verification_with_http_info(account_id, verification_request, opts)
-
nil
-
end
-
-
# Request Toll-Free Verification
-
# Submit a request for verification of a toll-free phone number.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param verification_request [VerificationRequest] Request for verification of a toll-free phone number.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def request_toll_free_verification_with_http_info(account_id, verification_request, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.request_toll_free_verification ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.request_toll_free_verification"
-
end
-
# verify the required parameter 'verification_request' is set
-
2
if @api_client.config.client_side_validation && verification_request.nil?
-
1
fail ArgumentError, "Missing the required parameter 'verification_request' when calling TollFreeVerificationApi.request_toll_free_verification"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(verification_request)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.request_toll_free_verification",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#request_toll_free_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Toll-Free Verification Request
-
# Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param tfv_submission_wrapper [TfvSubmissionWrapper] Update a request for verification of a toll-free phone number.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper, opts = {})
-
3
update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper, opts)
-
nil
-
end
-
-
# Update Toll-Free Verification Request
-
# Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param phone_number [String] Valid Toll-Free telephone number in E.164 format.
-
# @param tfv_submission_wrapper [TfvSubmissionWrapper] Update a request for verification of a toll-free phone number.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.update_toll_free_verification_request ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.update_toll_free_verification_request"
-
end
-
# verify the required parameter 'phone_number' is set
-
3
if @api_client.config.client_side_validation && phone_number.nil?
-
1
fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.update_toll_free_verification_request"
-
end
-
2
if @api_client.config.client_side_validation && phone_number.to_s.length > 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be smaller than or equal to 12.'
-
end
-
-
2
if @api_client.config.client_side_validation && phone_number.to_s.length < 12
-
fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be greater than or equal to 12.'
-
end
-
-
2
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
2
if @api_client.config.client_side_validation && phone_number !~ pattern
-
fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.update_toll_free_verification_request, must conform to the pattern #{pattern}."
-
end
-
-
# verify the required parameter 'tfv_submission_wrapper' is set
-
2
if @api_client.config.client_side_validation && tfv_submission_wrapper.nil?
-
1
fail ArgumentError, "Missing the required parameter 'tfv_submission_wrapper' when calling TollFreeVerificationApi.update_toll_free_verification_request"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(tfv_submission_wrapper)
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.update_toll_free_verification_request",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#update_toll_free_verification_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Update Webhook Subscription
-
# Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param id [String] Webhook subscription ID
-
# @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
-
# @param [Hash] opts the optional parameters
-
# @return [WebhookSubscription]
-
1
def update_webhook_subscription(account_id, id, webhook_subscription_request_schema, opts = {})
-
3
data, _status_code, _headers = update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema, opts)
-
data
-
end
-
-
# Update Webhook Subscription
-
# Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param id [String] Webhook subscription ID
-
# @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers
-
1
def update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.update_webhook_subscription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.update_webhook_subscription"
-
end
-
# verify the required parameter 'id' is set
-
3
if @api_client.config.client_side_validation && id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'id' when calling TollFreeVerificationApi.update_webhook_subscription"
-
end
-
# verify the required parameter 'webhook_subscription_request_schema' is set
-
2
if @api_client.config.client_side_validation && webhook_subscription_request_schema.nil?
-
1
fail ArgumentError, "Missing the required parameter 'webhook_subscription_request_schema' when calling TollFreeVerificationApi.update_webhook_subscription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
# HTTP header 'Content-Type'
-
1
content_type = @api_client.select_header_content_type(['application/json'])
-
1
if !content_type.nil?
-
1
header_params['Content-Type'] = content_type
-
end
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_subscription_request_schema)
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'WebhookSubscription'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TollFreeVerificationApi.update_webhook_subscription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TollFreeVerificationApi#update_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'cgi'
-
-
1
module Bandwidth
-
1
class TranscriptionsApi
-
1
attr_accessor :api_client
-
-
1
def initialize(api_client = ApiClient.default)
-
1
@api_client = api_client
-
end
-
# Delete Real-time Transcription
-
# Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `200` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param transcription_id [String] Programmable Voice API Transcription ID.
-
# @param [Hash] opts the optional parameters
-
# @return [nil]
-
1
def delete_real_time_transcription(account_id, call_id, transcription_id, opts = {})
-
3
delete_real_time_transcription_with_http_info(account_id, call_id, transcription_id, opts)
-
nil
-
end
-
-
# Delete Real-time Transcription
-
# Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `200` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param transcription_id [String] Programmable Voice API Transcription ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
-
1
def delete_real_time_transcription_with_http_info(account_id, call_id, transcription_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: TranscriptionsApi.delete_real_time_transcription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TranscriptionsApi.delete_real_time_transcription"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling TranscriptionsApi.delete_real_time_transcription"
-
end
-
# verify the required parameter 'transcription_id' is set
-
2
if @api_client.config.client_side_validation && transcription_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'transcription_id' when calling TranscriptionsApi.delete_real_time_transcription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'transcriptionId' + '}', CGI.escape(transcription_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type]
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TranscriptionsApi.delete_real_time_transcription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TranscriptionsApi#delete_real_time_transcription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# Get Real-time Transcription
-
# Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param transcription_id [String] Programmable Voice API Transcription ID.
-
# @param [Hash] opts the optional parameters
-
# @return [CallTranscriptionResponse]
-
1
def get_real_time_transcription(account_id, call_id, transcription_id, opts = {})
-
3
data, _status_code, _headers = get_real_time_transcription_with_http_info(account_id, call_id, transcription_id, opts)
-
data
-
end
-
-
# Get Real-time Transcription
-
# Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param transcription_id [String] Programmable Voice API Transcription ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(CallTranscriptionResponse, Integer, Hash)>] CallTranscriptionResponse data, response status code and response headers
-
1
def get_real_time_transcription_with_http_info(account_id, call_id, transcription_id, opts = {})
-
4
if @api_client.config.debugging
-
4
@api_client.config.logger.debug 'Calling API: TranscriptionsApi.get_real_time_transcription ...'
-
end
-
# verify the required parameter 'account_id' is set
-
4
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TranscriptionsApi.get_real_time_transcription"
-
end
-
# verify the required parameter 'call_id' is set
-
3
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling TranscriptionsApi.get_real_time_transcription"
-
end
-
# verify the required parameter 'transcription_id' is set
-
2
if @api_client.config.client_side_validation && transcription_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'transcription_id' when calling TranscriptionsApi.get_real_time_transcription"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s)).sub('{' + 'transcriptionId' + '}', CGI.escape(transcription_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'CallTranscriptionResponse'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TranscriptionsApi.get_real_time_transcription",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TranscriptionsApi#get_real_time_transcription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
-
# List Real-time Transcriptions
-
# List the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<CallTranscriptionMetadata>]
-
1
def list_real_time_transcriptions(account_id, call_id, opts = {})
-
2
data, _status_code, _headers = list_real_time_transcriptions_with_http_info(account_id, call_id, opts)
-
data
-
end
-
-
# List Real-time Transcriptions
-
# List the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
-
# @param account_id [String] Your Bandwidth Account ID.
-
# @param call_id [String] Programmable Voice API Call ID.
-
# @param [Hash] opts the optional parameters
-
# @return [Array<(Array<CallTranscriptionMetadata>, Integer, Hash)>] Array<CallTranscriptionMetadata> data, response status code and response headers
-
1
def list_real_time_transcriptions_with_http_info(account_id, call_id, opts = {})
-
3
if @api_client.config.debugging
-
3
@api_client.config.logger.debug 'Calling API: TranscriptionsApi.list_real_time_transcriptions ...'
-
end
-
# verify the required parameter 'account_id' is set
-
3
if @api_client.config.client_side_validation && account_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'account_id' when calling TranscriptionsApi.list_real_time_transcriptions"
-
end
-
# verify the required parameter 'call_id' is set
-
2
if @api_client.config.client_side_validation && call_id.nil?
-
1
fail ArgumentError, "Missing the required parameter 'call_id' when calling TranscriptionsApi.list_real_time_transcriptions"
-
end
-
# resource path
-
1
local_var_path = '/accounts/{accountId}/calls/{callId}/transcriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'callId' + '}', CGI.escape(call_id.to_s))
-
-
# query parameters
-
1
query_params = opts[:query_params] || {}
-
-
# header parameters
-
1
header_params = opts[:header_params] || {}
-
# HTTP header 'Accept' (if needed)
-
1
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
-
-
# form parameters
-
1
form_params = opts[:form_params] || {}
-
-
# http body (model)
-
1
post_body = opts[:debug_body]
-
-
# return_type
-
1
return_type = opts[:debug_return_type] || 'Array<CallTranscriptionMetadata>'
-
-
# auth_names
-
1
auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
-
-
1
new_options = opts.merge(
-
:operation => :"TranscriptionsApi.list_real_time_transcriptions",
-
:header_params => header_params,
-
:query_params => query_params,
-
:form_params => form_params,
-
:body => post_body,
-
:auth_names => auth_names,
-
:return_type => return_type
-
)
-
-
1
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
-
1
if @api_client.config.debugging
-
1
@api_client.config.logger.debug "API called: TranscriptionsApi#list_real_time_transcriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
-
end
-
1
return data, status_code, headers
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'json'
-
1
require 'logger'
-
1
require 'tempfile'
-
1
require 'time'
-
1
require 'faraday'
-
1
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
-
1
require 'marcel'
-
-
-
1
module Bandwidth
-
1
class ApiClient
-
# The Configuration object holding settings to be used in the API client.
-
1
attr_accessor :config
-
-
# Defines the headers to be used in HTTP requests of all API calls by default.
-
#
-
# @return [Hash]
-
1
attr_accessor :default_headers
-
-
# Initializes the ApiClient
-
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
-
1
def initialize(config = Configuration.default)
-
18
@config = config
-
18
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
-
@default_headers = {
-
18
'Content-Type' => 'application/json',
-
'User-Agent' => @user_agent
-
}
-
end
-
-
1
def self.default
-
13
@@default ||= ApiClient.new
-
end
-
-
# Call an API with given options.
-
#
-
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
-
# the data deserialized from response body (could be nil), response status code and response headers.
-
1
def call_api(http_method, path, opts = {})
-
54
stream = nil
-
begin
-
54
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
-
54
request = build_request(http_method, path, req, opts)
-
54
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
-
end
-
-
54
if config.debugging
-
54
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
-
end
-
-
54
unless response.success?
-
if response.status == 0 && response.respond_to?(:return_message)
-
# Errors from libcurl will be made visible here
-
fail ApiError.new(code: 0,
-
message: response.return_message)
-
else
-
fail ApiError.new(code: response.status,
-
response_headers: response.headers,
-
response_body: response.body),
-
response.reason_phrase
-
end
-
end
-
rescue Faraday::TimeoutError
-
fail ApiError.new('Connection timed out')
-
rescue Faraday::ConnectionFailed
-
fail ApiError.new('Connection failed')
-
end
-
-
54
if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
-
3
data = deserialize_file(response, stream)
-
51
elsif opts[:return_type]
-
32
data = deserialize(response, opts[:return_type])
-
else
-
19
data = nil
-
end
-
54
return data, response.status, response.headers
-
end
-
-
# Builds the HTTP request
-
#
-
# @param [String] http_method HTTP method/verb (e.g. POST)
-
# @param [String] path URL path (e.g. /account/new)
-
# @option opts [Hash] :header_params Header parameters
-
# @option opts [Hash] :query_params Query parameters
-
# @option opts [Hash] :form_params Query parameters
-
# @option opts [Object] :body HTTP body (JSON/XML)
-
# @return [Faraday::Request] A Faraday Request
-
1
def build_request(http_method, path, request, opts = {})
-
54
url = build_request_url(path, opts)
-
54
http_method = http_method.to_sym.downcase
-
-
54
header_params = @default_headers.merge(opts[:header_params] || {})
-
54
query_params = opts[:query_params] || {}
-
54
form_params = opts[:form_params] || {}
-
-
54
update_params_for_auth! header_params, query_params, opts[:auth_names]
-
-
54
if [:post, :patch, :put, :delete].include?(http_method)
-
30
req_body = build_request_body(header_params, form_params, opts[:body])
-
30
if config.debugging
-
30
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
-
end
-
end
-
54
request.headers = header_params
-
54
request.body = req_body
-
-
# Overload default options only if provided
-
54
request.options.params_encoder = config.params_encoder if config.params_encoder
-
54
request.options.timeout = config.timeout if config.timeout
-
-
54
request.url url
-
54
request.params = query_params
-
54
request
-
end
-
-
# Builds the HTTP request body
-
#
-
# @param [Hash] header_params Header parameters
-
# @param [Hash] form_params Query parameters
-
# @param [Object] body HTTP body (JSON/XML)
-
# @return [String] HTTP body data in the form of string
-
1
def build_request_body(header_params, form_params, body)
-
# http form
-
32
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
-
1
data = URI.encode_www_form(form_params)
-
31
elsif header_params['Content-Type'] == 'multipart/form-data'
-
data = {}
-
form_params.each do |key, value|
-
case value
-
when ::File, ::Tempfile
-
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
-
when ::Array, nil
-
# let Faraday handle Array and nil parameters
-
data[key] = value
-
else
-
data[key] = value.to_s
-
end
-
end
-
31
elsif body
-
22
data = body.is_a?(String) ? body : body.to_json
-
else
-
9
data = nil
-
end
-
32
data
-
end
-
-
1
def download_file(request)
-
3
stream = []
-
-
# handle streaming Responses
-
3
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
-
3
stream << chunk
-
end
-
-
3
stream
-
end
-
-
1
def deserialize_file(response, stream)
-
3
body = response.body
-
3
encoding = body.encoding
-
-
# reconstruct content
-
3
content = stream.join
-
3
content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
-
3
content = content.force_encoding(encoding)
-
-
# return byte stream
-
3
return content if @config.return_binary_data == true
-
-
# return file instead of binary data
-
content_disposition = response.headers['Content-Disposition']
-
if content_disposition && content_disposition =~ /filename=/i
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
-
prefix = sanitize_filename(filename)
-
else
-
prefix = 'download-'
-
end
-
prefix = prefix + '-' unless prefix.end_with?('-')
-
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
-
tempfile.write(content)
-
tempfile.close
-
-
config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
-
"explicitly with `tempfile.delete`"
-
tempfile
-
end
-
-
1
def connection(opts)
-
54
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
-
end
-
-
1
def connection_multipart
-
@connection_multipart ||= build_connection do |conn|
-
conn.request :multipart
-
conn.request :url_encoded
-
end
-
end
-
-
1
def connection_regular
-
54
@connection_regular ||= build_connection
-
end
-
-
1
def build_connection
-
1
Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn|
-
1
basic_auth(conn)
-
1
config.configure_middleware(conn)
-
1
yield(conn) if block_given?
-
1
conn.adapter(Faraday.default_adapter)
-
1
config.configure_connection(conn)
-
end
-
end
-
-
1
def ssl_options
-
{
-
1
ca_file: config.ssl_ca_file,
-
verify: config.ssl_verify,
-
verify_mode: config.ssl_verify_mode,
-
client_cert: config.ssl_client_cert,
-
client_key: config.ssl_client_key
-
}
-
end
-
-
1
def basic_auth(conn)
-
2
if config.username && config.password
-
2
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
-
2
conn.request(:authorization, :basic, config.username, config.password)
-
else
-
conn.request(:basic_auth, config.username, config.password)
-
end
-
end
-
end
-
-
# Check if the given MIME is a JSON MIME.
-
# JSON MIME examples:
-
# application/json
-
# application/json; charset=UTF8
-
# APPLICATION/JSON
-
# */*
-
# @param [String] mime MIME
-
# @return [Boolean] True if the MIME is application/json
-
1
def json_mime?(mime)
-
129
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
-
end
-
-
# Deserialize the response to the given return type.
-
#
-
# @param [Response] response HTTP response
-
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
-
1
def deserialize(response, return_type)
-
34
body = response.body
-
34
return nil if body.nil? || body.empty?
-
-
# return response body directly for String return type
-
34
return body.to_s if return_type == 'String'
-
-
# ensuring a default content type
-
34
content_type = response.headers['Content-Type'] || 'application/json'
-
-
34
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
-
-
begin
-
34
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
-
rescue JSON::ParserError => e
-
2
if %w(String Date Time).include?(return_type)
-
1
data = body
-
else
-
1
raise e
-
end
-
end
-
-
33
convert_to_type data, return_type
-
end
-
-
# Convert data to the given return type.
-
# @param [Object] data Data to be converted
-
# @param [String] return_type Return type
-
# @return [Mixed] Data in a particular type
-
1
def convert_to_type(data, return_type)
-
66
return nil if data.nil?
-
66
case return_type
-
when 'String'
-
12
data.to_s
-
when 'Integer'
-
4
data.to_i
-
when 'Float'
-
1
data.to_f
-
when 'Boolean'
-
1
data == true
-
when 'Time'
-
# parse date time (expecting ISO 8601 format)
-
1
Time.parse data
-
when 'Date'
-
# parse date time (expecting ISO 8601 format)
-
2
Date.parse data
-
when 'Object'
-
# generic object (usually a Hash), return directly
-
1
data
-
when /\AArray<(.+)>\z/
-
# e.g. Array<Pet>
-
11
sub_type = $1
-
33
data.map { |item| convert_to_type(item, sub_type) }
-
when /\AHash\<String, (.+)\>\z/
-
# e.g. Hash<String, Integer>
-
1
sub_type = $1
-
1
{}.tap do |hash|
-
2
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
-
end
-
else
-
# models (e.g. Pet) or oneOf/anyOf
-
32
klass = Bandwidth.const_get(return_type)
-
32
if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
-
klass.build(data)
-
else
-
32
klass.build_from_hash(data)
-
end
-
end
-
end
-
-
# Sanitize filename by removing path.
-
# e.g. ../../sun.gif becomes sun.gif
-
#
-
# @param [String] filename the filename to be sanitized
-
# @return [String] the sanitized filename
-
1
def sanitize_filename(filename)
-
9
filename.split(/[\/\\]/).last
-
end
-
-
1
def build_request_url(path, opts = {})
-
# Add leading and trailing slashes to path
-
55
path = "/#{path}".gsub(/\/+/, '/')
-
55
@config.base_url(opts[:operation]) + path
-
end
-
-
# Update header and query params based on authentication settings.
-
#
-
# @param [Hash] header_params Header parameters
-
# @param [Hash] query_params Query parameters
-
# @param [String] auth_names Authentication scheme name
-
1
def update_params_for_auth!(header_params, query_params, auth_names)
-
54
Array(auth_names).each do |auth_name|
-
108
auth_setting = @config.auth_settings[auth_name]
-
108
next unless auth_setting
-
108
case auth_setting[:in]
-
108
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil?
-
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil?
-
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
-
end
-
end
-
end
-
-
# Sets user agent in HTTP header
-
#
-
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
-
1
def user_agent=(user_agent)
-
1
@user_agent = user_agent
-
1
@default_headers['User-Agent'] = @user_agent
-
end
-
-
# Return Accept header based on an array of accepts provided.
-
# @param [Array] accepts array for Accept
-
# @return [String] the Accept header (e.g. application/json)
-
1
def select_header_accept(accepts)
-
58
return nil if accepts.nil? || accepts.empty?
-
# use JSON when present, otherwise use all of the provided
-
114
json_accept = accepts.find { |s| json_mime?(s) }
-
56
json_accept || accepts.join(',')
-
end
-
-
# Return Content-Type header based on an array of content types provided.
-
# @param [Array] content_types array for Content-Type
-
# @return [String] the Content-Type header (e.g. application/json)
-
1
def select_header_content_type(content_types)
-
# return nil by default
-
29
return if content_types.nil? || content_types.empty?
-
# use JSON when present, otherwise use the first one
-
56
json_content_type = content_types.find { |s| json_mime?(s) }
-
27
json_content_type || content_types.first
-
end
-
-
# Convert object (array, hash, object, etc) to JSON string.
-
# @param [Object] model object to be converted into JSON string
-
# @return [String] JSON string representation of the object
-
1
def object_to_http_body(model)
-
24
return model if model.nil? || model.is_a?(String)
-
20
local_body = nil
-
20
if model.is_a?(Array)
-
4
local_body = model.map { |m| object_to_hash(m) }
-
else
-
19
local_body = object_to_hash(model)
-
end
-
20
local_body.to_json
-
end
-
-
# Convert object(non-array) to hash.
-
# @param [Object] obj object to be converted into JSON string
-
# @return [String] JSON string representation of the object
-
1
def object_to_hash(obj)
-
25
if obj.respond_to?(:to_hash)
-
20
obj.to_hash
-
else
-
5
obj
-
end
-
end
-
-
# Build parameter value according to the given collection format.
-
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
-
1
def build_collection_param(param, collection_format)
-
6
case collection_format
-
when :csv
-
1
param.join(',')
-
when :ssv
-
1
param.join(' ')
-
when :tsv
-
1
param.join("\t")
-
when :pipes
-
1
param.join('|')
-
when :multi
-
# return the array directly as typhoeus will handle it as expected
-
1
param
-
else
-
1
fail "unknown collection format: #{collection_format.inspect}"
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
module Bandwidth
-
1
class ApiError < StandardError
-
1
attr_reader :code, :response_headers, :response_body
-
-
# Usage examples:
-
# ApiError.new
-
# ApiError.new("message")
-
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
-
# ApiError.new(:code => 404, :message => "Not Found")
-
1
def initialize(arg = nil)
-
3
if arg.is_a? Hash
-
1
if arg.key?(:message) || arg.key?('message')
-
1
super(arg[:message] || arg['message'])
-
else
-
super arg
-
end
-
-
1
arg.each do |k, v|
-
1
instance_variable_set "@#{k}", v
-
end
-
else
-
2
super arg
-
2
@message = arg
-
end
-
end
-
-
# Override to_s to display a friendly error message
-
1
def to_s
-
1
message
-
end
-
-
1
def message
-
3
if @message.nil?
-
1
msg = 'Error message: the server returns an error'
-
else
-
2
msg = @message
-
end
-
-
3
msg += "\nHTTP status code: #{code}" if code
-
3
msg += "\nResponse headers: #{response_headers}" if response_headers
-
3
msg += "\nResponse body: #{response_body}" if response_body
-
-
3
msg
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
module Bandwidth
-
1
class ApiModelBase
-
# Deserializes the data based on type
-
# @param string type Data type
-
# @param string value Value to be deserialized
-
# @return [Object] Deserialized data
-
1
def self._deserialize(type, value)
-
1722
case type.to_sym
-
when :Time
-
167
Time.parse(value)
-
when :Date
-
10
Date.parse(value)
-
when :String
-
1079
value.to_s
-
when :Integer
-
71
value.to_i
-
when :Float
-
24
value.to_f
-
when :Boolean
-
26
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
-
13
true
-
else
-
13
false
-
end
-
when :Object
-
# generic object (usually a Hash), return directly
-
5
value
-
when /\AArray<(?<inner_type>.+)>\z/
-
inner_type = Regexp.last_match[:inner_type]
-
value.map { |v| _deserialize(inner_type, v) }
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
-
3
k_type = Regexp.last_match[:k_type]
-
3
v_type = Regexp.last_match[:v_type]
-
3
{}.tap do |hash|
-
3
value.each do |k, v|
-
9
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
-
end
-
end
-
else # model
-
# models (e.g. Pet) or oneOf
-
337
klass = Bandwidth.const_get(type)
-
337
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
-
end
-
end
-
-
# Returns the string representation of the object
-
# @return [String] String presentation of the object
-
1
def to_s
-
151
to_hash.to_s
-
end
-
-
# to_body is an alias to to_hash (backward compatibility)
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_body
-
151
to_hash
-
end
-
-
# Outputs non-array value in the form of hash
-
# For object, use to_hash. Otherwise, just return the value
-
# @param [Object] value Any valid value
-
# @return [Hash] Returns the value in the form of hash
-
1
def _to_hash(value)
-
2726
if value.is_a?(Array)
-
292
value.compact.map { |v| _to_hash(v) }
-
2585
elsif value.is_a?(Hash)
-
63
{}.tap do |hash|
-
193
value.each { |k, v| hash[k] = _to_hash(v) }
-
end
-
2522
elsif value.respond_to? :to_hash
-
150
value.to_hash
-
else
-
2372
value
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
module Bandwidth
-
1
class Configuration
-
# Defines url scheme
-
1
attr_accessor :scheme
-
-
# Defines url host
-
1
attr_accessor :host
-
-
# Defines url base path
-
1
attr_accessor :base_path
-
-
# Define server configuration index
-
1
attr_accessor :server_index
-
-
# Define server operation configuration index
-
1
attr_accessor :server_operation_index
-
-
# Default server variables
-
1
attr_accessor :server_variables
-
-
# Default server operation variables
-
1
attr_accessor :server_operation_variables
-
-
# Defines API keys used with API Key authentications.
-
#
-
# @return [Hash] key: parameter name, value: parameter value (API key)
-
#
-
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
-
# config.api_key['api_key'] = 'xxx'
-
1
attr_accessor :api_key
-
-
# Defines API key prefixes used with API Key authentications.
-
#
-
# @return [Hash] key: parameter name, value: API key prefix
-
#
-
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
-
# config.api_key_prefix['api_key'] = 'Token'
-
1
attr_accessor :api_key_prefix
-
-
# Defines the username used with HTTP basic authentication.
-
#
-
# @return [String]
-
1
attr_accessor :username
-
-
# Defines the password used with HTTP basic authentication.
-
#
-
# @return [String]
-
1
attr_accessor :password
-
-
# Defines the client ID used with OAuth2.
-
#
-
# @return [String]
-
1
attr_accessor :client_id
-
-
# Defines the client secret used with OAuth2.
-
#
-
# @return [String]
-
1
attr_accessor :client_secret
-
-
# Defines the access token (Bearer) used with OAuth2.
-
1
attr_accessor :access_token
-
-
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
-
# Overrides the access_token if set
-
# @return [Proc]
-
1
attr_accessor :access_token_getter
-
-
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
-
# HTTP responses with return type `File` will be returned as a stream of binary data.
-
# Default to false.
-
1
attr_accessor :return_binary_data
-
-
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
-
# details will be logged with `logger.debug` (see the `logger` attribute).
-
# Default to false.
-
#
-
# @return [true, false]
-
1
attr_accessor :debugging
-
-
# Set this to ignore operation servers for the API client. This is useful when you need to
-
# send requests to a different server than the one specified in the OpenAPI document.
-
# Will default to the base url defined in the spec but can be overridden by setting
-
# `scheme`, `host`, `base_path` directly.
-
# Default to false.
-
# @return [true, false]
-
1
attr_accessor :ignore_operation_servers
-
-
# Defines the logger used for debugging.
-
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
-
#
-
# @return [#debug]
-
1
attr_accessor :logger
-
-
# Defines the temporary folder to store downloaded files
-
# (for API endpoints that have file response).
-
# Default to use `Tempfile`.
-
#
-
# @return [String]
-
1
attr_accessor :temp_folder_path
-
-
# The time limit for HTTP request in seconds.
-
# Default to 0 (never times out).
-
1
attr_accessor :timeout
-
-
# Set this to false to skip client side validation in the operation.
-
# Default to true.
-
# @return [true, false]
-
1
attr_accessor :client_side_validation
-
-
### TLS/SSL setting
-
# Set this to false to skip verifying SSL certificate when calling API from https server.
-
# Default to true.
-
#
-
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
-
#
-
# @return [true, false]
-
1
attr_accessor :ssl_verify
-
-
### TLS/SSL setting
-
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
-
#
-
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
-
#
-
1
attr_accessor :ssl_verify_mode
-
-
### TLS/SSL setting
-
# Set this to customize the certificate file to verify the peer.
-
#
-
# @return [String] the path to the certificate file
-
1
attr_accessor :ssl_ca_file
-
-
### TLS/SSL setting
-
# Client certificate file (for client certificate)
-
1
attr_accessor :ssl_client_cert
-
-
### TLS/SSL setting
-
# Client private key file (for client certificate)
-
1
attr_accessor :ssl_client_key
-
-
### Proxy setting
-
# HTTP Proxy settings
-
1
attr_accessor :proxy
-
-
# Set this to customize parameters encoder of array parameter.
-
# Default to nil. Faraday uses NestedParamsEncoder when nil.
-
#
-
# @see The params_encoder option of Faraday. Related source code:
-
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
-
1
attr_accessor :params_encoder
-
-
-
1
attr_accessor :inject_format
-
-
1
attr_accessor :force_ending_format
-
-
1
def initialize
-
37
@scheme = 'http'
-
37
@host = 'localhost'
-
37
@base_path = ''
-
37
@server_index = nil
-
37
@server_operation_index = {}
-
37
@server_variables = {}
-
37
@server_operation_variables = {}
-
37
@api_key = {}
-
37
@api_key_prefix = {}
-
37
@client_side_validation = true
-
37
@ssl_verify = true
-
37
@ssl_verify_mode = nil
-
37
@ssl_ca_file = nil
-
37
@ssl_client_cert = nil
-
37
@ssl_client_key = nil
-
42
@middlewares = Hash.new { |h, k| h[k] = [] }
-
37
@configure_connection_blocks = []
-
37
@timeout = 60
-
# return data as binary instead of file
-
37
@return_binary_data = false
-
37
@params_encoder = nil
-
37
@debugging = false
-
37
@ignore_operation_servers = false
-
37
@inject_format = false
-
37
@force_ending_format = false
-
37
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
-
37
@access_token_expiration = nil
-
37
@access_token_getter = Proc.new {
-
116
access_token_valid = @access_token && (@access_token_expiration.nil? || @access_token_expiration > Time.now + 60)
-
116
next @access_token if access_token_valid
-
113
next unless @client_id && @client_secret
-
-
3
puts "Refreshing access token..." if @debugging
-
# obtain new access token using client credentials
-
3
token_url = 'https://api.bandwidth.com/api/v1/oauth2/token'
-
3
auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n")
-
3
conn = Faraday.new(url: token_url) do |faraday|
-
faraday.request :url_encoded
-
faraday.adapter Faraday.default_adapter
-
end
-
3
response = conn.post do |req|
-
req.headers['Authorization'] = auth_header
-
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
-
req.body = 'grant_type=client_credentials'
-
end
-
3
if response.status != 200
-
1
raise "Failed to obtain access token: #{response.status} #{response.body}"
-
end
-
2
body = JSON.parse(response.body)
-
2
@access_token = body['access_token']
-
2
@access_token_expiration = Time.now + body['expires_in']
-
2
@access_token
-
}
-
-
37
yield(self) if block_given?
-
end
-
-
# The default Configuration object.
-
1
def self.default
-
30
@@default ||= Configuration.new
-
end
-
-
1
def configure
-
1
yield(self) if block_given?
-
end
-
-
1
def scheme=(scheme)
-
# remove :// from scheme
-
2
@scheme = scheme.sub(/:\/\//, '')
-
end
-
-
1
def host=(host)
-
# remove http(s):// and anything after a slash
-
14
@host = host.sub(/https?:\/\//, '').split('/').first
-
end
-
-
1
def base_path=(base_path)
-
# Add leading and trailing slashes to base_path
-
2
@base_path = "/#{base_path}".gsub(/\/+/, '/')
-
2
@base_path = '' if @base_path == '/'
-
end
-
-
# Returns base URL for specified operation based on server settings
-
1
def base_url(operation = nil)
-
61
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
-
5
if operation_server_settings.key?(operation) then
-
2
index = server_operation_index.fetch(operation, server_index)
-
2
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
-
else
-
3
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
-
end
-
end
-
-
# Gets API key (with prefix if set).
-
# @param [String] param_name the parameter name of API key auth
-
1
def api_key_with_prefix(param_name, param_alias = nil)
-
2
key = @api_key[param_name]
-
2
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
-
2
if @api_key_prefix[param_name]
-
1
"#{@api_key_prefix[param_name]} #{key}"
-
else
-
1
key
-
end
-
end
-
-
# Gets access_token using access_token_getter or uses the static access_token
-
1
def access_token_with_refresh
-
118
return access_token if access_token_getter.nil?
-
114
access_token_getter.call
-
end
-
-
# Gets Basic Auth token string
-
1
def basic_auth_token
-
111
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
-
end
-
-
# Gets Bearer auth token string
-
1
def oauth_bearer_token
-
113
"Bearer #{access_token_with_refresh}" unless access_token_with_refresh.nil?
-
end
-
-
-
# Returns Auth Settings hash for api client.
-
1
def auth_settings
-
{
-
110
'Basic' =>
-
{
-
type: 'basic',
-
in: 'header',
-
key: 'Authorization',
-
value: basic_auth_token
-
},
-
'OAuth2' =>
-
{
-
type: 'oauth2',
-
in: 'header',
-
key: 'Authorization',
-
value: oauth_bearer_token
-
},
-
}
-
end
-
-
# Returns an array of Server setting
-
1
def server_settings
-
[
-
{
-
1
url: "",
-
description: "No description provided",
-
}
-
]
-
end
-
-
1
def operation_server_settings
-
{
-
8
"CallsApi.create_call": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"CallsApi.get_call_state": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"CallsApi.list_calls": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"CallsApi.update_call": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"CallsApi.update_call_bxml": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.download_conference_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.get_conference": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.get_conference_member": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.get_conference_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.list_conference_recordings": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.list_conferences": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.update_conference": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.update_conference_bxml": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"ConferencesApi.update_conference_member": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"EndpointsApi.create_endpoint": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"EndpointsApi.delete_endpoint": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"EndpointsApi.get_endpoint": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"EndpointsApi.list_endpoints": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"EndpointsApi.update_endpoint_bxml": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"MFAApi.generate_messaging_code": [
-
{
-
url: "https://mfa.bandwidth.com/api/v1",
-
description: "Production",
-
}
-
],
-
"MFAApi.generate_voice_code": [
-
{
-
url: "https://mfa.bandwidth.com/api/v1",
-
description: "Production",
-
}
-
],
-
"MFAApi.verify_code": [
-
{
-
url: "https://mfa.bandwidth.com/api/v1",
-
description: "Production",
-
}
-
],
-
"MediaApi.delete_media": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MediaApi.get_media": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MediaApi.list_media": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MediaApi.upload_media": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MessagesApi.create_message": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MessagesApi.list_messages": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"MultiChannelApi.create_multi_channel_message": [
-
{
-
url: "https://messaging.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"PhoneNumberLookupApi.create_async_bulk_lookup": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"PhoneNumberLookupApi.create_sync_lookup": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"PhoneNumberLookupApi.get_async_bulk_lookup": [
-
{
-
url: "https://api.bandwidth.com/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.delete_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.delete_recording_media": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.delete_recording_transcription": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.download_call_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.get_call_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.get_recording_transcription": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.list_account_call_recordings": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.list_call_recordings": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.transcribe_call_recording": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"RecordingsApi.update_call_recording_state": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"StatisticsApi.get_statistics": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.create_webhook_subscription": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.delete_verification_request": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.delete_webhook_subscription": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.get_toll_free_verification_status": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.list_toll_free_use_cases": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.list_webhook_subscriptions": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.request_toll_free_verification": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.update_toll_free_verification_request": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TollFreeVerificationApi.update_webhook_subscription": [
-
{
-
url: "https://api.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TranscriptionsApi.delete_real_time_transcription": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TranscriptionsApi.get_real_time_transcription": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
"TranscriptionsApi.list_real_time_transcriptions": [
-
{
-
url: "https://voice.bandwidth.com/api/v2",
-
description: "Production",
-
}
-
],
-
}
-
end
-
-
# Returns URL based on server settings
-
#
-
# @param index array index of the server settings
-
# @param variables hash of variable and the corresponding value
-
1
def server_url(index, variables = {}, servers = nil)
-
5
servers = server_settings if servers == nil
-
-
# check array index out of bound
-
5
if (index.nil? || index < 0 || index >= servers.size)
-
2
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
-
end
-
-
3
server = servers[index]
-
3
url = server[:url]
-
-
3
return url unless server.key? :variables
-
-
# go through variable and assign a value
-
2
server[:variables].each do |name, variable|
-
3
if variables.key?(name)
-
2
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
-
1
url.gsub! "{" + name.to_s + "}", variables[name]
-
else
-
1
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
-
end
-
else
-
# use default value
-
1
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
-
end
-
end
-
-
1
url
-
end
-
-
# Configure Faraday connection directly.
-
#
-
# ```
-
# c.configure_faraday_connection do |conn|
-
# conn.use Faraday::HttpCache, shared_cache: false, logger: logger
-
# conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
-
# logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
-
# end
-
# end
-
#
-
# c.configure_faraday_connection do |conn|
-
# conn.adapter :typhoeus
-
# end
-
# ```
-
#
-
# @param block [Proc] `#call`able object that takes one arg, the connection
-
1
def configure_faraday_connection(&block)
-
1
@configure_connection_blocks << block
-
end
-
-
1
def configure_connection(conn)
-
2
@configure_connection_blocks.each do |block|
-
1
block.call(conn)
-
end
-
end
-
-
# Adds middleware to the stack
-
1
def use(*middleware)
-
1
set_faraday_middleware(:use, *middleware)
-
end
-
-
# Adds request middleware to the stack
-
1
def request(*middleware)
-
1
set_faraday_middleware(:request, *middleware)
-
end
-
-
# Adds response middleware to the stack
-
1
def response(*middleware)
-
2
set_faraday_middleware(:response, *middleware)
-
end
-
-
# Adds Faraday middleware setting information to the stack
-
#
-
# @example Use the `set_faraday_middleware` method to set middleware information
-
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
-
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
-
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
-
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
-
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
-
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
-
#
-
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
-
1
def set_faraday_middleware(operation, key, *args, &block)
-
6
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
-
1
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
-
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
-
end
-
-
5
@middlewares[operation] << [key, args, block]
-
end
-
1
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
-
-
# Set up middleware on the connection
-
1
def configure_middleware(connection)
-
3
return if @middlewares.empty?
-
-
2
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
-
14
next unless @middlewares.key?(operation)
-
-
1
@middlewares[operation].each do |key, args, block|
-
1
connection.builder.send(operation, key, *args, &block)
-
end
-
end
-
-
2
if @middlewares.key?(:delete)
-
1
@middlewares[:delete].each do |key, _args, _block|
-
1
connection.builder.delete(key)
-
end
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class AccountStatistics < ApiModelBase
-
# The number of calls currently enqueued.
-
1
attr_accessor :current_call_queue_size
-
-
# The maximum size of the queue before outgoing calls start being rejected.
-
1
attr_accessor :max_call_queue_size
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
28
{
-
:'current_call_queue_size' => :'currentCallQueueSize',
-
:'max_call_queue_size' => :'maxCallQueueSize'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'current_call_queue_size' => :'Integer',
-
:'max_call_queue_size' => :'Integer'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AccountStatistics` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
11
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
10
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'current_call_queue_size')
-
5
self.current_call_queue_size = attributes[:'current_call_queue_size']
-
end
-
-
7
if attributes.key?(:'max_call_queue_size')
-
5
self.max_call_queue_size = attributes[:'max_call_queue_size']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
current_call_queue_size == o.current_call_queue_size &&
-
max_call_queue_size == o.max_call_queue_size
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[current_call_queue_size, max_call_queue_size].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class AdditionalDenialReason < ApiModelBase
-
# Reason code for denial.
-
1
attr_accessor :status_code
-
-
# Explanation for why a verification request was declined.
-
1
attr_accessor :reason
-
-
# Whether a Toll-Free Verification request qualifies for resubmission via PUT.
-
1
attr_accessor :resubmit_allowed
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
44
{
-
:'status_code' => :'statusCode',
-
:'reason' => :'reason',
-
:'resubmit_allowed' => :'resubmitAllowed'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
15
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'status_code' => :'Integer',
-
:'reason' => :'String',
-
:'resubmit_allowed' => :'Boolean'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
15
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AdditionalDenialReason` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
14
acceptable_attribute_map = self.class.acceptable_attribute_map
-
14
attributes = attributes.each_with_object({}) { |(k, v), h|
-
40
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
39
h[k.to_sym] = v
-
}
-
-
13
if attributes.key?(:'status_code')
-
13
self.status_code = attributes[:'status_code']
-
else
-
self.status_code = nil
-
end
-
-
12
if attributes.key?(:'reason')
-
12
self.reason = attributes[:'reason']
-
else
-
self.reason = nil
-
end
-
-
11
if attributes.key?(:'resubmit_allowed')
-
11
self.resubmit_allowed = attributes[:'resubmit_allowed']
-
else
-
self.resubmit_allowed = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @status_code.nil?
-
invalid_properties.push('invalid value for "status_code", status_code cannot be nil.')
-
end
-
-
if @reason.nil?
-
invalid_properties.push('invalid value for "reason", reason cannot be nil.')
-
end
-
-
if @resubmit_allowed.nil?
-
invalid_properties.push('invalid value for "resubmit_allowed", resubmit_allowed cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @status_code.nil?
-
return false if @reason.nil?
-
return false if @resubmit_allowed.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status_code Value to be assigned
-
1
def status_code=(status_code)
-
13
if status_code.nil?
-
1
fail ArgumentError, 'status_code cannot be nil'
-
end
-
-
12
@status_code = status_code
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] reason Value to be assigned
-
1
def reason=(reason)
-
12
if reason.nil?
-
1
fail ArgumentError, 'reason cannot be nil'
-
end
-
-
11
@reason = reason
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] resubmit_allowed Value to be assigned
-
1
def resubmit_allowed=(resubmit_allowed)
-
11
if resubmit_allowed.nil?
-
1
fail ArgumentError, 'resubmit_allowed cannot be nil'
-
end
-
-
10
@resubmit_allowed = resubmit_allowed
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
status_code == o.status_code &&
-
reason == o.reason &&
-
resubmit_allowed == o.resubmit_allowed
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[status_code, reason, resubmit_allowed].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Address < ApiModelBase
-
# The name of the business using the toll-free number.
-
1
attr_accessor :name
-
-
# The address of the business using the toll-free number.
-
1
attr_accessor :addr1
-
-
# The address of the business using the toll-free number.
-
1
attr_accessor :addr2
-
-
# The city of the business using the toll-free number.
-
1
attr_accessor :city
-
-
# The state of the business using the toll-free number.
-
1
attr_accessor :state
-
-
# The zip of the business using the toll-free number.
-
1
attr_accessor :zip
-
-
# The website of the business using the toll-free number.
-
1
attr_accessor :url
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
224
{
-
:'name' => :'name',
-
:'addr1' => :'addr1',
-
:'addr2' => :'addr2',
-
:'city' => :'city',
-
:'state' => :'state',
-
:'zip' => :'zip',
-
:'url' => :'url'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
33
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
7
{
-
:'name' => :'String',
-
:'addr1' => :'String',
-
:'addr2' => :'String',
-
:'city' => :'String',
-
:'state' => :'String',
-
:'zip' => :'String',
-
:'url' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'addr2',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
33
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Address` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
32
acceptable_attribute_map = self.class.acceptable_attribute_map
-
32
attributes = attributes.each_with_object({}) { |(k, v), h|
-
152
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Address`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
151
h[k.to_sym] = v
-
}
-
-
31
if attributes.key?(:'name')
-
31
self.name = attributes[:'name']
-
else
-
self.name = nil
-
end
-
-
28
if attributes.key?(:'addr1')
-
28
self.addr1 = attributes[:'addr1']
-
else
-
self.addr1 = nil
-
end
-
-
25
if attributes.key?(:'addr2')
-
8
self.addr2 = attributes[:'addr2']
-
end
-
-
24
if attributes.key?(:'city')
-
24
self.city = attributes[:'city']
-
else
-
self.city = nil
-
end
-
-
21
if attributes.key?(:'state')
-
21
self.state = attributes[:'state']
-
else
-
self.state = nil
-
end
-
-
18
if attributes.key?(:'zip')
-
18
self.zip = attributes[:'zip']
-
else
-
self.zip = nil
-
end
-
-
17
if attributes.key?(:'url')
-
17
self.url = attributes[:'url']
-
else
-
self.url = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @name.nil?
-
invalid_properties.push('invalid value for "name", name cannot be nil.')
-
end
-
-
if @name.to_s.length > 500
-
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 500.')
-
end
-
-
if @name.to_s.length < 1
-
invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
-
end
-
-
if @addr1.nil?
-
invalid_properties.push('invalid value for "addr1", addr1 cannot be nil.')
-
end
-
-
if @addr1.to_s.length > 500
-
invalid_properties.push('invalid value for "addr1", the character length must be smaller than or equal to 500.')
-
end
-
-
if @addr1.to_s.length < 1
-
invalid_properties.push('invalid value for "addr1", the character length must be greater than or equal to 1.')
-
end
-
-
if !@addr2.nil? && @addr2.to_s.length > 500
-
invalid_properties.push('invalid value for "addr2", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@addr2.nil? && @addr2.to_s.length < 0
-
invalid_properties.push('invalid value for "addr2", the character length must be greater than or equal to 0.')
-
end
-
-
if @city.nil?
-
invalid_properties.push('invalid value for "city", city cannot be nil.')
-
end
-
-
if @city.to_s.length > 500
-
invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 500.')
-
end
-
-
if @city.to_s.length < 1
-
invalid_properties.push('invalid value for "city", the character length must be greater than or equal to 1.')
-
end
-
-
if @state.nil?
-
invalid_properties.push('invalid value for "state", state cannot be nil.')
-
end
-
-
if @state.to_s.length > 500
-
invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 500.')
-
end
-
-
if @state.to_s.length < 1
-
invalid_properties.push('invalid value for "state", the character length must be greater than or equal to 1.')
-
end
-
-
if @zip.nil?
-
invalid_properties.push('invalid value for "zip", zip cannot be nil.')
-
end
-
-
pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/)
-
if @zip !~ pattern
-
invalid_properties.push("invalid value for \"zip\", must conform to the pattern #{pattern}.")
-
end
-
-
if @url.nil?
-
invalid_properties.push('invalid value for "url", url cannot be nil.')
-
end
-
-
if @url.to_s.length > 500
-
invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 500.')
-
end
-
-
if @url.to_s.length < 1
-
invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @name.nil?
-
return false if @name.to_s.length > 500
-
return false if @name.to_s.length < 1
-
return false if @addr1.nil?
-
return false if @addr1.to_s.length > 500
-
return false if @addr1.to_s.length < 1
-
return false if !@addr2.nil? && @addr2.to_s.length > 500
-
return false if !@addr2.nil? && @addr2.to_s.length < 0
-
return false if @city.nil?
-
return false if @city.to_s.length > 500
-
return false if @city.to_s.length < 1
-
return false if @state.nil?
-
return false if @state.to_s.length > 500
-
return false if @state.to_s.length < 1
-
return false if @zip.nil?
-
return false if @zip !~ Regexp.new(/[- A-Za-z0-9]{0,500}/)
-
return false if @url.nil?
-
return false if @url.to_s.length > 500
-
return false if @url.to_s.length < 1
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] name Value to be assigned
-
1
def name=(name)
-
31
if name.nil?
-
1
fail ArgumentError, 'name cannot be nil'
-
end
-
-
30
if name.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 500.'
-
end
-
-
29
if name.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
-
end
-
-
28
@name = name
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] addr1 Value to be assigned
-
1
def addr1=(addr1)
-
28
if addr1.nil?
-
1
fail ArgumentError, 'addr1 cannot be nil'
-
end
-
-
27
if addr1.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "addr1", the character length must be smaller than or equal to 500.'
-
end
-
-
26
if addr1.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "addr1", the character length must be greater than or equal to 1.'
-
end
-
-
25
@addr1 = addr1
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] addr2 Value to be assigned
-
1
def addr2=(addr2)
-
8
if !addr2.nil? && addr2.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "addr2", the character length must be smaller than or equal to 500.'
-
end
-
-
7
if !addr2.nil? && addr2.to_s.length < 0
-
fail ArgumentError, 'invalid value for "addr2", the character length must be greater than or equal to 0.'
-
end
-
-
7
@addr2 = addr2
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] city Value to be assigned
-
1
def city=(city)
-
24
if city.nil?
-
1
fail ArgumentError, 'city cannot be nil'
-
end
-
-
23
if city.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 500.'
-
end
-
-
22
if city.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "city", the character length must be greater than or equal to 1.'
-
end
-
-
21
@city = city
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] state Value to be assigned
-
1
def state=(state)
-
21
if state.nil?
-
1
fail ArgumentError, 'state cannot be nil'
-
end
-
-
20
if state.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 500.'
-
end
-
-
19
if state.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "state", the character length must be greater than or equal to 1.'
-
end
-
-
18
@state = state
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] zip Value to be assigned
-
1
def zip=(zip)
-
18
if zip.nil?
-
1
fail ArgumentError, 'zip cannot be nil'
-
end
-
-
17
pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/)
-
17
if zip !~ pattern
-
fail ArgumentError, "invalid value for \"zip\", must conform to the pattern #{pattern}."
-
end
-
-
17
@zip = zip
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] url Value to be assigned
-
1
def url=(url)
-
17
if url.nil?
-
1
fail ArgumentError, 'url cannot be nil'
-
end
-
-
16
if url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 500.'
-
end
-
-
15
if url.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "url", the character length must be greater than or equal to 1.'
-
end
-
-
14
@url = url
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
name == o.name &&
-
addr1 == o.addr1 &&
-
addr2 == o.addr2 &&
-
city == o.city &&
-
state == o.state &&
-
zip == o.zip &&
-
url == o.url
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[name, addr1, addr2, city, state, zip, url].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
7
return nil unless attributes.is_a?(Hash)
-
7
attributes = attributes.transform_keys(&:to_sym)
-
7
transformed_hash = {}
-
7
openapi_types.each_pair do |key, type|
-
49
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
49
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
49
elsif !attributes[attribute_map[key]].nil?
-
44
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
7
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered.
-
1
class AnswerCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
attr_accessor :machine_detection_result
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
67
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'machine_detection_result' => :'machineDetectionResult'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'machine_detection_result' => :'MachineDetectionResult'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'machine_detection_result'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AnswerCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
57
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
56
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'machine_detection_result')
-
4
self.machine_detection_result = attributes[:'machine_detection_result']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
machine_detection_result == o.machine_detection_result
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, machine_detection_result].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
14
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
14
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
14
elsif !attributes[attribute_map[key]].nil?
-
14
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class AsyncLookupRequest < ApiModelBase
-
# Telephone numbers in E.164 format.
-
1
attr_accessor :phone_numbers
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
19
{
-
:'phone_numbers' => :'phoneNumbers'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
11
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'phone_numbers' => :'Array<String>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
11
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AsyncLookupRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
10
acceptable_attribute_map = self.class.acceptable_attribute_map
-
10
attributes = attributes.each_with_object({}) { |(k, v), h|
-
10
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AsyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
9
h[k.to_sym] = v
-
}
-
-
9
if attributes.key?(:'phone_numbers')
-
9
if (value = attributes[:'phone_numbers']).is_a?(Array)
-
9
self.phone_numbers = value
-
end
-
else
-
self.phone_numbers = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @phone_numbers.nil?
-
invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @phone_numbers.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_numbers Value to be assigned
-
1
def phone_numbers=(phone_numbers)
-
10
if phone_numbers.nil?
-
1
fail ArgumentError, 'phone_numbers cannot be nil'
-
end
-
-
9
@phone_numbers = phone_numbers
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
phone_numbers == o.phone_numbers
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[phone_numbers].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
3
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
elsif !attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
3
value = self.send(attr)
-
3
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
3
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BlockedWebhook < ApiModelBase
-
# User's account ID.
-
1
attr_accessor :account_id
-
-
# Toll-free telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
1
attr_accessor :status
-
-
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
-
1
attr_accessor :internal_ticket_number
-
-
# Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked
-
-
# The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked_reason
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
39
{
-
:'account_id' => :'accountId',
-
:'phone_number' => :'phoneNumber',
-
:'status' => :'status',
-
:'internal_ticket_number' => :'internalTicketNumber',
-
:'blocked' => :'blocked',
-
:'blocked_reason' => :'blockedReason'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'account_id' => :'String',
-
:'phone_number' => :'String',
-
:'status' => :'TfvCallbackStatusEnum',
-
:'internal_ticket_number' => :'String',
-
:'blocked' => :'Boolean',
-
:'blocked_reason' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BlockedWebhook` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
29
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BlockedWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
28
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
10
if attributes.key?(:'phone_number')
-
8
self.phone_number = attributes[:'phone_number']
-
end
-
-
6
if attributes.key?(:'status')
-
4
self.status = attributes[:'status']
-
end
-
-
6
if attributes.key?(:'internal_ticket_number')
-
4
self.internal_ticket_number = attributes[:'internal_ticket_number']
-
end
-
-
6
if attributes.key?(:'blocked')
-
4
self.blocked = attributes[:'blocked']
-
end
-
-
6
if attributes.key?(:'blocked_reason')
-
4
self.blocked_reason = attributes[:'blocked_reason']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@phone_number.nil? && @phone_number.to_s.length > 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
end
-
-
if !@phone_number.nil? && @phone_number.to_s.length < 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
end
-
-
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
if !@phone_number.nil? && @phone_number !~ pattern
-
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
-
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
-
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
8
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
7
if phone_number.to_s.length > 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
-
end
-
-
6
if phone_number.to_s.length < 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.'
-
end
-
-
5
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
5
if phone_number !~ pattern
-
1
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
-
end
-
-
4
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
phone_number == o.phone_number &&
-
status == o.status &&
-
internal_ticket_number == o.internal_ticket_number &&
-
blocked == o.blocked &&
-
blocked_reason == o.blocked_reason
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, phone_number, status, internal_ticket_number, blocked, blocked_reason].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# If the target call leaves the <Bridge>, then this callback is sent to the bridgeCompleteUrl, and the BXML returned in it is executed on the call. If this webhook is sent, the Bridge Target Complete webhook is NOT sent. This callback is also sent if any problem occurs that prevents the calls to be bridged.
-
1
class BridgeCompleteCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
-
1
attr_accessor :cause
-
-
# Text explaining the reason that caused the call to fail in case of errors.
-
1
attr_accessor :error_message
-
-
# Bandwidth's internal id that references the error event.
-
1
attr_accessor :error_id
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
75
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'cause' => :'cause',
-
:'error_message' => :'errorMessage',
-
:'error_id' => :'errorId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'cause' => :'String',
-
:'error_message' => :'String',
-
:'error_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BridgeCompleteCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
65
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BridgeCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
64
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'cause')
-
4
self.cause = attributes[:'cause']
-
end
-
-
6
if attributes.key?(:'error_message')
-
4
self.error_message = attributes[:'error_message']
-
end
-
-
6
if attributes.key?(:'error_id')
-
4
self.error_id = attributes[:'error_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
cause == o.cause &&
-
error_message == o.error_message &&
-
error_id == o.error_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, cause, error_message, error_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
16
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
16
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
16
elsif !attributes[attribute_map[key]].nil?
-
16
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
32
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# If the originating call leaves the <Bridge>, then this callback is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed on the target call. If this webhook is sent, the Bridge Complete webhook is NOT sent.
-
1
class BridgeTargetCompleteCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
63
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BridgeTargetCompleteCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
53
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BridgeTargetCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
52
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
13
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
13
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
13
elsif !attributes[attribute_map[key]].nil?
-
13
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
26
value = self.send(attr)
-
26
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BrtcError < ApiModelBase
-
# A unique identifier for the error.
-
1
attr_accessor :id
-
-
# The type of error.
-
1
attr_accessor :type
-
-
# A description of the error.
-
1
attr_accessor :description
-
-
# A code that uniquely identifies the error.
-
1
attr_accessor :code
-
-
1
attr_accessor :source
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
124
{
-
:'id' => :'id',
-
:'type' => :'type',
-
:'description' => :'description',
-
:'code' => :'code',
-
:'source' => :'source'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
37
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'id' => :'String',
-
:'type' => :'String',
-
:'description' => :'String',
-
:'code' => :'String',
-
:'source' => :'BrtcErrorSource'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
25
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
37
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BrtcError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
36
acceptable_attribute_map = self.class.acceptable_attribute_map
-
36
attributes = attributes.each_with_object({}) { |(k, v), h|
-
83
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BrtcError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
82
h[k.to_sym] = v
-
}
-
-
35
if attributes.key?(:'id')
-
4
self.id = attributes[:'id']
-
end
-
-
35
if attributes.key?(:'type')
-
35
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
34
if attributes.key?(:'description')
-
34
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
33
if attributes.key?(:'code')
-
4
self.code = attributes[:'code']
-
end
-
-
33
if attributes.key?(:'source')
-
4
self.source = attributes[:'source']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @description.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
35
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
34
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
34
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
33
@description = description
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
type == o.type &&
-
description == o.description &&
-
code == o.code &&
-
source == o.source
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, type, description, code, source].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
25
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
25
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
25
elsif !attributes[attribute_map[key]].nil?
-
13
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
10
hash = {}
-
10
self.class.attribute_map.each_pair do |attr, param|
-
50
value = self.send(attr)
-
50
if value.nil?
-
24
is_nullable = self.class.openapi_nullable.include?(attr)
-
24
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
10
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BrtcErrorResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
25
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'links' => :'Array<BrtcLink>',
-
:'data' => :'Object',
-
:'errors' => :'Array<BrtcError>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'data',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BrtcErrorResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
23
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BrtcErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
22
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'links')
-
8
if (value = attributes[:'links']).is_a?(Array)
-
8
self.links = value
-
end
-
else
-
self.links = nil
-
end
-
-
8
if attributes.key?(:'data')
-
6
self.data = attributes[:'data']
-
else
-
2
self.data = nil
-
end
-
-
8
if attributes.key?(:'errors')
-
8
if (value = attributes[:'errors']).is_a?(Array)
-
8
self.errors = value
-
end
-
else
-
self.errors = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @links.nil?
-
invalid_properties.push('invalid value for "links", links cannot be nil.')
-
end
-
-
if @errors.nil?
-
invalid_properties.push('invalid value for "errors", errors cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @links.nil?
-
return false if @errors.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] links Value to be assigned
-
1
def links=(links)
-
9
if links.nil?
-
1
fail ArgumentError, 'links cannot be nil'
-
end
-
-
8
@links = links
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] errors Value to be assigned
-
1
def errors=(errors)
-
9
if errors.nil?
-
1
fail ArgumentError, 'errors cannot be nil'
-
end
-
-
8
@errors = errors
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BrtcErrorSource < ApiModelBase
-
# The URI parameter that caused the error.
-
1
attr_accessor :parameter
-
-
# The request body field that caused the error.
-
1
attr_accessor :field
-
-
# The header that caused the error.
-
1
attr_accessor :header
-
-
# The resource ID or path to the resource (or non-existent resource) causing the error.
-
1
attr_accessor :reference
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
43
{
-
:'parameter' => :'parameter',
-
:'field' => :'field',
-
:'header' => :'header',
-
:'reference' => :'reference'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'parameter' => :'String',
-
:'field' => :'String',
-
:'header' => :'String',
-
:'reference' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
7
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BrtcErrorSource` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BrtcErrorSource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'parameter')
-
4
self.parameter = attributes[:'parameter']
-
end
-
-
10
if attributes.key?(:'field')
-
8
self.field = attributes[:'field']
-
end
-
-
10
if attributes.key?(:'header')
-
4
self.header = attributes[:'header']
-
end
-
-
10
if attributes.key?(:'reference')
-
4
self.reference = attributes[:'reference']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
parameter == o.parameter &&
-
field == o.field &&
-
header == o.header &&
-
reference == o.reference
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[parameter, field, header, reference].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
6
is_nullable = self.class.openapi_nullable.include?(attr)
-
6
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BrtcLink < ApiModelBase
-
# The full URL of the link.
-
1
attr_accessor :href
-
-
# The relationship of the link to the current resource.
-
1
attr_accessor :rel
-
-
# The HTTP method to use when making the request.
-
1
attr_accessor :method
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
158
{
-
:'href' => :'href',
-
:'rel' => :'rel',
-
:'method' => :'method'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
39
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
9
{
-
:'href' => :'String',
-
:'rel' => :'String',
-
:'method' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
39
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BrtcLink` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
38
acceptable_attribute_map = self.class.acceptable_attribute_map
-
38
attributes = attributes.each_with_object({}) { |(k, v), h|
-
106
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BrtcLink`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
105
h[k.to_sym] = v
-
}
-
-
37
if attributes.key?(:'href')
-
35
self.href = attributes[:'href']
-
end
-
-
37
if attributes.key?(:'rel')
-
35
self.rel = attributes[:'rel']
-
end
-
-
37
if attributes.key?(:'method')
-
35
self.method = attributes[:'method']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
href == o.href &&
-
rel == o.rel &&
-
method == o.method
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[href, rel, method].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
9
return nil unless attributes.is_a?(Hash)
-
9
attributes = attributes.transform_keys(&:to_sym)
-
9
transformed_hash = {}
-
9
openapi_types.each_pair do |key, type|
-
27
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
27
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
27
elsif !attributes[attribute_map[key]].nil?
-
27
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
9
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
10
hash = {}
-
10
self.class.attribute_map.each_pair do |attr, param|
-
30
value = self.send(attr)
-
30
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
30
hash[param] = _to_hash(value)
-
end
-
10
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BusinessEntityTypeEnum
-
1
SOLE_PROPRIETOR = 'SOLE_PROPRIETOR'.freeze
-
1
PRIVATE_PROFIT = 'PRIVATE_PROFIT'.freeze
-
1
PUBLIC_PROFIT = 'PUBLIC_PROFIT'.freeze
-
1
NON_PROFIT = 'NON_PROFIT'.freeze
-
1
GOVERNMENT = 'GOVERNMENT'.freeze
-
-
1
def self.all_vars
-
11
@all_vars ||= [SOLE_PROPRIETOR, PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, GOVERNMENT].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
10
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
10
return value if BusinessEntityTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #BusinessEntityTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class BusinessRegistrationTypeEnum
-
1
EIN = 'EIN'.freeze
-
1
CBN = 'CBN'.freeze
-
1
NEQ = 'NEQ'.freeze
-
1
PROVINCIAL_NUMBER = 'PROVINCIAL_NUMBER'.freeze
-
1
CRN = 'CRN'.freeze
-
1
VAT = 'VAT'.freeze
-
1
ACN = 'ACN'.freeze
-
1
ABN = 'ABN'.freeze
-
1
BRN = 'BRN'.freeze
-
1
SIREN = 'SIREN'.freeze
-
1
SIRET = 'SIRET'.freeze
-
1
NZBN = 'NZBN'.freeze
-
1
UST_IDNR = 'UST_IDNR'.freeze
-
1
CIF = 'CIF'.freeze
-
1
NIF = 'NIF'.freeze
-
1
CNPJ = 'CNPJ'.freeze
-
1
UID = 'UID'.freeze
-
1
OTHER = 'OTHER'.freeze
-
-
1
def self.all_vars
-
24
@all_vars ||= [EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
23
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
23
return value if BusinessRegistrationTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #BusinessRegistrationTypeEnum"
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Bxml < Bandwidth::Bxml::Root
-
# Initializer
-
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
-
1
def initialize(nested_verbs = [])
-
6
super(tag = 'Bxml', nested_verbs)
-
end
-
end
-
end
-
end
-
1
require 'ox'
-
-
1
module Bandwidth
-
1
module Bxml
-
1
class NestableVerb < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param tag [String] Name of the XML element.
-
# @param content [String] XML element content. Defaults to nil.
-
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(tag, content = nil, nested_verbs = [], attributes = {})
-
25
@tag = tag
-
25
@content = content
-
25
@nested_verbs = Array(nested_verbs)
-
25
@attributes = attributes
-
end
-
-
# Generate an XML element for the verb
-
# @return [Node] The XML element.
-
1
def generate_xml
-
20
root = Ox::Element.new(@tag)
-
20
if @content
-
root << @content
-
end
-
-
20
if @nested_verbs.length > 0
-
12
@nested_verbs.each do |verb|
-
28
root << verb.generate_xml
-
end
-
end
-
-
20
if !@attributes.empty? && !@attribute_map.nil?
-
20
@attributes.each do |key, value|
-
230
if @attribute_map.include? key.to_sym
-
230
root[@attribute_map[key.to_sym]] = value
-
else
-
raise NoMethodError.new("attribute '#{key}' is not a valid attribute for this verb")
-
end
-
end
-
end
-
-
20
root
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Response < Bandwidth::Bxml::Root
-
# Initializer
-
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
-
1
def initialize(nested_verbs = [])
-
6
super(tag = 'Response', nested_verbs)
-
end
-
end
-
end
-
end
-
1
require 'ox'
-
-
1
module Bandwidth
-
1
module Bxml
-
1
SPEAK_SENTENCE_REGEX = /<SpeakSentence.*?>(.*?)<\/SpeakSentence>/
-
1
SSML_REGEX = /<([a-zA-Z\/\/].*?)>/
-
-
1
class Root
-
# Initializer
-
# @param tag [String] Name of the XML element.
-
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
-
1
def initialize(tag, nested_verbs = [])
-
12
@tag = tag
-
12
@nested_verbs = Array(nested_verbs)
-
end
-
-
# Generate an XML element for the BXML response
-
# @return [Document] The XML element.
-
1
def generate_xml
-
10
xml = Ox::Document.new
-
10
instruct = Ox::Instruct.new(:xml)
-
10
instruct[:version] = '1.0'
-
10
instruct[:encoding] = 'UTF-8'
-
10
xml << instruct
-
10
root = Ox::Element.new(@tag)
-
10
@nested_verbs.each do |verb|
-
12
root << verb.generate_xml
-
end
-
10
xml << root
-
10
xml
-
end
-
-
# Add a verb or verbs to the nested verbs array
-
# @param *nested_verbs [Verb] or [Array<Verb>] Verb or verbs to add to the array.
-
1
def add_verbs(nested_verbs)
-
4
@nested_verbs.push(*nested_verbs)
-
end
-
-
# Return BXML representaion of this response
-
# @return [String] The XML response in string format.
-
1
def to_bxml
-
10
bxml = Ox.dump(generate_xml)
-
10
bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>') }
-
end
-
end
-
end
-
end
-
1
require 'ox'
-
-
1
module Bandwidth
-
1
module Bxml
-
1
class Verb
-
# Initializer
-
# @param tag [String] Name of the XML element.
-
# @param content [String] XML element content. Defaults to nil.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(tag, content = nil, attributes = {})
-
92
@tag = tag
-
92
@content = content
-
92
@attributes = attributes
-
end
-
-
# Set XML attributes for the verb
-
# @param attributes [Hash] The attributes to add to the element.
-
1
def set_attributes(attributes)
-
22
@attributes = attributes
-
end
-
-
# Generate an XML element for the verb
-
# @return [Node] The XML element.
-
1
def generate_xml
-
83
root = Ox::Element.new(@tag)
-
83
if @content
-
29
root << @content
-
end
-
-
83
if !@attributes.empty? && !@attribute_map.nil?
-
50
@attributes.each do |key, value|
-
258
if @attribute_map.include? key.to_sym
-
258
root[@attribute_map[key.to_sym]] = value
-
else
-
raise NoMethodError.new("attribute '#{key}' is not a valid attribute for this verb")
-
end
-
end
-
end
-
-
83
root
-
end
-
-
# Return BXML representaion of this element
-
# @return [String] The XML element in string format.
-
1
def to_bxml
-
56
Ox.dump(generate_xml)
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Bridge < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param target_call [String] The callId of the call to be bridged.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(target_call, attributes = {})
-
3
super('Bridge', target_call, attributes)
-
-
@attribute_map = {
-
3
bridge_complete_url: 'bridgeCompleteUrl', # Optional [String]: URL to send the Bridge Complete event to and request new BXML. If this attribute is specified, then Verbs following the <Bridge> verb will be ignored and the BXML returned in this webhook is executed on the call. If this attribute is not specified then no webhook will be sent, and execution of the verbs following the <Bridge> verb continues. May be a relative URL. Defaults to None.
-
bridge_complete_method: 'bridgeCompleteMethod', # Optional [String]: The HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST.
-
bridge_complete_fallback_url: 'bridgeCompleteFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Bridge Complete webhook delivery in case bridgeCompleteUrl fails to respond. Defaults to None.
-
bridge_complete_fallback_method: 'bridgeCompleteFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Bridge Complete webhook to bridgeCompleteFallbackUrl. GET or POST. Default value is POST.
-
bridge_target_complete_url: 'bridgeTargetCompleteUrl', # Optional [String]: URL to send the Bridge Target Complete event to and request new BXML. If this attribute is specified, then the BXML returned in this webhook is executed on the target call. If this attribute is not specified then no webhook will be sent, and the target call will be hung up. May be a relative URL. Defaults to None.
-
bridge_target_complete_method: 'bridgeTargetCompleteMethod', # Optional [String]: The HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST.
-
bridge_target_complete_fallback_url: 'bridgeTargetCompleteFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Bridge Target Complete webhook delivery in case bridgeTargetCompleteUrl fails to respond. Defaults to None.
-
bridge_target_complete_fallback_method: 'bridgeTargetCompleteFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Bridge Target Complete webhook to bridgeTargetCompleteFallbackUrl. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with the bridgeComplete webhook and all future webhooks of the call unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Conference < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param name [String] The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and .
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(name, attributes = {})
-
3
super('Conference', name, attributes)
-
-
@attribute_map = {
-
3
mute: 'mute', # Optional [Boolean]: A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false.
-
hold: 'hold', # Optional [Boolean]: A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false.
-
call_ids_to_coach: 'callIdsToCoach', # Optional [String]: A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach.
-
conference_event_url: 'conferenceEventUrl', # Optional [String]: URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), they will be ignored and the original webhook information will be used. This URL may be a relative endpoint.
-
conference_event_method: 'conferenceEventMethod', # Optional [String]: The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST.
-
conference_event_fallback_url: 'conferenceEventFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond.
-
conference_event_fallback_method: 'conferenceEventFallbackMethod', # Optional [String]: The HTTP method to use to deliver the conference webhooks to conferenceEventFallbackUrl. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to conferenceEventUrl.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to conferenceEventUrl.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to conferenceEventFallbackUrl.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to conferenceEventFallbackUrl.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
-
callback_timeout: 'callbackTimeout', # Optional [Number]: This is the timeout (in seconds) to use when delivering webhooks for the conference. If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class CustomParam < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
7
super('CustomParam', nil, attributes)
-
-
@attribute_map = {
-
7
name: 'name', # [String]: The name of this parameter, up to 256 characters.
-
value: 'value', # [String]: The value of this parameter, up to 2048 characters.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Forward < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('Forward', nil, attributes)
-
-
@attribute_map = {
-
3
to: 'to', # [String]: The phone number destination of the call.
-
from: 'from', # Optional [String]: The phone number that the recipient will receive the call from.
-
call_timeout: 'callTimeout', # Optional [Number]: The number of seconds to wait before timing out the call.
-
diversion_treatment: 'diversionTreatment', # Optional [String]: Can be any of the following: - none: No diversion headers are sent on the outbound leg of the transferred call. - propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. - stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. If diversionTreatment is not specified, no diversion header will be included for the transfer even if one came with the inbound call. Defaults to None.
-
diversion_reason: 'diversionReason', # Optional [String]: Can be any of the following values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. This parameter is considered only when diversionTreatment is set to stack. Defaults to None.
-
uui: 'uui', # Optional [String]: The value of the User-To-User header to send within the outbound INVITE when forwarding to a SIP URI. Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Gather < Bandwidth::Bxml::NestableVerb
-
# Initializer
-
# @param audio_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested audio verbs are: SpeakSentence, PlayAudio.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(audio_verbs = [], attributes = {})
-
6
super('Gather', nil, audio_verbs, attributes)
-
-
@attribute_map = {
-
6
gather_url: 'gatherUrl', # Optional [String]: URL to send Gather event to and request new BXML. May be a relative URL.
-
gather_method: 'gatherMethod', # Optional [String]: The HTTP method to use for the request to gather_url. GET or POST. Default value is POST.
-
gather_fallback_url: 'gatherFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Gather event callback delivery in case gather_url fails to respond.
-
gather_fallback_method: 'gatherFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Gather event callback to gather_fallback_url. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to gather_url.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to gather_url.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to gather_fallback_url.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to gather_fallback_url.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters.
-
terminating_digits: 'terminatingDigits', # Optional [String]: When any of these digits are pressed, it will terminate the Gather. Default value is "", which disables this feature.
-
max_digits: 'maxDigits', # Optional [Number]: Max number of digits to collect. Default value is 50. Range: decimal values between 1 - 50.
-
inter_digit_timeout: 'interDigitTimeout', # Optional [Number]: Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60.
-
first_digit_timeout: 'firstDigitTimeout', # Optional [Number]: Time (in seconds) to pause after any audio from nested <SpeakSentence> or <PlayAudio> verb is played (in seconds) before terminating the Gather. Default value is 5. Range: decimal values between 0 - 60.
-
repeat_count: 'repeatCount', # Optional [Number]: The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. The delay between repetitions will be equal to first_digit_timeout. Default value is 1. repeatCount * number of verbs must not be greater than 20.
-
}
-
end
-
-
# Return BXML representaion of this response
-
# @return [String] The XML response in string format.
-
1
def to_bxml
-
5
bxml = Ox.dump(generate_xml)
-
8
bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>') }
-
end
-
-
# Add audio verb or verbs to the nested verbs array
-
# @param audio_verbs [SpeakSentence] or [PlayAudio] or [Array<SpeakSentence || PlayAudio>] Verb or verbs to add to the array.
-
1
def add_audio_verbs(audio_verbs)
-
2
@nested_verbs.push(*audio_verbs)
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Hangup < Bandwidth::Bxml::Verb
-
# Initializer
-
1
def initialize
-
2
super('Hangup', nil, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Pause < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('Pause', nil, attributes)
-
-
@attribute_map = {
-
3
duration: 'duration', # Optional [Number]: The time in seconds to pause. Default value is 1.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class PauseRecording < Bandwidth::Bxml::Verb
-
# Initializer
-
1
def initialize
-
10
super('PauseRecording', nil, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class PhoneNumber < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param number [String] A phone number to transfer the call to. Value must be in E.164 format (e.g. +15555555555).
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(number, attributes = {})
-
6
super('PhoneNumber', number, attributes)
-
-
@attribute_map = {
-
6
transfer_answer_url: 'transferAnswerUrl', # Optional [String]: URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged. May be a relative URL. Defaults to None.
-
transfer_answer_method: 'transferAnswerMethod', # Optional [String]: The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. Defaults to None.
-
transfer_answer_fallback_url: 'transferAnswerFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Transfer Answer callback delivery in case transferAnswerUrl fails to respond. Defaults to None.
-
transfer_answer_fallback_method: 'transferAnswerFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Transfer Answer callback to transferAnswerFallbackUrl. GET or POST. Default value is POST. Defaults to None.
-
transfer_disconnect_url: 'transferDisconnectUrl', # Optional [String]: URL, if any, to send the Transfer Disconnect event to. This event will be sent regardless of how the transfer ends and may not be responded to with BXML. May be a relative URL. Defaults to None.
-
transfer_disconnect_method: 'transferDisconnectMethod', # Optional [String]: The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. Defaults to Defaults to Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
-
uui: 'uui', # Optional [String]: The value of the User-To-User header to send within the initial INVITE. Must include the encoding parameter as specified in RFC 7433. Only base64, jwt and hex encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class PlayAudio < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param audio_uri [String] The URL of the audio file to play. May be a relative URL.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(audio_uri, attributes = {})
-
6
super('PlayAudio', audio_uri, attributes)
-
-
@attribute_map = {
-
6
username: 'username', # Optional [String]: The username to send in the HTTP request to audio_uri.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to audio_uri.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Record < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('Record', nil, attributes)
-
-
@attribute_map = {
-
3
record_complete_url: 'recordCompleteUrl', # Optional [String]: URL to send the Record Complete event to once the recording has ended. Accepts BXML, and may be a relative URL. This callback will not be sent if the recording ended due to the call hanging up. Defaults to None.
-
record_complete_method: 'recordCompleteMethod', # Optional [String]: The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default value is POST. Defaults to None.
-
record_complete_fallback_url: 'recordCompleteFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Record Complete callback delivery in case recordCompleteUrl fails to respond. Defaults to None.
-
record_complete_fallback_method: 'recordCompleteFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Record Complete callback to recordCompleteFallbackUrl. GET or POST. Default value is POST. Defaults to None.
-
recording_available_url: 'recordingAvailableUrl', # Optional [String]: URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
-
recording_available_method: 'recordingAvailableMethod', # Optional [String]: The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. Defaults to None.
-
transcribe: 'transcribe', # Optional [Boolean]: A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None.
-
transcription_available_url: 'transcriptionAvailableUrl', # Optional [String]: URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
-
transcription_available_method: 'transcriptionAvailableMethod', # Optional [String]: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
-
terminating_digits: 'terminatingDigits', # Optional [String]: When pressed, this digit will terminate the recording. Default value is “#”. This feature can be disabled with "". Defaults to None.
-
max_duration: 'maxDuration', # Optional [Number]: Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None.
-
silence_timeout: 'silenceTimeout', # Optional [Number]: Length of silence after which to end the recording (in seconds). Max is equivalent to the maximum maxDuration value. Default value is 0, which means no timeout. Defaults to None.
-
file_format: 'fileFormat', # Optional [String]: The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Redirect < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('Redirect', nil, attributes)
-
-
@attribute_map = {
-
3
redirect_url: 'redirectUrl', # [String]: URL to request new BXML from. A Redirect event will be sent to this endpoint. May be a relative URL. Defaults to None.
-
redirect_method: 'redirectMethod', # Optional [String]: The HTTP method to use for the request to redirectUrl. GET or POST. Defaults to None.
-
redirect_fallback_url: 'redirectFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Redirect callback delivery in case redirectUrl fails to respond. Defaults to None.
-
redirect_fallback_method: 'redirectFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Redirect callback to redirectFallbackUrl. GET or POST. Default value is POST. Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to redirectUrl. Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to redirectUrl. Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to redirectFallbackUrl. Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to redirectFallbackUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class ResumeRecording < Bandwidth::Bxml::Verb
-
# Initializer
-
1
def initialize
-
2
super('ResumeRecording', nil, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Ring < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('Ring', nil, attributes)
-
-
@attribute_map = {
-
3
duration: 'duration', # Optional [Number]: How many seconds to play ringing on the call. Default value is 5. Range: decimal values between 0.1 - 86400.
-
answer_call: 'answerCall', # Optional [Boolean]: A boolean indicating whether or not to answer the call when Ring is executed on an unanswered incoming call. Default value is 'true'.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class SendDtmf < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param digits [String] String containing the DTMF characters to be sent in a call. Allows a maximum of 50 characters. The digits will be sent one-by-one with a marginal delay.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(digits, attributes = {})
-
3
super('SendDtmf', digits, attributes)
-
-
@attribute_map = {
-
3
tone_duration: 'toneDuration', # Optional [Number]: The length (in milliseconds) of each DTMF tone. Default value is 200. Range: decimal values between 50 - 5000.
-
tone_interval: 'toneInterval', # Optional [Number]: The duration of silence (in milliseconds) following each DTMF tone. Default value is 400. Range: decimal values between 50 - 5000.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class SipUri < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param uri [String] A SIP URI to transfer the call to (e.g. sip:user@server.com)
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(uri, attributes = {})
-
4
super('SipUri', uri, attributes)
-
-
@attribute_map = {
-
4
uui: 'uui', # Optional [String]: The value of the User-To-User header to send within the initial INVITE. Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. Defaults to None.
-
transfer_answer_url: 'transferAnswerUrl', # Optional [String]: URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged. May be a relative URL. Defaults to None.
-
transfer_answer_method: 'transferAnswerMethod', # Optional [String]: The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. Defaults to None.
-
transfer_answer_fallback_url: 'transferAnswerFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Transfer Answer callback delivery in case transferAnswerUrl fails to respond. Defaults to None.
-
transfer_answer_fallback_method: 'transferAnswerFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Transfer Answer callback to transferAnswerFallbackUrl. GET or POST. Default value is POST. Defaults to None.
-
transfer_disconnect_url: 'transferDisconnectUrl', # Optional [String]: URL, if any, to send the Transfer Disconnect event to. This event will be sent regardless of how the transfer ends and may not be responded to with BXML. May be a relative URL. Defaults to None.
-
transfer_disconnect_method: 'transferDisconnectMethod', # Optional [String]: The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. Defaults to Defaults to Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class SpeakSentence < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param text [String] The text to speak. Cannot be blank. Can be a mixture of plain text and SSML tags.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(text, attributes = {})
-
4
super('SpeakSentence', text, attributes)
-
-
@attribute_map = {
-
4
voice: 'voice', # Optional [String]: Selects the voice of the speaker. If the voice attribute is present, gender and locale are ignored. You can find a list of supported voices here: https://dev.bandwidth.com/docs/voice/bxml/speakSentence/#supported-voices
-
gender: 'gender', # Optional [String]: Selects the gender of the speaker. Valid values are "male" or "female". Default "female".
-
locale: 'locale', # Optional [String]: Selects the locale of the speaker. Default "en_US"
-
}
-
end
-
-
# Return BXML representaion of this response
-
# @return [String] The XML response in string format.
-
1
def to_bxml
-
2
bxml = Ox.dump(generate_xml)
-
4
bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>') }
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StartGather < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('StartGather', nil, attributes)
-
-
@attribute_map = {
-
3
dtmf_url: 'dtmfUrl', # [String]: URL to send the DTMF event to. May be a relative URL.
-
dtmf_method: 'dtmfMethod', # Optional [String]: The HTTP method to use for the request to dtmfUrl. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to dtmfUrl. Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to dtmfUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StartRecording < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('StartRecording', nil, attributes)
-
-
@attribute_map = {
-
3
recording_available_url: 'recordingAvailableUrl', # Optional [String]: URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
-
recording_available_method: 'recordingAvailableMethod', # Optional [String]: The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST.
-
transcribe: 'transcribe', # Optional [Boolean]: A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None.
-
transcription_available_url: 'transcriptionAvailableUrl', # Optional [String]: URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
-
transcription_available_method: 'transcriptionAvailableMethod', # Optional [String]: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
-
file_format: 'fileFormat', # Optional [String]: The audio format that the recording will be saved as: mp3 or wav. Default value is wav.
-
multi_channel: 'multiChannel', # Optional [Boolean]: A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StartStream < Bandwidth::Bxml::NestableVerb
-
# Initializer
-
# @param stream_params [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested stream params are: StreamParam. You may specify up to 12 <StreamParam/> elements nested within a <StartStream> tag.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(stream_params = [], attributes = {})
-
6
super('StartStream', nil, stream_params, attributes)
-
-
@attribute_map = {
-
6
name: 'name', # Optional [String]: A name to refer to this stream by. Used when sending <StopStream>. If not provided, it will default to the generated stream id as sent in the Media Stream Started webhook.
-
mode: 'mode', # Optional [String]: The mode to use for the stream. unidirectional or bidirectional. Specifies whether the audio being streamed over the WebSocket is bidirectional (the service can both read and write audio over the WebSocket) or unidirectional (one-way, read-only). Default is unidirectional.
-
tracks: 'tracks', # Optional [String]: The part of the call to send a stream from. inbound, outbound or both. Default is inbound.
-
destination: 'destination', # Optional [String]: A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL as base64-encoded PCMU/G711 audio.
-
destination_username: 'destination_username', # Optional [String]: The username to send in the `Authorization` header of the initial websocket connection to the `destination` URL.
-
destination_password: 'destination_password', # Optional [String]: The password to send in the `Authorization` header of the initial websocket connection to the `destination` URL.
-
stream_event_url: 'streamEventUrl', # Optional [String]: URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL.
-
stream_event_method: 'streamEventMethod', # Optional [String]: The HTTP method to use for the request to streamEventUrl. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
-
password: 'password', # Optional [String]: The password to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
-
}
-
end
-
-
# Add stream param or params to the nested verbs array
-
# @param stream_params [StreamParam] or [Array<StreamParam>] Verb or verbs to add to the array.
-
1
def add_stream_params(stream_params)
-
2
@nested_verbs.push(*stream_params)
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StartTranscription < Bandwidth::Bxml::NestableVerb
-
# Initializer
-
# @param custom_params [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested custom params are: CustomParam. You may specify up to 12 <CustomParam/> elements nested within a <StartTranscription> tag.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(custom_params = [], attributes = {})
-
6
super('StartTranscription', nil, custom_params, attributes)
-
-
@attribute_map = {
-
6
name: 'name', # Optional [String]: A name to refer to this transcription by. Used when sending <StopTranscription>. If not provided, it will default to the generated transcription id as sent in the Real-Time Transcription Started webhook.
-
tracks: 'tracks', # Optional [String]: The part of the call to send a transcription from. inbound, outbound or both. Default is inbound.
-
transcription_event_url: 'transcriptionEventUrl', # Optional [String]: URL to send the associated Webhook events to during this real-time transcription's lifetime. Does not accept BXML. May be a relative URL.
-
transcription_event_method: 'transcriptionEventMethod', # Optional [String]: The HTTP method to use for the request to transcriptionEventUrl. GET or POST. Default value is POST.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
-
password: 'password', # Optional [String]: The password to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
-
destination: 'destination', # Optional [String]: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
-
stabilized: 'stabilized', # Optional [Boolean]: Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true.
-
}
-
end
-
-
# Add custom param or params to the nested verbs array
-
# @param custom_params [CustomParam] or [Array<CustomParam>] Verb or verbs to add to the array.
-
1
def add_custom_params(custom_params)
-
2
@nested_verbs.push(*custom_params)
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StopGather < Bandwidth::Bxml::Verb
-
# Initializer
-
1
def initialize
-
2
super('StopGather', nil, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StopRecording < Bandwidth::Bxml::Verb
-
# Initializer
-
1
def initialize
-
2
super('StopRecording', nil, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StopStream < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('StopStream', nil, attributes)
-
-
@attribute_map = {
-
3
name: 'name', # [String]: The name of the stream to stop. This is either the user selected name when sending the <StartStream> verb, or the system generated name returned in the Media Stream Started webhook if <StartStream> was sent with no name attribute.
-
wait: 'wait' # Optional [Boolean]: If true, the BXML interpreter will wait for the stream to stop before processing the next verb.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StopTranscription < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
3
super('StopTranscription', nil, attributes)
-
-
@attribute_map = {
-
3
name: 'name' # [String]: The name of the real-time transcription to stop. This is either the user selected name when sending the <StartTranscription> verb, or the system generated name returned in the Real-Time Transcription Started webhook if <StartTranscription> was sent with no name attribute. If no name is specified, then all active call transcriptions will be stopped.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class StreamParam < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(attributes = {})
-
7
super('StreamParam', nil, attributes)
-
-
@attribute_map = {
-
7
name: 'name', # [String]: The name of this parameter, up to 256 characters.
-
value: 'value', # [String]: The value of this parameter, up to 2048 characters.
-
}
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Tag < Bandwidth::Bxml::Verb
-
# Initializer
-
# @param content [String] Custom tag value. Defaults to nil.
-
1
def initialize(content = nil)
-
2
super('Tag', content, {})
-
end
-
end
-
end
-
end
-
1
module Bandwidth
-
1
module Bxml
-
1
class Transfer < Bandwidth::Bxml::NestableVerb
-
# Initializer
-
# @param transfer_to [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested transfer verbs are: PhoneNumber, SipUri.
-
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
-
1
def initialize(transfer_to = [], attributes = {})
-
6
super('Transfer', nil, transfer_to, attributes)
-
-
@attribute_map = {
-
6
transfer_caller_id: 'transferCallerId', # Optional [String]: The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555) or be one of the following strings Restricted, Anonymous, Private, or Unavailable. Leave as default to pass along the number of the remote party. Defaults to None.
-
transfer_caller_display_name: 'transferCallerDisplayName', # Optional [String]: The caller display name to use when the call is transferred. May not exceed 256 characters nor contain control characters such as new lines. Defaults to None.
-
call_timeout: 'callTimeout', # Optional [Number]: The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Range: decimal values between 1 - 300. Default value is 30 seconds. Defaults to None.
-
transfer_complete_url: 'transferCompleteUrl', # Optional [String]: URL to send the Transfer Complete event to and request new BXML. Optional but recommended. See below for further details. May be a relative URL. Defaults to None.
-
transfer_complete_method: 'transferCompleteMethod', # Optional [String]: The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Defaults to None.
-
transfer_complete_fallback_url: 'transferCompleteFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Transfer Complete callback delivery in case transferCompleteUrl fails to respond. Defaults to None.
-
transfer_complete_fallback_method: 'transferCompleteFallbackMethod', # Optional [String]: The HTTP method to use to deliver the Transfer Complete callback to transferCompleteFallbackUrl. GET or POST. Default value is POST. Defaults to None.
-
username: 'username', # Optional [String]: The username to send in the HTTP request to transferCompleteUrl. Defaults to None.
-
password: 'password', # Optional [String]: The password to send in the HTTP request to transferCompleteUrl. Defaults to None.
-
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to transferCompleteFallbackUrl. Defaults to None.
-
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to transferCompleteFallbackUrl. Defaults to None.
-
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None.
-
diversion_treatment: 'diversionTreatment', # Optional [String]: Can be any of the following: - none: No diversion headers are sent on the outbound leg of the transferred call. - propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. - stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. If diversionTreatment is not specified, no diversion header will be included for the transfer even if one came with the inbound call. Defaults to None.
-
diversion_reason: 'diversionReason', # Optional [String]: Can be any of the following values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. This parameter is considered only when diversionTreatment is set to stack. Defaults to None.
-
}
-
end
-
-
# Add transfer recipient or recipients to the nested verbs array
-
# @param recipients [PhoneNumber] or [SipUri] or [Array<PhoneNumber || SipUri>] Verb or verbs to add to the array.
-
1
def add_transfer_recipients(recipients)
-
2
@nested_verbs.push(*recipients)
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallDirectionEnum
-
1
INBOUND = 'inbound'.freeze
-
1
OUTBOUND = 'outbound'.freeze
-
-
1
def self.all_vars
-
29
@all_vars ||= [INBOUND, OUTBOUND].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
24
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
24
return value if CallDirectionEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CallDirectionEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallRecordingMetadata < ApiModelBase
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
1
attr_accessor :direction
-
-
# Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
-
1
attr_accessor :channels
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
1
attr_accessor :file_format
-
-
# The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :status
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
1
attr_accessor :transcription
-
-
# A name to identify this recording.
-
1
attr_accessor :recording_name
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
239
{
-
:'application_id' => :'applicationId',
-
:'account_id' => :'accountId',
-
:'call_id' => :'callId',
-
:'parent_call_id' => :'parentCallId',
-
:'recording_id' => :'recordingId',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo',
-
:'duration' => :'duration',
-
:'direction' => :'direction',
-
:'channels' => :'channels',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'file_format' => :'fileFormat',
-
:'status' => :'status',
-
:'media_url' => :'mediaUrl',
-
:'transcription' => :'transcription',
-
:'recording_name' => :'recordingName'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'application_id' => :'String',
-
:'account_id' => :'String',
-
:'call_id' => :'String',
-
:'parent_call_id' => :'String',
-
:'recording_id' => :'String',
-
:'to' => :'String',
-
:'from' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String',
-
:'duration' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'channels' => :'Integer',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'file_format' => :'FileFormatEnum',
-
:'status' => :'String',
-
:'media_url' => :'String',
-
:'transcription' => :'RecordingTranscriptionMetadata',
-
:'recording_name' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
:'transcription',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallRecordingMetadata` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
114
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
113
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'application_id')
-
6
self.application_id = attributes[:'application_id']
-
end
-
-
8
if attributes.key?(:'account_id')
-
6
self.account_id = attributes[:'account_id']
-
end
-
-
8
if attributes.key?(:'call_id')
-
6
self.call_id = attributes[:'call_id']
-
end
-
-
8
if attributes.key?(:'parent_call_id')
-
6
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
8
if attributes.key?(:'recording_id')
-
6
self.recording_id = attributes[:'recording_id']
-
end
-
-
8
if attributes.key?(:'to')
-
6
self.to = attributes[:'to']
-
end
-
-
8
if attributes.key?(:'from')
-
6
self.from = attributes[:'from']
-
end
-
-
8
if attributes.key?(:'transfer_caller_id')
-
6
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
8
if attributes.key?(:'transfer_to')
-
6
self.transfer_to = attributes[:'transfer_to']
-
end
-
-
8
if attributes.key?(:'duration')
-
6
self.duration = attributes[:'duration']
-
end
-
-
8
if attributes.key?(:'direction')
-
6
self.direction = attributes[:'direction']
-
end
-
-
8
if attributes.key?(:'channels')
-
6
self.channels = attributes[:'channels']
-
end
-
-
8
if attributes.key?(:'start_time')
-
6
self.start_time = attributes[:'start_time']
-
end
-
-
8
if attributes.key?(:'end_time')
-
6
self.end_time = attributes[:'end_time']
-
end
-
-
8
if attributes.key?(:'file_format')
-
6
self.file_format = attributes[:'file_format']
-
end
-
-
8
if attributes.key?(:'status')
-
6
self.status = attributes[:'status']
-
end
-
-
8
if attributes.key?(:'media_url')
-
6
self.media_url = attributes[:'media_url']
-
end
-
-
8
if attributes.key?(:'transcription')
-
5
self.transcription = attributes[:'transcription']
-
end
-
-
8
if attributes.key?(:'recording_name')
-
6
self.recording_name = attributes[:'recording_name']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
application_id == o.application_id &&
-
account_id == o.account_id &&
-
call_id == o.call_id &&
-
parent_call_id == o.parent_call_id &&
-
recording_id == o.recording_id &&
-
to == o.to &&
-
from == o.from &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to &&
-
duration == o.duration &&
-
direction == o.direction &&
-
channels == o.channels &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
file_format == o.file_format &&
-
status == o.status &&
-
media_url == o.media_url &&
-
transcription == o.transcription &&
-
recording_name == o.recording_name
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[application_id, account_id, call_id, parent_call_id, recording_id, to, from, transfer_caller_id, transfer_to, duration, direction, channels, start_time, end_time, file_format, status, media_url, transcription, recording_name].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
57
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
57
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
57
elsif !attributes[attribute_map[key]].nil?
-
56
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
38
value = self.send(attr)
-
38
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
38
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallState < ApiModelBase
-
# The application id associated with the call.
-
1
attr_accessor :application_id
-
-
# The account id associated with the call.
-
1
attr_accessor :account_id
-
-
# The programmable voice API call ID.
-
1
attr_accessor :call_id
-
-
# The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer).
-
1
attr_accessor :parent_call_id
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI.
-
1
attr_accessor :to
-
-
# The phone number that made the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
1
attr_accessor :direction
-
-
# The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :state
-
-
# For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken).
-
1
attr_accessor :stir_shaken
-
-
# The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header.
-
1
attr_accessor :identity
-
-
# The time this call was placed in queue.
-
1
attr_accessor :enqueued_time
-
-
# The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue.
-
1
attr_accessor :start_time
-
-
# Populated once the call has been answered, with the time in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# Populated once the call has ended, with the time in ISO 8601 format.
-
1
attr_accessor :end_time
-
-
# | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future.
-
1
attr_accessor :disconnect_cause
-
-
# Populated only if the call ended with an error, with text explaining the reason.
-
1
attr_accessor :error_message
-
-
# Populated only if the call ended with an error, with a Bandwidth internal id that references the error event.
-
1
attr_accessor :error_id
-
-
# The last time the call had a state update, in ISO 8601 format.
-
1
attr_accessor :last_update
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
217
{
-
:'application_id' => :'applicationId',
-
:'account_id' => :'accountId',
-
:'call_id' => :'callId',
-
:'parent_call_id' => :'parentCallId',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'direction' => :'direction',
-
:'state' => :'state',
-
:'stir_shaken' => :'stirShaken',
-
:'identity' => :'identity',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'end_time' => :'endTime',
-
:'disconnect_cause' => :'disconnectCause',
-
:'error_message' => :'errorMessage',
-
:'error_id' => :'errorId',
-
:'last_update' => :'lastUpdate'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'application_id' => :'String',
-
:'account_id' => :'String',
-
:'call_id' => :'String',
-
:'parent_call_id' => :'String',
-
:'to' => :'String',
-
:'from' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'state' => :'String',
-
:'stir_shaken' => :'Hash<String, String>',
-
:'identity' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'end_time' => :'Time',
-
:'disconnect_cause' => :'String',
-
:'error_message' => :'String',
-
:'error_id' => :'String',
-
:'last_update' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
:'parent_call_id',
-
:'stir_shaken',
-
:'identity',
-
:'enqueued_time',
-
:'start_time',
-
:'answer_time',
-
:'end_time',
-
:'disconnect_cause',
-
:'error_message',
-
:'error_id',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallState` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
109
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallState`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
108
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'application_id')
-
6
self.application_id = attributes[:'application_id']
-
end
-
-
8
if attributes.key?(:'account_id')
-
6
self.account_id = attributes[:'account_id']
-
end
-
-
8
if attributes.key?(:'call_id')
-
6
self.call_id = attributes[:'call_id']
-
end
-
-
8
if attributes.key?(:'parent_call_id')
-
6
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
8
if attributes.key?(:'to')
-
6
self.to = attributes[:'to']
-
end
-
-
8
if attributes.key?(:'from')
-
6
self.from = attributes[:'from']
-
end
-
-
8
if attributes.key?(:'direction')
-
6
self.direction = attributes[:'direction']
-
end
-
-
8
if attributes.key?(:'state')
-
6
self.state = attributes[:'state']
-
end
-
-
8
if attributes.key?(:'stir_shaken')
-
6
if (value = attributes[:'stir_shaken']).is_a?(Hash)
-
6
self.stir_shaken = value
-
end
-
end
-
-
8
if attributes.key?(:'identity')
-
6
self.identity = attributes[:'identity']
-
end
-
-
8
if attributes.key?(:'enqueued_time')
-
6
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
8
if attributes.key?(:'start_time')
-
6
self.start_time = attributes[:'start_time']
-
end
-
-
8
if attributes.key?(:'answer_time')
-
6
self.answer_time = attributes[:'answer_time']
-
end
-
-
8
if attributes.key?(:'end_time')
-
6
self.end_time = attributes[:'end_time']
-
end
-
-
8
if attributes.key?(:'disconnect_cause')
-
6
self.disconnect_cause = attributes[:'disconnect_cause']
-
end
-
-
8
if attributes.key?(:'error_message')
-
6
self.error_message = attributes[:'error_message']
-
end
-
-
8
if attributes.key?(:'error_id')
-
6
self.error_id = attributes[:'error_id']
-
end
-
-
8
if attributes.key?(:'last_update')
-
6
self.last_update = attributes[:'last_update']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
application_id == o.application_id &&
-
account_id == o.account_id &&
-
call_id == o.call_id &&
-
parent_call_id == o.parent_call_id &&
-
to == o.to &&
-
from == o.from &&
-
direction == o.direction &&
-
state == o.state &&
-
stir_shaken == o.stir_shaken &&
-
identity == o.identity &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
end_time == o.end_time &&
-
disconnect_cause == o.disconnect_cause &&
-
error_message == o.error_message &&
-
error_id == o.error_id &&
-
last_update == o.last_update
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[application_id, account_id, call_id, parent_call_id, to, from, direction, state, stir_shaken, identity, enqueued_time, start_time, answer_time, end_time, disconnect_cause, error_message, error_id, last_update].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
54
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = nil
-
48
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
48
elsif !attributes[attribute_map[key]].nil?
-
48
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
36
value = self.send(attr)
-
36
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
36
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallStateEnum
-
1
ACTIVE = 'active'.freeze
-
1
COMPLETED = 'completed'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [ACTIVE, COMPLETED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if CallStateEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CallStateEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallTranscription < ApiModelBase
-
1
attr_accessor :detected_language
-
-
1
attr_accessor :track
-
-
# The transcription itself.
-
1
attr_accessor :transcript
-
-
# How confident the transcription engine was in transcribing the associated audio (from `0` to `1`).
-
1
attr_accessor :confidence
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
69
{
-
:'detected_language' => :'detectedLanguage',
-
:'track' => :'track',
-
:'transcript' => :'transcript',
-
:'confidence' => :'confidence'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
16
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'detected_language' => :'CallTranscriptionDetectedLanguageEnum',
-
:'track' => :'CallTranscriptionTrackEnum',
-
:'transcript' => :'String',
-
:'confidence' => :'Float'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
16
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscription` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
15
acceptable_attribute_map = self.class.acceptable_attribute_map
-
15
attributes = attributes.each_with_object({}) { |(k, v), h|
-
40
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
39
h[k.to_sym] = v
-
}
-
-
14
if attributes.key?(:'detected_language')
-
9
self.detected_language = attributes[:'detected_language']
-
end
-
-
14
if attributes.key?(:'track')
-
9
self.track = attributes[:'track']
-
end
-
-
14
if attributes.key?(:'transcript')
-
9
self.transcript = attributes[:'transcript']
-
end
-
-
14
if attributes.key?(:'confidence')
-
12
self.confidence = attributes[:'confidence']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@confidence.nil? && @confidence > 1
-
invalid_properties.push('invalid value for "confidence", must be smaller than or equal to 1.')
-
end
-
-
if !@confidence.nil? && @confidence < 0
-
invalid_properties.push('invalid value for "confidence", must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@confidence.nil? && @confidence > 1
-
return false if !@confidence.nil? && @confidence < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] confidence Value to be assigned
-
1
def confidence=(confidence)
-
12
if confidence.nil?
-
1
fail ArgumentError, 'confidence cannot be nil'
-
end
-
-
11
if confidence > 1
-
1
fail ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.'
-
end
-
-
10
if confidence < 0
-
1
fail ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.'
-
end
-
-
9
@confidence = confidence
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
detected_language == o.detected_language &&
-
track == o.track &&
-
transcript == o.transcript &&
-
confidence == o.confidence
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[detected_language, track, transcript, confidence].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
12
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
12
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
12
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallTranscriptionDetectedLanguageEnum
-
1
EN_US = 'en-US'.freeze
-
1
ES_US = 'es-US'.freeze
-
1
FR_FR = 'fr-FR'.freeze
-
-
1
def self.all_vars
-
9
@all_vars ||= [EN_US, ES_US, FR_FR].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if CallTranscriptionDetectedLanguageEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CallTranscriptionDetectedLanguageEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallTranscriptionMetadata < ApiModelBase
-
# The programmable voice API transcription ID.
-
1
attr_accessor :transcription_id
-
-
# The programmable voice API transcription name. This name could be provided by the user when creating the transcription.
-
1
attr_accessor :transcription_name
-
-
# A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) endpoint.
-
1
attr_accessor :transcription_url
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'transcription_id' => :'transcriptionId',
-
:'transcription_name' => :'transcriptionName',
-
:'transcription_url' => :'transcriptionUrl'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'transcription_id' => :'String',
-
:'transcription_name' => :'String',
-
:'transcription_url' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscriptionMetadata` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'transcription_id')
-
5
self.transcription_id = attributes[:'transcription_id']
-
end
-
-
7
if attributes.key?(:'transcription_name')
-
5
self.transcription_name = attributes[:'transcription_name']
-
end
-
-
7
if attributes.key?(:'transcription_url')
-
5
self.transcription_url = attributes[:'transcription_url']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
transcription_id == o.transcription_id &&
-
transcription_name == o.transcription_name &&
-
transcription_url == o.transcription_url
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[transcription_id, transcription_name, transcription_url].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallTranscriptionResponse < ApiModelBase
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The programmable voice API transcription ID.
-
1
attr_accessor :transcription_id
-
-
1
attr_accessor :tracks
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
44
{
-
:'account_id' => :'accountId',
-
:'call_id' => :'callId',
-
:'transcription_id' => :'transcriptionId',
-
:'tracks' => :'tracks'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'account_id' => :'String',
-
:'call_id' => :'String',
-
:'transcription_id' => :'String',
-
:'tracks' => :'Array<CallTranscription>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CallTranscriptionResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'account_id')
-
5
self.account_id = attributes[:'account_id']
-
end
-
-
7
if attributes.key?(:'call_id')
-
5
self.call_id = attributes[:'call_id']
-
end
-
-
7
if attributes.key?(:'transcription_id')
-
5
self.transcription_id = attributes[:'transcription_id']
-
end
-
-
7
if attributes.key?(:'tracks')
-
5
if (value = attributes[:'tracks']).is_a?(Array)
-
5
self.tracks = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
call_id == o.call_id &&
-
transcription_id == o.transcription_id &&
-
tracks == o.tracks
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, call_id, transcription_id, tracks].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallTranscriptionTrackEnum
-
1
INBOUND = 'inbound'.freeze
-
1
OUTBOUND = 'outbound'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [INBOUND, OUTBOUND].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if CallTranscriptionTrackEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CallTranscriptionTrackEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Callbacks are divided into two types based on direction of the related message: - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM message. - `inboundCallback` indicates an inbound MO message or a multichannel message client's response to a suggestion or location request.
-
1
module Callback
-
1
class << self
-
# List of class defined in oneOf (OpenAPI v3)
-
1
def openapi_one_of
-
2
[
-
:'InboundCallback',
-
:'StatusCallback'
-
]
-
end
-
-
# Discriminator's property name (OpenAPI v3)
-
1
def openapi_discriminator_name
-
11
:'type'
-
end
-
-
# Discriminator's mapping (OpenAPI v3)
-
1
def openapi_discriminator_mapping
-
13
{
-
:'message-delivered' => :'StatusCallback',
-
:'message-failed' => :'StatusCallback',
-
:'message-read' => :'StatusCallback',
-
:'message-received' => :'InboundCallback',
-
:'message-sending' => :'StatusCallback',
-
:'message-sent' => :'StatusCallback',
-
:'request-location-response' => :'InboundCallback',
-
:'suggestion-response' => :'InboundCallback'
-
}
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of oneOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
10
discriminator_value = data[openapi_discriminator_name]
-
10
return nil if discriminator_value.nil?
-
-
9
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
-
9
return nil unless klass
-
-
8
Bandwidth.const_get(klass).build_from_hash(data)
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CallbackMethodEnum
-
1
GET = 'GET'.freeze
-
1
POST = 'POST'.freeze
-
-
1
def self.all_vars
-
24
@all_vars ||= [GET, POST].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
18
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
18
return value if CallbackMethodEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CallbackMethodEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CardWidthEnum
-
1
SMALL = 'SMALL'.freeze
-
1
MEDIUM = 'MEDIUM'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [SMALL, MEDIUM].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if CardWidthEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CardWidthEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CodeRequest < ApiModelBase
-
# The phone number to send the mfa code to.
-
1
attr_accessor :to
-
-
# The application phone number, the sender of the mfa code.
-
1
attr_accessor :from
-
-
# The application unique ID, obtained from Bandwidth.
-
1
attr_accessor :application_id
-
-
# An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\".
-
1
attr_accessor :scope
-
-
# The message format of the mfa code. There are three values that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\" must be supplied. As the name would suggest, code will be replace with the actual mfa code. Name is replaced with the application name, configured during provisioning of mfa. The scope value is the same value sent during the call and partitioned by the server.
-
1
attr_accessor :message
-
-
# The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively.
-
1
attr_accessor :digits
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
53
{
-
:'to' => :'to',
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'scope' => :'scope',
-
:'message' => :'message',
-
:'digits' => :'digits'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
24
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'to' => :'String',
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'scope' => :'String',
-
:'message' => :'String',
-
:'digits' => :'Integer'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
24
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CodeRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
23
acceptable_attribute_map = self.class.acceptable_attribute_map
-
23
attributes = attributes.each_with_object({}) { |(k, v), h|
-
117
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CodeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
116
h[k.to_sym] = v
-
}
-
-
22
if attributes.key?(:'to')
-
22
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
20
if attributes.key?(:'from')
-
20
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
17
if attributes.key?(:'application_id')
-
17
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
15
if attributes.key?(:'scope')
-
6
self.scope = attributes[:'scope']
-
end
-
-
13
if attributes.key?(:'message')
-
13
self.message = attributes[:'message']
-
else
-
self.message = nil
-
end
-
-
11
if attributes.key?(:'digits')
-
11
self.digits = attributes[:'digits']
-
else
-
self.digits = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
if @to !~ pattern
-
invalid_properties.push("invalid value for \"to\", must conform to the pattern #{pattern}.")
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @from.to_s.length > 32
-
invalid_properties.push('invalid value for "from", the character length must be smaller than or equal to 32.')
-
end
-
-
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
if @from !~ pattern
-
invalid_properties.push("invalid value for \"from\", must conform to the pattern #{pattern}.")
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @application_id.to_s.length > 50
-
invalid_properties.push('invalid value for "application_id", the character length must be smaller than or equal to 50.')
-
end
-
-
if !@scope.nil? && @scope.to_s.length > 25
-
invalid_properties.push('invalid value for "scope", the character length must be smaller than or equal to 25.')
-
end
-
-
if @message.nil?
-
invalid_properties.push('invalid value for "message", message cannot be nil.')
-
end
-
-
if @message.to_s.length > 2048
-
invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 2048.')
-
end
-
-
if @digits.nil?
-
invalid_properties.push('invalid value for "digits", digits cannot be nil.')
-
end
-
-
if @digits > 8
-
invalid_properties.push('invalid value for "digits", must be smaller than or equal to 8.')
-
end
-
-
if @digits < 4
-
invalid_properties.push('invalid value for "digits", must be greater than or equal to 4.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @to.nil?
-
return false if @to !~ Regexp.new(/^\+[1-9]\d{1,14}$/)
-
return false if @from.nil?
-
return false if @from.to_s.length > 32
-
return false if @from !~ Regexp.new(/^\+[1-9]\d{1,14}$/)
-
return false if @application_id.nil?
-
return false if @application_id.to_s.length > 50
-
return false if !@scope.nil? && @scope.to_s.length > 25
-
return false if @message.nil?
-
return false if @message.to_s.length > 2048
-
return false if @digits.nil?
-
return false if @digits > 8
-
return false if @digits < 4
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
22
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
21
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
21
if to !~ pattern
-
1
fail ArgumentError, "invalid value for \"to\", must conform to the pattern #{pattern}."
-
end
-
-
20
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
20
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
19
if from.to_s.length > 32
-
1
fail ArgumentError, 'invalid value for "from", the character length must be smaller than or equal to 32.'
-
end
-
-
18
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
18
if from !~ pattern
-
1
fail ArgumentError, "invalid value for \"from\", must conform to the pattern #{pattern}."
-
end
-
-
17
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
17
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
16
if application_id.to_s.length > 50
-
1
fail ArgumentError, 'invalid value for "application_id", the character length must be smaller than or equal to 50.'
-
end
-
-
15
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] scope Value to be assigned
-
1
def scope=(scope)
-
6
if scope.nil?
-
1
fail ArgumentError, 'scope cannot be nil'
-
end
-
-
5
if scope.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "scope", the character length must be smaller than or equal to 25.'
-
end
-
-
4
@scope = scope
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message Value to be assigned
-
1
def message=(message)
-
13
if message.nil?
-
1
fail ArgumentError, 'message cannot be nil'
-
end
-
-
12
if message.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 2048.'
-
end
-
-
11
@message = message
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] digits Value to be assigned
-
1
def digits=(digits)
-
11
if digits.nil?
-
1
fail ArgumentError, 'digits cannot be nil'
-
end
-
-
10
if digits > 8
-
1
fail ArgumentError, 'invalid value for "digits", must be smaller than or equal to 8.'
-
end
-
-
9
if digits < 4
-
1
fail ArgumentError, 'invalid value for "digits", must be greater than or equal to 4.'
-
end
-
-
8
@digits = digits
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
to == o.to &&
-
from == o.from &&
-
application_id == o.application_id &&
-
scope == o.scope &&
-
message == o.message &&
-
digits == o.digits
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[to, from, application_id, scope, message, digits].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
22
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CompletedLookupStatusEnum
-
1
COMPLETE = 'COMPLETE'.freeze
-
1
PARTIAL_COMPLETE = 'PARTIAL_COMPLETE'.freeze
-
1
FAILED = 'FAILED'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [COMPLETE, PARTIAL_COMPLETE, FAILED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if CompletedLookupStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #CompletedLookupStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Conference < ApiModelBase
-
# The Bandwidth-generated conference ID.
-
1
attr_accessor :id
-
-
# The name of the conference, as specified by your application.
-
1
attr_accessor :name
-
-
# The time the conference was initiated, in ISO 8601 format.
-
1
attr_accessor :created_time
-
-
# The time the conference was terminated, in ISO 8601 format.
-
1
attr_accessor :completed_time
-
-
# The URL to send the conference-related events.
-
1
attr_accessor :conference_event_url
-
-
1
attr_accessor :conference_event_method
-
-
# The custom string attached to the conference that will be sent with callbacks.
-
1
attr_accessor :tag
-
-
# A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences).
-
1
attr_accessor :active_members
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
107
{
-
:'id' => :'id',
-
:'name' => :'name',
-
:'created_time' => :'createdTime',
-
:'completed_time' => :'completedTime',
-
:'conference_event_url' => :'conferenceEventUrl',
-
:'conference_event_method' => :'conferenceEventMethod',
-
:'tag' => :'tag',
-
:'active_members' => :'activeMembers'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'id' => :'String',
-
:'name' => :'String',
-
:'created_time' => :'Time',
-
:'completed_time' => :'Time',
-
:'conference_event_url' => :'String',
-
:'conference_event_method' => :'CallbackMethodEnum',
-
:'tag' => :'String',
-
:'active_members' => :'Array<ConferenceMember>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'completed_time',
-
:'conference_event_url',
-
:'conference_event_method',
-
:'tag',
-
:'active_members'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Conference` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
48
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Conference`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
47
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'id')
-
6
self.id = attributes[:'id']
-
end
-
-
8
if attributes.key?(:'name')
-
6
self.name = attributes[:'name']
-
end
-
-
8
if attributes.key?(:'created_time')
-
6
self.created_time = attributes[:'created_time']
-
end
-
-
8
if attributes.key?(:'completed_time')
-
6
self.completed_time = attributes[:'completed_time']
-
end
-
-
8
if attributes.key?(:'conference_event_url')
-
6
self.conference_event_url = attributes[:'conference_event_url']
-
end
-
-
8
if attributes.key?(:'conference_event_method')
-
6
self.conference_event_method = attributes[:'conference_event_method']
-
else
-
2
self.conference_event_method = 'POST'
-
end
-
-
8
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
8
if attributes.key?(:'active_members')
-
5
if (value = attributes[:'active_members']).is_a?(Array)
-
5
self.active_members = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
name == o.name &&
-
created_time == o.created_time &&
-
completed_time == o.completed_time &&
-
conference_event_url == o.conference_event_url &&
-
conference_event_method == o.conference_event_method &&
-
tag == o.tag &&
-
active_members == o.active_members
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, name, created_time, completed_time, conference_event_url, conference_event_method, tag, active_members].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
24
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
24
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
21
elsif !attributes[attribute_map[key]].nil?
-
21
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Completed event is fired when the last member leaves the conference. The response to this event may not contain BXML.
-
1
class ConferenceCompletedCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceCompletedCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceCompletedCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Created event is fired whenever a new conference that specified a callbackUrl is created. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference.
-
1
class ConferenceCreatedCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceCreatedCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceCreatedCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ConferenceMember < ApiModelBase
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# A URL that may be used to retrieve information about or update the state of this conference member. This is the URL of this member's [Get Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/updateConferenceMember) endpoint.
-
1
attr_accessor :member_url
-
-
# Whether or not this member is currently muted. Members who are muted are still able to hear other participants. If used in a PUT request, updates this member's mute status. Has no effect if omitted.
-
1
attr_accessor :mute
-
-
# Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. If used in a PUT request, updates this member's hold status. Has no effect if omitted.
-
1
attr_accessor :hold
-
-
# If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join.
-
1
attr_accessor :call_ids_to_coach
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
107
{
-
:'call_id' => :'callId',
-
:'conference_id' => :'conferenceId',
-
:'member_url' => :'memberUrl',
-
:'mute' => :'mute',
-
:'hold' => :'hold',
-
:'call_ids_to_coach' => :'callIdsToCoach'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'call_id' => :'String',
-
:'conference_id' => :'String',
-
:'member_url' => :'String',
-
:'mute' => :'Boolean',
-
:'hold' => :'Boolean',
-
:'call_ids_to_coach' => :'Array<String>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
9
Set.new([
-
:'call_ids_to_coach'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceMember` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
45
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
44
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'call_id')
-
10
self.call_id = attributes[:'call_id']
-
end
-
-
12
if attributes.key?(:'conference_id')
-
10
self.conference_id = attributes[:'conference_id']
-
end
-
-
12
if attributes.key?(:'member_url')
-
6
self.member_url = attributes[:'member_url']
-
end
-
-
12
if attributes.key?(:'mute')
-
6
self.mute = attributes[:'mute']
-
end
-
-
12
if attributes.key?(:'hold')
-
6
self.hold = attributes[:'hold']
-
end
-
-
12
if attributes.key?(:'call_ids_to_coach')
-
6
if (value = attributes[:'call_ids_to_coach']).is_a?(Array)
-
6
self.call_ids_to_coach = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
call_id == o.call_id &&
-
conference_id == o.conference_id &&
-
member_url == o.member_url &&
-
mute == o.mute &&
-
hold == o.hold &&
-
call_ids_to_coach == o.call_ids_to_coach
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[call_id, conference_id, member_url, mute, hold, call_ids_to_coach].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
24
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
24
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
20
elsif !attributes[attribute_map[key]].nil?
-
17
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
8
is_nullable = self.class.openapi_nullable.include?(attr)
-
8
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Member Exit event is fired whenever a caller exits a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference.
-
1
class ConferenceMemberExitCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
43
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'call_id' => :'callId',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'call_id' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceMemberExitCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
33
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMemberExitCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
32
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
from == o.from &&
-
to == o.to &&
-
call_id == o.call_id &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, from, to, call_id, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Member Join event is fired whenever a caller joins a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference.
-
1
class ConferenceMemberJoinCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
43
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'call_id' => :'callId',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'call_id' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceMemberJoinCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
33
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMemberJoinCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
32
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
from == o.from &&
-
to == o.to &&
-
call_id == o.call_id &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, from, to, call_id, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Recording Available event is sent after a conference recording has been processed. It indicates that the recording is available for download.
-
1
class ConferenceRecordingAvailableCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
-
1
attr_accessor :channels
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
1
attr_accessor :file_format
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :status
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
67
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'account_id' => :'accountId',
-
:'recording_id' => :'recordingId',
-
:'channels' => :'channels',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'duration' => :'duration',
-
:'file_format' => :'fileFormat',
-
:'media_url' => :'mediaUrl',
-
:'tag' => :'tag',
-
:'status' => :'status'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'account_id' => :'String',
-
:'recording_id' => :'String',
-
:'channels' => :'Integer',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'duration' => :'String',
-
:'file_format' => :'FileFormatEnum',
-
:'media_url' => :'String',
-
:'tag' => :'String',
-
:'status' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceRecordingAvailableCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
57
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
56
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'recording_id')
-
4
self.recording_id = attributes[:'recording_id']
-
end
-
-
6
if attributes.key?(:'channels')
-
4
self.channels = attributes[:'channels']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'duration')
-
4
self.duration = attributes[:'duration']
-
end
-
-
6
if attributes.key?(:'file_format')
-
4
self.file_format = attributes[:'file_format']
-
end
-
-
6
if attributes.key?(:'media_url')
-
4
self.media_url = attributes[:'media_url']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'status')
-
4
self.status = attributes[:'status']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
account_id == o.account_id &&
-
recording_id == o.recording_id &&
-
channels == o.channels &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
duration == o.duration &&
-
file_format == o.file_format &&
-
media_url == o.media_url &&
-
tag == o.tag &&
-
status == o.status
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, account_id, recording_id, channels, start_time, end_time, duration, file_format, media_url, tag, status].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
14
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
14
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
14
elsif !attributes[attribute_map[key]].nil?
-
14
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ConferenceRecordingMetadata < ApiModelBase
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
# Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
-
1
attr_accessor :channels
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
1
attr_accessor :file_format
-
-
# The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :status
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
# A name to identify this recording.
-
1
attr_accessor :recording_name
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
157
{
-
:'account_id' => :'accountId',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'recording_id' => :'recordingId',
-
:'duration' => :'duration',
-
:'channels' => :'channels',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'file_format' => :'fileFormat',
-
:'status' => :'status',
-
:'media_url' => :'mediaUrl',
-
:'recording_name' => :'recordingName'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'account_id' => :'String',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'recording_id' => :'String',
-
:'duration' => :'String',
-
:'channels' => :'Integer',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'file_format' => :'FileFormatEnum',
-
:'status' => :'String',
-
:'media_url' => :'String',
-
:'recording_name' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceRecordingMetadata` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
73
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
72
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'account_id')
-
6
self.account_id = attributes[:'account_id']
-
end
-
-
8
if attributes.key?(:'conference_id')
-
6
self.conference_id = attributes[:'conference_id']
-
end
-
-
8
if attributes.key?(:'name')
-
6
self.name = attributes[:'name']
-
end
-
-
8
if attributes.key?(:'recording_id')
-
6
self.recording_id = attributes[:'recording_id']
-
end
-
-
8
if attributes.key?(:'duration')
-
6
self.duration = attributes[:'duration']
-
end
-
-
8
if attributes.key?(:'channels')
-
6
self.channels = attributes[:'channels']
-
end
-
-
8
if attributes.key?(:'start_time')
-
6
self.start_time = attributes[:'start_time']
-
end
-
-
8
if attributes.key?(:'end_time')
-
6
self.end_time = attributes[:'end_time']
-
end
-
-
8
if attributes.key?(:'file_format')
-
6
self.file_format = attributes[:'file_format']
-
end
-
-
8
if attributes.key?(:'status')
-
6
self.status = attributes[:'status']
-
end
-
-
8
if attributes.key?(:'media_url')
-
6
self.media_url = attributes[:'media_url']
-
end
-
-
8
if attributes.key?(:'recording_name')
-
6
self.recording_name = attributes[:'recording_name']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
recording_id == o.recording_id &&
-
duration == o.duration &&
-
channels == o.channels &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
file_format == o.file_format &&
-
status == o.status &&
-
media_url == o.media_url &&
-
recording_name == o.recording_name
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, conference_id, name, recording_id, duration, channels, start_time, end_time, file_format, status, media_url, recording_name].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
36
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
36
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
36
elsif !attributes[attribute_map[key]].nil?
-
36
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
24
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Conference Redirect event is fired whenever an existing conference is modified via a POST request made to the /conferences/{conferenceId} endpoint. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference.
-
1
class ConferenceRedirectCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The unique, Bandwidth-generated ID of the conference that was recorded
-
1
attr_accessor :conference_id
-
-
# The user-specified name of the conference that was recorded
-
1
attr_accessor :name
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'conference_id' => :'conferenceId',
-
:'name' => :'name',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'conference_id' => :'String',
-
:'name' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ConferenceRedirectCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'conference_id')
-
4
self.conference_id = attributes[:'conference_id']
-
end
-
-
6
if attributes.key?(:'name')
-
4
self.name = attributes[:'name']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
conference_id == o.conference_id &&
-
name == o.name &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, conference_id, name, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ConferenceStateEnum
-
1
ACTIVE = 'active'.freeze
-
1
COMPLETED = 'completed'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [ACTIVE, COMPLETED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if ConferenceStateEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #ConferenceStateEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Contact < ApiModelBase
-
# The first name of the business contact using the toll-free number.
-
1
attr_accessor :first_name
-
-
# The last name of the business contact using the toll-free number.
-
1
attr_accessor :last_name
-
-
1
attr_accessor :email
-
-
# Contact telephone number
-
1
attr_accessor :phone_number
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
128
{
-
:'first_name' => :'firstName',
-
:'last_name' => :'lastName',
-
:'email' => :'email',
-
:'phone_number' => :'phoneNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
27
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
6
{
-
:'first_name' => :'String',
-
:'last_name' => :'String',
-
:'email' => :'String',
-
:'phone_number' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
27
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Contact` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
26
acceptable_attribute_map = self.class.acceptable_attribute_map
-
26
attributes = attributes.each_with_object({}) { |(k, v), h|
-
101
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Contact`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
100
h[k.to_sym] = v
-
}
-
-
25
if attributes.key?(:'first_name')
-
25
self.first_name = attributes[:'first_name']
-
else
-
self.first_name = nil
-
end
-
-
22
if attributes.key?(:'last_name')
-
22
self.last_name = attributes[:'last_name']
-
else
-
self.last_name = nil
-
end
-
-
19
if attributes.key?(:'email')
-
19
self.email = attributes[:'email']
-
else
-
self.email = nil
-
end
-
-
16
if attributes.key?(:'phone_number')
-
16
self.phone_number = attributes[:'phone_number']
-
else
-
self.phone_number = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @first_name.nil?
-
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
-
end
-
-
if @first_name.to_s.length > 500
-
invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 500.')
-
end
-
-
if @first_name.to_s.length < 1
-
invalid_properties.push('invalid value for "first_name", the character length must be greater than or equal to 1.')
-
end
-
-
if @last_name.nil?
-
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
-
end
-
-
if @last_name.to_s.length > 500
-
invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 500.')
-
end
-
-
if @last_name.to_s.length < 1
-
invalid_properties.push('invalid value for "last_name", the character length must be greater than or equal to 1.')
-
end
-
-
if @email.nil?
-
invalid_properties.push('invalid value for "email", email cannot be nil.')
-
end
-
-
if @email.to_s.length > 500
-
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 500.')
-
end
-
-
if @email.to_s.length < 0
-
invalid_properties.push('invalid value for "email", the character length must be greater than or equal to 0.')
-
end
-
-
pattern = Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/)
-
if @email !~ pattern
-
invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
-
end
-
-
if @phone_number.nil?
-
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
-
end
-
-
if @phone_number.to_s.length > 500
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 500.')
-
end
-
-
if @phone_number.to_s.length < 1
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 1.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @first_name.nil?
-
return false if @first_name.to_s.length > 500
-
return false if @first_name.to_s.length < 1
-
return false if @last_name.nil?
-
return false if @last_name.to_s.length > 500
-
return false if @last_name.to_s.length < 1
-
return false if @email.nil?
-
return false if @email.to_s.length > 500
-
return false if @email.to_s.length < 0
-
return false if @email !~ Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/)
-
return false if @phone_number.nil?
-
return false if @phone_number.to_s.length > 500
-
return false if @phone_number.to_s.length < 1
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] first_name Value to be assigned
-
1
def first_name=(first_name)
-
25
if first_name.nil?
-
1
fail ArgumentError, 'first_name cannot be nil'
-
end
-
-
24
if first_name.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 500.'
-
end
-
-
23
if first_name.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "first_name", the character length must be greater than or equal to 1.'
-
end
-
-
22
@first_name = first_name
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] last_name Value to be assigned
-
1
def last_name=(last_name)
-
22
if last_name.nil?
-
1
fail ArgumentError, 'last_name cannot be nil'
-
end
-
-
21
if last_name.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 500.'
-
end
-
-
20
if last_name.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "last_name", the character length must be greater than or equal to 1.'
-
end
-
-
19
@last_name = last_name
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] email Value to be assigned
-
1
def email=(email)
-
19
if email.nil?
-
1
fail ArgumentError, 'email cannot be nil'
-
end
-
-
18
if email.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 500.'
-
end
-
-
17
if email.to_s.length < 0
-
fail ArgumentError, 'invalid value for "email", the character length must be greater than or equal to 0.'
-
end
-
-
17
pattern = Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/)
-
17
if email !~ pattern
-
1
fail ArgumentError, "invalid value for \"email\", must conform to the pattern #{pattern}."
-
end
-
-
16
@email = email
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
16
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
15
if phone_number.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 500.'
-
end
-
-
14
if phone_number.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 1.'
-
end
-
-
13
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
first_name == o.first_name &&
-
last_name == o.last_name &&
-
email == o.email &&
-
phone_number == o.phone_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[first_name, last_name, email, phone_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
6
return nil unless attributes.is_a?(Hash)
-
6
attributes = attributes.transform_keys(&:to_sym)
-
6
transformed_hash = {}
-
6
openapi_types.each_pair do |key, type|
-
24
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
24
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
24
elsif !attributes[attribute_map[key]].nil?
-
24
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
6
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateAsyncBulkLookupResponse < ApiModelBase
-
# Links for pagination (if applicable)
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<LinkSchema>',
-
:'data' => :'CreateAsyncBulkLookupResponseData',
-
:'errors' => :'Array<LookupErrorSchema>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateAsyncBulkLookupResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'links')
-
5
if (value = attributes[:'links']).is_a?(Array)
-
5
self.links = value
-
end
-
end
-
-
7
if attributes.key?(:'data')
-
5
self.data = attributes[:'data']
-
end
-
-
7
if attributes.key?(:'errors')
-
5
if (value = attributes[:'errors']).is_a?(Array)
-
5
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
7
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The phone number lookup response data
-
1
class CreateAsyncBulkLookupResponseData < ApiModelBase
-
# The phone number lookup request ID from Bandwidth.
-
1
attr_accessor :request_id
-
-
1
attr_accessor :status
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
42
{
-
:'request_id' => :'requestId',
-
:'status' => :'status'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'request_id' => :'String',
-
:'status' => :'InProgressLookupStatusEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateAsyncBulkLookupResponseData` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
19
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
18
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'request_id')
-
9
self.request_id = attributes[:'request_id']
-
end
-
-
11
if attributes.key?(:'status')
-
9
self.status = attributes[:'status']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
request_id == o.request_id &&
-
status == o.status
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[request_id, status].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateCall < ApiModelBase
-
# The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)).
-
1
attr_accessor :to
-
-
# A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true.
-
1
attr_accessor :from
-
-
# Hide the calling number. The `displayName` field can be used to customize the displayed name.
-
1
attr_accessor :privacy
-
-
# The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`.
-
1
attr_accessor :display_name
-
-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators.
-
1
attr_accessor :uui
-
-
# The id of the application associated with the `from` number.
-
1
attr_accessor :application_id
-
-
# The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`.
-
1
attr_accessor :answer_url
-
-
1
attr_accessor :answer_method
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# A fallback url which, if provided, will be used to retry the `answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`.
-
1
attr_accessor :answer_fallback_url
-
-
1
attr_accessor :answer_fallback_method
-
-
# Basic auth username.
-
1
attr_accessor :fallback_username
-
-
# Basic auth password.
-
1
attr_accessor :fallback_password
-
-
# The URL to send the <a href='/docs/voice/webhooks/disconnect'>Disconnect</a> event to when the call ends. This event does not expect a BXML response.
-
1
attr_accessor :disconnect_url
-
-
1
attr_accessor :disconnect_method
-
-
# The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300.
-
1
attr_accessor :call_timeout
-
-
# This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25.
-
1
attr_accessor :callback_timeout
-
-
1
attr_accessor :machine_detection
-
-
# The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call.
-
1
attr_accessor :priority
-
-
# A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 4096 characters.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
114
{
-
:'to' => :'to',
-
:'from' => :'from',
-
:'privacy' => :'privacy',
-
:'display_name' => :'displayName',
-
:'uui' => :'uui',
-
:'application_id' => :'applicationId',
-
:'answer_url' => :'answerUrl',
-
:'answer_method' => :'answerMethod',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'answer_fallback_url' => :'answerFallbackUrl',
-
:'answer_fallback_method' => :'answerFallbackMethod',
-
:'fallback_username' => :'fallbackUsername',
-
:'fallback_password' => :'fallbackPassword',
-
:'disconnect_url' => :'disconnectUrl',
-
:'disconnect_method' => :'disconnectMethod',
-
:'call_timeout' => :'callTimeout',
-
:'callback_timeout' => :'callbackTimeout',
-
:'machine_detection' => :'machineDetection',
-
:'priority' => :'priority',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
28
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'to' => :'String',
-
:'from' => :'String',
-
:'privacy' => :'Boolean',
-
:'display_name' => :'String',
-
:'uui' => :'String',
-
:'application_id' => :'String',
-
:'answer_url' => :'String',
-
:'answer_method' => :'CallbackMethodEnum',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'answer_fallback_url' => :'String',
-
:'answer_fallback_method' => :'CallbackMethodEnum',
-
:'fallback_username' => :'String',
-
:'fallback_password' => :'String',
-
:'disconnect_url' => :'String',
-
:'disconnect_method' => :'CallbackMethodEnum',
-
:'call_timeout' => :'Float',
-
:'callback_timeout' => :'Float',
-
:'machine_detection' => :'MachineDetectionConfiguration',
-
:'priority' => :'Integer',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
4
Set.new([
-
:'privacy',
-
:'display_name',
-
:'uui',
-
:'answer_method',
-
:'username',
-
:'password',
-
:'answer_fallback_url',
-
:'answer_fallback_method',
-
:'fallback_username',
-
:'fallback_password',
-
:'disconnect_url',
-
:'disconnect_method',
-
:'call_timeout',
-
:'callback_timeout',
-
:'priority',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
28
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateCall` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
27
acceptable_attribute_map = self.class.acceptable_attribute_map
-
27
attributes = attributes.each_with_object({}) { |(k, v), h|
-
200
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateCall`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
199
h[k.to_sym] = v
-
}
-
-
26
if attributes.key?(:'to')
-
26
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
25
if attributes.key?(:'from')
-
25
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
24
if attributes.key?(:'privacy')
-
4
self.privacy = attributes[:'privacy']
-
end
-
-
24
if attributes.key?(:'display_name')
-
5
self.display_name = attributes[:'display_name']
-
end
-
-
23
if attributes.key?(:'uui')
-
4
self.uui = attributes[:'uui']
-
end
-
-
23
if attributes.key?(:'application_id')
-
23
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
22
if attributes.key?(:'answer_url')
-
22
self.answer_url = attributes[:'answer_url']
-
else
-
self.answer_url = nil
-
end
-
-
20
if attributes.key?(:'answer_method')
-
5
self.answer_method = attributes[:'answer_method']
-
else
-
15
self.answer_method = 'POST'
-
end
-
-
20
if attributes.key?(:'username')
-
6
self.username = attributes[:'username']
-
end
-
-
19
if attributes.key?(:'password')
-
6
self.password = attributes[:'password']
-
end
-
-
18
if attributes.key?(:'answer_fallback_url')
-
6
self.answer_fallback_url = attributes[:'answer_fallback_url']
-
end
-
-
17
if attributes.key?(:'answer_fallback_method')
-
5
self.answer_fallback_method = attributes[:'answer_fallback_method']
-
else
-
12
self.answer_fallback_method = 'POST'
-
end
-
-
17
if attributes.key?(:'fallback_username')
-
6
self.fallback_username = attributes[:'fallback_username']
-
end
-
-
16
if attributes.key?(:'fallback_password')
-
6
self.fallback_password = attributes[:'fallback_password']
-
end
-
-
15
if attributes.key?(:'disconnect_url')
-
6
self.disconnect_url = attributes[:'disconnect_url']
-
end
-
-
14
if attributes.key?(:'disconnect_method')
-
5
self.disconnect_method = attributes[:'disconnect_method']
-
else
-
9
self.disconnect_method = 'POST'
-
end
-
-
14
if attributes.key?(:'call_timeout')
-
7
self.call_timeout = attributes[:'call_timeout']
-
else
-
7
self.call_timeout = 30
-
end
-
-
12
if attributes.key?(:'callback_timeout')
-
7
self.callback_timeout = attributes[:'callback_timeout']
-
else
-
5
self.callback_timeout = 15
-
end
-
-
10
if attributes.key?(:'machine_detection')
-
4
self.machine_detection = attributes[:'machine_detection']
-
end
-
-
10
if attributes.key?(:'priority')
-
7
self.priority = attributes[:'priority']
-
else
-
3
self.priority = 5
-
end
-
-
8
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if !@display_name.nil? && @display_name.to_s.length > 256
-
invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 256.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @answer_url.nil?
-
invalid_properties.push('invalid value for "answer_url", answer_url cannot be nil.')
-
end
-
-
if @answer_url.to_s.length > 2048
-
invalid_properties.push('invalid value for "answer_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@answer_fallback_url.nil? && @answer_fallback_url.to_s.length > 2048
-
invalid_properties.push('invalid value for "answer_fallback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@disconnect_url.nil? && @disconnect_url.to_s.length > 2048
-
invalid_properties.push('invalid value for "disconnect_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
if !@call_timeout.nil? && @call_timeout > 300
-
invalid_properties.push('invalid value for "call_timeout", must be smaller than or equal to 300.')
-
end
-
-
if !@call_timeout.nil? && @call_timeout < 1
-
invalid_properties.push('invalid value for "call_timeout", must be greater than or equal to 1.')
-
end
-
-
if !@callback_timeout.nil? && @callback_timeout > 25
-
invalid_properties.push('invalid value for "callback_timeout", must be smaller than or equal to 25.')
-
end
-
-
if !@callback_timeout.nil? && @callback_timeout < 1
-
invalid_properties.push('invalid value for "callback_timeout", must be greater than or equal to 1.')
-
end
-
-
if !@priority.nil? && @priority > 5
-
invalid_properties.push('invalid value for "priority", must be smaller than or equal to 5.')
-
end
-
-
if !@priority.nil? && @priority < 1
-
invalid_properties.push('invalid value for "priority", must be greater than or equal to 1.')
-
end
-
-
if !@tag.nil? && @tag.to_s.length > 4096
-
invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 4096.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @to.nil?
-
return false if @from.nil?
-
return false if !@display_name.nil? && @display_name.to_s.length > 256
-
return false if @application_id.nil?
-
return false if @answer_url.nil?
-
return false if @answer_url.to_s.length > 2048
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@answer_fallback_url.nil? && @answer_fallback_url.to_s.length > 2048
-
return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
return false if !@disconnect_url.nil? && @disconnect_url.to_s.length > 2048
-
return false if !@call_timeout.nil? && @call_timeout > 300
-
return false if !@call_timeout.nil? && @call_timeout < 1
-
return false if !@callback_timeout.nil? && @callback_timeout > 25
-
return false if !@callback_timeout.nil? && @callback_timeout < 1
-
return false if !@priority.nil? && @priority > 5
-
return false if !@priority.nil? && @priority < 1
-
return false if !@tag.nil? && @tag.to_s.length > 4096
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
26
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
25
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
25
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
24
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] display_name Value to be assigned
-
1
def display_name=(display_name)
-
5
if !display_name.nil? && display_name.to_s.length > 256
-
1
fail ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 256.'
-
end
-
-
4
@display_name = display_name
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
23
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
22
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] answer_url Value to be assigned
-
1
def answer_url=(answer_url)
-
22
if answer_url.nil?
-
1
fail ArgumentError, 'answer_url cannot be nil'
-
end
-
-
21
if answer_url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "answer_url", the character length must be smaller than or equal to 2048.'
-
end
-
-
20
@answer_url = answer_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
6
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
6
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] answer_fallback_url Value to be assigned
-
1
def answer_fallback_url=(answer_fallback_url)
-
6
if !answer_fallback_url.nil? && answer_fallback_url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "answer_fallback_url", the character length must be smaller than or equal to 2048.'
-
end
-
-
5
@answer_fallback_url = answer_fallback_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_username Value to be assigned
-
1
def fallback_username=(fallback_username)
-
6
if !fallback_username.nil? && fallback_username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_username = fallback_username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_password Value to be assigned
-
1
def fallback_password=(fallback_password)
-
6
if !fallback_password.nil? && fallback_password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_password = fallback_password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] disconnect_url Value to be assigned
-
1
def disconnect_url=(disconnect_url)
-
6
if !disconnect_url.nil? && disconnect_url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "disconnect_url", the character length must be smaller than or equal to 2048.'
-
end
-
-
5
@disconnect_url = disconnect_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] call_timeout Value to be assigned
-
1
def call_timeout=(call_timeout)
-
14
if !call_timeout.nil? && call_timeout > 300
-
1
fail ArgumentError, 'invalid value for "call_timeout", must be smaller than or equal to 300.'
-
end
-
-
13
if !call_timeout.nil? && call_timeout < 1
-
1
fail ArgumentError, 'invalid value for "call_timeout", must be greater than or equal to 1.'
-
end
-
-
12
@call_timeout = call_timeout
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] callback_timeout Value to be assigned
-
1
def callback_timeout=(callback_timeout)
-
12
if !callback_timeout.nil? && callback_timeout > 25
-
1
fail ArgumentError, 'invalid value for "callback_timeout", must be smaller than or equal to 25.'
-
end
-
-
11
if !callback_timeout.nil? && callback_timeout < 1
-
1
fail ArgumentError, 'invalid value for "callback_timeout", must be greater than or equal to 1.'
-
end
-
-
10
@callback_timeout = callback_timeout
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] priority Value to be assigned
-
1
def priority=(priority)
-
10
if !priority.nil? && priority > 5
-
1
fail ArgumentError, 'invalid value for "priority", must be smaller than or equal to 5.'
-
end
-
-
9
if !priority.nil? && priority < 1
-
1
fail ArgumentError, 'invalid value for "priority", must be greater than or equal to 1.'
-
end
-
-
8
@priority = priority
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
6
if !tag.nil? && tag.to_s.length > 4096
-
1
fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 4096.'
-
end
-
-
5
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
to == o.to &&
-
from == o.from &&
-
privacy == o.privacy &&
-
display_name == o.display_name &&
-
uui == o.uui &&
-
application_id == o.application_id &&
-
answer_url == o.answer_url &&
-
answer_method == o.answer_method &&
-
username == o.username &&
-
password == o.password &&
-
answer_fallback_url == o.answer_fallback_url &&
-
answer_fallback_method == o.answer_fallback_method &&
-
fallback_username == o.fallback_username &&
-
fallback_password == o.fallback_password &&
-
disconnect_url == o.disconnect_url &&
-
disconnect_method == o.disconnect_method &&
-
call_timeout == o.call_timeout &&
-
callback_timeout == o.callback_timeout &&
-
machine_detection == o.machine_detection &&
-
priority == o.priority &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[to, from, privacy, display_name, uui, application_id, answer_url, answer_method, username, password, answer_fallback_url, answer_fallback_method, fallback_username, fallback_password, disconnect_url, disconnect_method, call_timeout, callback_timeout, machine_detection, priority, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
21
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
21
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
21
elsif !attributes[attribute_map[key]].nil?
-
20
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
63
value = self.send(attr)
-
63
if value.nil?
-
3
is_nullable = self.class.openapi_nullable.include?(attr)
-
3
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
60
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateCallResponse < ApiModelBase
-
# The id of the application associated with the `from` number.
-
1
attr_accessor :application_id
-
-
# The bandwidth account ID associated with the call.
-
1
attr_accessor :account_id
-
-
# Programmable Voice API Call ID.
-
1
attr_accessor :call_id
-
-
# Recipient of the outgoing call.
-
1
attr_accessor :to
-
-
# Phone number that created the outbound call.
-
1
attr_accessor :from
-
-
# The time at which the call was accepted into the queue.
-
1
attr_accessor :enqueued_time
-
-
# The URL to update this call's state.
-
1
attr_accessor :call_url
-
-
# The timeout (in seconds) for the callee to answer the call after it starts ringing.
-
1
attr_accessor :call_timeout
-
-
# This is the timeout (in seconds) to use when delivering webhooks for the call.
-
1
attr_accessor :callback_timeout
-
-
# Custom tag value.
-
1
attr_accessor :tag
-
-
1
attr_accessor :answer_method
-
-
# URL to deliver the `answer` event webhook.
-
1
attr_accessor :answer_url
-
-
1
attr_accessor :answer_fallback_method
-
-
# Fallback URL to deliver the `answer` event webhook.
-
1
attr_accessor :answer_fallback_url
-
-
1
attr_accessor :disconnect_method
-
-
# URL to deliver the `disconnect` event webhook.
-
1
attr_accessor :disconnect_url
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# Basic auth username.
-
1
attr_accessor :fallback_username
-
-
# Basic auth password.
-
1
attr_accessor :fallback_password
-
-
# The priority of this call over other calls from your account.
-
1
attr_accessor :priority
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
191
{
-
:'application_id' => :'applicationId',
-
:'account_id' => :'accountId',
-
:'call_id' => :'callId',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'enqueued_time' => :'enqueuedTime',
-
:'call_url' => :'callUrl',
-
:'call_timeout' => :'callTimeout',
-
:'callback_timeout' => :'callbackTimeout',
-
:'tag' => :'tag',
-
:'answer_method' => :'answerMethod',
-
:'answer_url' => :'answerUrl',
-
:'answer_fallback_method' => :'answerFallbackMethod',
-
:'answer_fallback_url' => :'answerFallbackUrl',
-
:'disconnect_method' => :'disconnectMethod',
-
:'disconnect_url' => :'disconnectUrl',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'fallback_username' => :'fallbackUsername',
-
:'fallback_password' => :'fallbackPassword',
-
:'priority' => :'priority'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
20
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'application_id' => :'String',
-
:'account_id' => :'String',
-
:'call_id' => :'String',
-
:'to' => :'String',
-
:'from' => :'String',
-
:'enqueued_time' => :'Time',
-
:'call_url' => :'String',
-
:'call_timeout' => :'Float',
-
:'callback_timeout' => :'Float',
-
:'tag' => :'String',
-
:'answer_method' => :'CallbackMethodEnum',
-
:'answer_url' => :'String',
-
:'answer_fallback_method' => :'CallbackMethodEnum',
-
:'answer_fallback_url' => :'String',
-
:'disconnect_method' => :'CallbackMethodEnum',
-
:'disconnect_url' => :'String',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'fallback_username' => :'String',
-
:'fallback_password' => :'String',
-
:'priority' => :'Integer'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'tag',
-
:'answer_method',
-
:'answer_fallback_method',
-
:'answer_fallback_url',
-
:'disconnect_method',
-
:'disconnect_url',
-
:'username',
-
:'password',
-
:'fallback_username',
-
:'fallback_password',
-
:'priority'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
20
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateCallResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
19
acceptable_attribute_map = self.class.acceptable_attribute_map
-
19
attributes = attributes.each_with_object({}) { |(k, v), h|
-
201
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateCallResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
200
h[k.to_sym] = v
-
}
-
-
18
if attributes.key?(:'application_id')
-
18
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
17
if attributes.key?(:'account_id')
-
17
self.account_id = attributes[:'account_id']
-
else
-
self.account_id = nil
-
end
-
-
16
if attributes.key?(:'call_id')
-
16
self.call_id = attributes[:'call_id']
-
else
-
self.call_id = nil
-
end
-
-
15
if attributes.key?(:'to')
-
15
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
14
if attributes.key?(:'from')
-
14
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
13
if attributes.key?(:'enqueued_time')
-
5
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
13
if attributes.key?(:'call_url')
-
13
self.call_url = attributes[:'call_url']
-
else
-
self.call_url = nil
-
end
-
-
12
if attributes.key?(:'call_timeout')
-
5
self.call_timeout = attributes[:'call_timeout']
-
end
-
-
12
if attributes.key?(:'callback_timeout')
-
5
self.callback_timeout = attributes[:'callback_timeout']
-
end
-
-
12
if attributes.key?(:'tag')
-
5
self.tag = attributes[:'tag']
-
end
-
-
12
if attributes.key?(:'answer_method')
-
5
self.answer_method = attributes[:'answer_method']
-
else
-
7
self.answer_method = 'POST'
-
end
-
-
12
if attributes.key?(:'answer_url')
-
12
self.answer_url = attributes[:'answer_url']
-
else
-
self.answer_url = nil
-
end
-
-
11
if attributes.key?(:'answer_fallback_method')
-
5
self.answer_fallback_method = attributes[:'answer_fallback_method']
-
else
-
6
self.answer_fallback_method = 'POST'
-
end
-
-
11
if attributes.key?(:'answer_fallback_url')
-
5
self.answer_fallback_url = attributes[:'answer_fallback_url']
-
end
-
-
11
if attributes.key?(:'disconnect_method')
-
5
self.disconnect_method = attributes[:'disconnect_method']
-
else
-
6
self.disconnect_method = 'POST'
-
end
-
-
11
if attributes.key?(:'disconnect_url')
-
5
self.disconnect_url = attributes[:'disconnect_url']
-
end
-
-
11
if attributes.key?(:'username')
-
6
self.username = attributes[:'username']
-
end
-
-
10
if attributes.key?(:'password')
-
6
self.password = attributes[:'password']
-
end
-
-
9
if attributes.key?(:'fallback_username')
-
6
self.fallback_username = attributes[:'fallback_username']
-
end
-
-
8
if attributes.key?(:'fallback_password')
-
6
self.fallback_password = attributes[:'fallback_password']
-
end
-
-
7
if attributes.key?(:'priority')
-
5
self.priority = attributes[:'priority']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @account_id.nil?
-
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
-
end
-
-
if @call_id.nil?
-
invalid_properties.push('invalid value for "call_id", call_id cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @call_url.nil?
-
invalid_properties.push('invalid value for "call_url", call_url cannot be nil.')
-
end
-
-
if @answer_url.nil?
-
invalid_properties.push('invalid value for "answer_url", answer_url cannot be nil.')
-
end
-
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @application_id.nil?
-
return false if @account_id.nil?
-
return false if @call_id.nil?
-
return false if @to.nil?
-
return false if @from.nil?
-
return false if @call_url.nil?
-
return false if @answer_url.nil?
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
18
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
17
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] account_id Value to be assigned
-
1
def account_id=(account_id)
-
17
if account_id.nil?
-
1
fail ArgumentError, 'account_id cannot be nil'
-
end
-
-
16
@account_id = account_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] call_id Value to be assigned
-
1
def call_id=(call_id)
-
16
if call_id.nil?
-
1
fail ArgumentError, 'call_id cannot be nil'
-
end
-
-
15
@call_id = call_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
15
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
14
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
14
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
13
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] call_url Value to be assigned
-
1
def call_url=(call_url)
-
13
if call_url.nil?
-
1
fail ArgumentError, 'call_url cannot be nil'
-
end
-
-
12
@call_url = call_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] answer_url Value to be assigned
-
1
def answer_url=(answer_url)
-
12
if answer_url.nil?
-
1
fail ArgumentError, 'answer_url cannot be nil'
-
end
-
-
11
@answer_url = answer_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
6
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
6
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_username Value to be assigned
-
1
def fallback_username=(fallback_username)
-
6
if !fallback_username.nil? && fallback_username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_username = fallback_username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_password Value to be assigned
-
1
def fallback_password=(fallback_password)
-
6
if !fallback_password.nil? && fallback_password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_password = fallback_password
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
application_id == o.application_id &&
-
account_id == o.account_id &&
-
call_id == o.call_id &&
-
to == o.to &&
-
from == o.from &&
-
enqueued_time == o.enqueued_time &&
-
call_url == o.call_url &&
-
call_timeout == o.call_timeout &&
-
callback_timeout == o.callback_timeout &&
-
tag == o.tag &&
-
answer_method == o.answer_method &&
-
answer_url == o.answer_url &&
-
answer_fallback_method == o.answer_fallback_method &&
-
answer_fallback_url == o.answer_fallback_url &&
-
disconnect_method == o.disconnect_method &&
-
disconnect_url == o.disconnect_url &&
-
username == o.username &&
-
password == o.password &&
-
fallback_username == o.fallback_username &&
-
fallback_password == o.fallback_password &&
-
priority == o.priority
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[application_id, account_id, call_id, to, from, enqueued_time, call_url, call_timeout, callback_timeout, tag, answer_method, answer_url, answer_fallback_method, answer_fallback_url, disconnect_method, disconnect_url, username, password, fallback_username, fallback_password, priority].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
42
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
42
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
42
elsif !attributes[attribute_map[key]].nil?
-
42
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
42
value = self.send(attr)
-
42
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
42
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateEndpointRequestBase < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :direction
-
-
# The URL to send event callbacks to.
-
1
attr_accessor :event_callback_url
-
-
# The URL to send event fallbacks to.
-
1
attr_accessor :event_fallback_url
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
34
{
-
:'type' => :'type',
-
:'direction' => :'direction',
-
:'event_callback_url' => :'eventCallbackUrl',
-
:'event_fallback_url' => :'eventFallbackUrl',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
11
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'EndpointTypeEnum',
-
:'direction' => :'EndpointDirectionEnum',
-
:'event_callback_url' => :'String',
-
:'event_fallback_url' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
11
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateEndpointRequestBase` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
10
acceptable_attribute_map = self.class.acceptable_attribute_map
-
10
attributes = attributes.each_with_object({}) { |(k, v), h|
-
32
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateEndpointRequestBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
31
h[k.to_sym] = v
-
}
-
-
9
if attributes.key?(:'type')
-
9
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
8
if attributes.key?(:'direction')
-
8
self.direction = attributes[:'direction']
-
else
-
self.direction = nil
-
end
-
-
7
if attributes.key?(:'event_callback_url')
-
4
self.event_callback_url = attributes[:'event_callback_url']
-
end
-
-
7
if attributes.key?(:'event_fallback_url')
-
4
self.event_fallback_url = attributes[:'event_fallback_url']
-
end
-
-
7
if attributes.key?(:'tag')
-
5
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @direction.nil?
-
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @direction.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
9
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
8
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] direction Value to be assigned
-
1
def direction=(direction)
-
8
if direction.nil?
-
1
fail ArgumentError, 'direction cannot be nil'
-
end
-
-
7
@direction = direction
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
5
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
4
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
direction == o.direction &&
-
event_callback_url == o.event_callback_url &&
-
event_fallback_url == o.event_fallback_url &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, direction, event_callback_url, event_fallback_url, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateEndpointResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
39
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<BrtcLink>',
-
:'data' => :'CreateEndpointResponseData',
-
:'errors' => :'Array<BrtcError>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateEndpointResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
31
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateEndpointResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
30
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'links')
-
10
if (value = attributes[:'links']).is_a?(Array)
-
10
self.links = value
-
end
-
else
-
self.links = nil
-
end
-
-
10
if attributes.key?(:'data')
-
10
self.data = attributes[:'data']
-
else
-
self.data = nil
-
end
-
-
10
if attributes.key?(:'errors')
-
10
if (value = attributes[:'errors']).is_a?(Array)
-
10
self.errors = value
-
end
-
else
-
self.errors = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @links.nil?
-
invalid_properties.push('invalid value for "links", links cannot be nil.')
-
end
-
-
if @data.nil?
-
invalid_properties.push('invalid value for "data", data cannot be nil.')
-
end
-
-
if @errors.nil?
-
invalid_properties.push('invalid value for "errors", errors cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @links.nil?
-
return false if @data.nil?
-
return false if @errors.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] links Value to be assigned
-
1
def links=(links)
-
11
if links.nil?
-
1
fail ArgumentError, 'links cannot be nil'
-
end
-
-
10
@links = links
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] data Value to be assigned
-
1
def data=(data)
-
11
if data.nil?
-
1
fail ArgumentError, 'data cannot be nil'
-
end
-
-
10
@data = data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] errors Value to be assigned
-
1
def errors=(errors)
-
11
if errors.nil?
-
1
fail ArgumentError, 'errors cannot be nil'
-
end
-
-
10
@errors = errors
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
7
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateEndpointResponseData < ApiModelBase
-
# The unique ID of the endpoint.
-
1
attr_accessor :endpoint_id
-
-
1
attr_accessor :type
-
-
1
attr_accessor :status
-
-
# The time the endpoint was created. In ISO-8601 format.
-
1
attr_accessor :creation_timestamp
-
-
# The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.
-
1
attr_accessor :expiration_timestamp
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
1
attr_accessor :devices
-
-
# The json web token specific to the endpoint. Used to authenticate the client with the media gateway.
-
1
attr_accessor :token
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
120
{
-
:'endpoint_id' => :'endpointId',
-
:'type' => :'type',
-
:'status' => :'status',
-
:'creation_timestamp' => :'creationTimestamp',
-
:'expiration_timestamp' => :'expirationTimestamp',
-
:'tag' => :'tag',
-
:'devices' => :'devices',
-
:'token' => :'token'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
23
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'endpoint_id' => :'String',
-
:'type' => :'EndpointTypeEnum',
-
:'status' => :'EndpointStatusEnum',
-
:'creation_timestamp' => :'Time',
-
:'expiration_timestamp' => :'Time',
-
:'tag' => :'String',
-
:'devices' => :'Array<Device>',
-
:'token' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'Endpoint'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
23
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateEndpointResponseData` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
22
acceptable_attribute_map = self.class.acceptable_attribute_map
-
22
attributes = attributes.each_with_object({}) { |(k, v), h|
-
138
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateEndpointResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
137
h[k.to_sym] = v
-
}
-
-
21
if attributes.key?(:'endpoint_id')
-
21
self.endpoint_id = attributes[:'endpoint_id']
-
else
-
self.endpoint_id = nil
-
end
-
-
20
if attributes.key?(:'type')
-
20
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
19
if attributes.key?(:'status')
-
19
self.status = attributes[:'status']
-
else
-
self.status = nil
-
end
-
-
18
if attributes.key?(:'creation_timestamp')
-
18
self.creation_timestamp = attributes[:'creation_timestamp']
-
else
-
self.creation_timestamp = nil
-
end
-
-
17
if attributes.key?(:'expiration_timestamp')
-
17
self.expiration_timestamp = attributes[:'expiration_timestamp']
-
else
-
self.expiration_timestamp = nil
-
end
-
-
16
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
15
if attributes.key?(:'devices')
-
5
if (value = attributes[:'devices']).is_a?(Array)
-
5
self.devices = value
-
end
-
end
-
-
15
if attributes.key?(:'token')
-
15
self.token = attributes[:'token']
-
else
-
self.token = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @endpoint_id.nil?
-
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @status.nil?
-
invalid_properties.push('invalid value for "status", status cannot be nil.')
-
end
-
-
if @creation_timestamp.nil?
-
invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
-
end
-
-
if @expiration_timestamp.nil?
-
invalid_properties.push('invalid value for "expiration_timestamp", expiration_timestamp cannot be nil.')
-
end
-
-
if @token.nil?
-
invalid_properties.push('invalid value for "token", token cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @endpoint_id.nil?
-
return false if @type.nil?
-
return false if @status.nil?
-
return false if @creation_timestamp.nil?
-
return false if @expiration_timestamp.nil?
-
return false if @token.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] endpoint_id Value to be assigned
-
1
def endpoint_id=(endpoint_id)
-
21
if endpoint_id.nil?
-
1
fail ArgumentError, 'endpoint_id cannot be nil'
-
end
-
-
20
@endpoint_id = endpoint_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
20
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
19
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status Value to be assigned
-
1
def status=(status)
-
19
if status.nil?
-
1
fail ArgumentError, 'status cannot be nil'
-
end
-
-
18
@status = status
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] creation_timestamp Value to be assigned
-
1
def creation_timestamp=(creation_timestamp)
-
18
if creation_timestamp.nil?
-
1
fail ArgumentError, 'creation_timestamp cannot be nil'
-
end
-
-
17
@creation_timestamp = creation_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] expiration_timestamp Value to be assigned
-
1
def expiration_timestamp=(expiration_timestamp)
-
17
if expiration_timestamp.nil?
-
1
fail ArgumentError, 'expiration_timestamp cannot be nil'
-
end
-
-
16
@expiration_timestamp = expiration_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
6
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
5
@tag = tag
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] token Value to be assigned
-
1
def token=(token)
-
15
if token.nil?
-
1
fail ArgumentError, 'token cannot be nil'
-
end
-
-
14
@token = token
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
endpoint_id == o.endpoint_id &&
-
type == o.type &&
-
status == o.status &&
-
creation_timestamp == o.creation_timestamp &&
-
expiration_timestamp == o.expiration_timestamp &&
-
tag == o.tag &&
-
devices == o.devices &&
-
token == o.token
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[endpoint_id, type, status, creation_timestamp, expiration_timestamp, tag, devices, token].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
24
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
24
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
3
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
21
elsif !attributes[attribute_map[key]].nil?
-
20
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateMessageRequestError < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :description
-
-
1
attr_accessor :field_errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
25
{
-
:'type' => :'type',
-
:'description' => :'description',
-
:'field_errors' => :'fieldErrors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'String',
-
:'description' => :'String',
-
:'field_errors' => :'Array<FieldError>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateMessageRequestError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateMessageRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'type')
-
8
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
7
if attributes.key?(:'description')
-
7
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
6
if attributes.key?(:'field_errors')
-
4
if (value = attributes[:'field_errors']).is_a?(Array)
-
4
self.field_errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @description.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
8
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
7
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
7
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
6
@description = description
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
description == o.description &&
-
field_errors == o.field_errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, description, field_errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateMultiChannelMessageResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
34
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<Link>',
-
:'data' => :'MultiChannelMessageResponseData',
-
:'errors' => :'Array<ErrorObject>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateMultiChannelMessageResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
12
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateMultiChannelMessageResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
11
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'links')
-
5
if (value = attributes[:'links']).is_a?(Array)
-
5
self.links = value
-
end
-
end
-
-
7
if attributes.key?(:'data')
-
1
self.data = attributes[:'data']
-
end
-
-
7
if attributes.key?(:'errors')
-
5
if (value = attributes[:'errors']).is_a?(Array)
-
5
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateSyncLookupResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<LinkSchema>',
-
:'data' => :'CreateSyncLookupResponseData',
-
:'errors' => :'Array<LookupErrorSchema>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateSyncLookupResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'links')
-
5
if (value = attributes[:'links']).is_a?(Array)
-
5
self.links = value
-
end
-
end
-
-
7
if attributes.key?(:'data')
-
5
self.data = attributes[:'data']
-
end
-
-
7
if attributes.key?(:'errors')
-
5
if (value = attributes[:'errors']).is_a?(Array)
-
5
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The phone number lookup response data
-
1
class CreateSyncLookupResponseData < ApiModelBase
-
# The phone number lookup request ID from Bandwidth.
-
1
attr_accessor :request_id
-
-
1
attr_accessor :status
-
-
# The carrier information results for the specified telephone numbers.
-
1
attr_accessor :results
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
52
{
-
:'request_id' => :'requestId',
-
:'status' => :'status',
-
:'results' => :'results'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'request_id' => :'String',
-
:'status' => :'CompletedLookupStatusEnum',
-
:'results' => :'Array<LookupResult>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateSyncLookupResponseData` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
24
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
23
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'request_id')
-
9
self.request_id = attributes[:'request_id']
-
end
-
-
11
if attributes.key?(:'status')
-
9
self.status = attributes[:'status']
-
end
-
-
11
if attributes.key?(:'results')
-
5
if (value = attributes[:'results']).is_a?(Array)
-
5
self.results = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
request_id == o.request_id &&
-
status == o.status &&
-
results == o.results
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[request_id, status, results].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
7
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class CreateWebRtcConnectionRequest < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :direction
-
-
# The URL to send event callbacks to.
-
1
attr_accessor :event_callback_url
-
-
# The URL to send event fallbacks to.
-
1
attr_accessor :event_fallback_url
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
1
attr_accessor :connection_metadata
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
40
{
-
:'type' => :'type',
-
:'direction' => :'direction',
-
:'event_callback_url' => :'eventCallbackUrl',
-
:'event_fallback_url' => :'eventFallbackUrl',
-
:'tag' => :'tag',
-
:'connection_metadata' => :'connectionMetadata'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'EndpointTypeEnum',
-
:'direction' => :'EndpointDirectionEnum',
-
:'event_callback_url' => :'String',
-
:'event_fallback_url' => :'String',
-
:'tag' => :'String',
-
:'connection_metadata' => :'Object'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'CreateEndpointRequestBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateWebRtcConnectionRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
42
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateWebRtcConnectionRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
41
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'type')
-
10
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
9
if attributes.key?(:'direction')
-
9
self.direction = attributes[:'direction']
-
else
-
self.direction = nil
-
end
-
-
8
if attributes.key?(:'event_callback_url')
-
5
self.event_callback_url = attributes[:'event_callback_url']
-
end
-
-
8
if attributes.key?(:'event_fallback_url')
-
5
self.event_fallback_url = attributes[:'event_fallback_url']
-
end
-
-
8
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
7
if attributes.key?(:'connection_metadata')
-
5
self.connection_metadata = attributes[:'connection_metadata']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @direction.nil?
-
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @direction.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
10
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
9
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] direction Value to be assigned
-
1
def direction=(direction)
-
9
if direction.nil?
-
1
fail ArgumentError, 'direction cannot be nil'
-
end
-
-
8
@direction = direction
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
6
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
5
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
direction == o.direction &&
-
event_callback_url == o.event_callback_url &&
-
event_fallback_url == o.event_fallback_url &&
-
tag == o.tag &&
-
connection_metadata == o.connection_metadata
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, direction, event_callback_url, event_fallback_url, tag, connection_metadata].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
18
value = self.send(attr)
-
18
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
18
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class DeactivationEventEnum
-
1
DEACTIVATED = 'DEACTIVATED'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [DEACTIVATED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if DeactivationEventEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #DeactivationEventEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Device < ApiModelBase
-
# The unique ID of the device.
-
1
attr_accessor :device_id
-
-
# The name of the device.
-
1
attr_accessor :device_name
-
-
1
attr_accessor :status
-
-
# The time the device was created. In ISO-8601 format.
-
1
attr_accessor :creation_timestamp
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
88
{
-
:'device_id' => :'deviceId',
-
:'device_name' => :'deviceName',
-
:'status' => :'status',
-
:'creation_timestamp' => :'creationTimestamp'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
21
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'device_id' => :'String',
-
:'device_name' => :'String',
-
:'status' => :'DeviceStatusEnum',
-
:'creation_timestamp' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
21
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Device` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
20
acceptable_attribute_map = self.class.acceptable_attribute_map
-
20
attributes = attributes.each_with_object({}) { |(k, v), h|
-
64
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Device`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
63
h[k.to_sym] = v
-
}
-
-
19
if attributes.key?(:'device_id')
-
19
self.device_id = attributes[:'device_id']
-
else
-
self.device_id = nil
-
end
-
-
18
if attributes.key?(:'device_name')
-
6
self.device_name = attributes[:'device_name']
-
end
-
-
17
if attributes.key?(:'status')
-
17
self.status = attributes[:'status']
-
else
-
self.status = nil
-
end
-
-
16
if attributes.key?(:'creation_timestamp')
-
16
self.creation_timestamp = attributes[:'creation_timestamp']
-
else
-
self.creation_timestamp = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @device_id.nil?
-
invalid_properties.push('invalid value for "device_id", device_id cannot be nil.')
-
end
-
-
if @status.nil?
-
invalid_properties.push('invalid value for "status", status cannot be nil.')
-
end
-
-
if @creation_timestamp.nil?
-
invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @device_id.nil?
-
return false if @status.nil?
-
return false if @creation_timestamp.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] device_id Value to be assigned
-
1
def device_id=(device_id)
-
19
if device_id.nil?
-
1
fail ArgumentError, 'device_id cannot be nil'
-
end
-
-
18
@device_id = device_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] device_name Value to be assigned
-
1
def device_name=(device_name)
-
6
if device_name.nil?
-
1
fail ArgumentError, 'device_name cannot be nil'
-
end
-
-
5
@device_name = device_name
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status Value to be assigned
-
1
def status=(status)
-
17
if status.nil?
-
1
fail ArgumentError, 'status cannot be nil'
-
end
-
-
16
@status = status
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] creation_timestamp Value to be assigned
-
1
def creation_timestamp=(creation_timestamp)
-
16
if creation_timestamp.nil?
-
1
fail ArgumentError, 'creation_timestamp cannot be nil'
-
end
-
-
15
@creation_timestamp = creation_timestamp
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
device_id == o.device_id &&
-
device_name == o.device_name &&
-
status == o.status &&
-
creation_timestamp == o.creation_timestamp
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[device_id, device_name, status, creation_timestamp].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
16
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
16
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
16
elsif !attributes[attribute_map[key]].nil?
-
14
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class DeviceStatusEnum
-
1
CONNECTED = 'CONNECTED'.freeze
-
1
DISCONNECTED = 'DISCONNECTED'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [CONNECTED, DISCONNECTED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if DeviceStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #DeviceStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Disconnect event is fired when a call ends, for any reason.
-
1
class DisconnectCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
1
attr_accessor :direction
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
-
1
attr_accessor :cause
-
-
# Text explaining the reason that caused the call to fail in case of errors.
-
1
attr_accessor :error_message
-
-
# Bandwidth's internal id that references the error event.
-
1
attr_accessor :error_id
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
79
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'call_id' => :'callId',
-
:'direction' => :'direction',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'end_time' => :'endTime',
-
:'cause' => :'cause',
-
:'error_message' => :'errorMessage',
-
:'error_id' => :'errorId',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'call_id' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'end_time' => :'Time',
-
:'cause' => :'String',
-
:'error_message' => :'String',
-
:'error_id' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'error_message',
-
:'error_id',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::DisconnectCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
69
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::DisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
68
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'cause')
-
4
self.cause = attributes[:'cause']
-
end
-
-
6
if attributes.key?(:'error_message')
-
4
self.error_message = attributes[:'error_message']
-
end
-
-
6
if attributes.key?(:'error_id')
-
4
self.error_id = attributes[:'error_id']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
call_id == o.call_id &&
-
direction == o.direction &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
end_time == o.end_time &&
-
cause == o.cause &&
-
error_message == o.error_message &&
-
error_id == o.error_id &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, call_id, direction, call_url, enqueued_time, start_time, answer_time, end_time, cause, error_message, error_id, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
17
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
17
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
17
elsif !attributes[attribute_map[key]].nil?
-
17
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
34
value = self.send(attr)
-
34
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
34
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Diversion < ApiModelBase
-
# The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away.
-
1
attr_accessor :reason
-
-
# off or full
-
1
attr_accessor :privacy
-
-
# No if the number was provided by the user, yes if the number was provided by the network
-
1
attr_accessor :screen
-
-
# The number of diversions that have occurred
-
1
attr_accessor :counter
-
-
# The maximum number of diversions allowed for this session
-
1
attr_accessor :limit
-
-
# The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys.
-
1
attr_accessor :unknown
-
-
# Always present. Indicates the last telephone number that the call was diverted from.
-
1
attr_accessor :orig_to
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
58
{
-
:'reason' => :'reason',
-
:'privacy' => :'privacy',
-
:'screen' => :'screen',
-
:'counter' => :'counter',
-
:'limit' => :'limit',
-
:'unknown' => :'unknown',
-
:'orig_to' => :'origTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'reason' => :'String',
-
:'privacy' => :'String',
-
:'screen' => :'String',
-
:'counter' => :'String',
-
:'limit' => :'String',
-
:'unknown' => :'String',
-
:'orig_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Diversion` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
31
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Diversion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
30
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'reason')
-
5
self.reason = attributes[:'reason']
-
end
-
-
7
if attributes.key?(:'privacy')
-
5
self.privacy = attributes[:'privacy']
-
end
-
-
7
if attributes.key?(:'screen')
-
4
self.screen = attributes[:'screen']
-
end
-
-
7
if attributes.key?(:'counter')
-
4
self.counter = attributes[:'counter']
-
end
-
-
7
if attributes.key?(:'limit')
-
4
self.limit = attributes[:'limit']
-
end
-
-
7
if attributes.key?(:'unknown')
-
4
self.unknown = attributes[:'unknown']
-
end
-
-
7
if attributes.key?(:'orig_to')
-
4
self.orig_to = attributes[:'orig_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
reason == o.reason &&
-
privacy == o.privacy &&
-
screen == o.screen &&
-
counter == o.counter &&
-
limit == o.limit &&
-
unknown == o.unknown &&
-
orig_to == o.orig_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[reason, privacy, screen, counter, limit, unknown, orig_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
14
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
14
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
14
elsif !attributes[attribute_map[key]].nil?
-
9
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
14
value = self.send(attr)
-
14
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
14
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The DTMF event is sent for every digit detected after a <StartGather> verb is executed. You may not respond to this event with BXML.
-
1
class DtmfCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
1
attr_accessor :direction
-
-
# The digit collected in the call.
-
1
attr_accessor :digit
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
79
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'call_id' => :'callId',
-
:'direction' => :'direction',
-
:'digit' => :'digit',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'parent_call_id' => :'parentCallId',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'call_id' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'digit' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'parent_call_id' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::DtmfCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
69
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::DtmfCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
68
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'digit')
-
4
self.digit = attributes[:'digit']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
call_id == o.call_id &&
-
direction == o.direction &&
-
digit == o.digit &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
parent_call_id == o.parent_call_id &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, call_id, direction, digit, call_url, enqueued_time, start_time, answer_time, parent_call_id, transfer_caller_id, transfer_to, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
17
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
17
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
17
elsif !attributes[attribute_map[key]].nil?
-
17
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
34
value = self.send(attr)
-
34
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
34
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Endpoint < ApiModelBase
-
# The unique ID of the endpoint.
-
1
attr_accessor :endpoint_id
-
-
1
attr_accessor :type
-
-
1
attr_accessor :status
-
-
# The time the endpoint was created. In ISO-8601 format.
-
1
attr_accessor :creation_timestamp
-
-
# The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.
-
1
attr_accessor :expiration_timestamp
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
1
attr_accessor :devices
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
107
{
-
:'endpoint_id' => :'endpointId',
-
:'type' => :'type',
-
:'status' => :'status',
-
:'creation_timestamp' => :'creationTimestamp',
-
:'expiration_timestamp' => :'expirationTimestamp',
-
:'tag' => :'tag',
-
:'devices' => :'devices'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
22
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'endpoint_id' => :'String',
-
:'type' => :'EndpointTypeEnum',
-
:'status' => :'EndpointStatusEnum',
-
:'creation_timestamp' => :'Time',
-
:'expiration_timestamp' => :'Time',
-
:'tag' => :'String',
-
:'devices' => :'Array<Device>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'Endpoints'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
22
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Endpoint` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
21
acceptable_attribute_map = self.class.acceptable_attribute_map
-
21
attributes = attributes.each_with_object({}) { |(k, v), h|
-
103
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Endpoint`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
102
h[k.to_sym] = v
-
}
-
-
20
if attributes.key?(:'endpoint_id')
-
20
self.endpoint_id = attributes[:'endpoint_id']
-
else
-
self.endpoint_id = nil
-
end
-
-
19
if attributes.key?(:'type')
-
19
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
18
if attributes.key?(:'status')
-
18
self.status = attributes[:'status']
-
else
-
self.status = nil
-
end
-
-
17
if attributes.key?(:'creation_timestamp')
-
17
self.creation_timestamp = attributes[:'creation_timestamp']
-
else
-
self.creation_timestamp = nil
-
end
-
-
16
if attributes.key?(:'expiration_timestamp')
-
16
self.expiration_timestamp = attributes[:'expiration_timestamp']
-
else
-
self.expiration_timestamp = nil
-
end
-
-
15
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
15
if attributes.key?(:'devices')
-
6
if (value = attributes[:'devices']).is_a?(Array)
-
6
self.devices = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @endpoint_id.nil?
-
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @status.nil?
-
invalid_properties.push('invalid value for "status", status cannot be nil.')
-
end
-
-
if @creation_timestamp.nil?
-
invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
-
end
-
-
if @expiration_timestamp.nil?
-
invalid_properties.push('invalid value for "expiration_timestamp", expiration_timestamp cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @endpoint_id.nil?
-
return false if @type.nil?
-
return false if @status.nil?
-
return false if @creation_timestamp.nil?
-
return false if @expiration_timestamp.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] endpoint_id Value to be assigned
-
1
def endpoint_id=(endpoint_id)
-
20
if endpoint_id.nil?
-
1
fail ArgumentError, 'endpoint_id cannot be nil'
-
end
-
-
19
@endpoint_id = endpoint_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
19
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
18
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status Value to be assigned
-
1
def status=(status)
-
18
if status.nil?
-
1
fail ArgumentError, 'status cannot be nil'
-
end
-
-
17
@status = status
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] creation_timestamp Value to be assigned
-
1
def creation_timestamp=(creation_timestamp)
-
17
if creation_timestamp.nil?
-
1
fail ArgumentError, 'creation_timestamp cannot be nil'
-
end
-
-
16
@creation_timestamp = creation_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] expiration_timestamp Value to be assigned
-
1
def expiration_timestamp=(expiration_timestamp)
-
16
if expiration_timestamp.nil?
-
1
fail ArgumentError, 'expiration_timestamp cannot be nil'
-
end
-
-
15
@expiration_timestamp = expiration_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
7
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
6
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
3
return true if self.equal?(o)
-
2
self.class == o.class &&
-
endpoint_id == o.endpoint_id &&
-
type == o.type &&
-
status == o.status &&
-
creation_timestamp == o.creation_timestamp &&
-
expiration_timestamp == o.expiration_timestamp &&
-
tag == o.tag &&
-
devices == o.devices
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[endpoint_id, type, status, creation_timestamp, expiration_timestamp, tag, devices].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
21
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
21
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
3
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
18
elsif !attributes[attribute_map[key]].nil?
-
17
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
24
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class EndpointDirectionEnum
-
1
INBOUND = 'INBOUND'.freeze
-
1
OUTBOUND = 'OUTBOUND'.freeze
-
1
BIDIRECTIONAL = 'BIDIRECTIONAL'.freeze
-
-
1
def self.all_vars
-
7
@all_vars ||= [INBOUND, OUTBOUND, BIDIRECTIONAL].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if EndpointDirectionEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #EndpointDirectionEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# An event that occurred on an endpoint.
-
1
class EndpointEvent < ApiModelBase
-
# The unique ID of the endpoint.
-
1
attr_accessor :endpoint_id
-
-
1
attr_accessor :type
-
-
1
attr_accessor :status
-
-
# The time the endpoint was created. In ISO-8601 format.
-
1
attr_accessor :creation_timestamp
-
-
# The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.
-
1
attr_accessor :expiration_timestamp
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
# The time the event occurred. In ISO-8601 format.
-
1
attr_accessor :event_time
-
-
1
attr_accessor :event_type
-
-
1
attr_accessor :device
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
55
{
-
:'endpoint_id' => :'endpointId',
-
:'type' => :'type',
-
:'status' => :'status',
-
:'creation_timestamp' => :'creationTimestamp',
-
:'expiration_timestamp' => :'expirationTimestamp',
-
:'tag' => :'tag',
-
:'event_time' => :'eventTime',
-
:'event_type' => :'eventType',
-
:'device' => :'device'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
16
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'endpoint_id' => :'String',
-
:'type' => :'EndpointTypeEnum',
-
:'status' => :'EndpointStatusEnum',
-
:'creation_timestamp' => :'Time',
-
:'expiration_timestamp' => :'Time',
-
:'tag' => :'String',
-
:'event_time' => :'Time',
-
:'event_type' => :'EndpointEventTypeEnum',
-
:'device' => :'Device'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'Endpoints'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
16
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::EndpointEvent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
15
acceptable_attribute_map = self.class.acceptable_attribute_map
-
15
attributes = attributes.each_with_object({}) { |(k, v), h|
-
108
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::EndpointEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
107
h[k.to_sym] = v
-
}
-
-
14
if attributes.key?(:'endpoint_id')
-
14
self.endpoint_id = attributes[:'endpoint_id']
-
else
-
self.endpoint_id = nil
-
end
-
-
13
if attributes.key?(:'type')
-
13
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
12
if attributes.key?(:'status')
-
12
self.status = attributes[:'status']
-
else
-
self.status = nil
-
end
-
-
11
if attributes.key?(:'creation_timestamp')
-
11
self.creation_timestamp = attributes[:'creation_timestamp']
-
else
-
self.creation_timestamp = nil
-
end
-
-
10
if attributes.key?(:'expiration_timestamp')
-
10
self.expiration_timestamp = attributes[:'expiration_timestamp']
-
else
-
self.expiration_timestamp = nil
-
end
-
-
9
if attributes.key?(:'tag')
-
5
self.tag = attributes[:'tag']
-
end
-
-
8
if attributes.key?(:'event_time')
-
8
self.event_time = attributes[:'event_time']
-
else
-
self.event_time = nil
-
end
-
-
7
if attributes.key?(:'event_type')
-
7
self.event_type = attributes[:'event_type']
-
else
-
self.event_type = nil
-
end
-
-
6
if attributes.key?(:'device')
-
4
self.device = attributes[:'device']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @endpoint_id.nil?
-
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @status.nil?
-
invalid_properties.push('invalid value for "status", status cannot be nil.')
-
end
-
-
if @creation_timestamp.nil?
-
invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
-
end
-
-
if @expiration_timestamp.nil?
-
invalid_properties.push('invalid value for "expiration_timestamp", expiration_timestamp cannot be nil.')
-
end
-
-
if @event_time.nil?
-
invalid_properties.push('invalid value for "event_time", event_time cannot be nil.')
-
end
-
-
if @event_type.nil?
-
invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @endpoint_id.nil?
-
return false if @type.nil?
-
return false if @status.nil?
-
return false if @creation_timestamp.nil?
-
return false if @expiration_timestamp.nil?
-
return false if @event_time.nil?
-
return false if @event_type.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] endpoint_id Value to be assigned
-
1
def endpoint_id=(endpoint_id)
-
14
if endpoint_id.nil?
-
1
fail ArgumentError, 'endpoint_id cannot be nil'
-
end
-
-
13
@endpoint_id = endpoint_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
13
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
12
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status Value to be assigned
-
1
def status=(status)
-
12
if status.nil?
-
1
fail ArgumentError, 'status cannot be nil'
-
end
-
-
11
@status = status
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] creation_timestamp Value to be assigned
-
1
def creation_timestamp=(creation_timestamp)
-
11
if creation_timestamp.nil?
-
1
fail ArgumentError, 'creation_timestamp cannot be nil'
-
end
-
-
10
@creation_timestamp = creation_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] expiration_timestamp Value to be assigned
-
1
def expiration_timestamp=(expiration_timestamp)
-
10
if expiration_timestamp.nil?
-
1
fail ArgumentError, 'expiration_timestamp cannot be nil'
-
end
-
-
9
@expiration_timestamp = expiration_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
5
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
4
@tag = tag
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] event_time Value to be assigned
-
1
def event_time=(event_time)
-
8
if event_time.nil?
-
1
fail ArgumentError, 'event_time cannot be nil'
-
end
-
-
7
@event_time = event_time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] event_type Value to be assigned
-
1
def event_type=(event_type)
-
7
if event_type.nil?
-
1
fail ArgumentError, 'event_type cannot be nil'
-
end
-
-
6
@event_type = event_type
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
endpoint_id == o.endpoint_id &&
-
type == o.type &&
-
status == o.status &&
-
creation_timestamp == o.creation_timestamp &&
-
expiration_timestamp == o.expiration_timestamp &&
-
tag == o.tag &&
-
event_time == o.event_time &&
-
event_type == o.event_type &&
-
device == o.device
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[endpoint_id, type, status, creation_timestamp, expiration_timestamp, tag, event_time, event_type, device].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
9
elsif !attributes[attribute_map[key]].nil?
-
9
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
18
value = self.send(attr)
-
18
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
18
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class EndpointEventTypeEnum
-
1
DEVICE_CONNECTED = 'DEVICE_CONNECTED'.freeze
-
1
DEVICE_DISCONNECTED = 'DEVICE_DISCONNECTED'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [DEVICE_CONNECTED, DEVICE_DISCONNECTED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if EndpointEventTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #EndpointEventTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class EndpointResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
39
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<BrtcLink>',
-
:'data' => :'Endpoint',
-
:'errors' => :'Array<BrtcError>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::EndpointResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
31
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::EndpointResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
30
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'links')
-
10
if (value = attributes[:'links']).is_a?(Array)
-
10
self.links = value
-
end
-
else
-
self.links = nil
-
end
-
-
10
if attributes.key?(:'data')
-
10
self.data = attributes[:'data']
-
else
-
self.data = nil
-
end
-
-
10
if attributes.key?(:'errors')
-
10
if (value = attributes[:'errors']).is_a?(Array)
-
10
self.errors = value
-
end
-
else
-
self.errors = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @links.nil?
-
invalid_properties.push('invalid value for "links", links cannot be nil.')
-
end
-
-
if @data.nil?
-
invalid_properties.push('invalid value for "data", data cannot be nil.')
-
end
-
-
if @errors.nil?
-
invalid_properties.push('invalid value for "errors", errors cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @links.nil?
-
return false if @data.nil?
-
return false if @errors.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] links Value to be assigned
-
1
def links=(links)
-
11
if links.nil?
-
1
fail ArgumentError, 'links cannot be nil'
-
end
-
-
10
@links = links
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] data Value to be assigned
-
1
def data=(data)
-
11
if data.nil?
-
1
fail ArgumentError, 'data cannot be nil'
-
end
-
-
10
@data = data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] errors Value to be assigned
-
1
def errors=(errors)
-
11
if errors.nil?
-
1
fail ArgumentError, 'errors cannot be nil'
-
end
-
-
10
@errors = errors
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
7
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class EndpointStatusEnum
-
1
CONNECTED = 'CONNECTED'.freeze
-
1
DISCONNECTED = 'DISCONNECTED'.freeze
-
-
1
def self.all_vars
-
18
@all_vars ||= [CONNECTED, DISCONNECTED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
14
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
14
return value if EndpointStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #EndpointStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class EndpointTypeEnum
-
1
WEBRTC = 'WEBRTC'.freeze
-
-
1
def self.all_vars
-
19
@all_vars ||= [WEBRTC].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
15
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
15
return value if EndpointTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #EndpointTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Endpoints < ApiModelBase
-
# The unique ID of the endpoint.
-
1
attr_accessor :endpoint_id
-
-
1
attr_accessor :type
-
-
1
attr_accessor :status
-
-
# The time the endpoint was created. In ISO-8601 format.
-
1
attr_accessor :creation_timestamp
-
-
# The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.
-
1
attr_accessor :expiration_timestamp
-
-
# A tag for the endpoint.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
122
{
-
:'endpoint_id' => :'endpointId',
-
:'type' => :'type',
-
:'status' => :'status',
-
:'creation_timestamp' => :'creationTimestamp',
-
:'expiration_timestamp' => :'expirationTimestamp',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
23
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'endpoint_id' => :'String',
-
:'type' => :'EndpointTypeEnum',
-
:'status' => :'EndpointStatusEnum',
-
:'creation_timestamp' => :'Time',
-
:'expiration_timestamp' => :'Time',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
23
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Endpoints` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
22
acceptable_attribute_map = self.class.acceptable_attribute_map
-
22
attributes = attributes.each_with_object({}) { |(k, v), h|
-
103
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Endpoints`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
102
h[k.to_sym] = v
-
}
-
-
21
if attributes.key?(:'endpoint_id')
-
21
self.endpoint_id = attributes[:'endpoint_id']
-
else
-
self.endpoint_id = nil
-
end
-
-
20
if attributes.key?(:'type')
-
20
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
19
if attributes.key?(:'status')
-
19
self.status = attributes[:'status']
-
else
-
self.status = nil
-
end
-
-
18
if attributes.key?(:'creation_timestamp')
-
18
self.creation_timestamp = attributes[:'creation_timestamp']
-
else
-
self.creation_timestamp = nil
-
end
-
-
17
if attributes.key?(:'expiration_timestamp')
-
17
self.expiration_timestamp = attributes[:'expiration_timestamp']
-
else
-
self.expiration_timestamp = nil
-
end
-
-
16
if attributes.key?(:'tag')
-
7
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @endpoint_id.nil?
-
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @status.nil?
-
invalid_properties.push('invalid value for "status", status cannot be nil.')
-
end
-
-
if @creation_timestamp.nil?
-
invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
-
end
-
-
if @expiration_timestamp.nil?
-
invalid_properties.push('invalid value for "expiration_timestamp", expiration_timestamp cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @endpoint_id.nil?
-
return false if @type.nil?
-
return false if @status.nil?
-
return false if @creation_timestamp.nil?
-
return false if @expiration_timestamp.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] endpoint_id Value to be assigned
-
1
def endpoint_id=(endpoint_id)
-
21
if endpoint_id.nil?
-
1
fail ArgumentError, 'endpoint_id cannot be nil'
-
end
-
-
20
@endpoint_id = endpoint_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
20
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
19
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] status Value to be assigned
-
1
def status=(status)
-
19
if status.nil?
-
1
fail ArgumentError, 'status cannot be nil'
-
end
-
-
18
@status = status
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] creation_timestamp Value to be assigned
-
1
def creation_timestamp=(creation_timestamp)
-
18
if creation_timestamp.nil?
-
1
fail ArgumentError, 'creation_timestamp cannot be nil'
-
end
-
-
17
@creation_timestamp = creation_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] expiration_timestamp Value to be assigned
-
1
def expiration_timestamp=(expiration_timestamp)
-
17
if expiration_timestamp.nil?
-
1
fail ArgumentError, 'expiration_timestamp cannot be nil'
-
end
-
-
16
@expiration_timestamp = expiration_timestamp
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
8
if tag.nil?
-
1
fail ArgumentError, 'tag cannot be nil'
-
end
-
-
7
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
endpoint_id == o.endpoint_id &&
-
type == o.type &&
-
status == o.status &&
-
creation_timestamp == o.creation_timestamp &&
-
expiration_timestamp == o.expiration_timestamp &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[endpoint_id, type, status, creation_timestamp, expiration_timestamp, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
24
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
24
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
24
elsif !attributes[attribute_map[key]].nil?
-
23
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
22
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ErrorObject < ApiModelBase
-
# A concise summary of the error used for categorization.
-
1
attr_accessor :type
-
-
# A detailed explanation of the error.
-
1
attr_accessor :description
-
-
1
attr_accessor :source
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
62
{
-
:'type' => :'type',
-
:'description' => :'description',
-
:'source' => :'source'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
19
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'type' => :'String',
-
:'description' => :'String',
-
:'source' => :'ErrorSource'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
19
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ErrorObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
18
acceptable_attribute_map = self.class.acceptable_attribute_map
-
18
attributes = attributes.each_with_object({}) { |(k, v), h|
-
49
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ErrorObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
48
h[k.to_sym] = v
-
}
-
-
17
if attributes.key?(:'type')
-
17
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
16
if attributes.key?(:'description')
-
16
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
15
if attributes.key?(:'source')
-
15
self.source = attributes[:'source']
-
else
-
self.source = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
if @source.nil?
-
invalid_properties.push('invalid value for "source", source cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @description.nil?
-
return false if @source.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
17
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
16
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
16
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
15
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] source Value to be assigned
-
1
def source=(source)
-
15
if source.nil?
-
1
fail ArgumentError, 'source cannot be nil'
-
end
-
-
14
@source = source
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
description == o.description &&
-
source == o.source
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, description, source].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
9
elsif !attributes[attribute_map[key]].nil?
-
9
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
18
value = self.send(attr)
-
18
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
18
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Specifies relevant sources of the error, if any.
-
1
class ErrorSource < ApiModelBase
-
# The relevant URI query parameter causing the error
-
1
attr_accessor :parameter
-
-
# The request body field that led to the error
-
1
attr_accessor :field
-
-
# The header field that contributed to the error
-
1
attr_accessor :header
-
-
# A resource ID or path linked to the error
-
1
attr_accessor :reference
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
68
{
-
:'parameter' => :'parameter',
-
:'field' => :'field',
-
:'header' => :'header',
-
:'reference' => :'reference'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'parameter' => :'String',
-
:'field' => :'String',
-
:'header' => :'String',
-
:'reference' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
15
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ErrorSource` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
22
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ErrorSource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
21
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'parameter')
-
5
self.parameter = attributes[:'parameter']
-
end
-
-
15
if attributes.key?(:'field')
-
8
self.field = attributes[:'field']
-
end
-
-
15
if attributes.key?(:'header')
-
4
self.header = attributes[:'header']
-
end
-
-
15
if attributes.key?(:'reference')
-
4
self.reference = attributes[:'reference']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
3
return true if self.equal?(o)
-
2
self.class == o.class &&
-
parameter == o.parameter &&
-
field == o.field &&
-
header == o.header &&
-
reference == o.reference
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[parameter, field, header, reference].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
16
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
16
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
16
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
14
is_nullable = self.class.openapi_nullable.include?(attr)
-
14
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class FailureWebhook < ApiModelBase
-
# User's account ID.
-
1
attr_accessor :account_id
-
-
# Toll-free telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
# An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered.
-
1
attr_accessor :error_code
-
-
# A description of the error that was encountered.
-
1
attr_accessor :error_message
-
-
# Details of the errors that were encountered when processing the request.
-
1
attr_accessor :errors
-
-
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
-
1
attr_accessor :internal_ticket_number
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
39
{
-
:'account_id' => :'accountId',
-
:'phone_number' => :'phoneNumber',
-
:'error_code' => :'errorCode',
-
:'error_message' => :'errorMessage',
-
:'errors' => :'errors',
-
:'internal_ticket_number' => :'internalTicketNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'account_id' => :'String',
-
:'phone_number' => :'String',
-
:'error_code' => :'String',
-
:'error_message' => :'String',
-
:'errors' => :'Array<String>',
-
:'internal_ticket_number' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::FailureWebhook` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
29
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::FailureWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
28
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
10
if attributes.key?(:'phone_number')
-
8
self.phone_number = attributes[:'phone_number']
-
end
-
-
6
if attributes.key?(:'error_code')
-
4
self.error_code = attributes[:'error_code']
-
end
-
-
6
if attributes.key?(:'error_message')
-
4
self.error_message = attributes[:'error_message']
-
end
-
-
6
if attributes.key?(:'errors')
-
4
if (value = attributes[:'errors']).is_a?(Array)
-
4
self.errors = value
-
end
-
end
-
-
6
if attributes.key?(:'internal_ticket_number')
-
4
self.internal_ticket_number = attributes[:'internal_ticket_number']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@phone_number.nil? && @phone_number.to_s.length > 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
end
-
-
if !@phone_number.nil? && @phone_number.to_s.length < 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
end
-
-
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
if !@phone_number.nil? && @phone_number !~ pattern
-
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
-
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
-
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
8
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
7
if phone_number.to_s.length > 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
-
end
-
-
6
if phone_number.to_s.length < 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.'
-
end
-
-
5
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
5
if phone_number !~ pattern
-
1
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
-
end
-
-
4
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
phone_number == o.phone_number &&
-
error_code == o.error_code &&
-
error_message == o.error_message &&
-
errors == o.errors &&
-
internal_ticket_number == o.internal_ticket_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, phone_number, error_code, error_message, errors, internal_ticket_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class FieldError < ApiModelBase
-
# The name of the field that contains the error
-
1
attr_accessor :field_name
-
-
# The error associated with the field
-
1
attr_accessor :description
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
33
{
-
:'field_name' => :'fieldName',
-
:'description' => :'description'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'field_name' => :'String',
-
:'description' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::FieldError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
17
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::FieldError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
16
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'field_name')
-
8
self.field_name = attributes[:'field_name']
-
end
-
-
10
if attributes.key?(:'description')
-
8
self.description = attributes[:'description']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
field_name == o.field_name &&
-
description == o.description
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[field_name, description].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class FileFormatEnum
-
1
MP3 = 'mp3'.freeze
-
1
WAV = 'wav'.freeze
-
-
1
def self.all_vars
-
18
@all_vars ||= [MP3, WAV].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
13
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
13
return value if FileFormatEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #FileFormatEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The gather event is sent after a <Gather> verb is executed. Its purpose is to report the gathered digits to the calling application.
-
1
class GatherCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed.
-
1
attr_accessor :digits
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed.
-
1
attr_accessor :terminating_digit
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
83
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'digits' => :'digits',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'parent_call_id' => :'parentCallId',
-
:'terminating_digit' => :'terminatingDigit',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'digits' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'parent_call_id' => :'String',
-
:'terminating_digit' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::GatherCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
73
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GatherCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
72
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'digits')
-
4
self.digits = attributes[:'digits']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'terminating_digit')
-
4
self.terminating_digit = attributes[:'terminating_digit']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
digits == o.digits &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
parent_call_id == o.parent_call_id &&
-
terminating_digit == o.terminating_digit &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, digits, call_url, enqueued_time, start_time, answer_time, parent_call_id, terminating_digit, transfer_caller_id, transfer_to, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
18
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
18
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
18
elsif !attributes[attribute_map[key]].nil?
-
18
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
36
value = self.send(attr)
-
36
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
36
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class GetAsyncBulkLookupResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<LinkSchema>',
-
:'data' => :'GetAsyncBulkLookupResponseData',
-
:'errors' => :'Array<LookupErrorSchema>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::GetAsyncBulkLookupResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'links')
-
5
if (value = attributes[:'links']).is_a?(Array)
-
5
self.links = value
-
end
-
end
-
-
7
if attributes.key?(:'data')
-
5
self.data = attributes[:'data']
-
end
-
-
7
if attributes.key?(:'errors')
-
5
if (value = attributes[:'errors']).is_a?(Array)
-
5
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The phone number lookup response data
-
1
class GetAsyncBulkLookupResponseData < ApiModelBase
-
# The phone number lookup request ID from Bandwidth.
-
1
attr_accessor :request_id
-
-
1
attr_accessor :status
-
-
# The carrier information results for the specified telephone number.
-
1
attr_accessor :results
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
50
{
-
:'request_id' => :'requestId',
-
:'status' => :'status',
-
:'results' => :'results'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'request_id' => :'String',
-
:'status' => :'InProgressLookupStatusEnum',
-
:'results' => :'Array<LookupResult>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::GetAsyncBulkLookupResponseData` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
20
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
19
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'request_id')
-
9
self.request_id = attributes[:'request_id']
-
end
-
-
11
if attributes.key?(:'status')
-
5
self.status = attributes[:'status']
-
end
-
-
11
if attributes.key?(:'results')
-
5
if (value = attributes[:'results']).is_a?(Array)
-
5
self.results = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
request_id == o.request_id &&
-
status == o.status &&
-
results == o.results
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[request_id, status, results].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
7
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class InProgressLookupStatusEnum
-
1
IN_PROGRESS = 'IN_PROGRESS'.freeze
-
1
COMPLETE = 'COMPLETE'.freeze
-
1
PARTIAL_COMPLETE = 'PARTIAL_COMPLETE'.freeze
-
1
FAILED = 'FAILED'.freeze
-
-
1
def self.all_vars
-
11
@all_vars ||= [IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, FAILED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
10
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
10
return value if InProgressLookupStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #InProgressLookupStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Represents an inbound callback.
-
1
class InboundCallback < ApiModelBase
-
1
attr_accessor :time
-
-
1
attr_accessor :type
-
-
# The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message.
-
1
attr_accessor :to
-
-
# A detailed description of the event described by the callback.
-
1
attr_accessor :description
-
-
1
attr_accessor :message
-
-
# The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled.
-
1
attr_accessor :carrier_name
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
40
{
-
:'time' => :'time',
-
:'type' => :'type',
-
:'to' => :'to',
-
:'description' => :'description',
-
:'message' => :'message',
-
:'carrier_name' => :'carrierName'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'time' => :'Time',
-
:'type' => :'InboundCallbackTypeEnum',
-
:'to' => :'String',
-
:'description' => :'String',
-
:'message' => :'InboundCallbackMessage',
-
:'carrier_name' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InboundCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
65
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
64
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'time')
-
11
self.time = attributes[:'time']
-
else
-
self.time = nil
-
end
-
-
11
if attributes.key?(:'type')
-
11
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
11
if attributes.key?(:'to')
-
11
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
11
if attributes.key?(:'description')
-
11
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
11
if attributes.key?(:'message')
-
11
self.message = attributes[:'message']
-
else
-
self.message = nil
-
end
-
-
11
if attributes.key?(:'carrier_name')
-
9
self.carrier_name = attributes[:'carrier_name']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @time.nil?
-
invalid_properties.push('invalid value for "time", time cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
if @message.nil?
-
invalid_properties.push('invalid value for "message", message cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @time.nil?
-
return false if @type.nil?
-
return false if @to.nil?
-
return false if @description.nil?
-
return false if @message.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] time Value to be assigned
-
1
def time=(time)
-
12
if time.nil?
-
1
fail ArgumentError, 'time cannot be nil'
-
end
-
-
11
@time = time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
12
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
11
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
12
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
11
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
12
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
11
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message Value to be assigned
-
1
def message=(message)
-
12
if message.nil?
-
1
fail ArgumentError, 'message cannot be nil'
-
end
-
-
11
@message = message
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
time == o.time &&
-
type == o.type &&
-
to == o.to &&
-
description == o.description &&
-
message == o.message &&
-
carrier_name == o.carrier_name
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[time, type, to, description, message, carrier_name].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class InboundCallbackMessage < ApiModelBase
-
# A unique identifier of the message.
-
1
attr_accessor :id
-
-
# The Bandwidth phone number or alphanumeric identifier associated with the message.
-
1
attr_accessor :owner
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :time
-
-
# The number of segments the user's message is broken into before sending over carrier networks.
-
1
attr_accessor :segment_count
-
-
1
attr_accessor :direction
-
-
# The phone number recipients of the message.
-
1
attr_accessor :to
-
-
# The Bandwidth phone number or alphanumeric identifier the message was sent from.
-
1
attr_accessor :from
-
-
1
attr_accessor :text
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
# Optional media, not applicable for sms
-
1
attr_accessor :media
-
-
1
attr_accessor :priority
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
1
attr_accessor :suggestion_response
-
-
1
attr_accessor :location_response
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
128
{
-
:'id' => :'id',
-
:'owner' => :'owner',
-
:'application_id' => :'applicationId',
-
:'time' => :'time',
-
:'segment_count' => :'segmentCount',
-
:'direction' => :'direction',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'text' => :'text',
-
:'tag' => :'tag',
-
:'media' => :'media',
-
:'priority' => :'priority',
-
:'channel' => :'channel',
-
:'content' => :'content',
-
:'suggestion_response' => :'suggestionResponse',
-
:'location_response' => :'locationResponse'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'id' => :'String',
-
:'owner' => :'String',
-
:'application_id' => :'String',
-
:'time' => :'Time',
-
:'segment_count' => :'Integer',
-
:'direction' => :'MessageDirectionEnum',
-
:'to' => :'Array<String>',
-
:'from' => :'String',
-
:'text' => :'String',
-
:'tag' => :'String',
-
:'media' => :'Array<String>',
-
:'priority' => :'PriorityEnum',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'MultiChannelMessageContent',
-
:'suggestion_response' => :'RbmSuggestionResponse',
-
:'location_response' => :'RbmLocationResponse'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
7
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'StatusCallbackMessage'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InboundCallbackMessage` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
182
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
181
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'id')
-
15
self.id = attributes[:'id']
-
else
-
self.id = nil
-
end
-
-
15
if attributes.key?(:'owner')
-
15
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
-
15
if attributes.key?(:'application_id')
-
15
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
15
if attributes.key?(:'time')
-
15
self.time = attributes[:'time']
-
else
-
self.time = nil
-
end
-
-
15
if attributes.key?(:'segment_count')
-
15
self.segment_count = attributes[:'segment_count']
-
else
-
self.segment_count = nil
-
end
-
-
15
if attributes.key?(:'direction')
-
15
self.direction = attributes[:'direction']
-
else
-
self.direction = nil
-
end
-
-
15
if attributes.key?(:'to')
-
15
if (value = attributes[:'to']).is_a?(Array)
-
15
self.to = value
-
end
-
else
-
self.to = nil
-
end
-
-
15
if attributes.key?(:'from')
-
15
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
15
if attributes.key?(:'text')
-
13
self.text = attributes[:'text']
-
end
-
-
15
if attributes.key?(:'tag')
-
12
self.tag = attributes[:'tag']
-
end
-
-
15
if attributes.key?(:'media')
-
12
if (value = attributes[:'media']).is_a?(Array)
-
12
self.media = value
-
end
-
end
-
-
15
if attributes.key?(:'priority')
-
12
self.priority = attributes[:'priority']
-
end
-
-
15
if attributes.key?(:'channel')
-
12
self.channel = attributes[:'channel']
-
end
-
-
15
if attributes.key?(:'content')
-
self.content = attributes[:'content']
-
end
-
-
15
if attributes.key?(:'suggestion_response')
-
self.suggestion_response = attributes[:'suggestion_response']
-
end
-
-
15
if attributes.key?(:'location_response')
-
self.location_response = attributes[:'location_response']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @id.nil?
-
invalid_properties.push('invalid value for "id", id cannot be nil.')
-
end
-
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @time.nil?
-
invalid_properties.push('invalid value for "time", time cannot be nil.')
-
end
-
-
if @segment_count.nil?
-
invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.')
-
end
-
-
if @direction.nil?
-
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @id.nil?
-
return false if @owner.nil?
-
return false if @application_id.nil?
-
return false if @time.nil?
-
return false if @segment_count.nil?
-
return false if @direction.nil?
-
return false if @to.nil?
-
return false if @from.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] id Value to be assigned
-
1
def id=(id)
-
16
if id.nil?
-
1
fail ArgumentError, 'id cannot be nil'
-
end
-
-
15
@id = id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
16
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
15
@owner = owner
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
16
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
15
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] time Value to be assigned
-
1
def time=(time)
-
16
if time.nil?
-
1
fail ArgumentError, 'time cannot be nil'
-
end
-
-
15
@time = time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] segment_count Value to be assigned
-
1
def segment_count=(segment_count)
-
16
if segment_count.nil?
-
1
fail ArgumentError, 'segment_count cannot be nil'
-
end
-
-
15
@segment_count = segment_count
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] direction Value to be assigned
-
1
def direction=(direction)
-
16
if direction.nil?
-
1
fail ArgumentError, 'direction cannot be nil'
-
end
-
-
15
@direction = direction
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
16
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
15
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
16
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
15
@from = from
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
owner == o.owner &&
-
application_id == o.application_id &&
-
time == o.time &&
-
segment_count == o.segment_count &&
-
direction == o.direction &&
-
to == o.to &&
-
from == o.from &&
-
text == o.text &&
-
tag == o.tag &&
-
media == o.media &&
-
priority == o.priority &&
-
channel == o.channel &&
-
content == o.content &&
-
suggestion_response == o.suggestion_response &&
-
location_response == o.location_response
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, content, suggestion_response, location_response].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
32
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
32
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
28
elsif !attributes[attribute_map[key]].nil?
-
19
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
6
is_nullable = self.class.openapi_nullable.include?(attr)
-
6
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class InboundCallbackTypeEnum
-
1
MESSAGE_RECEIVED = 'message-received'.freeze
-
1
REQUEST_LOCATION_RESPONSE = 'request-location-response'.freeze
-
1
SUGGESTION_RESPONSE = 'suggestion-response'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [MESSAGE_RECEIVED, REQUEST_LOCATION_RESPONSE, SUGGESTION_RESPONSE].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if InboundCallbackTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #InboundCallbackTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Initiate event is fired when an inbound call is received for a Telephone Number on your Account. It is sent to the URL specified in the application associated with the location (sip-peer) that the called telephone number belongs to.
-
1
class InitiateCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
1
attr_accessor :diversion
-
-
1
attr_accessor :stir_shaken
-
-
# The value of the `User-To-User` header to send within the initial `INVITE`. Must include the encoding parameter as specified in RFC 7433. Only `base64`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters.
-
1
attr_accessor :uui
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
63
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'start_time' => :'startTime',
-
:'diversion' => :'diversion',
-
:'stir_shaken' => :'stirShaken',
-
:'uui' => :'uui'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'start_time' => :'Time',
-
:'diversion' => :'Diversion',
-
:'stir_shaken' => :'StirShaken',
-
:'uui' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InitiateCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
53
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InitiateCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
52
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'diversion')
-
4
self.diversion = attributes[:'diversion']
-
end
-
-
6
if attributes.key?(:'stir_shaken')
-
4
self.stir_shaken = attributes[:'stir_shaken']
-
end
-
-
6
if attributes.key?(:'uui')
-
4
self.uui = attributes[:'uui']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@uui.nil? && @uui.to_s.length > 256
-
invalid_properties.push('invalid value for "uui", the character length must be smaller than or equal to 256.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@uui.nil? && @uui.to_s.length > 256
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] uui Value to be assigned
-
1
def uui=(uui)
-
4
if uui.nil?
-
fail ArgumentError, 'uui cannot be nil'
-
end
-
-
4
if uui.to_s.length > 256
-
fail ArgumentError, 'invalid value for "uui", the character length must be smaller than or equal to 256.'
-
end
-
-
4
@uui = uui
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
start_time == o.start_time &&
-
diversion == o.diversion &&
-
stir_shaken == o.stir_shaken &&
-
uui == o.uui
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, start_time, diversion, stir_shaken, uui].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
13
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
13
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
13
elsif !attributes[attribute_map[key]].nil?
-
13
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
26
value = self.send(attr)
-
26
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LatestMessageDeliveryStatusEnum
-
1
ACTIVE = 'ACTIVE'.freeze
-
1
DEACTIVATED = 'DEACTIVATED'.freeze
-
1
UNKNOWN = 'UNKNOWN'.freeze
-
1
NOT_ENABLED = 'NOT_ENABLED'.freeze
-
-
1
def self.all_vars
-
15
@all_vars ||= [ACTIVE, DEACTIVATED, UNKNOWN, NOT_ENABLED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
14
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
14
return value if LatestMessageDeliveryStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #LatestMessageDeliveryStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LineTypeEnum
-
1
FIXED = 'FIXED'.freeze
-
1
VOIP_FIXED = 'VOIP-FIXED'.freeze
-
1
MOBILE = 'MOBILE'.freeze
-
1
VOIP = 'VOIP'.freeze
-
-
1
def self.all_vars
-
15
@all_vars ||= [FIXED, VOIP_FIXED, MOBILE, VOIP].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
14
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
14
return value if LineTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #LineTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Link < ApiModelBase
-
1
attr_accessor :rel
-
-
1
attr_accessor :href
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
47
{
-
:'rel' => :'rel',
-
:'href' => :'href'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
16
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'rel' => :'String',
-
:'href' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
16
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Link` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
15
acceptable_attribute_map = self.class.acceptable_attribute_map
-
15
attributes = attributes.each_with_object({}) { |(k, v), h|
-
25
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Link`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
24
h[k.to_sym] = v
-
}
-
-
14
if attributes.key?(:'rel')
-
12
self.rel = attributes[:'rel']
-
end
-
-
14
if attributes.key?(:'href')
-
12
self.href = attributes[:'href']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
rel == o.rel &&
-
href == o.href
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[rel, href].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LinkSchema < ApiModelBase
-
# URI of the link.
-
1
attr_accessor :href
-
-
# Specifies the relationship between this link and the resource.
-
1
attr_accessor :rel
-
-
# HTTP method to be used.
-
1
attr_accessor :method
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
108
{
-
:'href' => :'href',
-
:'rel' => :'rel',
-
:'method' => :'method'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
25
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
6
{
-
:'href' => :'String',
-
:'rel' => :'String',
-
:'method' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
25
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LinkSchema` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
24
acceptable_attribute_map = self.class.acceptable_attribute_map
-
24
attributes = attributes.each_with_object({}) { |(k, v), h|
-
64
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinkSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
63
h[k.to_sym] = v
-
}
-
-
23
if attributes.key?(:'href')
-
21
self.href = attributes[:'href']
-
end
-
-
23
if attributes.key?(:'rel')
-
21
self.rel = attributes[:'rel']
-
end
-
-
23
if attributes.key?(:'method')
-
21
self.method = attributes[:'method']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
href == o.href &&
-
rel == o.rel &&
-
method == o.method
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[href, rel, method].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
6
return nil unless attributes.is_a?(Hash)
-
6
attributes = attributes.transform_keys(&:to_sym)
-
6
transformed_hash = {}
-
6
openapi_types.each_pair do |key, type|
-
18
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
18
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
18
elsif !attributes[attribute_map[key]].nil?
-
18
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
6
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
10
hash = {}
-
10
self.class.attribute_map.each_pair do |attr, param|
-
30
value = self.send(attr)
-
30
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
30
hash[param] = _to_hash(value)
-
end
-
10
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LinksObject < ApiModelBase
-
# The first (or only) page of results matching the query.
-
1
attr_accessor :first
-
-
# If more results exist than specified by 'size', this link returns the next page of 'size' results.
-
1
attr_accessor :_next
-
-
# If the results are more than one page, this link returns the previous page of 'size' results.
-
1
attr_accessor :previous
-
-
# If more results exist than specified by 'size', this link return the last page of result.
-
1
attr_accessor :last
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
53
{
-
:'first' => :'first',
-
:'_next' => :'next',
-
:'previous' => :'previous',
-
:'last' => :'last'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'first' => :'String',
-
:'_next' => :'String',
-
:'previous' => :'String',
-
:'last' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LinksObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinksObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'first')
-
5
self.first = attributes[:'first']
-
end
-
-
8
if attributes.key?(:'_next')
-
5
self._next = attributes[:'_next']
-
end
-
-
8
if attributes.key?(:'previous')
-
5
self.previous = attributes[:'previous']
-
end
-
-
8
if attributes.key?(:'last')
-
5
self.last = attributes[:'last']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
first == o.first &&
-
_next == o._next &&
-
previous == o.previous &&
-
last == o.last
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[first, _next, previous, last].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
12
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
12
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ListEndpointsResponse < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :page
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
47
{
-
:'links' => :'links',
-
:'page' => :'page',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'Array<BrtcLink>',
-
:'page' => :'Page',
-
:'data' => :'Array<Endpoints>',
-
:'errors' => :'Array<BrtcError>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ListEndpointsResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
39
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ListEndpointsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
38
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'links')
-
10
if (value = attributes[:'links']).is_a?(Array)
-
10
self.links = value
-
end
-
else
-
self.links = nil
-
end
-
-
10
if attributes.key?(:'page')
-
8
self.page = attributes[:'page']
-
end
-
-
10
if attributes.key?(:'data')
-
10
if (value = attributes[:'data']).is_a?(Array)
-
10
self.data = value
-
end
-
else
-
self.data = nil
-
end
-
-
10
if attributes.key?(:'errors')
-
10
if (value = attributes[:'errors']).is_a?(Array)
-
10
self.errors = value
-
end
-
else
-
self.errors = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @links.nil?
-
invalid_properties.push('invalid value for "links", links cannot be nil.')
-
end
-
-
if @data.nil?
-
invalid_properties.push('invalid value for "data", data cannot be nil.')
-
end
-
-
if @errors.nil?
-
invalid_properties.push('invalid value for "errors", errors cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @links.nil?
-
return false if @data.nil?
-
return false if @errors.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] links Value to be assigned
-
1
def links=(links)
-
11
if links.nil?
-
1
fail ArgumentError, 'links cannot be nil'
-
end
-
-
10
@links = links
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] data Value to be assigned
-
1
def data=(data)
-
11
if data.nil?
-
1
fail ArgumentError, 'data cannot be nil'
-
end
-
-
10
@data = data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] errors Value to be assigned
-
1
def errors=(errors)
-
11
if errors.nil?
-
1
fail ArgumentError, 'errors cannot be nil'
-
end
-
-
10
@errors = errors
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
page == o.page &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, page, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
6
if attributes[attribute_map[key]].is_a?(Array)
-
13
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ListMessageDirectionEnum
-
1
INBOUND = 'INBOUND'.freeze
-
1
OUTBOUND = 'OUTBOUND'.freeze
-
-
1
def self.all_vars
-
7
@all_vars ||= [INBOUND, OUTBOUND].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if ListMessageDirectionEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #ListMessageDirectionEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ListMessageItem < ApiModelBase
-
# The message id
-
1
attr_accessor :message_id
-
-
# The account id associated with this message.
-
1
attr_accessor :account_id
-
-
# The source phone number of the message.
-
1
attr_accessor :source_tn
-
-
# The recipient phone number of the message.
-
1
attr_accessor :destination_tn
-
-
1
attr_accessor :message_status
-
-
1
attr_accessor :message_direction
-
-
1
attr_accessor :message_type
-
-
# The number of segments the user's message is broken into before sending over carrier networks.
-
1
attr_accessor :segment_count
-
-
# The numeric error code of the message.
-
1
attr_accessor :error_code
-
-
# The ISO 8601 datetime of the message.
-
1
attr_accessor :receive_time
-
-
# The name of the carrier. Not currently supported for MMS coming soon.
-
1
attr_accessor :carrier_name
-
-
# The size of the message including message content and headers.
-
1
attr_accessor :message_size
-
-
# The length of the message content.
-
1
attr_accessor :message_length
-
-
# The number of attachments the message has.
-
1
attr_accessor :attachment_count
-
-
# The number of recipients the message has.
-
1
attr_accessor :recipient_count
-
-
# The campaign class of the message if it has one.
-
1
attr_accessor :campaign_class
-
-
# The campaign ID of the message if it has one.
-
1
attr_accessor :campaign_id
-
-
# The Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled.
-
1
attr_accessor :bw_latency
-
-
# The carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
-
1
attr_accessor :carrier_latency
-
-
# The A3 country code of the calling number.
-
1
attr_accessor :calling_number_country_a3
-
-
# The A3 country code of the called number.
-
1
attr_accessor :called_number_country_a3
-
-
# The messaging product associated with the message.
-
1
attr_accessor :product
-
-
# The location ID associated with this message.
-
1
attr_accessor :location
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
252
{
-
:'message_id' => :'messageId',
-
:'account_id' => :'accountId',
-
:'source_tn' => :'sourceTn',
-
:'destination_tn' => :'destinationTn',
-
:'message_status' => :'messageStatus',
-
:'message_direction' => :'messageDirection',
-
:'message_type' => :'messageType',
-
:'segment_count' => :'segmentCount',
-
:'error_code' => :'errorCode',
-
:'receive_time' => :'receiveTime',
-
:'carrier_name' => :'carrierName',
-
:'message_size' => :'messageSize',
-
:'message_length' => :'messageLength',
-
:'attachment_count' => :'attachmentCount',
-
:'recipient_count' => :'recipientCount',
-
:'campaign_class' => :'campaignClass',
-
:'campaign_id' => :'campaignId',
-
:'bw_latency' => :'bwLatency',
-
:'carrier_latency' => :'carrierLatency',
-
:'calling_number_country_a3' => :'callingNumberCountryA3',
-
:'called_number_country_a3' => :'calledNumberCountryA3',
-
:'product' => :'product',
-
:'location' => :'location'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'message_id' => :'String',
-
:'account_id' => :'String',
-
:'source_tn' => :'String',
-
:'destination_tn' => :'String',
-
:'message_status' => :'MessageStatusEnum',
-
:'message_direction' => :'ListMessageDirectionEnum',
-
:'message_type' => :'MessageTypeEnum',
-
:'segment_count' => :'Integer',
-
:'error_code' => :'Integer',
-
:'receive_time' => :'Time',
-
:'carrier_name' => :'String',
-
:'message_size' => :'Integer',
-
:'message_length' => :'Integer',
-
:'attachment_count' => :'Integer',
-
:'recipient_count' => :'Integer',
-
:'campaign_class' => :'String',
-
:'campaign_id' => :'String',
-
:'bw_latency' => :'Integer',
-
:'carrier_latency' => :'Integer',
-
:'calling_number_country_a3' => :'String',
-
:'called_number_country_a3' => :'String',
-
:'product' => :'String',
-
:'location' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
43
Set.new([
-
:'carrier_name',
-
:'message_size',
-
:'attachment_count',
-
:'recipient_count',
-
:'campaign_class',
-
:'campaign_id',
-
:'bw_latency',
-
:'carrier_latency',
-
:'calling_number_country_a3',
-
:'called_number_country_a3',
-
:'product',
-
:'location'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ListMessageItem` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
124
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ListMessageItem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
123
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'message_id')
-
9
self.message_id = attributes[:'message_id']
-
end
-
-
11
if attributes.key?(:'account_id')
-
5
self.account_id = attributes[:'account_id']
-
end
-
-
11
if attributes.key?(:'source_tn')
-
5
self.source_tn = attributes[:'source_tn']
-
end
-
-
11
if attributes.key?(:'destination_tn')
-
5
self.destination_tn = attributes[:'destination_tn']
-
end
-
-
11
if attributes.key?(:'message_status')
-
5
self.message_status = attributes[:'message_status']
-
end
-
-
11
if attributes.key?(:'message_direction')
-
5
self.message_direction = attributes[:'message_direction']
-
end
-
-
11
if attributes.key?(:'message_type')
-
5
self.message_type = attributes[:'message_type']
-
end
-
-
11
if attributes.key?(:'segment_count')
-
5
self.segment_count = attributes[:'segment_count']
-
end
-
-
11
if attributes.key?(:'error_code')
-
5
self.error_code = attributes[:'error_code']
-
end
-
-
11
if attributes.key?(:'receive_time')
-
5
self.receive_time = attributes[:'receive_time']
-
end
-
-
11
if attributes.key?(:'carrier_name')
-
5
self.carrier_name = attributes[:'carrier_name']
-
end
-
-
11
if attributes.key?(:'message_size')
-
5
self.message_size = attributes[:'message_size']
-
end
-
-
11
if attributes.key?(:'message_length')
-
9
self.message_length = attributes[:'message_length']
-
end
-
-
11
if attributes.key?(:'attachment_count')
-
5
self.attachment_count = attributes[:'attachment_count']
-
end
-
-
11
if attributes.key?(:'recipient_count')
-
5
self.recipient_count = attributes[:'recipient_count']
-
end
-
-
11
if attributes.key?(:'campaign_class')
-
5
self.campaign_class = attributes[:'campaign_class']
-
end
-
-
11
if attributes.key?(:'campaign_id')
-
5
self.campaign_id = attributes[:'campaign_id']
-
end
-
-
11
if attributes.key?(:'bw_latency')
-
5
self.bw_latency = attributes[:'bw_latency']
-
end
-
-
11
if attributes.key?(:'carrier_latency')
-
5
self.carrier_latency = attributes[:'carrier_latency']
-
end
-
-
11
if attributes.key?(:'calling_number_country_a3')
-
5
self.calling_number_country_a3 = attributes[:'calling_number_country_a3']
-
end
-
-
11
if attributes.key?(:'called_number_country_a3')
-
5
self.called_number_country_a3 = attributes[:'called_number_country_a3']
-
end
-
-
11
if attributes.key?(:'product')
-
5
self.product = attributes[:'product']
-
end
-
-
11
if attributes.key?(:'location')
-
5
self.location = attributes[:'location']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
message_id == o.message_id &&
-
account_id == o.account_id &&
-
source_tn == o.source_tn &&
-
destination_tn == o.destination_tn &&
-
message_status == o.message_status &&
-
message_direction == o.message_direction &&
-
message_type == o.message_type &&
-
segment_count == o.segment_count &&
-
error_code == o.error_code &&
-
receive_time == o.receive_time &&
-
carrier_name == o.carrier_name &&
-
message_size == o.message_size &&
-
message_length == o.message_length &&
-
attachment_count == o.attachment_count &&
-
recipient_count == o.recipient_count &&
-
campaign_class == o.campaign_class &&
-
campaign_id == o.campaign_id &&
-
bw_latency == o.bw_latency &&
-
carrier_latency == o.carrier_latency &&
-
calling_number_country_a3 == o.calling_number_country_a3 &&
-
called_number_country_a3 == o.called_number_country_a3 &&
-
product == o.product &&
-
location == o.location
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[message_id, account_id, source_tn, destination_tn, message_status, message_direction, message_type, segment_count, error_code, receive_time, carrier_name, message_size, message_length, attachment_count, recipient_count, campaign_class, campaign_id, bw_latency, carrier_latency, calling_number_country_a3, called_number_country_a3, product, location].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
69
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
69
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
69
elsif !attributes[attribute_map[key]].nil?
-
48
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
92
value = self.send(attr)
-
92
if value.nil?
-
42
is_nullable = self.class.openapi_nullable.include?(attr)
-
42
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
50
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LookupErrorResponse < ApiModelBase
-
1
attr_accessor :links
-
-
# The phone number lookup response data
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
23
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'links' => :'Array<LinkSchema>',
-
:'data' => :'Object',
-
:'errors' => :'Array<LookupErrorSchema>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'links')
-
4
if (value = attributes[:'links']).is_a?(Array)
-
4
self.links = value
-
end
-
end
-
-
6
if attributes.key?(:'data')
-
4
self.data = attributes[:'data']
-
end
-
-
6
if attributes.key?(:'errors')
-
4
if (value = attributes[:'errors']).is_a?(Array)
-
4
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LookupErrorSchema < ApiModelBase
-
# Validation error code
-
1
attr_accessor :code
-
-
# Description of validation error
-
1
attr_accessor :description
-
-
# Type of validation error
-
1
attr_accessor :type
-
-
1
attr_accessor :meta
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
110
{
-
:'code' => :'code',
-
:'description' => :'description',
-
:'type' => :'type',
-
:'meta' => :'meta'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
27
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'code' => :'String',
-
:'description' => :'String',
-
:'type' => :'String',
-
:'meta' => :'LookupErrorSchemaMeta'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
9
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
27
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorSchema` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
26
acceptable_attribute_map = self.class.acceptable_attribute_map
-
26
attributes = attributes.each_with_object({}) { |(k, v), h|
-
77
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
76
h[k.to_sym] = v
-
}
-
-
25
if attributes.key?(:'code')
-
25
self.code = attributes[:'code']
-
else
-
self.code = nil
-
end
-
-
24
if attributes.key?(:'description')
-
24
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
23
if attributes.key?(:'type')
-
23
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
22
if attributes.key?(:'meta')
-
4
self.meta = attributes[:'meta']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @code.nil?
-
invalid_properties.push('invalid value for "code", code cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @code.nil?
-
return false if @description.nil?
-
return false if @type.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] code Value to be assigned
-
1
def code=(code)
-
25
if code.nil?
-
1
fail ArgumentError, 'code cannot be nil'
-
end
-
-
24
@code = code
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
24
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
23
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
23
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
22
@type = type
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
code == o.code &&
-
description == o.description &&
-
type == o.type &&
-
meta == o.meta
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[code, description, type, meta].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
20
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
20
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
20
elsif !attributes[attribute_map[key]].nil?
-
16
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
10
hash = {}
-
10
self.class.attribute_map.each_pair do |attr, param|
-
40
value = self.send(attr)
-
40
if value.nil?
-
8
is_nullable = self.class.openapi_nullable.include?(attr)
-
8
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
32
hash[param] = _to_hash(value)
-
end
-
10
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class LookupErrorSchemaMeta < ApiModelBase
-
1
attr_accessor :phone_numbers
-
-
# Message describing the error
-
1
attr_accessor :message
-
-
# Error code associated with the message
-
1
attr_accessor :code
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
41
{
-
:'phone_numbers' => :'phoneNumbers',
-
:'message' => :'message',
-
:'code' => :'code'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'phone_numbers' => :'Array<String>',
-
:'message' => :'String',
-
:'code' => :'Integer'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorSchemaMeta` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
25
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchemaMeta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
24
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'phone_numbers')
-
8
if (value = attributes[:'phone_numbers']).is_a?(Array)
-
8
self.phone_numbers = value
-
end
-
end
-
-
10
if attributes.key?(:'message')
-
8
self.message = attributes[:'message']
-
end
-
-
10
if attributes.key?(:'code')
-
8
self.code = attributes[:'code']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
phone_numbers == o.phone_numbers &&
-
message == o.message &&
-
code == o.code
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[phone_numbers, message, code].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Carrier information results for the specified telephone number.
-
1
class LookupResult < ApiModelBase
-
# The telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
1
attr_accessor :line_type
-
-
# The messaging service provider of the telephone number.
-
1
attr_accessor :messaging_provider
-
-
# The voice service provider of the telephone number.
-
1
attr_accessor :voice_provider
-
-
# The country code of the telephone number in ISO 3166-1 alpha-3 format.
-
1
attr_accessor :country_code_a3
-
-
# [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number.
-
1
attr_accessor :deactivation_reporter
-
-
# [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event.
-
1
attr_accessor :deactivation_date
-
-
1
attr_accessor :deactivation_event
-
-
1
attr_accessor :latest_message_delivery_status
-
-
# [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes.
-
1
attr_accessor :initial_message_delivery_status_date
-
-
# [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes.
-
1
attr_accessor :latest_message_delivery_status_date
-
-
# [RCS-Only](#section/RCS-Only). Indicates whether the phone number is capable of receiving RCS messages. Value will be null if account has RCS, but no value was returned. Absent when account does not have RCS.
-
1
attr_accessor :rcs_enabled
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
451
{
-
:'phone_number' => :'phoneNumber',
-
:'line_type' => :'lineType',
-
:'messaging_provider' => :'messagingProvider',
-
:'voice_provider' => :'voiceProvider',
-
:'country_code_a3' => :'countryCodeA3',
-
:'deactivation_reporter' => :'deactivationReporter',
-
:'deactivation_date' => :'deactivationDate',
-
:'deactivation_event' => :'deactivationEvent',
-
:'latest_message_delivery_status' => :'latestMessageDeliveryStatus',
-
:'initial_message_delivery_status_date' => :'initialMessageDeliveryStatusDate',
-
:'latest_message_delivery_status_date' => :'latestMessageDeliveryStatusDate',
-
:'rcs_enabled' => :'rcsEnabled'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
24
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
11
{
-
:'phone_number' => :'String',
-
:'line_type' => :'LineTypeEnum',
-
:'messaging_provider' => :'String',
-
:'voice_provider' => :'String',
-
:'country_code_a3' => :'String',
-
:'deactivation_reporter' => :'String',
-
:'deactivation_date' => :'String',
-
:'deactivation_event' => :'DeactivationEventEnum',
-
:'latest_message_delivery_status' => :'LatestMessageDeliveryStatusEnum',
-
:'initial_message_delivery_status_date' => :'Date',
-
:'latest_message_delivery_status_date' => :'Date',
-
:'rcs_enabled' => :'Boolean'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
45
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
24
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupResult` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
23
acceptable_attribute_map = self.class.acceptable_attribute_map
-
23
attributes = attributes.each_with_object({}) { |(k, v), h|
-
121
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
120
h[k.to_sym] = v
-
}
-
-
22
if attributes.key?(:'phone_number')
-
20
self.phone_number = attributes[:'phone_number']
-
end
-
-
22
if attributes.key?(:'line_type')
-
12
self.line_type = attributes[:'line_type']
-
end
-
-
22
if attributes.key?(:'messaging_provider')
-
8
self.messaging_provider = attributes[:'messaging_provider']
-
end
-
-
22
if attributes.key?(:'voice_provider')
-
12
self.voice_provider = attributes[:'voice_provider']
-
end
-
-
22
if attributes.key?(:'country_code_a3')
-
12
self.country_code_a3 = attributes[:'country_code_a3']
-
end
-
-
22
if attributes.key?(:'deactivation_reporter')
-
8
self.deactivation_reporter = attributes[:'deactivation_reporter']
-
end
-
-
22
if attributes.key?(:'deactivation_date')
-
8
self.deactivation_date = attributes[:'deactivation_date']
-
end
-
-
22
if attributes.key?(:'deactivation_event')
-
8
self.deactivation_event = attributes[:'deactivation_event']
-
end
-
-
22
if attributes.key?(:'latest_message_delivery_status')
-
12
self.latest_message_delivery_status = attributes[:'latest_message_delivery_status']
-
end
-
-
22
if attributes.key?(:'initial_message_delivery_status_date')
-
8
self.initial_message_delivery_status_date = attributes[:'initial_message_delivery_status_date']
-
end
-
-
22
if attributes.key?(:'latest_message_delivery_status_date')
-
8
self.latest_message_delivery_status_date = attributes[:'latest_message_delivery_status_date']
-
end
-
-
22
if attributes.key?(:'rcs_enabled')
-
4
self.rcs_enabled = attributes[:'rcs_enabled']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
phone_number == o.phone_number &&
-
line_type == o.line_type &&
-
messaging_provider == o.messaging_provider &&
-
voice_provider == o.voice_provider &&
-
country_code_a3 == o.country_code_a3 &&
-
deactivation_reporter == o.deactivation_reporter &&
-
deactivation_date == o.deactivation_date &&
-
deactivation_event == o.deactivation_event &&
-
latest_message_delivery_status == o.latest_message_delivery_status &&
-
initial_message_delivery_status_date == o.initial_message_delivery_status_date &&
-
latest_message_delivery_status_date == o.latest_message_delivery_status_date &&
-
rcs_enabled == o.rcs_enabled
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[phone_number, line_type, messaging_provider, voice_provider, country_code_a3, deactivation_reporter, deactivation_date, deactivation_event, latest_message_delivery_status, initial_message_delivery_status_date, latest_message_delivery_status_date, rcs_enabled].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
11
return nil unless attributes.is_a?(Hash)
-
11
attributes = attributes.transform_keys(&:to_sym)
-
11
transformed_hash = {}
-
11
openapi_types.each_pair do |key, type|
-
132
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
132
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
132
elsif !attributes[attribute_map[key]].nil?
-
78
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
11
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
72
value = self.send(attr)
-
72
if value.nil?
-
44
is_nullable = self.class.openapi_nullable.include?(attr)
-
44
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# This event is sent to the url informed when requesting a machine detection operation. It contains the machine detection operation result, which can be: human, answering-machine, silence, timeout, error. This event is not sent when sync answering machine detection mode is chosen.
-
1
class MachineDetectionCompleteCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
attr_accessor :machine_detection_result
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
67
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'machine_detection_result' => :'machineDetectionResult'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'machine_detection_result' => :'MachineDetectionResult'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'machine_detection_result'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MachineDetectionCompleteCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
57
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
56
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'machine_detection_result')
-
4
self.machine_detection_result = attributes[:'machine_detection_result']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
machine_detection_result == o.machine_detection_result
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, machine_detection_result].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
14
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
14
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
14
elsif !attributes[attribute_map[key]].nil?
-
14
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
28
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The machine detection request used to perform <a href='/docs/voice/guides/machineDetection'>machine detection</a> on the call. Currently, there is an issue where decimal values are not getting processed correctly. Please use whole number values. We are working to resolve this issue. Please contact Bandwidth Support if you need more information.
-
1
class MachineDetectionConfiguration < ApiModelBase
-
1
attr_accessor :mode
-
-
# The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent.
-
1
attr_accessor :detection_timeout
-
-
# If no speech is detected in this period, a callback with a 'silence' result is sent.
-
1
attr_accessor :silence_timeout
-
-
# When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'.
-
1
attr_accessor :speech_threshold
-
-
# Amount of silence (in seconds) before assuming the callee has finished speaking.
-
1
attr_accessor :speech_end_threshold
-
-
# When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value.
-
1
attr_accessor :machine_speech_end_threshold
-
-
# If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately.
-
1
attr_accessor :delay_result
-
-
# The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode.
-
1
attr_accessor :callback_url
-
-
1
attr_accessor :callback_method
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond
-
1
attr_accessor :fallback_url
-
-
1
attr_accessor :fallback_method
-
-
# Basic auth username.
-
1
attr_accessor :fallback_username
-
-
# Basic auth password.
-
1
attr_accessor :fallback_password
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
79
{
-
:'mode' => :'mode',
-
:'detection_timeout' => :'detectionTimeout',
-
:'silence_timeout' => :'silenceTimeout',
-
:'speech_threshold' => :'speechThreshold',
-
:'speech_end_threshold' => :'speechEndThreshold',
-
:'machine_speech_end_threshold' => :'machineSpeechEndThreshold',
-
:'delay_result' => :'delayResult',
-
:'callback_url' => :'callbackUrl',
-
:'callback_method' => :'callbackMethod',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'fallback_url' => :'fallbackUrl',
-
:'fallback_method' => :'fallbackMethod',
-
:'fallback_username' => :'fallbackUsername',
-
:'fallback_password' => :'fallbackPassword'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
15
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'mode' => :'MachineDetectionModeEnum',
-
:'detection_timeout' => :'Float',
-
:'silence_timeout' => :'Float',
-
:'speech_threshold' => :'Float',
-
:'speech_end_threshold' => :'Float',
-
:'machine_speech_end_threshold' => :'Float',
-
:'delay_result' => :'Boolean',
-
:'callback_url' => :'String',
-
:'callback_method' => :'CallbackMethodEnum',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'fallback_url' => :'String',
-
:'fallback_method' => :'CallbackMethodEnum',
-
:'fallback_username' => :'String',
-
:'fallback_password' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'detection_timeout',
-
:'silence_timeout',
-
:'speech_threshold',
-
:'speech_end_threshold',
-
:'machine_speech_end_threshold',
-
:'delay_result',
-
:'callback_url',
-
:'callback_method',
-
:'username',
-
:'password',
-
:'fallback_url',
-
:'fallback_method',
-
:'fallback_username',
-
:'fallback_password'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
15
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MachineDetectionConfiguration` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
14
acceptable_attribute_map = self.class.acceptable_attribute_map
-
14
attributes = attributes.each_with_object({}) { |(k, v), h|
-
82
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
81
h[k.to_sym] = v
-
}
-
-
13
if attributes.key?(:'mode')
-
5
self.mode = attributes[:'mode']
-
else
-
8
self.mode = 'async'
-
end
-
-
13
if attributes.key?(:'detection_timeout')
-
5
self.detection_timeout = attributes[:'detection_timeout']
-
else
-
8
self.detection_timeout = 15
-
end
-
-
13
if attributes.key?(:'silence_timeout')
-
5
self.silence_timeout = attributes[:'silence_timeout']
-
else
-
8
self.silence_timeout = 10
-
end
-
-
13
if attributes.key?(:'speech_threshold')
-
5
self.speech_threshold = attributes[:'speech_threshold']
-
else
-
8
self.speech_threshold = 10
-
end
-
-
13
if attributes.key?(:'speech_end_threshold')
-
5
self.speech_end_threshold = attributes[:'speech_end_threshold']
-
else
-
8
self.speech_end_threshold = 5
-
end
-
-
13
if attributes.key?(:'machine_speech_end_threshold')
-
5
self.machine_speech_end_threshold = attributes[:'machine_speech_end_threshold']
-
end
-
-
13
if attributes.key?(:'delay_result')
-
5
self.delay_result = attributes[:'delay_result']
-
else
-
8
self.delay_result = false
-
end
-
-
13
if attributes.key?(:'callback_url')
-
6
self.callback_url = attributes[:'callback_url']
-
end
-
-
12
if attributes.key?(:'callback_method')
-
5
self.callback_method = attributes[:'callback_method']
-
else
-
7
self.callback_method = 'POST'
-
end
-
-
12
if attributes.key?(:'username')
-
6
self.username = attributes[:'username']
-
end
-
-
11
if attributes.key?(:'password')
-
6
self.password = attributes[:'password']
-
end
-
-
10
if attributes.key?(:'fallback_url')
-
6
self.fallback_url = attributes[:'fallback_url']
-
end
-
-
9
if attributes.key?(:'fallback_method')
-
5
self.fallback_method = attributes[:'fallback_method']
-
else
-
4
self.fallback_method = 'POST'
-
end
-
-
9
if attributes.key?(:'fallback_username')
-
6
self.fallback_username = attributes[:'fallback_username']
-
end
-
-
8
if attributes.key?(:'fallback_password')
-
6
self.fallback_password = attributes[:'fallback_password']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@callback_url.nil? && @callback_url.to_s.length > 2048
-
invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_url.nil? && @fallback_url.to_s.length > 2048
-
invalid_properties.push('invalid value for "fallback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@callback_url.nil? && @callback_url.to_s.length > 2048
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@fallback_url.nil? && @fallback_url.to_s.length > 2048
-
return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] callback_url Value to be assigned
-
1
def callback_url=(callback_url)
-
6
if !callback_url.nil? && callback_url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2048.'
-
end
-
-
5
@callback_url = callback_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
6
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
6
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_url Value to be assigned
-
1
def fallback_url=(fallback_url)
-
6
if !fallback_url.nil? && fallback_url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "fallback_url", the character length must be smaller than or equal to 2048.'
-
end
-
-
5
@fallback_url = fallback_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_username Value to be assigned
-
1
def fallback_username=(fallback_username)
-
6
if !fallback_username.nil? && fallback_username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_username = fallback_username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_password Value to be assigned
-
1
def fallback_password=(fallback_password)
-
6
if !fallback_password.nil? && fallback_password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_password = fallback_password
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
mode == o.mode &&
-
detection_timeout == o.detection_timeout &&
-
silence_timeout == o.silence_timeout &&
-
speech_threshold == o.speech_threshold &&
-
speech_end_threshold == o.speech_end_threshold &&
-
machine_speech_end_threshold == o.machine_speech_end_threshold &&
-
delay_result == o.delay_result &&
-
callback_url == o.callback_url &&
-
callback_method == o.callback_method &&
-
username == o.username &&
-
password == o.password &&
-
fallback_url == o.fallback_url &&
-
fallback_method == o.fallback_method &&
-
fallback_username == o.fallback_username &&
-
fallback_password == o.fallback_password
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[mode, detection_timeout, silence_timeout, speech_threshold, speech_end_threshold, machine_speech_end_threshold, delay_result, callback_url, callback_method, username, password, fallback_url, fallback_method, fallback_username, fallback_password].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
15
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
15
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
15
elsif !attributes[attribute_map[key]].nil?
-
15
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
45
value = self.send(attr)
-
45
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
45
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MachineDetectionModeEnum
-
1
SYNC = 'sync'.freeze
-
1
ASYNC = 'async'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [SYNC, ASYNC].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if MachineDetectionModeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #MachineDetectionModeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# (optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete
-
1
class MachineDetectionResult < ApiModelBase
-
# Possible values are answering-machine, human, silence, timeout, or error.
-
1
attr_accessor :value
-
-
# The amount of time it took to determine the result.
-
1
attr_accessor :duration
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
37
{
-
:'value' => :'value',
-
:'duration' => :'duration'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'value' => :'String',
-
:'duration' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MachineDetectionResult` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'value')
-
6
self.value = attributes[:'value']
-
end
-
-
8
if attributes.key?(:'duration')
-
6
self.duration = attributes[:'duration']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
value == o.value &&
-
duration == o.duration
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[value, duration].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Media < ApiModelBase
-
1
attr_accessor :content
-
-
1
attr_accessor :content_length
-
-
1
attr_accessor :media_name
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'content' => :'content',
-
:'content_length' => :'contentLength',
-
:'media_name' => :'mediaName'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'content' => :'String',
-
:'content_length' => :'Integer',
-
:'media_name' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Media` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Media`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'content')
-
5
self.content = attributes[:'content']
-
end
-
-
7
if attributes.key?(:'content_length')
-
5
self.content_length = attributes[:'content_length']
-
end
-
-
7
if attributes.key?(:'media_name')
-
5
self.media_name = attributes[:'media_name']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
content == o.content &&
-
content_length == o.content_length &&
-
media_name == o.media_name
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[content, content_length, media_name].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Message < ApiModelBase
-
# The id of the message.
-
1
attr_accessor :id
-
-
# The Bandwidth phone number associated with the message.
-
1
attr_accessor :owner
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
# The datetime stamp of the message in ISO 8601
-
1
attr_accessor :time
-
-
# The number of segments the user's message is broken into before sending over carrier networks.
-
1
attr_accessor :segment_count
-
-
1
attr_accessor :direction
-
-
# The phone number recipients of the message.
-
1
attr_accessor :to
-
-
# The phone number the message was sent from.
-
1
attr_accessor :from
-
-
# The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name.
-
1
attr_accessor :media
-
-
# The contents of the message.
-
1
attr_accessor :text
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
1
attr_accessor :priority
-
-
# A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future.
-
1
attr_accessor :expiration
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
118
{
-
:'id' => :'id',
-
:'owner' => :'owner',
-
:'application_id' => :'applicationId',
-
:'time' => :'time',
-
:'segment_count' => :'segmentCount',
-
:'direction' => :'direction',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'media' => :'media',
-
:'text' => :'text',
-
:'tag' => :'tag',
-
:'priority' => :'priority',
-
:'expiration' => :'expiration'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
11
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'id' => :'String',
-
:'owner' => :'String',
-
:'application_id' => :'String',
-
:'time' => :'Time',
-
:'segment_count' => :'Integer',
-
:'direction' => :'MessageDirectionEnum',
-
:'to' => :'Array<String>',
-
:'from' => :'String',
-
:'media' => :'Array<String>',
-
:'text' => :'String',
-
:'tag' => :'String',
-
:'priority' => :'PriorityEnum',
-
:'expiration' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
11
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Message` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
10
acceptable_attribute_map = self.class.acceptable_attribute_map
-
10
attributes = attributes.each_with_object({}) { |(k, v), h|
-
92
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Message`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
91
h[k.to_sym] = v
-
}
-
-
9
if attributes.key?(:'id')
-
7
self.id = attributes[:'id']
-
end
-
-
9
if attributes.key?(:'owner')
-
7
self.owner = attributes[:'owner']
-
end
-
-
9
if attributes.key?(:'application_id')
-
7
self.application_id = attributes[:'application_id']
-
end
-
-
9
if attributes.key?(:'time')
-
7
self.time = attributes[:'time']
-
end
-
-
9
if attributes.key?(:'segment_count')
-
7
self.segment_count = attributes[:'segment_count']
-
end
-
-
9
if attributes.key?(:'direction')
-
7
self.direction = attributes[:'direction']
-
end
-
-
9
if attributes.key?(:'to')
-
7
if (value = attributes[:'to']).is_a?(Array)
-
7
self.to = value
-
end
-
end
-
-
9
if attributes.key?(:'from')
-
7
self.from = attributes[:'from']
-
end
-
-
9
if attributes.key?(:'media')
-
7
if (value = attributes[:'media']).is_a?(Array)
-
7
self.media = value
-
end
-
end
-
-
9
if attributes.key?(:'text')
-
7
self.text = attributes[:'text']
-
end
-
-
9
if attributes.key?(:'tag')
-
7
self.tag = attributes[:'tag']
-
end
-
-
9
if attributes.key?(:'priority')
-
7
self.priority = attributes[:'priority']
-
end
-
-
9
if attributes.key?(:'expiration')
-
7
self.expiration = attributes[:'expiration']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
8
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
7
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] media Value to be assigned
-
1
def media=(media)
-
8
if media.nil?
-
1
fail ArgumentError, 'media cannot be nil'
-
end
-
-
7
@media = media
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
owner == o.owner &&
-
application_id == o.application_id &&
-
time == o.time &&
-
segment_count == o.segment_count &&
-
direction == o.direction &&
-
to == o.to &&
-
from == o.from &&
-
media == o.media &&
-
text == o.text &&
-
tag == o.tag &&
-
priority == o.priority &&
-
expiration == o.expiration
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, owner, application_id, time, segment_count, direction, to, from, media, text, tag, priority, expiration].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
26
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
26
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
8
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
22
elsif !attributes[attribute_map[key]].nil?
-
22
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
26
value = self.send(attr)
-
26
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessageDirectionEnum
-
1
IN = 'in'.freeze
-
1
OUT = 'out'.freeze
-
-
1
def self.all_vars
-
14
@all_vars ||= [IN, OUT].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
11
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
11
return value if MessageDirectionEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #MessageDirectionEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessageRequest < ApiModelBase
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
# The phone number(s) the message should be sent to in E164 format.
-
1
attr_accessor :to
-
-
# Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter.
-
1
attr_accessor :from
-
-
# The contents of the text message. Must be 2048 characters or less.
-
1
attr_accessor :text
-
-
# A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters.
-
1
attr_accessor :media
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
1
attr_accessor :priority
-
-
# A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future.
-
1
attr_accessor :expiration
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
49
{
-
:'application_id' => :'applicationId',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'text' => :'text',
-
:'media' => :'media',
-
:'tag' => :'tag',
-
:'priority' => :'priority',
-
:'expiration' => :'expiration'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'application_id' => :'String',
-
:'to' => :'Array<String>',
-
:'from' => :'String',
-
:'text' => :'String',
-
:'media' => :'Array<String>',
-
:'tag' => :'String',
-
:'priority' => :'PriorityEnum',
-
:'expiration' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
63
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
62
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'application_id')
-
11
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
10
if attributes.key?(:'to')
-
10
if (value = attributes[:'to']).is_a?(Array)
-
10
self.to = value
-
end
-
else
-
self.to = nil
-
end
-
-
10
if attributes.key?(:'from')
-
10
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
9
if attributes.key?(:'text')
-
7
self.text = attributes[:'text']
-
end
-
-
9
if attributes.key?(:'media')
-
6
if (value = attributes[:'media']).is_a?(Array)
-
6
self.media = value
-
end
-
end
-
-
9
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
9
if attributes.key?(:'priority')
-
6
self.priority = attributes[:'priority']
-
end
-
-
9
if attributes.key?(:'expiration')
-
6
self.expiration = attributes[:'expiration']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if !@text.nil? && @text.to_s.length > 2048
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @application_id.nil?
-
return false if @to.nil?
-
return false if @from.nil?
-
return false if !@text.nil? && @text.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
11
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
10
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
11
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
10
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
10
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
9
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
9
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
8
if text.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.'
-
end
-
-
7
@text = text
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
application_id == o.application_id &&
-
to == o.to &&
-
from == o.from &&
-
text == o.text &&
-
media == o.media &&
-
tag == o.tag &&
-
priority == o.priority &&
-
expiration == o.expiration
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[application_id, to, from, text, media, tag, priority, expiration].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
24
value = self.send(attr)
-
24
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessageStatusEnum
-
1
RECEIVED = 'RECEIVED'.freeze
-
1
QUEUED = 'QUEUED'.freeze
-
1
SENDING = 'SENDING'.freeze
-
1
SENT = 'SENT'.freeze
-
1
FAILED = 'FAILED'.freeze
-
1
DELIVERED = 'DELIVERED'.freeze
-
1
ACCEPTED = 'ACCEPTED'.freeze
-
1
UNDELIVERED = 'UNDELIVERED'.freeze
-
-
1
def self.all_vars
-
13
@all_vars ||= [RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
11
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
11
return value if MessageStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #MessageStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessageTypeEnum
-
1
SMS = 'sms'.freeze
-
1
MMS = 'mms'.freeze
-
1
RCS = 'rcs'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [SMS, MMS, RCS].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if MessageTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #MessageTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessagesList < ApiModelBase
-
# The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000.
-
1
attr_accessor :total_count
-
-
1
attr_accessor :page_info
-
-
1
attr_accessor :messages
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'total_count' => :'totalCount',
-
:'page_info' => :'pageInfo',
-
:'messages' => :'messages'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'total_count' => :'Integer',
-
:'page_info' => :'PageInfo',
-
:'messages' => :'Array<ListMessageItem>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessagesList` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagesList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'total_count')
-
5
self.total_count = attributes[:'total_count']
-
end
-
-
7
if attributes.key?(:'page_info')
-
5
self.page_info = attributes[:'page_info']
-
end
-
-
7
if attributes.key?(:'messages')
-
5
if (value = attributes[:'messages']).is_a?(Array)
-
5
self.messages = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
total_count == o.total_count &&
-
page_info == o.page_info &&
-
messages == o.messages
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[total_count, page_info, messages].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessagingCodeResponse < ApiModelBase
-
# Messaging API Message ID.
-
1
attr_accessor :message_id
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
20
{
-
:'message_id' => :'messageId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'message_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessagingCodeResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
6
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagingCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
5
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'message_id')
-
5
self.message_id = attributes[:'message_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
message_id == o.message_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[message_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MessagingRequestError < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :description
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
21
{
-
:'type' => :'type',
-
:'description' => :'description'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'String',
-
:'description' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessagingRequestError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagingRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'type')
-
8
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
7
if attributes.key?(:'description')
-
7
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @description.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
8
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
7
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
7
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
6
@description = description
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
description == o.description
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, description].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MfaForbiddenRequestError < ApiModelBase
-
# The message containing the reason behind the request being forbidden.
-
1
attr_accessor :message
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
15
{
-
:'message' => :'message'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'message' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MfaForbiddenRequestError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
5
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaForbiddenRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
4
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'message')
-
4
self.message = attributes[:'message']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
message == o.message
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[message].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MfaRequestError < ApiModelBase
-
# A message describing the error with your request.
-
1
attr_accessor :error
-
-
# The associated requestId from AWS.
-
1
attr_accessor :request_id
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
19
{
-
:'error' => :'error',
-
:'request_id' => :'requestId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'error' => :'String',
-
:'request_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MfaRequestError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
9
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
8
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'error')
-
4
self.error = attributes[:'error']
-
end
-
-
6
if attributes.key?(:'request_id')
-
4
self.request_id = attributes[:'request_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
error == o.error &&
-
request_id == o.request_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[error, request_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MfaUnauthorizedRequestError < ApiModelBase
-
# Unauthorized
-
1
attr_accessor :message
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
15
{
-
:'message' => :'message'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'message' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MfaUnauthorizedRequestError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
5
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaUnauthorizedRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
4
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'message')
-
4
self.message = attributes[:'message']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
message == o.message
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[message].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MmsMessageContent < ApiModelBase
-
# The contents of the text message. Must be 2048 characters or less.
-
1
attr_accessor :text
-
-
1
attr_accessor :media
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
49
{
-
:'text' => :'text',
-
:'media' => :'media'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
22
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'text' => :'String',
-
:'media' => :'Array<MmsMessageContentFile>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
22
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MmsMessageContent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
21
acceptable_attribute_map = self.class.acceptable_attribute_map
-
21
attributes = attributes.each_with_object({}) { |(k, v), h|
-
23
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
22
h[k.to_sym] = v
-
}
-
-
20
if attributes.key?(:'text')
-
18
self.text = attributes[:'text']
-
end
-
-
18
if attributes.key?(:'media')
-
4
if (value = attributes[:'media']).is_a?(Array)
-
4
self.media = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@text.nil? && @text.to_s.length > 2048
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@text.nil? && @text.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
18
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
17
if text.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.'
-
end
-
-
16
@text = text
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
4
return true if self.equal?(o)
-
4
self.class == o.class &&
-
text == o.text &&
-
media == o.media
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text, media].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MmsMessageContentFile < ApiModelBase
-
# The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see more at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823216-what-are-the-mms-file-size-limits) for more details.
-
1
attr_accessor :file_url
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
27
{
-
:'file_url' => :'fileUrl'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'file_url' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MmsMessageContentFile` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'file_url')
-
12
self.file_url = attributes[:'file_url']
-
else
-
self.file_url = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @file_url.nil?
-
invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
-
end
-
-
if @file_url.to_s.length > 1000
-
invalid_properties.push('invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @file_url.nil?
-
return false if @file_url.to_s.length > 1000
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] file_url Value to be assigned
-
1
def file_url=(file_url)
-
12
if file_url.nil?
-
1
fail ArgumentError, 'file_url cannot be nil'
-
end
-
-
11
if file_url.to_s.length > 1000
-
1
fail ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.'
-
end
-
-
10
@file_url = file_url
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
file_url == o.file_url
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[file_url].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
module MultiChannelAction
-
1
class << self
-
# List of class defined in anyOf (OpenAPI v3)
-
1
def openapi_any_of
-
2
[
-
:'MultiChannelActionCalendarEvent',
-
:'RbmActionBase',
-
:'RbmActionDial',
-
:'RbmActionOpenUrl',
-
:'RbmActionViewLocation'
-
]
-
end
-
-
# Discriminator's property name (OpenAPI v3)
-
1
def openapi_discriminator_name
-
15
:'type'
-
end
-
-
# Discriminator's mapping (OpenAPI v3)
-
1
def openapi_discriminator_mapping
-
20
{
-
:'CREATE_CALENDAR_EVENT' => :'MultiChannelActionCalendarEvent',
-
:'DIAL_PHONE' => :'RbmActionDial',
-
:'OPEN_URL' => :'RbmActionOpenUrl',
-
:'REPLY' => :'RbmActionBase',
-
:'REQUEST_LOCATION' => :'RbmActionBase',
-
:'SHOW_LOCATION' => :'RbmActionViewLocation'
-
}
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of anyOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
14
discriminator_value = data[openapi_discriminator_name]
-
14
return nil if discriminator_value.nil?
-
-
13
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
-
13
return nil unless klass
-
-
12
Bandwidth.const_get(klass).build_from_hash(data)
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelActionCalendarEvent < ApiModelBase
-
1
attr_accessor :type
-
-
# Displayed text for user to click
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
# The title of the event.
-
1
attr_accessor :title
-
-
# The start time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00.
-
1
attr_accessor :start_time
-
-
# The end time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00.
-
1
attr_accessor :end_time
-
-
# The description of the event.
-
1
attr_accessor :description
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
49
{
-
:'type' => :'type',
-
:'text' => :'text',
-
:'postback_data' => :'postbackData',
-
:'title' => :'title',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'description' => :'description'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
18
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'RbmActionTypeEnum',
-
:'text' => :'String',
-
:'postback_data' => :'String',
-
:'title' => :'String',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'description' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'RbmActionBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
18
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelActionCalendarEvent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
17
acceptable_attribute_map = self.class.acceptable_attribute_map
-
17
attributes = attributes.each_with_object({}) { |(k, v), h|
-
78
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelActionCalendarEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
77
h[k.to_sym] = v
-
}
-
-
16
if attributes.key?(:'type')
-
16
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
15
if attributes.key?(:'text')
-
15
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
13
if attributes.key?(:'postback_data')
-
13
self.postback_data = attributes[:'postback_data']
-
else
-
self.postback_data = nil
-
end
-
-
11
if attributes.key?(:'title')
-
11
self.title = attributes[:'title']
-
else
-
self.title = nil
-
end
-
-
9
if attributes.key?(:'start_time')
-
9
self.start_time = attributes[:'start_time']
-
else
-
self.start_time = nil
-
end
-
-
8
if attributes.key?(:'end_time')
-
8
self.end_time = attributes[:'end_time']
-
else
-
self.end_time = nil
-
end
-
-
7
if attributes.key?(:'description')
-
5
self.description = attributes[:'description']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 25
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
if @postback_data.nil?
-
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
-
end
-
-
if @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
if @title.nil?
-
invalid_properties.push('invalid value for "title", title cannot be nil.')
-
end
-
-
if @title.to_s.length > 100
-
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 100.')
-
end
-
-
if @start_time.nil?
-
invalid_properties.push('invalid value for "start_time", start_time cannot be nil.')
-
end
-
-
if @end_time.nil?
-
invalid_properties.push('invalid value for "end_time", end_time cannot be nil.')
-
end
-
-
if !@description.nil? && @description.to_s.length > 500
-
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @text.nil?
-
return false if @text.to_s.length > 25
-
return false if @postback_data.nil?
-
return false if @postback_data.to_s.length > 2048
-
return false if @title.nil?
-
return false if @title.to_s.length > 100
-
return false if @start_time.nil?
-
return false if @end_time.nil?
-
return false if !@description.nil? && @description.to_s.length > 500
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
16
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
15
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
15
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
14
if text.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
-
end
-
-
13
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
13
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
12
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
11
@postback_data = postback_data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] title Value to be assigned
-
1
def title=(title)
-
11
if title.nil?
-
1
fail ArgumentError, 'title cannot be nil'
-
end
-
-
10
if title.to_s.length > 100
-
1
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.'
-
end
-
-
9
@title = title
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] start_time Value to be assigned
-
1
def start_time=(start_time)
-
9
if start_time.nil?
-
1
fail ArgumentError, 'start_time cannot be nil'
-
end
-
-
8
@start_time = start_time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] end_time Value to be assigned
-
1
def end_time=(end_time)
-
8
if end_time.nil?
-
1
fail ArgumentError, 'end_time cannot be nil'
-
end
-
-
7
@end_time = end_time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
7
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
6
if description.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
-
end
-
-
5
@description = description
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
text == o.text &&
-
postback_data == o.postback_data &&
-
title == o.title &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
description == o.description
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, text, postback_data, title, start_time, end_time, description].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
7
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
7
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
7
elsif !attributes[attribute_map[key]].nil?
-
7
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
14
value = self.send(attr)
-
14
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
14
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListMMSObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'MmsMessageContent'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListObjectBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListMMSObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
35
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListMMSObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
34
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'from')
-
10
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
9
if attributes.key?(:'application_id')
-
9
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
8
if attributes.key?(:'channel')
-
8
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
7
if attributes.key?(:'content')
-
7
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
10
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
9
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
9
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
8
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
8
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
7
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
7
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
6
@content = content
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListMMSResponseObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
# The Bandwidth senderId associated with the message. Identical to 'from'.
-
1
attr_accessor :owner
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content',
-
:'owner' => :'owner'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'MmsMessageContent',
-
:'owner' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListMMSObject',
-
:'MultiChannelChannelListOwnerObject'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListMMSResponseObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
46
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListMMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
45
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'from')
-
11
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
10
if attributes.key?(:'application_id')
-
10
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
9
if attributes.key?(:'channel')
-
9
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
8
if attributes.key?(:'content')
-
8
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
-
7
if attributes.key?(:'owner')
-
7
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
return false if @owner.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
11
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
10
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
10
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
9
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
9
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
8
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
8
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
7
@content = content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
7
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
6
@owner = owner
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content &&
-
owner == o.owner
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content, owner].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListObjectBase < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
26
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
11
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
11
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListObjectBase` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
10
acceptable_attribute_map = self.class.acceptable_attribute_map
-
10
attributes = attributes.each_with_object({}) { |(k, v), h|
-
25
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListObjectBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
24
h[k.to_sym] = v
-
}
-
-
9
if attributes.key?(:'from')
-
9
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
8
if attributes.key?(:'application_id')
-
8
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
7
if attributes.key?(:'channel')
-
7
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
9
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
8
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
8
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
7
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
7
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
6
@channel = channel
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListOwnerObject < ApiModelBase
-
# The Bandwidth senderId associated with the message. Identical to 'from'.
-
1
attr_accessor :owner
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
16
{
-
:'owner' => :'owner'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'owner' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListOwnerObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
8
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListOwnerObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
7
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'owner')
-
7
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @owner.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
7
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
6
@owner = owner
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
owner == o.owner
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[owner].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListRBMObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'MultiChannelChannelListRBMObjectAllOfContent'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListObjectBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListRBMObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
35
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
34
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'from')
-
10
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
9
if attributes.key?(:'application_id')
-
9
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
8
if attributes.key?(:'channel')
-
8
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
7
if attributes.key?(:'content')
-
7
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
10
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
9
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
9
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
8
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
8
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
7
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
7
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
6
@content = content
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The content of the message.
-
1
module MultiChannelChannelListRBMObjectAllOfContent
-
1
class << self
-
# List of class defined in oneOf (OpenAPI v3)
-
1
def openapi_one_of
-
8
[
-
:'RbmMessageContentRichCard',
-
:'RbmMessageContentText',
-
:'RbmMessageMedia'
-
]
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of oneOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
# Go through the list of oneOf items and attempt to identify the appropriate one.
-
# Note:
-
# - We do not attempt to check whether exactly one item matches.
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
-
# - TODO: scalar values are de facto behaving as if they were nullable.
-
# - TODO: logging when debugging is set.
-
6
openapi_one_of.each do |klass|
-
begin
-
14
next if klass == :AnyType # "nullable: true"
-
14
return find_and_cast_into_type(klass, data)
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
-
end
-
end
-
-
1
openapi_one_of.include?(:AnyType) ? data : nil
-
end
-
-
1
private
-
-
1
SchemaMismatchError = Class.new(StandardError)
-
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
-
1
def find_and_cast_into_type(klass, data)
-
14
return if data.nil?
-
-
14
case klass.to_s
-
when 'Boolean'
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
-
when 'Float'
-
return data if data.instance_of?(Float)
-
when 'Integer'
-
return data if data.instance_of?(Integer)
-
when 'Time'
-
return Time.parse(data)
-
when 'Date'
-
return Date.iso8601(data)
-
when 'String'
-
return data if data.instance_of?(String)
-
when 'Object' # "type: object"
-
return data if data.instance_of?(Hash)
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
-
if data.instance_of?(Array)
-
sub_type = Regexp.last_match[:sub_type]
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
-
end
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
-
sub_type = Regexp.last_match[:sub_type]
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
-
end
-
else # model
-
14
const = Bandwidth.const_get(klass)
-
14
if const
-
14
if const.respond_to?(:openapi_one_of) # nested oneOf model
-
6
model = const.build(data)
-
6
return model if model
-
else
-
# raise if data contains keys that are not known to the model
-
8
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
-
5
model = const.build_from_hash(data)
-
5
return model if model
-
end
-
end
-
end
-
-
6
raise # if no match by now, raise
-
rescue
-
9
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListRBMResponseObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
# The Bandwidth senderId associated with the message. Identical to 'from'.
-
1
attr_accessor :owner
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
57
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content',
-
:'owner' => :'owner'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'MultiChannelChannelListRBMObjectAllOfContent',
-
:'owner' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListOwnerObject',
-
:'MultiChannelChannelListRBMObject'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListRBMResponseObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
51
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
50
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'from')
-
12
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
11
if attributes.key?(:'application_id')
-
11
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
10
if attributes.key?(:'channel')
-
10
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
9
if attributes.key?(:'content')
-
9
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
-
8
if attributes.key?(:'owner')
-
8
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
return false if @owner.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
12
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
11
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
11
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
10
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
10
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
9
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
9
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
8
@content = content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
8
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
7
@owner = owner
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content &&
-
owner == o.owner
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content, owner].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
10
elsif !attributes[attribute_map[key]].nil?
-
10
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
10
value = self.send(attr)
-
10
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
module MultiChannelChannelListRequestObject
-
1
class << self
-
# List of class defined in anyOf (OpenAPI v3)
-
1
def openapi_any_of
-
2
[
-
:'MultiChannelChannelListMMSObject',
-
:'MultiChannelChannelListRBMObject',
-
:'MultiChannelChannelListSMSObject'
-
]
-
end
-
-
# Discriminator's property name (OpenAPI v3)
-
1
def openapi_discriminator_name
-
7
:'channel'
-
end
-
-
# Discriminator's mapping (OpenAPI v3)
-
1
def openapi_discriminator_mapping
-
10
{
-
:'MMS' => :'MultiChannelChannelListMMSObject',
-
:'RBM' => :'MultiChannelChannelListRBMObject',
-
:'SMS' => :'MultiChannelChannelListSMSObject'
-
}
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of anyOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
6
discriminator_value = data[openapi_discriminator_name]
-
6
return nil if discriminator_value.nil?
-
-
5
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
-
5
return nil unless klass
-
-
4
Bandwidth.const_get(klass).build_from_hash(data)
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
module MultiChannelChannelListResponseObject
-
1
class << self
-
# List of class defined in anyOf (OpenAPI v3)
-
1
def openapi_any_of
-
2
[
-
:'MultiChannelChannelListMMSResponseObject',
-
:'MultiChannelChannelListRBMResponseObject',
-
:'MultiChannelChannelListSMSResponseObject'
-
]
-
end
-
-
# Discriminator's property name (OpenAPI v3)
-
1
def openapi_discriminator_name
-
8
:'channel'
-
end
-
-
# Discriminator's mapping (OpenAPI v3)
-
1
def openapi_discriminator_mapping
-
11
{
-
:'MMS' => :'MultiChannelChannelListMMSResponseObject',
-
:'RBM' => :'MultiChannelChannelListRBMResponseObject',
-
:'SMS' => :'MultiChannelChannelListSMSResponseObject'
-
}
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of anyOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
7
discriminator_value = data[openapi_discriminator_name]
-
7
return nil if discriminator_value.nil?
-
-
6
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
-
6
return nil unless klass
-
-
5
Bandwidth.const_get(klass).build_from_hash(data)
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListSMSObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
56
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
18
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'SmsMessageContent'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListObjectBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
18
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListSMSObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
17
acceptable_attribute_map = self.class.acceptable_attribute_map
-
17
attributes = attributes.each_with_object({}) { |(k, v), h|
-
59
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListSMSObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
58
h[k.to_sym] = v
-
}
-
-
16
if attributes.key?(:'from')
-
16
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
15
if attributes.key?(:'application_id')
-
15
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
14
if attributes.key?(:'channel')
-
14
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
13
if attributes.key?(:'content')
-
13
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
16
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
15
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
15
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
14
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
14
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
13
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
13
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
12
@content = content
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
5
hash = {}
-
5
self.class.attribute_map.each_pair do |attr, param|
-
20
value = self.send(attr)
-
20
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
5
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelChannelListSMSResponseObject < ApiModelBase
-
# The sender ID of the message. This could be an alphanumeric sender ID.
-
1
attr_accessor :from
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :channel
-
-
1
attr_accessor :content
-
-
# The Bandwidth senderId associated with the message. Identical to 'from'.
-
1
attr_accessor :owner
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
64
{
-
:'from' => :'from',
-
:'application_id' => :'applicationId',
-
:'channel' => :'channel',
-
:'content' => :'content',
-
:'owner' => :'owner'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
19
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'from' => :'String',
-
:'application_id' => :'String',
-
:'channel' => :'MultiChannelMessageChannelEnum',
-
:'content' => :'SmsMessageContent',
-
:'owner' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'MultiChannelChannelListOwnerObject',
-
:'MultiChannelChannelListSMSObject'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
19
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListSMSResponseObject` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
18
acceptable_attribute_map = self.class.acceptable_attribute_map
-
18
attributes = attributes.each_with_object({}) { |(k, v), h|
-
76
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListSMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
75
h[k.to_sym] = v
-
}
-
-
17
if attributes.key?(:'from')
-
17
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
16
if attributes.key?(:'application_id')
-
16
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
15
if attributes.key?(:'channel')
-
15
self.channel = attributes[:'channel']
-
else
-
self.channel = nil
-
end
-
-
14
if attributes.key?(:'content')
-
14
self.content = attributes[:'content']
-
else
-
self.content = nil
-
end
-
-
13
if attributes.key?(:'owner')
-
13
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @channel.nil?
-
invalid_properties.push('invalid value for "channel", channel cannot be nil.')
-
end
-
-
if @content.nil?
-
invalid_properties.push('invalid value for "content", content cannot be nil.')
-
end
-
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @from.nil?
-
return false if @application_id.nil?
-
return false if @channel.nil?
-
return false if @content.nil?
-
return false if @owner.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
17
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
16
@from = from
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
16
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
15
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel Value to be assigned
-
1
def channel=(channel)
-
15
if channel.nil?
-
1
fail ArgumentError, 'channel cannot be nil'
-
end
-
-
14
@channel = channel
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] content Value to be assigned
-
1
def content=(content)
-
14
if content.nil?
-
1
fail ArgumentError, 'content cannot be nil'
-
end
-
-
13
@content = content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
13
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
12
@owner = owner
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
from == o.from &&
-
application_id == o.application_id &&
-
channel == o.channel &&
-
content == o.content &&
-
owner == o.owner
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[from, application_id, channel, content, owner].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
10
elsif !attributes[attribute_map[key]].nil?
-
10
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
20
value = self.send(attr)
-
20
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelError < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :data
-
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
23
{
-
:'links' => :'links',
-
:'data' => :'data',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'links' => :'Array<Link>',
-
:'data' => :'Object',
-
:'errors' => :'Array<ErrorObject>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'data',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'links')
-
4
if (value = attributes[:'links']).is_a?(Array)
-
4
self.links = value
-
end
-
end
-
-
6
if attributes.key?(:'data')
-
4
self.data = attributes[:'data']
-
end
-
-
6
if attributes.key?(:'errors')
-
4
if (value = attributes[:'errors']).is_a?(Array)
-
4
self.errors = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
data == o.data &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, data, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class MultiChannelMessageChannelEnum
-
1
RBM = 'RBM'.freeze
-
1
SMS = 'SMS'.freeze
-
1
MMS = 'MMS'.freeze
-
-
1
def self.all_vars
-
17
@all_vars ||= [RBM, SMS, MMS].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
16
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
16
return value if MultiChannelMessageChannelEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #MultiChannelMessageChannelEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The structure of the content field of a multichannel message.
-
1
class MultiChannelMessageContent < ApiModelBase
-
1
attr_accessor :text
-
-
1
attr_accessor :media
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
19
{
-
:'text' => :'text',
-
:'media' => :'media'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'text' => :'String',
-
:'media' => :'RbmMessageContentFile'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageContent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
9
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
8
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'text')
-
4
self.text = attributes[:'text']
-
end
-
-
6
if attributes.key?(:'media')
-
4
self.media = attributes[:'media']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
text == o.text &&
-
media == o.media
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text, media].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Multi-Channel Message Request
-
1
class MultiChannelMessageRequest < ApiModelBase
-
# The phone number the message should be sent to in E164 format.
-
1
attr_accessor :to
-
-
# A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored.
-
1
attr_accessor :channel_list
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
1
attr_accessor :priority
-
-
# A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future.
-
1
attr_accessor :expiration
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'to' => :'to',
-
:'channel_list' => :'channelList',
-
:'tag' => :'tag',
-
:'priority' => :'priority',
-
:'expiration' => :'expiration'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'to' => :'String',
-
:'channel_list' => :'Array<MultiChannelChannelListRequestObject>',
-
:'tag' => :'String',
-
:'priority' => :'PriorityEnum',
-
:'expiration' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
36
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
35
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'to')
-
9
self.to = attributes[:'to']
-
else
-
1
self.to = nil
-
end
-
-
9
if attributes.key?(:'channel_list')
-
8
if (value = attributes[:'channel_list']).is_a?(Array)
-
8
self.channel_list = value
-
end
-
else
-
1
self.channel_list = nil
-
end
-
-
8
if attributes.key?(:'tag')
-
6
self.tag = attributes[:'tag']
-
end
-
-
8
if attributes.key?(:'priority')
-
6
self.priority = attributes[:'priority']
-
end
-
-
8
if attributes.key?(:'expiration')
-
6
self.expiration = attributes[:'expiration']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @channel_list.nil?
-
invalid_properties.push('invalid value for "channel_list", channel_list cannot be nil.')
-
end
-
-
if @channel_list.length > 4
-
invalid_properties.push('invalid value for "channel_list", number of items must be less than or equal to 4.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @to.nil?
-
return false if @channel_list.nil?
-
return false if @channel_list.length > 4
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
10
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
9
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel_list Value to be assigned
-
1
def channel_list=(channel_list)
-
11
if channel_list.nil?
-
2
fail ArgumentError, 'channel_list cannot be nil'
-
end
-
-
9
if channel_list.length > 4
-
1
fail ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.'
-
end
-
-
8
@channel_list = channel_list
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
to == o.to &&
-
channel_list == o.channel_list &&
-
tag == o.tag &&
-
priority == o.priority &&
-
expiration == o.expiration
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[to, channel_list, tag, priority, expiration].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
15
value = self.send(attr)
-
15
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
15
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The data returned in a multichannel message response.
-
1
class MultiChannelMessageResponseData < ApiModelBase
-
# The ID of the message.
-
1
attr_accessor :id
-
-
# The time the message was received by the Bandwidth API.
-
1
attr_accessor :time
-
-
1
attr_accessor :direction
-
-
# The destination phone number(s) of the message, in E164 format.
-
1
attr_accessor :to
-
-
# A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored.
-
1
attr_accessor :channel_list
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
1
attr_accessor :priority
-
-
# A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future.
-
1
attr_accessor :expiration
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
83
{
-
:'id' => :'id',
-
:'time' => :'time',
-
:'direction' => :'direction',
-
:'to' => :'to',
-
:'channel_list' => :'channelList',
-
:'tag' => :'tag',
-
:'priority' => :'priority',
-
:'expiration' => :'expiration'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
16
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'id' => :'String',
-
:'time' => :'Time',
-
:'direction' => :'MessageDirectionEnum',
-
:'to' => :'Array<String>',
-
:'channel_list' => :'Array<MultiChannelChannelListResponseObject>',
-
:'tag' => :'String',
-
:'priority' => :'PriorityEnum',
-
:'expiration' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
16
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageResponseData` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
15
acceptable_attribute_map = self.class.acceptable_attribute_map
-
15
attributes = attributes.each_with_object({}) { |(k, v), h|
-
80
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
79
h[k.to_sym] = v
-
}
-
-
14
if attributes.key?(:'id')
-
14
self.id = attributes[:'id']
-
else
-
self.id = nil
-
end
-
-
13
if attributes.key?(:'time')
-
13
self.time = attributes[:'time']
-
else
-
self.time = nil
-
end
-
-
12
if attributes.key?(:'direction')
-
12
self.direction = attributes[:'direction']
-
else
-
self.direction = nil
-
end
-
-
11
if attributes.key?(:'to')
-
10
if (value = attributes[:'to']).is_a?(Array)
-
10
self.to = value
-
end
-
else
-
1
self.to = nil
-
end
-
-
10
if attributes.key?(:'channel_list')
-
9
if (value = attributes[:'channel_list']).is_a?(Array)
-
9
self.channel_list = value
-
end
-
else
-
1
self.channel_list = nil
-
end
-
-
9
if attributes.key?(:'tag')
-
7
self.tag = attributes[:'tag']
-
end
-
-
9
if attributes.key?(:'priority')
-
7
self.priority = attributes[:'priority']
-
end
-
-
9
if attributes.key?(:'expiration')
-
7
self.expiration = attributes[:'expiration']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @id.nil?
-
invalid_properties.push('invalid value for "id", id cannot be nil.')
-
end
-
-
if @time.nil?
-
invalid_properties.push('invalid value for "time", time cannot be nil.')
-
end
-
-
if @direction.nil?
-
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @channel_list.nil?
-
invalid_properties.push('invalid value for "channel_list", channel_list cannot be nil.')
-
end
-
-
if @channel_list.length > 4
-
invalid_properties.push('invalid value for "channel_list", number of items must be less than or equal to 4.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @id.nil?
-
return false if @time.nil?
-
return false if @direction.nil?
-
return false if @to.nil?
-
return false if @channel_list.nil?
-
return false if @channel_list.length > 4
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] id Value to be assigned
-
1
def id=(id)
-
14
if id.nil?
-
1
fail ArgumentError, 'id cannot be nil'
-
end
-
-
13
@id = id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] time Value to be assigned
-
1
def time=(time)
-
13
if time.nil?
-
1
fail ArgumentError, 'time cannot be nil'
-
end
-
-
12
@time = time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] direction Value to be assigned
-
1
def direction=(direction)
-
12
if direction.nil?
-
1
fail ArgumentError, 'direction cannot be nil'
-
end
-
-
11
@direction = direction
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
12
if to.nil?
-
2
fail ArgumentError, 'to cannot be nil'
-
end
-
-
10
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] channel_list Value to be assigned
-
1
def channel_list=(channel_list)
-
12
if channel_list.nil?
-
2
fail ArgumentError, 'channel_list cannot be nil'
-
end
-
-
10
if channel_list.length > 4
-
1
fail ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.'
-
end
-
-
9
@channel_list = channel_list
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
time == o.time &&
-
direction == o.direction &&
-
to == o.to &&
-
channel_list == o.channel_list &&
-
tag == o.tag &&
-
priority == o.priority &&
-
expiration == o.expiration
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, time, direction, to, channel_list, tag, priority, expiration].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
16
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
16
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
8
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
12
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class OptInWorkflow < ApiModelBase
-
1
attr_accessor :description
-
-
1
attr_accessor :image_urls
-
-
1
attr_accessor :confirmation_response
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
90
{
-
:'description' => :'description',
-
:'image_urls' => :'imageUrls',
-
:'confirmation_response' => :'confirmationResponse'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
21
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
6
{
-
:'description' => :'String',
-
:'image_urls' => :'Array<String>',
-
:'confirmation_response' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
:'confirmation_response'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
21
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::OptInWorkflow` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
20
acceptable_attribute_map = self.class.acceptable_attribute_map
-
20
attributes = attributes.each_with_object({}) { |(k, v), h|
-
42
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::OptInWorkflow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
41
h[k.to_sym] = v
-
}
-
-
19
if attributes.key?(:'description')
-
19
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
16
if attributes.key?(:'image_urls')
-
15
if (value = attributes[:'image_urls']).is_a?(Array)
-
15
self.image_urls = value
-
end
-
else
-
1
self.image_urls = nil
-
end
-
-
15
if attributes.key?(:'confirmation_response')
-
7
self.confirmation_response = attributes[:'confirmation_response']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
if @description.to_s.length > 500
-
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
-
end
-
-
if @description.to_s.length < 1
-
invalid_properties.push('invalid value for "description", the character length must be greater than or equal to 1.')
-
end
-
-
if @image_urls.nil?
-
invalid_properties.push('invalid value for "image_urls", image_urls cannot be nil.')
-
end
-
-
if !@confirmation_response.nil? && @confirmation_response.to_s.length > 500
-
invalid_properties.push('invalid value for "confirmation_response", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@confirmation_response.nil? && @confirmation_response.to_s.length < 0
-
invalid_properties.push('invalid value for "confirmation_response", the character length must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @description.nil?
-
return false if @description.to_s.length > 500
-
return false if @description.to_s.length < 1
-
return false if @image_urls.nil?
-
return false if !@confirmation_response.nil? && @confirmation_response.to_s.length > 500
-
return false if !@confirmation_response.nil? && @confirmation_response.to_s.length < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
19
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
18
if description.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
-
end
-
-
17
if description.to_s.length < 1
-
1
fail ArgumentError, 'invalid value for "description", the character length must be greater than or equal to 1.'
-
end
-
-
16
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] image_urls Value to be assigned
-
1
def image_urls=(image_urls)
-
17
if image_urls.nil?
-
2
fail ArgumentError, 'image_urls cannot be nil'
-
end
-
-
15
@image_urls = image_urls
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] confirmation_response Value to be assigned
-
1
def confirmation_response=(confirmation_response)
-
8
if !confirmation_response.nil? && confirmation_response.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "confirmation_response", the character length must be smaller than or equal to 500.'
-
end
-
-
7
if !confirmation_response.nil? && confirmation_response.to_s.length < 0
-
fail ArgumentError, 'invalid value for "confirmation_response", the character length must be greater than or equal to 0.'
-
end
-
-
7
@confirmation_response = confirmation_response
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
description == o.description &&
-
image_urls == o.image_urls &&
-
confirmation_response == o.confirmation_response
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[description, image_urls, confirmation_response].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
6
return nil unless attributes.is_a?(Hash)
-
6
attributes = attributes.transform_keys(&:to_sym)
-
6
transformed_hash = {}
-
6
openapi_types.each_pair do |key, type|
-
18
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
18
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
6
if attributes[attribute_map[key]].is_a?(Array)
-
13
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
6
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Page < ApiModelBase
-
# The number of items per page.
-
1
attr_accessor :page_size
-
-
# The total number of items.
-
1
attr_accessor :total_elements
-
-
# The total number of pages.
-
1
attr_accessor :total_pages
-
-
# The current page number.
-
1
attr_accessor :page_number
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
74
{
-
:'page_size' => :'pageSize',
-
:'total_elements' => :'totalElements',
-
:'total_pages' => :'totalPages',
-
:'page_number' => :'pageNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
21
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'page_size' => :'Integer',
-
:'total_elements' => :'Integer',
-
:'total_pages' => :'Integer',
-
:'page_number' => :'Integer'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
21
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Page` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
20
acceptable_attribute_map = self.class.acceptable_attribute_map
-
20
attributes = attributes.each_with_object({}) { |(k, v), h|
-
65
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Page`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
64
h[k.to_sym] = v
-
}
-
-
19
if attributes.key?(:'page_size')
-
19
self.page_size = attributes[:'page_size']
-
else
-
self.page_size = nil
-
end
-
-
17
if attributes.key?(:'total_elements')
-
15
self.total_elements = attributes[:'total_elements']
-
end
-
-
17
if attributes.key?(:'total_pages')
-
15
self.total_pages = attributes[:'total_pages']
-
end
-
-
17
if attributes.key?(:'page_number')
-
15
self.page_number = attributes[:'page_number']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @page_size.nil?
-
invalid_properties.push('invalid value for "page_size", page_size cannot be nil.')
-
end
-
-
if @page_size < 0
-
invalid_properties.push('invalid value for "page_size", must be greater than or equal to 0.')
-
end
-
-
if !@total_elements.nil? && @total_elements < 0
-
invalid_properties.push('invalid value for "total_elements", must be greater than or equal to 0.')
-
end
-
-
if !@total_pages.nil? && @total_pages < 0
-
invalid_properties.push('invalid value for "total_pages", must be greater than or equal to 0.')
-
end
-
-
if !@page_number.nil? && @page_number < 0
-
invalid_properties.push('invalid value for "page_number", must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @page_size.nil?
-
return false if @page_size < 0
-
return false if !@total_elements.nil? && @total_elements < 0
-
return false if !@total_pages.nil? && @total_pages < 0
-
return false if !@page_number.nil? && @page_number < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] page_size Value to be assigned
-
1
def page_size=(page_size)
-
19
if page_size.nil?
-
1
fail ArgumentError, 'page_size cannot be nil'
-
end
-
-
18
if page_size < 0
-
1
fail ArgumentError, 'invalid value for "page_size", must be greater than or equal to 0.'
-
end
-
-
17
@page_size = page_size
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] total_elements Value to be assigned
-
1
def total_elements=(total_elements)
-
17
if total_elements.nil?
-
1
fail ArgumentError, 'total_elements cannot be nil'
-
end
-
-
16
if total_elements < 0
-
1
fail ArgumentError, 'invalid value for "total_elements", must be greater than or equal to 0.'
-
end
-
-
15
@total_elements = total_elements
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] total_pages Value to be assigned
-
1
def total_pages=(total_pages)
-
17
if total_pages.nil?
-
1
fail ArgumentError, 'total_pages cannot be nil'
-
end
-
-
16
if total_pages < 0
-
1
fail ArgumentError, 'invalid value for "total_pages", must be greater than or equal to 0.'
-
end
-
-
15
@total_pages = total_pages
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] page_number Value to be assigned
-
1
def page_number=(page_number)
-
17
if page_number.nil?
-
1
fail ArgumentError, 'page_number cannot be nil'
-
end
-
-
16
if page_number < 0
-
1
fail ArgumentError, 'invalid value for "page_number", must be greater than or equal to 0.'
-
end
-
-
15
@page_number = page_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
page_size == o.page_size &&
-
total_elements == o.total_elements &&
-
total_pages == o.total_pages &&
-
page_number == o.page_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[page_size, total_elements, total_pages, page_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
12
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
12
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
12
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class PageInfo < ApiModelBase
-
# The link to the previous page for pagination.
-
1
attr_accessor :prev_page
-
-
# The link to the next page for pagination.
-
1
attr_accessor :next_page
-
-
# The isolated pagination token for the previous page.
-
1
attr_accessor :prev_page_token
-
-
# The isolated pagination token for the next page.
-
1
attr_accessor :next_page_token
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
66
{
-
:'prev_page' => :'prevPage',
-
:'next_page' => :'nextPage',
-
:'prev_page_token' => :'prevPageToken',
-
:'next_page_token' => :'nextPageToken'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'prev_page' => :'String',
-
:'next_page' => :'String',
-
:'prev_page_token' => :'String',
-
:'next_page_token' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::PageInfo` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
37
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::PageInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
36
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'prev_page')
-
9
self.prev_page = attributes[:'prev_page']
-
end
-
-
11
if attributes.key?(:'next_page')
-
9
self.next_page = attributes[:'next_page']
-
end
-
-
11
if attributes.key?(:'prev_page_token')
-
9
self.prev_page_token = attributes[:'prev_page_token']
-
end
-
-
11
if attributes.key?(:'next_page_token')
-
9
self.next_page_token = attributes[:'next_page_token']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
prev_page == o.prev_page &&
-
next_page == o.next_page &&
-
prev_page_token == o.prev_page_token &&
-
next_page_token == o.next_page_token
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[prev_page, next_page, prev_page_token, next_page_token].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
12
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
12
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
12
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class PriorityEnum
-
1
DEFAULT = 'default'.freeze
-
1
HIGH = 'high'.freeze
-
-
1
def self.all_vars
-
14
@all_vars ||= [DEFAULT, HIGH].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
11
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
11
return value if PriorityEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #PriorityEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ProductTypeEnum
-
1
LOCAL_A2_P = 'LOCAL_A2P'.freeze
-
1
P2_P = 'P2P'.freeze
-
1
SHORT_CODE_REACH = 'SHORT_CODE_REACH'.freeze
-
1
TOLL_FREE = 'TOLL_FREE'.freeze
-
1
HOSTED_SHORT_CODE = 'HOSTED_SHORT_CODE'.freeze
-
1
ALPHA_NUMERIC = 'ALPHA_NUMERIC'.freeze
-
1
RBM_MEDIA = 'RBM_MEDIA'.freeze
-
1
RBM_RICH = 'RBM_RICH'.freeze
-
1
RBM_CONVERSATIONAL = 'RBM_CONVERSATIONAL'.freeze
-
-
1
def self.all_vars
-
12
@all_vars ||= [LOCAL_A2_P, P2_P, SHORT_CODE_REACH, TOLL_FREE, HOSTED_SHORT_CODE, ALPHA_NUMERIC, RBM_MEDIA, RBM_RICH, RBM_CONVERSATIONAL].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
10
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
10
return value if ProductTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #ProductTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmActionBase < ApiModelBase
-
1
attr_accessor :type
-
-
# Displayed text for user to click
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
138
{
-
:'type' => :'type',
-
:'text' => :'text',
-
:'postback_data' => :'postbackData'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
41
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
7
{
-
:'type' => :'RbmActionTypeEnum',
-
:'text' => :'String',
-
:'postback_data' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
41
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmActionBase` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
40
acceptable_attribute_map = self.class.acceptable_attribute_map
-
40
attributes = attributes.each_with_object({}) { |(k, v), h|
-
114
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
113
h[k.to_sym] = v
-
}
-
-
39
if attributes.key?(:'type')
-
39
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
38
if attributes.key?(:'text')
-
38
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
36
if attributes.key?(:'postback_data')
-
36
self.postback_data = attributes[:'postback_data']
-
else
-
self.postback_data = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 25
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
if @postback_data.nil?
-
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
-
end
-
-
if @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @text.nil?
-
return false if @text.to_s.length > 25
-
return false if @postback_data.nil?
-
return false if @postback_data.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
39
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
38
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
38
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
37
if text.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
-
end
-
-
36
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
36
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
35
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
34
@postback_data = postback_data
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
text == o.text &&
-
postback_data == o.postback_data
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, text, postback_data].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
7
return nil unless attributes.is_a?(Hash)
-
7
attributes = attributes.transform_keys(&:to_sym)
-
7
transformed_hash = {}
-
7
openapi_types.each_pair do |key, type|
-
21
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
21
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
21
elsif !attributes[attribute_map[key]].nil?
-
21
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
7
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
12
hash = {}
-
12
self.class.attribute_map.each_pair do |attr, param|
-
36
value = self.send(attr)
-
36
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
36
hash[param] = _to_hash(value)
-
end
-
12
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmActionDial < ApiModelBase
-
1
attr_accessor :type
-
-
# Displayed text for user to click
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
# The phone number to dial. Must be E164 format.
-
1
attr_accessor :phone_number
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
33
{
-
:'type' => :'type',
-
:'text' => :'text',
-
:'postback_data' => :'postbackData',
-
:'phone_number' => :'phoneNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'RbmActionTypeEnum',
-
:'text' => :'String',
-
:'postback_data' => :'String',
-
:'phone_number' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'RbmActionBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmActionDial` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
40
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionDial`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
39
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'type')
-
12
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
11
if attributes.key?(:'text')
-
11
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
9
if attributes.key?(:'postback_data')
-
9
self.postback_data = attributes[:'postback_data']
-
else
-
self.postback_data = nil
-
end
-
-
7
if attributes.key?(:'phone_number')
-
7
self.phone_number = attributes[:'phone_number']
-
else
-
self.phone_number = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 25
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
if @postback_data.nil?
-
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
-
end
-
-
if @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
if @phone_number.nil?
-
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @text.nil?
-
return false if @text.to_s.length > 25
-
return false if @postback_data.nil?
-
return false if @postback_data.to_s.length > 2048
-
return false if @phone_number.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
12
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
11
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
11
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
10
if text.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
-
end
-
-
9
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
9
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
8
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
7
@postback_data = postback_data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
7
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
6
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
text == o.text &&
-
postback_data == o.postback_data &&
-
phone_number == o.phone_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, text, postback_data, phone_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmActionOpenUrl < ApiModelBase
-
1
attr_accessor :type
-
-
# Displayed text for user to click
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
# The URL to open in browser. Must use http:// or https:// scheme.
-
1
attr_accessor :url
-
-
1
attr_accessor :application
-
-
1
attr_accessor :webview_view_mode
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
42
{
-
:'type' => :'type',
-
:'text' => :'text',
-
:'postback_data' => :'postbackData',
-
:'url' => :'url',
-
:'application' => :'application',
-
:'webview_view_mode' => :'webviewViewMode'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
15
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'RbmActionTypeEnum',
-
:'text' => :'String',
-
:'postback_data' => :'String',
-
:'url' => :'String',
-
:'application' => :'RbmOpenUrlEnum',
-
:'webview_view_mode' => :'RbmWebViewEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'RbmActionBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
15
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmActionOpenUrl` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
14
acceptable_attribute_map = self.class.acceptable_attribute_map
-
14
attributes = attributes.each_with_object({}) { |(k, v), h|
-
52
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionOpenUrl`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
51
h[k.to_sym] = v
-
}
-
-
13
if attributes.key?(:'type')
-
13
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
12
if attributes.key?(:'text')
-
12
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
10
if attributes.key?(:'postback_data')
-
10
self.postback_data = attributes[:'postback_data']
-
else
-
self.postback_data = nil
-
end
-
-
8
if attributes.key?(:'url')
-
8
self.url = attributes[:'url']
-
else
-
self.url = nil
-
end
-
-
6
if attributes.key?(:'application')
-
4
self.application = attributes[:'application']
-
end
-
-
6
if attributes.key?(:'webview_view_mode')
-
4
self.webview_view_mode = attributes[:'webview_view_mode']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 25
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
if @postback_data.nil?
-
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
-
end
-
-
if @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
if @url.nil?
-
invalid_properties.push('invalid value for "url", url cannot be nil.')
-
end
-
-
if @url.to_s.length > 2048
-
invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @text.nil?
-
return false if @text.to_s.length > 25
-
return false if @postback_data.nil?
-
return false if @postback_data.to_s.length > 2048
-
return false if @url.nil?
-
return false if @url.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
13
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
12
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
12
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
11
if text.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
-
end
-
-
10
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
10
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
9
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
8
@postback_data = postback_data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] url Value to be assigned
-
1
def url=(url)
-
8
if url.nil?
-
1
fail ArgumentError, 'url cannot be nil'
-
end
-
-
7
if url.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2048.'
-
end
-
-
6
@url = url
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
text == o.text &&
-
postback_data == o.postback_data &&
-
url == o.url &&
-
application == o.application &&
-
webview_view_mode == o.webview_view_mode
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, text, postback_data, url, application, webview_view_mode].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmActionTypeEnum
-
1
REPLY = 'REPLY'.freeze
-
1
DIAL_PHONE = 'DIAL_PHONE'.freeze
-
1
SHOW_LOCATION = 'SHOW_LOCATION'.freeze
-
1
CREATE_CALENDAR_EVENT = 'CREATE_CALENDAR_EVENT'.freeze
-
1
OPEN_URL = 'OPEN_URL'.freeze
-
1
REQUEST_LOCATION = 'REQUEST_LOCATION'.freeze
-
-
1
def self.all_vars
-
19
@all_vars ||= [REPLY, DIAL_PHONE, SHOW_LOCATION, CREATE_CALENDAR_EVENT, OPEN_URL, REQUEST_LOCATION].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
18
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
18
return value if RbmActionTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RbmActionTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmActionViewLocation < ApiModelBase
-
1
attr_accessor :type
-
-
# Displayed text for user to click
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
# The latitude of the location. Must be in range [-90.000000, 90.000000].
-
1
attr_accessor :latitude
-
-
# The longitude of the location. Must be in range [-180.000000, 180.000000].
-
1
attr_accessor :longitude
-
-
# The label of the location.
-
1
attr_accessor :label
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
43
{
-
:'type' => :'type',
-
:'text' => :'text',
-
:'postback_data' => :'postbackData',
-
:'latitude' => :'latitude',
-
:'longitude' => :'longitude',
-
:'label' => :'label'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
16
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'RbmActionTypeEnum',
-
:'text' => :'String',
-
:'postback_data' => :'String',
-
:'latitude' => :'Float',
-
:'longitude' => :'Float',
-
:'label' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'RbmActionBase'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
16
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmActionViewLocation` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
15
acceptable_attribute_map = self.class.acceptable_attribute_map
-
15
attributes = attributes.each_with_object({}) { |(k, v), h|
-
61
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionViewLocation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
60
h[k.to_sym] = v
-
}
-
-
14
if attributes.key?(:'type')
-
14
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
13
if attributes.key?(:'text')
-
13
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
11
if attributes.key?(:'postback_data')
-
11
self.postback_data = attributes[:'postback_data']
-
else
-
self.postback_data = nil
-
end
-
-
9
if attributes.key?(:'latitude')
-
9
self.latitude = attributes[:'latitude']
-
else
-
self.latitude = nil
-
end
-
-
8
if attributes.key?(:'longitude')
-
8
self.longitude = attributes[:'longitude']
-
else
-
self.longitude = nil
-
end
-
-
7
if attributes.key?(:'label')
-
5
self.label = attributes[:'label']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 25
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
if @postback_data.nil?
-
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
-
end
-
-
if @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
if @latitude.nil?
-
invalid_properties.push('invalid value for "latitude", latitude cannot be nil.')
-
end
-
-
if @longitude.nil?
-
invalid_properties.push('invalid value for "longitude", longitude cannot be nil.')
-
end
-
-
if !@label.nil? && @label.to_s.length > 100
-
invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 100.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @type.nil?
-
return false if @text.nil?
-
return false if @text.to_s.length > 25
-
return false if @postback_data.nil?
-
return false if @postback_data.to_s.length > 2048
-
return false if @latitude.nil?
-
return false if @longitude.nil?
-
return false if !@label.nil? && @label.to_s.length > 100
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
14
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
13
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
13
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
12
if text.to_s.length > 25
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
-
end
-
-
11
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
11
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
10
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
9
@postback_data = postback_data
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] latitude Value to be assigned
-
1
def latitude=(latitude)
-
9
if latitude.nil?
-
1
fail ArgumentError, 'latitude cannot be nil'
-
end
-
-
8
@latitude = latitude
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] longitude Value to be assigned
-
1
def longitude=(longitude)
-
8
if longitude.nil?
-
1
fail ArgumentError, 'longitude cannot be nil'
-
end
-
-
7
@longitude = longitude
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] label Value to be assigned
-
1
def label=(label)
-
7
if label.nil?
-
1
fail ArgumentError, 'label cannot be nil'
-
end
-
-
6
if label.to_s.length > 100
-
1
fail ArgumentError, 'invalid value for "label", the character length must be smaller than or equal to 100.'
-
end
-
-
5
@label = label
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
text == o.text &&
-
postback_data == o.postback_data &&
-
latitude == o.latitude &&
-
longitude == o.longitude &&
-
label == o.label
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, text, postback_data, latitude, longitude, label].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Must contain at least one of title, description, or media to be valid.
-
1
class RbmCardContent < ApiModelBase
-
# The title of the card. Must be 200 characters or less.
-
1
attr_accessor :title
-
-
# The description of the card. Must be 2000 characters or less.
-
1
attr_accessor :description
-
-
1
attr_accessor :media
-
-
# An array of suggested actions for the recipient that will be displayed on the rich card.
-
1
attr_accessor :suggestions
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
98
{
-
:'title' => :'title',
-
:'description' => :'description',
-
:'media' => :'media',
-
:'suggestions' => :'suggestions'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
27
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'title' => :'String',
-
:'description' => :'String',
-
:'media' => :'RbmCardContentMedia',
-
:'suggestions' => :'Array<MultiChannelAction>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
13
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
27
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmCardContent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
26
acceptable_attribute_map = self.class.acceptable_attribute_map
-
26
attributes = attributes.each_with_object({}) { |(k, v), h|
-
52
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmCardContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
51
h[k.to_sym] = v
-
}
-
-
25
if attributes.key?(:'title')
-
21
self.title = attributes[:'title']
-
end
-
-
23
if attributes.key?(:'description')
-
20
self.description = attributes[:'description']
-
end
-
-
21
if attributes.key?(:'media')
-
5
self.media = attributes[:'media']
-
end
-
-
21
if attributes.key?(:'suggestions')
-
5
if (value = attributes[:'suggestions']).is_a?(Array)
-
5
self.suggestions = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@title.nil? && @title.to_s.length > 200
-
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 200.')
-
end
-
-
if !@description.nil? && @description.to_s.length > 2000
-
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
-
end
-
-
if !@suggestions.nil? && @suggestions.length > 4
-
invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 4.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@title.nil? && @title.to_s.length > 200
-
return false if !@description.nil? && @description.to_s.length > 2000
-
return false if !@suggestions.nil? && @suggestions.length > 4
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] title Value to be assigned
-
1
def title=(title)
-
21
if title.nil?
-
1
fail ArgumentError, 'title cannot be nil'
-
end
-
-
20
if title.to_s.length > 200
-
1
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 200.'
-
end
-
-
19
@title = title
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
20
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
19
if description.to_s.length > 2000
-
1
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
-
end
-
-
18
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] suggestions Value to be assigned
-
1
def suggestions=(suggestions)
-
7
if suggestions.nil?
-
1
fail ArgumentError, 'suggestions cannot be nil'
-
end
-
-
6
if suggestions.length > 4
-
1
fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 4.'
-
end
-
-
5
@suggestions = suggestions
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
3
return true if self.equal?(o)
-
2
self.class == o.class &&
-
title == o.title &&
-
description == o.description &&
-
media == o.media &&
-
suggestions == o.suggestions
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[title, description, media, suggestions].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
7
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
20
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
20
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
5
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
15
elsif !attributes[attribute_map[key]].nil?
-
10
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
8
hash = {}
-
8
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
12
is_nullable = self.class.openapi_nullable.include?(attr)
-
12
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
8
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmCardContentMedia < ApiModelBase
-
# The URL of the media file. 100MB is the maximum file size.
-
1
attr_accessor :file_url
-
-
# The URL of the thumbnail image. Applies only to video file media.
-
1
attr_accessor :thumbnail_url
-
-
1
attr_accessor :height
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
44
{
-
:'file_url' => :'fileUrl',
-
:'thumbnail_url' => :'thumbnailUrl',
-
:'height' => :'height'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'file_url' => :'String',
-
:'thumbnail_url' => :'String',
-
:'height' => :'RbmMediaHeightEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# List of class defined in allOf (OpenAPI v3)
-
1
def self.openapi_all_of
-
[
-
:'RbmMessageContentFile'
-
]
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmCardContentMedia` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
34
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmCardContentMedia`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
33
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'file_url')
-
15
self.file_url = attributes[:'file_url']
-
else
-
self.file_url = nil
-
end
-
-
13
if attributes.key?(:'thumbnail_url')
-
5
self.thumbnail_url = attributes[:'thumbnail_url']
-
end
-
-
13
if attributes.key?(:'height')
-
13
self.height = attributes[:'height']
-
else
-
self.height = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @file_url.nil?
-
invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
-
end
-
-
if @file_url.to_s.length > 1000
-
invalid_properties.push('invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
if !@thumbnail_url.nil? && @thumbnail_url.to_s.length > 1000
-
invalid_properties.push('invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
if @height.nil?
-
invalid_properties.push('invalid value for "height", height cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @file_url.nil?
-
return false if @file_url.to_s.length > 1000
-
return false if !@thumbnail_url.nil? && @thumbnail_url.to_s.length > 1000
-
return false if @height.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] file_url Value to be assigned
-
1
def file_url=(file_url)
-
15
if file_url.nil?
-
1
fail ArgumentError, 'file_url cannot be nil'
-
end
-
-
14
if file_url.to_s.length > 1000
-
1
fail ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.'
-
end
-
-
13
@file_url = file_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] thumbnail_url Value to be assigned
-
1
def thumbnail_url=(thumbnail_url)
-
7
if thumbnail_url.nil?
-
1
fail ArgumentError, 'thumbnail_url cannot be nil'
-
end
-
-
6
if thumbnail_url.to_s.length > 1000
-
1
fail ArgumentError, 'invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.'
-
end
-
-
5
@thumbnail_url = thumbnail_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] height Value to be assigned
-
1
def height=(height)
-
13
if height.nil?
-
1
fail ArgumentError, 'height cannot be nil'
-
end
-
-
12
@height = height
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
file_url == o.file_url &&
-
thumbnail_url == o.thumbnail_url &&
-
height == o.height
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[file_url, thumbnail_url, height].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmLocationResponse < ApiModelBase
-
# The latitude of the client's location.
-
1
attr_accessor :latitude
-
-
# The longitude of the client's location.
-
1
attr_accessor :longitude
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
19
{
-
:'latitude' => :'latitude',
-
:'longitude' => :'longitude'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'latitude' => :'Float',
-
:'longitude' => :'Float'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmLocationResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
9
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmLocationResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
8
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'latitude')
-
4
self.latitude = attributes[:'latitude']
-
end
-
-
6
if attributes.key?(:'longitude')
-
4
self.longitude = attributes[:'longitude']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
latitude == o.latitude &&
-
longitude == o.longitude
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[latitude, longitude].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmMediaHeightEnum
-
1
SHORT = 'SHORT'.freeze
-
1
MEDIUM = 'MEDIUM'.freeze
-
1
TALL = 'TALL'.freeze
-
-
1
def self.all_vars
-
7
@all_vars ||= [SHORT, MEDIUM, TALL].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if RbmMediaHeightEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RbmMediaHeightEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmMessageCarouselCard < ApiModelBase
-
1
attr_accessor :card_width
-
-
1
attr_accessor :card_contents
-
-
# An array of suggested actions for the recipient.
-
1
attr_accessor :suggestions
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
47
{
-
:'card_width' => :'cardWidth',
-
:'card_contents' => :'cardContents',
-
:'suggestions' => :'suggestions'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
22
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
10
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'card_width' => :'CardWidthEnum',
-
:'card_contents' => :'Array<RbmCardContent>',
-
:'suggestions' => :'Array<MultiChannelAction>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmMessageCarouselCard` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
27
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageCarouselCard`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
26
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'card_width')
-
11
self.card_width = attributes[:'card_width']
-
else
-
self.card_width = nil
-
end
-
-
10
if attributes.key?(:'card_contents')
-
9
if (value = attributes[:'card_contents']).is_a?(Array)
-
9
self.card_contents = value
-
end
-
else
-
1
self.card_contents = nil
-
end
-
-
9
if attributes.key?(:'suggestions')
-
6
if (value = attributes[:'suggestions']).is_a?(Array)
-
6
self.suggestions = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @card_width.nil?
-
invalid_properties.push('invalid value for "card_width", card_width cannot be nil.')
-
end
-
-
if @card_contents.nil?
-
invalid_properties.push('invalid value for "card_contents", card_contents cannot be nil.')
-
end
-
-
if @card_contents.length > 10
-
invalid_properties.push('invalid value for "card_contents", number of items must be less than or equal to 10.')
-
end
-
-
if @card_contents.length < 2
-
invalid_properties.push('invalid value for "card_contents", number of items must be greater than or equal to 2.')
-
end
-
-
if !@suggestions.nil? && @suggestions.length > 11
-
invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @card_width.nil?
-
return false if @card_contents.nil?
-
return false if @card_contents.length > 10
-
return false if @card_contents.length < 2
-
return false if !@suggestions.nil? && @suggestions.length > 11
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] card_width Value to be assigned
-
1
def card_width=(card_width)
-
11
if card_width.nil?
-
1
fail ArgumentError, 'card_width cannot be nil'
-
end
-
-
10
@card_width = card_width
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] card_contents Value to be assigned
-
1
def card_contents=(card_contents)
-
12
if card_contents.nil?
-
2
fail ArgumentError, 'card_contents cannot be nil'
-
end
-
-
10
if card_contents.length > 10
-
1
fail ArgumentError, 'invalid value for "card_contents", number of items must be less than or equal to 10.'
-
end
-
-
9
if card_contents.length < 2
-
fail ArgumentError, 'invalid value for "card_contents", number of items must be greater than or equal to 2.'
-
end
-
-
9
@card_contents = card_contents
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] suggestions Value to be assigned
-
1
def suggestions=(suggestions)
-
8
if suggestions.nil?
-
1
fail ArgumentError, 'suggestions cannot be nil'
-
end
-
-
7
if suggestions.length > 11
-
1
fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.'
-
end
-
-
6
@suggestions = suggestions
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
card_width == o.card_width &&
-
card_contents == o.card_contents &&
-
suggestions == o.suggestions
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[card_width, card_contents, suggestions].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
8
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmMessageContentFile < ApiModelBase
-
# The URL of the media file. 100MB is the maximum file size.
-
1
attr_accessor :file_url
-
-
# The URL of the thumbnail image. Applies only to video file media.
-
1
attr_accessor :thumbnail_url
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
55
{
-
:'file_url' => :'fileUrl',
-
:'thumbnail_url' => :'thumbnailUrl'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
22
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'file_url' => :'String',
-
:'thumbnail_url' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
22
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmMessageContentFile` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
21
acceptable_attribute_map = self.class.acceptable_attribute_map
-
21
attributes = attributes.each_with_object({}) { |(k, v), h|
-
26
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
25
h[k.to_sym] = v
-
}
-
-
20
if attributes.key?(:'file_url')
-
20
self.file_url = attributes[:'file_url']
-
else
-
self.file_url = nil
-
end
-
-
18
if attributes.key?(:'thumbnail_url')
-
5
self.thumbnail_url = attributes[:'thumbnail_url']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @file_url.nil?
-
invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
-
end
-
-
if @file_url.to_s.length > 1000
-
invalid_properties.push('invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
if !@thumbnail_url.nil? && @thumbnail_url.to_s.length > 1000
-
invalid_properties.push('invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @file_url.nil?
-
return false if @file_url.to_s.length > 1000
-
return false if !@thumbnail_url.nil? && @thumbnail_url.to_s.length > 1000
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] file_url Value to be assigned
-
1
def file_url=(file_url)
-
20
if file_url.nil?
-
1
fail ArgumentError, 'file_url cannot be nil'
-
end
-
-
19
if file_url.to_s.length > 1000
-
1
fail ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.'
-
end
-
-
18
@file_url = file_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] thumbnail_url Value to be assigned
-
1
def thumbnail_url=(thumbnail_url)
-
7
if thumbnail_url.nil?
-
1
fail ArgumentError, 'thumbnail_url cannot be nil'
-
end
-
-
6
if thumbnail_url.to_s.length > 1000
-
1
fail ArgumentError, 'invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.'
-
end
-
-
5
@thumbnail_url = thumbnail_url
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
file_url == o.file_url &&
-
thumbnail_url == o.thumbnail_url
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[file_url, thumbnail_url].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
module RbmMessageContentRichCard
-
1
class << self
-
# List of class defined in oneOf (OpenAPI v3)
-
1
def openapi_one_of
-
17
[
-
:'RbmMessageCarouselCard',
-
:'RbmStandaloneCard'
-
]
-
end
-
-
# Builds the object
-
# @param [Mixed] Data to be matched against the list of oneOf items
-
# @return [Object] Returns the model or the data itself
-
1
def build(data)
-
# Go through the list of oneOf items and attempt to identify the appropriate one.
-
# Note:
-
# - We do not attempt to check whether exactly one item matches.
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
-
# - TODO: scalar values are de facto behaving as if they were nullable.
-
# - TODO: logging when debugging is set.
-
9
openapi_one_of.each do |klass|
-
begin
-
17
next if klass == :AnyType # "nullable: true"
-
17
return find_and_cast_into_type(klass, data)
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
-
end
-
end
-
-
7
openapi_one_of.include?(:AnyType) ? data : nil
-
end
-
-
1
private
-
-
1
SchemaMismatchError = Class.new(StandardError)
-
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
-
1
def find_and_cast_into_type(klass, data)
-
17
return if data.nil?
-
-
17
case klass.to_s
-
when 'Boolean'
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
-
when 'Float'
-
return data if data.instance_of?(Float)
-
when 'Integer'
-
return data if data.instance_of?(Integer)
-
when 'Time'
-
return Time.parse(data)
-
when 'Date'
-
return Date.iso8601(data)
-
when 'String'
-
return data if data.instance_of?(String)
-
when 'Object' # "type: object"
-
return data if data.instance_of?(Hash)
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
-
if data.instance_of?(Array)
-
sub_type = Regexp.last_match[:sub_type]
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
-
end
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
-
sub_type = Regexp.last_match[:sub_type]
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
-
end
-
else # model
-
17
const = Bandwidth.const_get(klass)
-
17
if const
-
17
if const.respond_to?(:openapi_one_of) # nested oneOf model
-
model = const.build(data)
-
return model if model
-
else
-
# raise if data contains keys that are not known to the model
-
17
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
-
2
model = const.build_from_hash(data)
-
2
return model if model
-
end
-
end
-
end
-
-
raise # if no match by now, raise
-
rescue
-
15
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
-
end
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmMessageContentText < ApiModelBase
-
# The text associated with the message. Must be 3270 characters or less
-
1
attr_accessor :text
-
-
# An array of suggested actions for the recipient.
-
1
attr_accessor :suggestions
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
72
{
-
:'text' => :'text',
-
:'suggestions' => :'suggestions'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
31
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
7
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'text' => :'String',
-
:'suggestions' => :'Array<MultiChannelAction>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
5
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
25
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmMessageContentText` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
24
acceptable_attribute_map = self.class.acceptable_attribute_map
-
24
attributes = attributes.each_with_object({}) { |(k, v), h|
-
30
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageContentText`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
29
h[k.to_sym] = v
-
}
-
-
23
if attributes.key?(:'text')
-
23
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
-
21
if attributes.key?(:'suggestions')
-
6
if (value = attributes[:'suggestions']).is_a?(Array)
-
6
self.suggestions = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 3270
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 3270.')
-
end
-
-
if !@suggestions.nil? && @suggestions.length > 11
-
invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @text.nil?
-
return false if @text.to_s.length > 3270
-
return false if !@suggestions.nil? && @suggestions.length > 11
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
23
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
22
if text.to_s.length > 3270
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 3270.'
-
end
-
-
21
@text = text
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] suggestions Value to be assigned
-
1
def suggestions=(suggestions)
-
8
if suggestions.nil?
-
1
fail ArgumentError, 'suggestions cannot be nil'
-
end
-
-
7
if suggestions.length > 11
-
1
fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.'
-
end
-
-
6
@suggestions = suggestions
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
4
return true if self.equal?(o)
-
4
self.class == o.class &&
-
text == o.text &&
-
suggestions == o.suggestions
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text, suggestions].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
5
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
6
hash = {}
-
6
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
4
is_nullable = self.class.openapi_nullable.include?(attr)
-
4
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
6
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmMessageMedia < ApiModelBase
-
1
attr_accessor :media
-
-
# An array of suggested actions for the recipient.
-
1
attr_accessor :suggestions
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'media' => :'media',
-
:'suggestions' => :'suggestions'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
3
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'media' => :'Array<RbmMessageContentFile>',
-
:'suggestions' => :'Array<MultiChannelAction>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmMessageMedia` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageMedia`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'media')
-
9
if (value = attributes[:'media']).is_a?(Array)
-
9
self.media = value
-
end
-
else
-
1
self.media = nil
-
end
-
-
9
if attributes.key?(:'suggestions')
-
6
if (value = attributes[:'suggestions']).is_a?(Array)
-
6
self.suggestions = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @media.nil?
-
invalid_properties.push('invalid value for "media", media cannot be nil.')
-
end
-
-
if !@suggestions.nil? && @suggestions.length > 11
-
invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @media.nil?
-
return false if !@suggestions.nil? && @suggestions.length > 11
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] media Value to be assigned
-
1
def media=(media)
-
11
if media.nil?
-
2
fail ArgumentError, 'media cannot be nil'
-
end
-
-
9
@media = media
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] suggestions Value to be assigned
-
1
def suggestions=(suggestions)
-
8
if suggestions.nil?
-
1
fail ArgumentError, 'suggestions cannot be nil'
-
end
-
-
7
if suggestions.length > 11
-
1
fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.'
-
end
-
-
6
@suggestions = suggestions
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
media == o.media &&
-
suggestions == o.suggestions
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[media, suggestions].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
elsif !attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmOpenUrlEnum
-
1
BROWSER = 'BROWSER'.freeze
-
1
WEBVIEW = 'WEBVIEW'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [BROWSER, WEBVIEW].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if RbmOpenUrlEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RbmOpenUrlEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmStandaloneCard < ApiModelBase
-
1
attr_accessor :orientation
-
-
1
attr_accessor :thumbnail_image_alignment
-
-
1
attr_accessor :card_content
-
-
# An array of suggested actions for the recipient.
-
1
attr_accessor :suggestions
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
53
{
-
:'orientation' => :'orientation',
-
:'thumbnail_image_alignment' => :'thumbnailImageAlignment',
-
:'card_content' => :'cardContent',
-
:'suggestions' => :'suggestions'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
20
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
9
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'orientation' => :'StandaloneCardOrientationEnum',
-
:'thumbnail_image_alignment' => :'ThumbnailAlignmentEnum',
-
:'card_content' => :'RbmCardContent',
-
:'suggestions' => :'Array<MultiChannelAction>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmStandaloneCard` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
34
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmStandaloneCard`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
33
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'orientation')
-
10
self.orientation = attributes[:'orientation']
-
else
-
self.orientation = nil
-
end
-
-
9
if attributes.key?(:'thumbnail_image_alignment')
-
9
self.thumbnail_image_alignment = attributes[:'thumbnail_image_alignment']
-
end
-
-
9
if attributes.key?(:'card_content')
-
9
self.card_content = attributes[:'card_content']
-
else
-
self.card_content = nil
-
end
-
-
8
if attributes.key?(:'suggestions')
-
5
if (value = attributes[:'suggestions']).is_a?(Array)
-
5
self.suggestions = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @orientation.nil?
-
invalid_properties.push('invalid value for "orientation", orientation cannot be nil.')
-
end
-
-
if @card_content.nil?
-
invalid_properties.push('invalid value for "card_content", card_content cannot be nil.')
-
end
-
-
if !@suggestions.nil? && @suggestions.length > 11
-
invalid_properties.push('invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @orientation.nil?
-
return false if @card_content.nil?
-
return false if !@suggestions.nil? && @suggestions.length > 11
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] orientation Value to be assigned
-
1
def orientation=(orientation)
-
10
if orientation.nil?
-
1
fail ArgumentError, 'orientation cannot be nil'
-
end
-
-
9
@orientation = orientation
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] card_content Value to be assigned
-
1
def card_content=(card_content)
-
9
if card_content.nil?
-
1
fail ArgumentError, 'card_content cannot be nil'
-
end
-
-
8
@card_content = card_content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] suggestions Value to be assigned
-
1
def suggestions=(suggestions)
-
7
if suggestions.nil?
-
1
fail ArgumentError, 'suggestions cannot be nil'
-
end
-
-
6
if suggestions.length > 11
-
1
fail ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.'
-
end
-
-
5
@suggestions = suggestions
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
orientation == o.orientation &&
-
thumbnail_image_alignment == o.thumbnail_image_alignment &&
-
card_content == o.card_content &&
-
suggestions == o.suggestions
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[orientation, thumbnail_image_alignment, card_content, suggestions].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmSuggestionResponse < ApiModelBase
-
# The text associated with the suggestion response.
-
1
attr_accessor :text
-
-
# Base64 payload the customer receives when the reply is clicked.
-
1
attr_accessor :postback_data
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
20
{
-
:'text' => :'text',
-
:'postback_data' => :'postbackData'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'text' => :'String',
-
:'postback_data' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmSuggestionResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
11
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmSuggestionResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
10
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'text')
-
5
self.text = attributes[:'text']
-
end
-
-
7
if attributes.key?(:'postback_data')
-
5
self.postback_data = attributes[:'postback_data']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@postback_data.nil? && @postback_data.to_s.length > 2048
-
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@postback_data.nil? && @postback_data.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] postback_data Value to be assigned
-
1
def postback_data=(postback_data)
-
7
if postback_data.nil?
-
1
fail ArgumentError, 'postback_data cannot be nil'
-
end
-
-
6
if postback_data.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
-
end
-
-
5
@postback_data = postback_data
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
text == o.text &&
-
postback_data == o.postback_data
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text, postback_data].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RbmWebViewEnum
-
1
FULL = 'FULL'.freeze
-
1
HALF = 'HALF'.freeze
-
1
TALL = 'TALL'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [FULL, HALF, TALL].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if RbmWebViewEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RbmWebViewEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Recording Available event is sent after a recording has been processed. It indicates that the recording is available for download.
-
1
class RecordingAvailableCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
1
attr_accessor :file_format
-
-
# Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
-
1
attr_accessor :channels
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :status
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
99
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'parent_call_id' => :'parentCallId',
-
:'recording_id' => :'recordingId',
-
:'media_url' => :'mediaUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'duration' => :'duration',
-
:'file_format' => :'fileFormat',
-
:'channels' => :'channels',
-
:'tag' => :'tag',
-
:'status' => :'status',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'parent_call_id' => :'String',
-
:'recording_id' => :'String',
-
:'media_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'duration' => :'String',
-
:'file_format' => :'FileFormatEnum',
-
:'channels' => :'Integer',
-
:'tag' => :'String',
-
:'status' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RecordingAvailableCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
89
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
88
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'recording_id')
-
4
self.recording_id = attributes[:'recording_id']
-
end
-
-
6
if attributes.key?(:'media_url')
-
4
self.media_url = attributes[:'media_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'duration')
-
4
self.duration = attributes[:'duration']
-
end
-
-
6
if attributes.key?(:'file_format')
-
4
self.file_format = attributes[:'file_format']
-
end
-
-
6
if attributes.key?(:'channels')
-
4
self.channels = attributes[:'channels']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'status')
-
4
self.status = attributes[:'status']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
parent_call_id == o.parent_call_id &&
-
recording_id == o.recording_id &&
-
media_url == o.media_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
duration == o.duration &&
-
file_format == o.file_format &&
-
channels == o.channels &&
-
tag == o.tag &&
-
status == o.status &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, recording_id, media_url, enqueued_time, start_time, end_time, duration, file_format, channels, tag, status, transfer_caller_id, transfer_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
22
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
22
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
22
elsif !attributes[attribute_map[key]].nil?
-
22
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
44
value = self.send(attr)
-
44
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
44
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Record Complete event is sent after a <Record> verb has executed if the call is still active. The BXML returned by this callback is executed next. When the recording is available for download, a Recording Available event will be sent.
-
1
class RecordingCompleteCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
1
attr_accessor :file_format
-
-
# Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
-
1
attr_accessor :channels
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
99
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'parent_call_id' => :'parentCallId',
-
:'recording_id' => :'recordingId',
-
:'media_url' => :'mediaUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'end_time' => :'endTime',
-
:'duration' => :'duration',
-
:'file_format' => :'fileFormat',
-
:'channels' => :'channels',
-
:'tag' => :'tag',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'parent_call_id' => :'String',
-
:'recording_id' => :'String',
-
:'media_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'end_time' => :'Time',
-
:'duration' => :'String',
-
:'file_format' => :'FileFormatEnum',
-
:'channels' => :'Integer',
-
:'tag' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RecordingCompleteCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
89
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
88
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'recording_id')
-
4
self.recording_id = attributes[:'recording_id']
-
end
-
-
6
if attributes.key?(:'media_url')
-
4
self.media_url = attributes[:'media_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'duration')
-
4
self.duration = attributes[:'duration']
-
end
-
-
6
if attributes.key?(:'file_format')
-
4
self.file_format = attributes[:'file_format']
-
end
-
-
6
if attributes.key?(:'channels')
-
4
self.channels = attributes[:'channels']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
parent_call_id == o.parent_call_id &&
-
recording_id == o.recording_id &&
-
media_url == o.media_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
end_time == o.end_time &&
-
duration == o.duration &&
-
file_format == o.file_format &&
-
channels == o.channels &&
-
tag == o.tag &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, recording_id, media_url, enqueued_time, start_time, answer_time, end_time, duration, file_format, channels, tag, transfer_caller_id, transfer_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
22
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
22
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
22
elsif !attributes[attribute_map[key]].nil?
-
22
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
44
value = self.send(attr)
-
44
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
44
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RecordingStateEnum
-
1
PAUSED = 'paused'.freeze
-
1
RECORDING = 'recording'.freeze
-
-
1
def self.all_vars
-
5
@all_vars ||= [PAUSED, RECORDING].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
4
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
4
return value if RecordingStateEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RecordingStateEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# If the recording was transcribed, metadata about the transcription
-
1
class RecordingTranscriptionMetadata < ApiModelBase
-
# The unique transcription ID
-
1
attr_accessor :id
-
-
# The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
-
1
attr_accessor :status
-
-
# The time that the transcription was completed
-
1
attr_accessor :completed_time
-
-
# The URL of the [transcription](#operation/getCallTranscription)
-
1
attr_accessor :url
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
61
{
-
:'id' => :'id',
-
:'status' => :'status',
-
:'completed_time' => :'completedTime',
-
:'url' => :'url'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'id' => :'String',
-
:'status' => :'String',
-
:'completed_time' => :'Time',
-
:'url' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RecordingTranscriptionMetadata` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
25
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
24
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'id')
-
6
self.id = attributes[:'id']
-
end
-
-
8
if attributes.key?(:'status')
-
6
self.status = attributes[:'status']
-
end
-
-
8
if attributes.key?(:'completed_time')
-
6
self.completed_time = attributes[:'completed_time']
-
end
-
-
8
if attributes.key?(:'url')
-
6
self.url = attributes[:'url']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
status == o.status &&
-
completed_time == o.completed_time &&
-
url == o.url
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, status, completed_time, url].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
12
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
12
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
12
elsif !attributes[attribute_map[key]].nil?
-
12
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RecordingTranscriptions < ApiModelBase
-
1
attr_accessor :transcripts
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
20
{
-
:'transcripts' => :'transcripts'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'transcripts' => :'Array<Transcription>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RecordingTranscriptions` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
6
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingTranscriptions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
5
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'transcripts')
-
5
if (value = attributes[:'transcripts']).is_a?(Array)
-
5
self.transcripts = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
transcripts == o.transcripts
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[transcripts].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
2
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
elsif !attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Redirect event is fired when a <Redirect> verb is executed. Its purpose is to get the next set of verbs from the calling application.
-
1
class RedirectCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
75
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'parent_call_id' => :'parentCallId',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'parent_call_id' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RedirectCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
65
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
64
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
parent_call_id == o.parent_call_id &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, enqueued_time, start_time, answer_time, tag, transfer_caller_id, transfer_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
16
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
16
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
16
elsif !attributes[attribute_map[key]].nil?
-
16
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
32
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class RedirectMethodEnum
-
1
GET = 'GET'.freeze
-
1
POST = 'POST'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [GET, POST].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if RedirectMethodEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #RedirectMethodEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class SipConnectionMetadata < ApiModelBase
-
# The IP address of the SIP connection.
-
1
attr_accessor :ip_address
-
-
# The port of the SIP connection.
-
1
attr_accessor :port
-
-
1
attr_accessor :credentials
-
-
# The User-to-User Information header for the SIP connection.
-
1
attr_accessor :uui_header
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
27
{
-
:'ip_address' => :'ipAddress',
-
:'port' => :'port',
-
:'credentials' => :'credentials',
-
:'uui_header' => :'uuiHeader'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'ip_address' => :'String',
-
:'port' => :'Integer',
-
:'credentials' => :'SipCredentials',
-
:'uui_header' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SipConnectionMetadata` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
17
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SipConnectionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
16
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'ip_address')
-
4
self.ip_address = attributes[:'ip_address']
-
end
-
-
6
if attributes.key?(:'port')
-
4
self.port = attributes[:'port']
-
end
-
-
6
if attributes.key?(:'credentials')
-
4
self.credentials = attributes[:'credentials']
-
end
-
-
6
if attributes.key?(:'uui_header')
-
4
self.uui_header = attributes[:'uui_header']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
ip_address == o.ip_address &&
-
port == o.port &&
-
credentials == o.credentials &&
-
uui_header == o.uui_header
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[ip_address, port, credentials, uui_header].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class SipCredentials < ApiModelBase
-
# The username for the SIP connection.
-
1
attr_accessor :username
-
-
# The password for the SIP connection.
-
1
attr_accessor :password
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
33
{
-
:'username' => :'username',
-
:'password' => :'password'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'username' => :'String',
-
:'password' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SipCredentials` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
17
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SipCredentials`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
16
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'username')
-
8
self.username = attributes[:'username']
-
end
-
-
10
if attributes.key?(:'password')
-
8
self.password = attributes[:'password']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
username == o.username &&
-
password == o.password
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[username, password].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class SmsMessageContent < ApiModelBase
-
# The contents of the text message. Must be 2048 characters or less.
-
1
attr_accessor :text
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
66
{
-
:'text' => :'text'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
34
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'text' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
34
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SmsMessageContent` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
33
acceptable_attribute_map = self.class.acceptable_attribute_map
-
33
attributes = attributes.each_with_object({}) { |(k, v), h|
-
33
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
32
h[k.to_sym] = v
-
}
-
-
32
if attributes.key?(:'text')
-
32
self.text = attributes[:'text']
-
else
-
self.text = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @text.nil?
-
invalid_properties.push('invalid value for "text", text cannot be nil.')
-
end
-
-
if @text.to_s.length > 2048
-
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @text.nil?
-
return false if @text.to_s.length > 2048
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] text Value to be assigned
-
1
def text=(text)
-
32
if text.nil?
-
1
fail ArgumentError, 'text cannot be nil'
-
end
-
-
31
if text.to_s.length > 2048
-
1
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.'
-
end
-
-
30
@text = text
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
4
return true if self.equal?(o)
-
4
self.class == o.class &&
-
text == o.text
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
5
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
5
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
5
elsif !attributes[attribute_map[key]].nil?
-
5
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
11
hash = {}
-
11
self.class.attribute_map.each_pair do |attr, param|
-
11
value = self.send(attr)
-
11
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
11
hash[param] = _to_hash(value)
-
end
-
11
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class StandaloneCardOrientationEnum
-
1
HORIZONTAL = 'HORIZONTAL'.freeze
-
1
VERTICAL = 'VERTICAL'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [HORIZONTAL, VERTICAL].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if StandaloneCardOrientationEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #StandaloneCardOrientationEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Represents a status callback for an outbound MT SMS or MMS or RBM message.
-
1
class StatusCallback < ApiModelBase
-
1
attr_accessor :time
-
-
# Represents the time at which the message was read, for `message-read` callbacks.
-
1
attr_accessor :event_time
-
-
1
attr_accessor :type
-
-
# The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number.
-
1
attr_accessor :to
-
-
# A detailed description of the event described by the callback.
-
1
attr_accessor :description
-
-
1
attr_accessor :message
-
-
# Optional error code, applicable only when type is `message-failed`.
-
1
attr_accessor :error_code
-
-
# The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled.
-
1
attr_accessor :carrier_name
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
48
{
-
:'time' => :'time',
-
:'event_time' => :'eventTime',
-
:'type' => :'type',
-
:'to' => :'to',
-
:'description' => :'description',
-
:'message' => :'message',
-
:'error_code' => :'errorCode',
-
:'carrier_name' => :'carrierName'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'time' => :'Time',
-
:'event_time' => :'Time',
-
:'type' => :'StatusCallbackTypeEnum',
-
:'to' => :'String',
-
:'description' => :'String',
-
:'message' => :'StatusCallbackMessage',
-
:'error_code' => :'Integer',
-
:'carrier_name' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::StatusCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
83
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StatusCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
82
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'time')
-
11
self.time = attributes[:'time']
-
else
-
self.time = nil
-
end
-
-
11
if attributes.key?(:'event_time')
-
9
self.event_time = attributes[:'event_time']
-
end
-
-
11
if attributes.key?(:'type')
-
11
self.type = attributes[:'type']
-
else
-
self.type = nil
-
end
-
-
11
if attributes.key?(:'to')
-
11
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
11
if attributes.key?(:'description')
-
11
self.description = attributes[:'description']
-
else
-
self.description = nil
-
end
-
-
11
if attributes.key?(:'message')
-
11
self.message = attributes[:'message']
-
else
-
self.message = nil
-
end
-
-
11
if attributes.key?(:'error_code')
-
9
self.error_code = attributes[:'error_code']
-
end
-
-
11
if attributes.key?(:'carrier_name')
-
9
self.carrier_name = attributes[:'carrier_name']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @time.nil?
-
invalid_properties.push('invalid value for "time", time cannot be nil.')
-
end
-
-
if @type.nil?
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @description.nil?
-
invalid_properties.push('invalid value for "description", description cannot be nil.')
-
end
-
-
if @message.nil?
-
invalid_properties.push('invalid value for "message", message cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @time.nil?
-
return false if @type.nil?
-
return false if @to.nil?
-
return false if @description.nil?
-
return false if @message.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] time Value to be assigned
-
1
def time=(time)
-
12
if time.nil?
-
1
fail ArgumentError, 'time cannot be nil'
-
end
-
-
11
@time = time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] type Value to be assigned
-
1
def type=(type)
-
12
if type.nil?
-
1
fail ArgumentError, 'type cannot be nil'
-
end
-
-
11
@type = type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
12
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
11
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] description Value to be assigned
-
1
def description=(description)
-
12
if description.nil?
-
1
fail ArgumentError, 'description cannot be nil'
-
end
-
-
11
@description = description
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message Value to be assigned
-
1
def message=(message)
-
12
if message.nil?
-
1
fail ArgumentError, 'message cannot be nil'
-
end
-
-
11
@message = message
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
time == o.time &&
-
event_time == o.event_time &&
-
type == o.type &&
-
to == o.to &&
-
description == o.description &&
-
message == o.message &&
-
error_code == o.error_code &&
-
carrier_name == o.carrier_name
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[time, event_time, type, to, description, message, error_code, carrier_name].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
16
value = self.send(attr)
-
16
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
16
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Message payload schema within a callback
-
1
class StatusCallbackMessage < ApiModelBase
-
# A unique identifier of the message.
-
1
attr_accessor :id
-
-
# The Bandwidth phone number or alphanumeric identifier associated with the message.
-
1
attr_accessor :owner
-
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth App.
-
1
attr_accessor :application_id
-
-
1
attr_accessor :time
-
-
# The number of segments the user's message is broken into before sending over carrier networks.
-
1
attr_accessor :segment_count
-
-
1
attr_accessor :direction
-
-
# The phone number recipients of the message.
-
1
attr_accessor :to
-
-
# The Bandwidth phone number or alphanumeric identifier the message was sent from.
-
1
attr_accessor :from
-
-
1
attr_accessor :text
-
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
-
1
attr_accessor :tag
-
-
# Optional media, not applicable for sms
-
1
attr_accessor :media
-
-
1
attr_accessor :priority
-
-
1
attr_accessor :channel
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
116
{
-
:'id' => :'id',
-
:'owner' => :'owner',
-
:'application_id' => :'applicationId',
-
:'time' => :'time',
-
:'segment_count' => :'segmentCount',
-
:'direction' => :'direction',
-
:'to' => :'to',
-
:'from' => :'from',
-
:'text' => :'text',
-
:'tag' => :'tag',
-
:'media' => :'media',
-
:'priority' => :'priority',
-
:'channel' => :'channel'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'id' => :'String',
-
:'owner' => :'String',
-
:'application_id' => :'String',
-
:'time' => :'Time',
-
:'segment_count' => :'Integer',
-
:'direction' => :'MessageDirectionEnum',
-
:'to' => :'Array<String>',
-
:'from' => :'String',
-
:'text' => :'String',
-
:'tag' => :'String',
-
:'media' => :'Array<String>',
-
:'priority' => :'PriorityEnum',
-
:'channel' => :'MultiChannelMessageChannelEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::StatusCallbackMessage` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
182
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StatusCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
181
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'id')
-
15
self.id = attributes[:'id']
-
else
-
self.id = nil
-
end
-
-
15
if attributes.key?(:'owner')
-
15
self.owner = attributes[:'owner']
-
else
-
self.owner = nil
-
end
-
-
15
if attributes.key?(:'application_id')
-
15
self.application_id = attributes[:'application_id']
-
else
-
self.application_id = nil
-
end
-
-
15
if attributes.key?(:'time')
-
15
self.time = attributes[:'time']
-
else
-
self.time = nil
-
end
-
-
15
if attributes.key?(:'segment_count')
-
15
self.segment_count = attributes[:'segment_count']
-
else
-
self.segment_count = nil
-
end
-
-
15
if attributes.key?(:'direction')
-
15
self.direction = attributes[:'direction']
-
else
-
self.direction = nil
-
end
-
-
15
if attributes.key?(:'to')
-
15
if (value = attributes[:'to']).is_a?(Array)
-
15
self.to = value
-
end
-
else
-
self.to = nil
-
end
-
-
15
if attributes.key?(:'from')
-
15
self.from = attributes[:'from']
-
else
-
self.from = nil
-
end
-
-
15
if attributes.key?(:'text')
-
13
self.text = attributes[:'text']
-
end
-
-
15
if attributes.key?(:'tag')
-
12
self.tag = attributes[:'tag']
-
end
-
-
15
if attributes.key?(:'media')
-
12
if (value = attributes[:'media']).is_a?(Array)
-
12
self.media = value
-
end
-
end
-
-
15
if attributes.key?(:'priority')
-
12
self.priority = attributes[:'priority']
-
end
-
-
15
if attributes.key?(:'channel')
-
12
self.channel = attributes[:'channel']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @id.nil?
-
invalid_properties.push('invalid value for "id", id cannot be nil.')
-
end
-
-
if @owner.nil?
-
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
-
end
-
-
if @application_id.nil?
-
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
-
end
-
-
if @time.nil?
-
invalid_properties.push('invalid value for "time", time cannot be nil.')
-
end
-
-
if @segment_count.nil?
-
invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.')
-
end
-
-
if @direction.nil?
-
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
-
end
-
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
if @from.nil?
-
invalid_properties.push('invalid value for "from", from cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @id.nil?
-
return false if @owner.nil?
-
return false if @application_id.nil?
-
return false if @time.nil?
-
return false if @segment_count.nil?
-
return false if @direction.nil?
-
return false if @to.nil?
-
return false if @from.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] id Value to be assigned
-
1
def id=(id)
-
16
if id.nil?
-
1
fail ArgumentError, 'id cannot be nil'
-
end
-
-
15
@id = id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] owner Value to be assigned
-
1
def owner=(owner)
-
16
if owner.nil?
-
1
fail ArgumentError, 'owner cannot be nil'
-
end
-
-
15
@owner = owner
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] application_id Value to be assigned
-
1
def application_id=(application_id)
-
16
if application_id.nil?
-
1
fail ArgumentError, 'application_id cannot be nil'
-
end
-
-
15
@application_id = application_id
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] time Value to be assigned
-
1
def time=(time)
-
16
if time.nil?
-
1
fail ArgumentError, 'time cannot be nil'
-
end
-
-
15
@time = time
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] segment_count Value to be assigned
-
1
def segment_count=(segment_count)
-
16
if segment_count.nil?
-
1
fail ArgumentError, 'segment_count cannot be nil'
-
end
-
-
15
@segment_count = segment_count
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] direction Value to be assigned
-
1
def direction=(direction)
-
16
if direction.nil?
-
1
fail ArgumentError, 'direction cannot be nil'
-
end
-
-
15
@direction = direction
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
16
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
15
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] from Value to be assigned
-
1
def from=(from)
-
16
if from.nil?
-
1
fail ArgumentError, 'from cannot be nil'
-
end
-
-
15
@from = from
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
owner == o.owner &&
-
application_id == o.application_id &&
-
time == o.time &&
-
segment_count == o.segment_count &&
-
direction == o.direction &&
-
to == o.to &&
-
from == o.from &&
-
text == o.text &&
-
tag == o.tag &&
-
media == o.media &&
-
priority == o.priority &&
-
channel == o.channel
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
26
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
26
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
6
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
22
elsif !attributes[attribute_map[key]].nil?
-
19
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
26
value = self.send(attr)
-
26
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
26
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class StatusCallbackTypeEnum
-
1
MESSAGE_SENDING = 'message-sending'.freeze
-
1
MESSAGE_DELIVERED = 'message-delivered'.freeze
-
1
MESSAGE_FAILED = 'message-failed'.freeze
-
1
MESSAGE_READ = 'message-read'.freeze
-
-
1
def self.all_vars
-
7
@all_vars ||= [MESSAGE_SENDING, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if StatusCallbackTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #StatusCallbackTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class StirShaken < ApiModelBase
-
# (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed.
-
1
attr_accessor :verstat
-
-
# (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway).
-
1
attr_accessor :attestation_indicator
-
-
# (optional) A unique origination identifier.
-
1
attr_accessor :originating_id
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
36
{
-
:'verstat' => :'verstat',
-
:'attestation_indicator' => :'attestationIndicator',
-
:'originating_id' => :'originatingId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'verstat' => :'String',
-
:'attestation_indicator' => :'String',
-
:'originating_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::StirShaken` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
16
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StirShaken`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
15
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'verstat')
-
5
self.verstat = attributes[:'verstat']
-
end
-
-
7
if attributes.key?(:'attestation_indicator')
-
5
self.attestation_indicator = attributes[:'attestation_indicator']
-
end
-
-
7
if attributes.key?(:'originating_id')
-
5
self.originating_id = attributes[:'originating_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
verstat == o.verstat &&
-
attestation_indicator == o.attestation_indicator &&
-
originating_id == o.originating_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[verstat, attestation_indicator, originating_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class SyncLookupRequest < ApiModelBase
-
# Telephone numbers in E.164 format.
-
1
attr_accessor :phone_numbers
-
-
# Override the default RCS sender/agent ID used when checking RCS capabilities. When provided, this value is used as the `sender` in the RCS capability-check request instead of the account default. Must be 1–40 characters and contain only letters, digits, underscores, or hyphens.
-
1
attr_accessor :rcs_agent
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
25
{
-
:'phone_numbers' => :'phoneNumbers',
-
:'rcs_agent' => :'rcsAgent'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'phone_numbers' => :'Array<String>',
-
:'rcs_agent' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SyncLookupRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'phone_numbers')
-
11
if (value = attributes[:'phone_numbers']).is_a?(Array)
-
11
self.phone_numbers = value
-
end
-
else
-
self.phone_numbers = nil
-
end
-
-
11
if attributes.key?(:'rcs_agent')
-
9
self.rcs_agent = attributes[:'rcs_agent']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @phone_numbers.nil?
-
invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
-
end
-
-
pattern = Regexp.new(/^[A-Za-z0-9_-]{1,40}$/)
-
if !@rcs_agent.nil? && @rcs_agent !~ pattern
-
invalid_properties.push("invalid value for \"rcs_agent\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @phone_numbers.nil?
-
return false if !@rcs_agent.nil? && @rcs_agent !~ Regexp.new(/^[A-Za-z0-9_-]{1,40}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_numbers Value to be assigned
-
1
def phone_numbers=(phone_numbers)
-
12
if phone_numbers.nil?
-
1
fail ArgumentError, 'phone_numbers cannot be nil'
-
end
-
-
11
@phone_numbers = phone_numbers
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] rcs_agent Value to be assigned
-
1
def rcs_agent=(rcs_agent)
-
9
if rcs_agent.nil?
-
1
fail ArgumentError, 'rcs_agent cannot be nil'
-
end
-
-
8
pattern = Regexp.new(/^[A-Za-z0-9_-]{1,40}$/)
-
8
if rcs_agent !~ pattern
-
1
fail ArgumentError, "invalid value for \"rcs_agent\", must conform to the pattern #{pattern}."
-
end
-
-
7
@rcs_agent = rcs_agent
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
phone_numbers == o.phone_numbers &&
-
rcs_agent == o.rcs_agent
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[phone_numbers, rcs_agent].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
3
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TelephoneNumber < ApiModelBase
-
# Simple Telephone Number.
-
1
attr_accessor :telephone_number
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
30
{
-
:'telephone_number' => :'telephoneNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'telephone_number' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TelephoneNumber` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
10
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TelephoneNumber`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
9
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'telephone_number')
-
9
self.telephone_number = attributes[:'telephone_number']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
telephone_number == o.telephone_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[telephone_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
4
value = self.send(attr)
-
4
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
4
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvBasicAuthentication < ApiModelBase
-
1
attr_accessor :username
-
-
1
attr_accessor :password
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
39
{
-
:'username' => :'username',
-
:'password' => :'password'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
18
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'username' => :'String',
-
:'password' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
18
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvBasicAuthentication` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
17
acceptable_attribute_map = self.class.acceptable_attribute_map
-
17
attributes = attributes.each_with_object({}) { |(k, v), h|
-
33
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvBasicAuthentication`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
32
h[k.to_sym] = v
-
}
-
-
16
if attributes.key?(:'username')
-
16
self.username = attributes[:'username']
-
else
-
self.username = nil
-
end
-
-
14
if attributes.key?(:'password')
-
14
self.password = attributes[:'password']
-
else
-
self.password = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @username.nil?
-
invalid_properties.push('invalid value for "username", username cannot be nil.')
-
end
-
-
if @username.to_s.length > 100
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 100.')
-
end
-
-
if @password.nil?
-
invalid_properties.push('invalid value for "password", password cannot be nil.')
-
end
-
-
if @password.to_s.length > 200
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 200.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @username.nil?
-
return false if @username.to_s.length > 100
-
return false if @password.nil?
-
return false if @password.to_s.length > 200
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
16
if username.nil?
-
1
fail ArgumentError, 'username cannot be nil'
-
end
-
-
15
if username.to_s.length > 100
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.'
-
end
-
-
14
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
14
if password.nil?
-
1
fail ArgumentError, 'password cannot be nil'
-
end
-
-
13
if password.to_s.length > 200
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.'
-
end
-
-
12
@password = password
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
username == o.username &&
-
password == o.password
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[username, password].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvCallbackStatusEnum
-
1
VERIFIED = 'VERIFIED'.freeze
-
1
UNVERIFIED = 'UNVERIFIED'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [VERIFIED, UNVERIFIED].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if TfvCallbackStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #TfvCallbackStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# A generic error object.
-
1
class TfvError < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :description
-
-
# Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field.
-
1
attr_accessor :errors
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
23
{
-
:'type' => :'type',
-
:'description' => :'description',
-
:'errors' => :'errors'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'String',
-
:'description' => :'String',
-
:'errors' => :'Object'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'type')
-
4
self.type = attributes[:'type']
-
end
-
-
6
if attributes.key?(:'description')
-
4
self.description = attributes[:'description']
-
end
-
-
6
if attributes.key?(:'errors')
-
4
self.errors = attributes[:'errors']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
description == o.description &&
-
errors == o.errors
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, description, errors].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvStatus < ApiModelBase
-
# Toll-free telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
1
attr_accessor :status
-
-
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads.
-
1
attr_accessor :internal_ticket_number
-
-
# Explanation for why a verification request was declined.
-
1
attr_accessor :decline_reason_description
-
-
# Whether a Toll-Free Verification request qualifies for resubmission via PUT.
-
1
attr_accessor :resubmit_allowed
-
-
# Date and time the verification request was created.
-
1
attr_accessor :created_date_time
-
-
# Date and time the verification request was last modified.
-
1
attr_accessor :modified_date_time
-
-
1
attr_accessor :submission
-
-
# Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked
-
-
# The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked_reason
-
-
# The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection.
-
1
attr_accessor :cv_token
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
105
{
-
:'phone_number' => :'phoneNumber',
-
:'status' => :'status',
-
:'internal_ticket_number' => :'internalTicketNumber',
-
:'decline_reason_description' => :'declineReasonDescription',
-
:'resubmit_allowed' => :'resubmitAllowed',
-
:'created_date_time' => :'createdDateTime',
-
:'modified_date_time' => :'modifiedDateTime',
-
:'submission' => :'submission',
-
:'blocked' => :'blocked',
-
:'blocked_reason' => :'blockedReason',
-
:'cv_token' => :'cvToken'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'phone_number' => :'String',
-
:'status' => :'TfvStatusEnum',
-
:'internal_ticket_number' => :'String',
-
:'decline_reason_description' => :'String',
-
:'resubmit_allowed' => :'Boolean',
-
:'created_date_time' => :'Time',
-
:'modified_date_time' => :'Time',
-
:'submission' => :'TfvSubmissionInfo',
-
:'blocked' => :'Boolean',
-
:'blocked_reason' => :'String',
-
:'cv_token' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'cv_token'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvStatus` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
61
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvStatus`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
60
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'phone_number')
-
9
self.phone_number = attributes[:'phone_number']
-
end
-
-
8
if attributes.key?(:'status')
-
5
self.status = attributes[:'status']
-
end
-
-
8
if attributes.key?(:'internal_ticket_number')
-
5
self.internal_ticket_number = attributes[:'internal_ticket_number']
-
end
-
-
8
if attributes.key?(:'decline_reason_description')
-
5
self.decline_reason_description = attributes[:'decline_reason_description']
-
end
-
-
8
if attributes.key?(:'resubmit_allowed')
-
5
self.resubmit_allowed = attributes[:'resubmit_allowed']
-
end
-
-
8
if attributes.key?(:'created_date_time')
-
5
self.created_date_time = attributes[:'created_date_time']
-
end
-
-
8
if attributes.key?(:'modified_date_time')
-
5
self.modified_date_time = attributes[:'modified_date_time']
-
end
-
-
8
if attributes.key?(:'submission')
-
5
self.submission = attributes[:'submission']
-
end
-
-
8
if attributes.key?(:'blocked')
-
5
self.blocked = attributes[:'blocked']
-
end
-
-
8
if attributes.key?(:'blocked_reason')
-
5
self.blocked_reason = attributes[:'blocked_reason']
-
end
-
-
8
if attributes.key?(:'cv_token')
-
6
self.cv_token = attributes[:'cv_token']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@phone_number.nil? && @phone_number.to_s.length > 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
end
-
-
if !@phone_number.nil? && @phone_number.to_s.length < 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
end
-
-
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
if !@phone_number.nil? && @phone_number !~ pattern
-
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length > 500
-
invalid_properties.push('invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length < 0
-
invalid_properties.push('invalid value for "cv_token", the character length must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
-
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
-
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
return false if !@cv_token.nil? && @cv_token.to_s.length > 500
-
return false if !@cv_token.nil? && @cv_token.to_s.length < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
9
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
8
if phone_number.to_s.length > 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
-
end
-
-
7
if phone_number.to_s.length < 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.'
-
end
-
-
6
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
6
if phone_number !~ pattern
-
1
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
-
end
-
-
5
@phone_number = phone_number
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] cv_token Value to be assigned
-
1
def cv_token=(cv_token)
-
6
if !cv_token.nil? && cv_token.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if !cv_token.nil? && cv_token.to_s.length < 0
-
fail ArgumentError, 'invalid value for "cv_token", the character length must be greater than or equal to 0.'
-
end
-
-
5
@cv_token = cv_token
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
phone_number == o.phone_number &&
-
status == o.status &&
-
internal_ticket_number == o.internal_ticket_number &&
-
decline_reason_description == o.decline_reason_description &&
-
resubmit_allowed == o.resubmit_allowed &&
-
created_date_time == o.created_date_time &&
-
modified_date_time == o.modified_date_time &&
-
submission == o.submission &&
-
blocked == o.blocked &&
-
blocked_reason == o.blocked_reason &&
-
cv_token == o.cv_token
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[phone_number, status, internal_ticket_number, decline_reason_description, resubmit_allowed, created_date_time, modified_date_time, submission, blocked, blocked_reason, cv_token].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
22
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
22
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
22
elsif !attributes[attribute_map[key]].nil?
-
22
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
22
value = self.send(attr)
-
22
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
22
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvStatusEnum
-
1
VERIFIED = 'VERIFIED'.freeze
-
1
UNVERIFIED = 'UNVERIFIED'.freeze
-
1
PENDING = 'PENDING'.freeze
-
-
1
def self.all_vars
-
8
@all_vars ||= [VERIFIED, UNVERIFIED, PENDING].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
6
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
6
return value if TfvStatusEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #TfvStatusEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvSubmissionInfo < ApiModelBase
-
1
attr_accessor :business_address
-
-
1
attr_accessor :business_contact
-
-
# Estimated monthly volume of messages from the toll-free number.
-
1
attr_accessor :message_volume
-
-
# The category of the use case.
-
1
attr_accessor :use_case
-
-
# A general idea of the use case and customer.
-
1
attr_accessor :use_case_summary
-
-
# Example of message content.
-
1
attr_accessor :production_message_content
-
-
1
attr_accessor :opt_in_workflow
-
-
# Any additional information.
-
1
attr_accessor :additional_information
-
-
# ISV name.
-
1
attr_accessor :isv_reseller
-
-
# The Toll-Free Verification request privacy policy URL.
-
1
attr_accessor :privacy_policy_url
-
-
# The Toll-Free Verification request terms and conditions policy URL.
-
1
attr_accessor :terms_and_conditions_url
-
-
# The company 'Doing Business As'.
-
1
attr_accessor :business_dba
-
-
# Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.**
-
1
attr_accessor :business_registration_number
-
-
1
attr_accessor :business_registration_type
-
-
# The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code |
-
1
attr_accessor :business_registration_issuing_country
-
-
1
attr_accessor :business_entity_type
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
193
{
-
:'business_address' => :'businessAddress',
-
:'business_contact' => :'businessContact',
-
:'message_volume' => :'messageVolume',
-
:'use_case' => :'useCase',
-
:'use_case_summary' => :'useCaseSummary',
-
:'production_message_content' => :'productionMessageContent',
-
:'opt_in_workflow' => :'optInWorkflow',
-
:'additional_information' => :'additionalInformation',
-
:'isv_reseller' => :'isvReseller',
-
:'privacy_policy_url' => :'privacyPolicyUrl',
-
:'terms_and_conditions_url' => :'termsAndConditionsUrl',
-
:'business_dba' => :'businessDba',
-
:'business_registration_number' => :'businessRegistrationNumber',
-
:'business_registration_type' => :'businessRegistrationType',
-
:'business_registration_issuing_country' => :'businessRegistrationIssuingCountry',
-
:'business_entity_type' => :'businessEntityType'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
28
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'business_address' => :'Address',
-
:'business_contact' => :'Contact',
-
:'message_volume' => :'Integer',
-
:'use_case' => :'String',
-
:'use_case_summary' => :'String',
-
:'production_message_content' => :'String',
-
:'opt_in_workflow' => :'OptInWorkflow',
-
:'additional_information' => :'String',
-
:'isv_reseller' => :'String',
-
:'privacy_policy_url' => :'String',
-
:'terms_and_conditions_url' => :'String',
-
:'business_dba' => :'String',
-
:'business_registration_number' => :'String',
-
:'business_registration_type' => :'BusinessRegistrationTypeEnum',
-
:'business_registration_issuing_country' => :'String',
-
:'business_entity_type' => :'BusinessEntityTypeEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
28
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvSubmissionInfo` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
27
acceptable_attribute_map = self.class.acceptable_attribute_map
-
27
attributes = attributes.each_with_object({}) { |(k, v), h|
-
100
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvSubmissionInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
99
h[k.to_sym] = v
-
}
-
-
26
if attributes.key?(:'business_address')
-
6
self.business_address = attributes[:'business_address']
-
end
-
-
26
if attributes.key?(:'business_contact')
-
5
self.business_contact = attributes[:'business_contact']
-
end
-
-
26
if attributes.key?(:'message_volume')
-
8
self.message_volume = attributes[:'message_volume']
-
end
-
-
23
if attributes.key?(:'use_case')
-
7
self.use_case = attributes[:'use_case']
-
end
-
-
21
if attributes.key?(:'use_case_summary')
-
7
self.use_case_summary = attributes[:'use_case_summary']
-
end
-
-
19
if attributes.key?(:'production_message_content')
-
7
self.production_message_content = attributes[:'production_message_content']
-
end
-
-
17
if attributes.key?(:'opt_in_workflow')
-
5
self.opt_in_workflow = attributes[:'opt_in_workflow']
-
end
-
-
17
if attributes.key?(:'additional_information')
-
6
self.additional_information = attributes[:'additional_information']
-
end
-
-
16
if attributes.key?(:'isv_reseller')
-
6
self.isv_reseller = attributes[:'isv_reseller']
-
end
-
-
15
if attributes.key?(:'privacy_policy_url')
-
7
self.privacy_policy_url = attributes[:'privacy_policy_url']
-
end
-
-
13
if attributes.key?(:'terms_and_conditions_url')
-
7
self.terms_and_conditions_url = attributes[:'terms_and_conditions_url']
-
end
-
-
11
if attributes.key?(:'business_dba')
-
7
self.business_dba = attributes[:'business_dba']
-
end
-
-
9
if attributes.key?(:'business_registration_number')
-
6
self.business_registration_number = attributes[:'business_registration_number']
-
end
-
-
8
if attributes.key?(:'business_registration_type')
-
5
self.business_registration_type = attributes[:'business_registration_type']
-
end
-
-
8
if attributes.key?(:'business_registration_issuing_country')
-
5
self.business_registration_issuing_country = attributes[:'business_registration_issuing_country']
-
end
-
-
8
if attributes.key?(:'business_entity_type')
-
5
self.business_entity_type = attributes[:'business_entity_type']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@message_volume.nil? && @message_volume > 10000000
-
invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
end
-
-
if !@message_volume.nil? && @message_volume < 10
-
invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
if !@use_case.nil? && @use_case.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@use_case.nil? && @use_case.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.')
-
end
-
-
if !@use_case_summary.nil? && @use_case_summary.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@use_case_summary.nil? && @use_case_summary.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.')
-
end
-
-
if !@production_message_content.nil? && @production_message_content.to_s.length > 500
-
invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@production_message_content.nil? && @production_message_content.to_s.length < 0
-
invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length > 500
-
invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length < 0
-
invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.')
-
end
-
-
if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
invalid_properties.push('invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
invalid_properties.push('invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_dba.nil? && @business_dba.to_s.length > 500
-
invalid_properties.push('invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
invalid_properties.push('invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@message_volume.nil? && @message_volume > 10000000
-
return false if !@message_volume.nil? && @message_volume < 10
-
return false if !@use_case.nil? && @use_case.to_s.length > 500
-
return false if !@use_case.nil? && @use_case.to_s.length < 0
-
return false if !@use_case_summary.nil? && @use_case_summary.to_s.length > 500
-
return false if !@use_case_summary.nil? && @use_case_summary.to_s.length < 0
-
return false if !@production_message_content.nil? && @production_message_content.to_s.length > 500
-
return false if !@production_message_content.nil? && @production_message_content.to_s.length < 0
-
return false if !@additional_information.nil? && @additional_information.to_s.length > 500
-
return false if !@additional_information.nil? && @additional_information.to_s.length < 0
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
return false if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
return false if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
return false if !@business_dba.nil? && @business_dba.to_s.length > 500
-
return false if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message_volume Value to be assigned
-
1
def message_volume=(message_volume)
-
8
if message_volume.nil?
-
1
fail ArgumentError, 'message_volume cannot be nil'
-
end
-
-
7
if message_volume > 10000000
-
1
fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.'
-
end
-
-
6
if message_volume < 10
-
1
fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.'
-
end
-
-
5
@message_volume = message_volume
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case Value to be assigned
-
1
def use_case=(use_case)
-
7
if use_case.nil?
-
1
fail ArgumentError, 'use_case cannot be nil'
-
end
-
-
6
if use_case.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if use_case.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.'
-
end
-
-
5
@use_case = use_case
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case_summary Value to be assigned
-
1
def use_case_summary=(use_case_summary)
-
7
if use_case_summary.nil?
-
1
fail ArgumentError, 'use_case_summary cannot be nil'
-
end
-
-
6
if use_case_summary.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if use_case_summary.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.'
-
end
-
-
5
@use_case_summary = use_case_summary
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] production_message_content Value to be assigned
-
1
def production_message_content=(production_message_content)
-
7
if production_message_content.nil?
-
1
fail ArgumentError, 'production_message_content cannot be nil'
-
end
-
-
6
if production_message_content.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if production_message_content.to_s.length < 0
-
fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.'
-
end
-
-
5
@production_message_content = production_message_content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] additional_information Value to be assigned
-
1
def additional_information=(additional_information)
-
6
if !additional_information.nil? && additional_information.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if !additional_information.nil? && additional_information.to_s.length < 0
-
fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.'
-
end
-
-
5
@additional_information = additional_information
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] isv_reseller Value to be assigned
-
1
def isv_reseller=(isv_reseller)
-
6
if !isv_reseller.nil? && isv_reseller.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.'
-
end
-
-
5
if !isv_reseller.nil? && isv_reseller.to_s.length < 0
-
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.'
-
end
-
-
5
@isv_reseller = isv_reseller
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] privacy_policy_url Value to be assigned
-
1
def privacy_policy_url=(privacy_policy_url)
-
7
if privacy_policy_url.nil?
-
1
fail ArgumentError, 'privacy_policy_url cannot be nil'
-
end
-
-
6
if privacy_policy_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.'
-
end
-
-
5
@privacy_policy_url = privacy_policy_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] terms_and_conditions_url Value to be assigned
-
1
def terms_and_conditions_url=(terms_and_conditions_url)
-
7
if terms_and_conditions_url.nil?
-
1
fail ArgumentError, 'terms_and_conditions_url cannot be nil'
-
end
-
-
6
if terms_and_conditions_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.'
-
end
-
-
5
@terms_and_conditions_url = terms_and_conditions_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_dba Value to be assigned
-
1
def business_dba=(business_dba)
-
7
if business_dba.nil?
-
1
fail ArgumentError, 'business_dba cannot be nil'
-
end
-
-
6
if business_dba.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.'
-
end
-
-
5
@business_dba = business_dba
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_registration_number Value to be assigned
-
1
def business_registration_number=(business_registration_number)
-
6
if !business_registration_number.nil? && business_registration_number.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.'
-
end
-
-
5
@business_registration_number = business_registration_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
business_address == o.business_address &&
-
business_contact == o.business_contact &&
-
message_volume == o.message_volume &&
-
use_case == o.use_case &&
-
use_case_summary == o.use_case_summary &&
-
production_message_content == o.production_message_content &&
-
opt_in_workflow == o.opt_in_workflow &&
-
additional_information == o.additional_information &&
-
isv_reseller == o.isv_reseller &&
-
privacy_policy_url == o.privacy_policy_url &&
-
terms_and_conditions_url == o.terms_and_conditions_url &&
-
business_dba == o.business_dba &&
-
business_registration_number == o.business_registration_number &&
-
business_registration_type == o.business_registration_type &&
-
business_registration_issuing_country == o.business_registration_issuing_country &&
-
business_entity_type == o.business_entity_type
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[business_address, business_contact, message_volume, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller, privacy_policy_url, terms_and_conditions_url, business_dba, business_registration_number, business_registration_type, business_registration_issuing_country, business_entity_type].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
48
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
48
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
48
elsif !attributes[attribute_map[key]].nil?
-
33
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
32
value = self.send(attr)
-
32
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
32
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TfvSubmissionWrapper < ApiModelBase
-
1
attr_accessor :submission
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
17
{
-
:'submission' => :'submission'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'submission' => :'VerificationUpdateRequest'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvSubmissionWrapper` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
6
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvSubmissionWrapper`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
5
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'submission')
-
5
self.submission = attributes[:'submission']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
submission == o.submission
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[submission].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
3
value = self.send(attr)
-
3
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
3
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class ThumbnailAlignmentEnum
-
1
LEFT = 'LEFT'.freeze
-
1
RIGHT = 'RIGHT'.freeze
-
-
1
def self.all_vars
-
6
@all_vars ||= [LEFT, RIGHT].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
5
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
5
return value if ThumbnailAlignmentEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #ThumbnailAlignmentEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class TranscribeRecording < ApiModelBase
-
# The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization.
-
1
attr_accessor :callback_url
-
-
1
attr_accessor :callback_method
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# This is the timeout (in seconds) to use when delivering the webhook to `callbackUrl`. Can be any numeric value (including decimals) between 1 and 25.
-
1
attr_accessor :callback_timeout
-
-
# A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish.
-
1
attr_accessor :detect_language
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
45
{
-
:'callback_url' => :'callbackUrl',
-
:'callback_method' => :'callbackMethod',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'tag' => :'tag',
-
:'callback_timeout' => :'callbackTimeout',
-
:'detect_language' => :'detectLanguage'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'callback_url' => :'String',
-
:'callback_method' => :'CallbackMethodEnum',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'tag' => :'String',
-
:'callback_timeout' => :'Float',
-
:'detect_language' => :'Boolean'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
:'callback_method',
-
:'username',
-
:'password',
-
:'tag',
-
:'callback_timeout',
-
:'detect_language'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TranscribeRecording` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
35
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscribeRecording`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
34
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'callback_url')
-
5
self.callback_url = attributes[:'callback_url']
-
end
-
-
11
if attributes.key?(:'callback_method')
-
4
self.callback_method = attributes[:'callback_method']
-
else
-
7
self.callback_method = 'POST'
-
end
-
-
11
if attributes.key?(:'username')
-
5
self.username = attributes[:'username']
-
end
-
-
10
if attributes.key?(:'password')
-
5
self.password = attributes[:'password']
-
end
-
-
9
if attributes.key?(:'tag')
-
5
self.tag = attributes[:'tag']
-
end
-
-
9
if attributes.key?(:'callback_timeout')
-
6
self.callback_timeout = attributes[:'callback_timeout']
-
else
-
3
self.callback_timeout = 15
-
end
-
-
7
if attributes.key?(:'detect_language')
-
4
self.detect_language = attributes[:'detect_language']
-
else
-
3
self.detect_language = false
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@callback_timeout.nil? && @callback_timeout > 25
-
invalid_properties.push('invalid value for "callback_timeout", must be smaller than or equal to 25.')
-
end
-
-
if !@callback_timeout.nil? && @callback_timeout < 1
-
invalid_properties.push('invalid value for "callback_timeout", must be greater than or equal to 1.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@callback_timeout.nil? && @callback_timeout > 25
-
return false if !@callback_timeout.nil? && @callback_timeout < 1
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
5
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
5
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] callback_timeout Value to be assigned
-
1
def callback_timeout=(callback_timeout)
-
9
if !callback_timeout.nil? && callback_timeout > 25
-
1
fail ArgumentError, 'invalid value for "callback_timeout", must be smaller than or equal to 25.'
-
end
-
-
8
if !callback_timeout.nil? && callback_timeout < 1
-
1
fail ArgumentError, 'invalid value for "callback_timeout", must be greater than or equal to 1.'
-
end
-
-
7
@callback_timeout = callback_timeout
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
callback_url == o.callback_url &&
-
callback_method == o.callback_method &&
-
username == o.username &&
-
password == o.password &&
-
tag == o.tag &&
-
callback_timeout == o.callback_timeout &&
-
detect_language == o.detect_language
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[callback_url, callback_method, username, password, tag, callback_timeout, detect_language].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
7
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
7
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
7
elsif !attributes[attribute_map[key]].nil?
-
7
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
21
value = self.send(attr)
-
21
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
19
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class Transcription < ApiModelBase
-
# The transcribed text
-
1
attr_accessor :text
-
-
# The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence.
-
1
attr_accessor :confidence
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
51
{
-
:'text' => :'text',
-
:'confidence' => :'confidence'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
4
{
-
:'text' => :'String',
-
:'confidence' => :'Float'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Transcription` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Transcription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'text')
-
10
self.text = attributes[:'text']
-
end
-
-
12
if attributes.key?(:'confidence')
-
10
self.confidence = attributes[:'confidence']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
text == o.text &&
-
confidence == o.confidence
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[text, confidence].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
4
return nil unless attributes.is_a?(Hash)
-
4
attributes = attributes.transform_keys(&:to_sym)
-
4
transformed_hash = {}
-
4
openapi_types.each_pair do |key, type|
-
8
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
8
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
8
elsif !attributes[attribute_map[key]].nil?
-
8
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
4
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# The Transcription Available event is sent when the recording transcription is available to be downloaded.
-
1
class TranscriptionAvailableCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
-
1
attr_accessor :media_url
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# The unique ID of this recording
-
1
attr_accessor :recording_id
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# The duration of the recording in ISO-8601 format
-
1
attr_accessor :duration
-
-
1
attr_accessor :file_format
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
1
attr_accessor :transcription
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
95
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'media_url' => :'mediaUrl',
-
:'parent_call_id' => :'parentCallId',
-
:'recording_id' => :'recordingId',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'end_time' => :'endTime',
-
:'duration' => :'duration',
-
:'file_format' => :'fileFormat',
-
:'tag' => :'tag',
-
:'transcription' => :'transcription',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'media_url' => :'String',
-
:'parent_call_id' => :'String',
-
:'recording_id' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'end_time' => :'Time',
-
:'duration' => :'String',
-
:'file_format' => :'FileFormatEnum',
-
:'tag' => :'String',
-
:'transcription' => :'Transcription',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TranscriptionAvailableCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
85
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscriptionAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
84
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'media_url')
-
4
self.media_url = attributes[:'media_url']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'recording_id')
-
4
self.recording_id = attributes[:'recording_id']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'duration')
-
4
self.duration = attributes[:'duration']
-
end
-
-
6
if attributes.key?(:'file_format')
-
4
self.file_format = attributes[:'file_format']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transcription')
-
4
self.transcription = attributes[:'transcription']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
media_url == o.media_url &&
-
parent_call_id == o.parent_call_id &&
-
recording_id == o.recording_id &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
end_time == o.end_time &&
-
duration == o.duration &&
-
file_format == o.file_format &&
-
tag == o.tag &&
-
transcription == o.transcription &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, media_url, parent_call_id, recording_id, enqueued_time, start_time, end_time, duration, file_format, tag, transcription, transfer_caller_id, transfer_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
21
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
21
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
21
elsif !attributes[attribute_map[key]].nil?
-
21
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
42
value = self.send(attr)
-
42
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
42
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# When processing a <Transfer> verb, this event is sent when a called party (B-leg) answers. The event is sent to the endpoint specified in the transferAnswerUrl attribute of the <PhoneNumber> tag that answered. BXML returned by this callback will be executed for the called party only. After all BXML has been executed, the called party will be bridged to the original call. Most BXML verbs are allowed in response to a transferAnswer event, but some are not allowed.
-
1
class TransferAnswerCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
71
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TransferAnswerCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
61
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferAnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
60
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, transfer_caller_id, transfer_to].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
15
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
15
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
15
elsif !attributes[attribute_map[key]].nil?
-
15
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
30
value = self.send(attr)
-
30
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
30
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# This event is sent to the transferCompleteUrl of the A-leg's <Transfer> verb when the transferred call (B-leg) completes. In a simultaneous ringing scenario, only one B-leg succeeds and this event corresponds to that successful leg. If none of the calls were answered, the transferComplete event corresponds to one of the legs.
-
1
class TransferCompleteCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
# Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
-
1
attr_accessor :cause
-
-
# Text explaining the reason that caused the call to fail in case of errors.
-
1
attr_accessor :error_message
-
-
# Bandwidth's internal id that references the error event.
-
1
attr_accessor :error_id
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
83
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'tag' => :'tag',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo',
-
:'cause' => :'cause',
-
:'error_message' => :'errorMessage',
-
:'error_id' => :'errorId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'tag' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String',
-
:'cause' => :'String',
-
:'error_message' => :'String',
-
:'error_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TransferCompleteCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
73
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
72
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
-
6
if attributes.key?(:'cause')
-
4
self.cause = attributes[:'cause']
-
end
-
-
6
if attributes.key?(:'error_message')
-
4
self.error_message = attributes[:'error_message']
-
end
-
-
6
if attributes.key?(:'error_id')
-
4
self.error_id = attributes[:'error_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
tag == o.tag &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to &&
-
cause == o.cause &&
-
error_message == o.error_message &&
-
error_id == o.error_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, enqueued_time, start_time, answer_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
18
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
18
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
18
elsif !attributes[attribute_map[key]].nil?
-
18
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
36
value = self.send(attr)
-
36
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
36
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# This event is sent to the transferDisconnectUrl of each <PhoneNumber> tag when its respective call leg ends for any reason. The event is sent in the normal case, when the transferred leg is answered and later hung up, but is also sent if the new leg was never answered in the first place, if it was rejected, and if the original call leg hung up before the transferred leg.
-
1
class TransferDisconnectCallback < ApiModelBase
-
# The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
-
1
attr_accessor :event_type
-
-
# The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
-
1
attr_accessor :event_time
-
-
# The user account associated with the call.
-
1
attr_accessor :account_id
-
-
# The id of the application associated with the call.
-
1
attr_accessor :application_id
-
-
# The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
-
1
attr_accessor :from
-
-
# The phone number that received the call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :to
-
-
1
attr_accessor :direction
-
-
# The call id associated with the event.
-
1
attr_accessor :call_id
-
-
# The URL of the call associated with the event.
-
1
attr_accessor :call_url
-
-
# (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present.
-
1
attr_accessor :parent_call_id
-
-
# (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
-
1
attr_accessor :enqueued_time
-
-
# Time the call was started, in ISO 8601 format.
-
1
attr_accessor :start_time
-
-
# Time the call was answered, in ISO 8601 format.
-
1
attr_accessor :answer_time
-
-
# The time that the recording ended in ISO-8601 format
-
1
attr_accessor :end_time
-
-
# (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
-
1
attr_accessor :tag
-
-
# The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_caller_id
-
-
# The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
-
1
attr_accessor :transfer_to
-
-
# Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
-
1
attr_accessor :cause
-
-
# Text explaining the reason that caused the call to fail in case of errors.
-
1
attr_accessor :error_message
-
-
# Bandwidth's internal id that references the error event.
-
1
attr_accessor :error_id
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
91
{
-
:'event_type' => :'eventType',
-
:'event_time' => :'eventTime',
-
:'account_id' => :'accountId',
-
:'application_id' => :'applicationId',
-
:'from' => :'from',
-
:'to' => :'to',
-
:'direction' => :'direction',
-
:'call_id' => :'callId',
-
:'call_url' => :'callUrl',
-
:'parent_call_id' => :'parentCallId',
-
:'enqueued_time' => :'enqueuedTime',
-
:'start_time' => :'startTime',
-
:'answer_time' => :'answerTime',
-
:'end_time' => :'endTime',
-
:'tag' => :'tag',
-
:'transfer_caller_id' => :'transferCallerId',
-
:'transfer_to' => :'transferTo',
-
:'cause' => :'cause',
-
:'error_message' => :'errorMessage',
-
:'error_id' => :'errorId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'event_type' => :'String',
-
:'event_time' => :'Time',
-
:'account_id' => :'String',
-
:'application_id' => :'String',
-
:'from' => :'String',
-
:'to' => :'String',
-
:'direction' => :'CallDirectionEnum',
-
:'call_id' => :'String',
-
:'call_url' => :'String',
-
:'parent_call_id' => :'String',
-
:'enqueued_time' => :'Time',
-
:'start_time' => :'Time',
-
:'answer_time' => :'Time',
-
:'end_time' => :'Time',
-
:'tag' => :'String',
-
:'transfer_caller_id' => :'String',
-
:'transfer_to' => :'String',
-
:'cause' => :'String',
-
:'error_message' => :'String',
-
:'error_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TransferDisconnectCallback` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
81
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferDisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
80
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'event_type')
-
4
self.event_type = attributes[:'event_type']
-
end
-
-
6
if attributes.key?(:'event_time')
-
4
self.event_time = attributes[:'event_time']
-
end
-
-
6
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
6
if attributes.key?(:'application_id')
-
4
self.application_id = attributes[:'application_id']
-
end
-
-
6
if attributes.key?(:'from')
-
4
self.from = attributes[:'from']
-
end
-
-
6
if attributes.key?(:'to')
-
4
self.to = attributes[:'to']
-
end
-
-
6
if attributes.key?(:'direction')
-
4
self.direction = attributes[:'direction']
-
end
-
-
6
if attributes.key?(:'call_id')
-
4
self.call_id = attributes[:'call_id']
-
end
-
-
6
if attributes.key?(:'call_url')
-
4
self.call_url = attributes[:'call_url']
-
end
-
-
6
if attributes.key?(:'parent_call_id')
-
4
self.parent_call_id = attributes[:'parent_call_id']
-
end
-
-
6
if attributes.key?(:'enqueued_time')
-
4
self.enqueued_time = attributes[:'enqueued_time']
-
end
-
-
6
if attributes.key?(:'start_time')
-
4
self.start_time = attributes[:'start_time']
-
end
-
-
6
if attributes.key?(:'answer_time')
-
4
self.answer_time = attributes[:'answer_time']
-
end
-
-
6
if attributes.key?(:'end_time')
-
4
self.end_time = attributes[:'end_time']
-
end
-
-
6
if attributes.key?(:'tag')
-
4
self.tag = attributes[:'tag']
-
end
-
-
6
if attributes.key?(:'transfer_caller_id')
-
4
self.transfer_caller_id = attributes[:'transfer_caller_id']
-
end
-
-
6
if attributes.key?(:'transfer_to')
-
4
self.transfer_to = attributes[:'transfer_to']
-
end
-
-
6
if attributes.key?(:'cause')
-
4
self.cause = attributes[:'cause']
-
end
-
-
6
if attributes.key?(:'error_message')
-
4
self.error_message = attributes[:'error_message']
-
end
-
-
6
if attributes.key?(:'error_id')
-
4
self.error_id = attributes[:'error_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
event_type == o.event_type &&
-
event_time == o.event_time &&
-
account_id == o.account_id &&
-
application_id == o.application_id &&
-
from == o.from &&
-
to == o.to &&
-
direction == o.direction &&
-
call_id == o.call_id &&
-
call_url == o.call_url &&
-
parent_call_id == o.parent_call_id &&
-
enqueued_time == o.enqueued_time &&
-
start_time == o.start_time &&
-
answer_time == o.answer_time &&
-
end_time == o.end_time &&
-
tag == o.tag &&
-
transfer_caller_id == o.transfer_caller_id &&
-
transfer_to == o.transfer_to &&
-
cause == o.cause &&
-
error_message == o.error_message &&
-
error_id == o.error_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, enqueued_time, start_time, answer_time, end_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
20
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
20
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
20
elsif !attributes[attribute_map[key]].nil?
-
20
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
40
value = self.send(attr)
-
40
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
40
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class UpdateCall < ApiModelBase
-
1
attr_accessor :state
-
-
# The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`.
-
1
attr_accessor :redirect_url
-
-
1
attr_accessor :redirect_method
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond.
-
1
attr_accessor :redirect_fallback_url
-
-
1
attr_accessor :redirect_fallback_method
-
-
# Basic auth username.
-
1
attr_accessor :fallback_username
-
-
# Basic auth password.
-
1
attr_accessor :fallback_password
-
-
# A custom string that will be sent with this and all future callbacks unless overwritten by a future `tag` attribute or [`<Tag>`](/docs/voice/bxml/tag) verb, or cleared. May be cleared by setting `tag=\"\"`. Max length 4096 characters. Not allowed if `state` is `completed`.
-
1
attr_accessor :tag
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
59
{
-
:'state' => :'state',
-
:'redirect_url' => :'redirectUrl',
-
:'redirect_method' => :'redirectMethod',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'redirect_fallback_url' => :'redirectFallbackUrl',
-
:'redirect_fallback_method' => :'redirectFallbackMethod',
-
:'fallback_username' => :'fallbackUsername',
-
:'fallback_password' => :'fallbackPassword',
-
:'tag' => :'tag'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
15
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'state' => :'CallStateEnum',
-
:'redirect_url' => :'String',
-
:'redirect_method' => :'RedirectMethodEnum',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'redirect_fallback_url' => :'String',
-
:'redirect_fallback_method' => :'RedirectMethodEnum',
-
:'fallback_username' => :'String',
-
:'fallback_password' => :'String',
-
:'tag' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
7
Set.new([
-
:'state',
-
:'redirect_url',
-
:'redirect_method',
-
:'username',
-
:'password',
-
:'redirect_fallback_url',
-
:'redirect_fallback_method',
-
:'fallback_username',
-
:'fallback_password',
-
:'tag'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
15
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::UpdateCall` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
14
acceptable_attribute_map = self.class.acceptable_attribute_map
-
14
attributes = attributes.each_with_object({}) { |(k, v), h|
-
49
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateCall`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
48
h[k.to_sym] = v
-
}
-
-
13
if attributes.key?(:'state')
-
6
self.state = attributes[:'state']
-
else
-
7
self.state = 'active'
-
end
-
-
13
if attributes.key?(:'redirect_url')
-
5
self.redirect_url = attributes[:'redirect_url']
-
end
-
-
13
if attributes.key?(:'redirect_method')
-
4
self.redirect_method = attributes[:'redirect_method']
-
else
-
9
self.redirect_method = 'POST'
-
end
-
-
13
if attributes.key?(:'username')
-
5
self.username = attributes[:'username']
-
end
-
-
12
if attributes.key?(:'password')
-
5
self.password = attributes[:'password']
-
end
-
-
11
if attributes.key?(:'redirect_fallback_url')
-
4
self.redirect_fallback_url = attributes[:'redirect_fallback_url']
-
end
-
-
11
if attributes.key?(:'redirect_fallback_method')
-
4
self.redirect_fallback_method = attributes[:'redirect_fallback_method']
-
else
-
7
self.redirect_fallback_method = 'POST'
-
end
-
-
11
if attributes.key?(:'fallback_username')
-
5
self.fallback_username = attributes[:'fallback_username']
-
end
-
-
10
if attributes.key?(:'fallback_password')
-
5
self.fallback_password = attributes[:'fallback_password']
-
end
-
-
9
if attributes.key?(:'tag')
-
5
self.tag = attributes[:'tag']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@tag.nil? && @tag.to_s.length > 4096
-
invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 4096.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
return false if !@tag.nil? && @tag.to_s.length > 4096
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
5
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
5
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_username Value to be assigned
-
1
def fallback_username=(fallback_username)
-
5
if !fallback_username.nil? && fallback_username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@fallback_username = fallback_username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_password Value to be assigned
-
1
def fallback_password=(fallback_password)
-
5
if !fallback_password.nil? && fallback_password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.'
-
end
-
-
4
@fallback_password = fallback_password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] tag Value to be assigned
-
1
def tag=(tag)
-
5
if !tag.nil? && tag.to_s.length > 4096
-
1
fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 4096.'
-
end
-
-
4
@tag = tag
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
state == o.state &&
-
redirect_url == o.redirect_url &&
-
redirect_method == o.redirect_method &&
-
username == o.username &&
-
password == o.password &&
-
redirect_fallback_url == o.redirect_fallback_url &&
-
redirect_fallback_method == o.redirect_fallback_method &&
-
fallback_username == o.fallback_username &&
-
fallback_password == o.fallback_password &&
-
tag == o.tag
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[state, redirect_url, redirect_method, username, password, redirect_fallback_url, redirect_fallback_method, fallback_username, fallback_password, tag].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
10
elsif !attributes[attribute_map[key]].nil?
-
10
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
30
value = self.send(attr)
-
30
if value.nil?
-
6
is_nullable = self.class.openapi_nullable.include?(attr)
-
6
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
24
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class UpdateCallRecording < ApiModelBase
-
1
attr_accessor :state
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
18
{
-
:'state' => :'state'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'state' => :'RecordingStateEnum'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::UpdateCallRecording` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
9
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateCallRecording`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
8
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'state')
-
8
self.state = attributes[:'state']
-
else
-
self.state = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @state.nil?
-
invalid_properties.push('invalid value for "state", state cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @state.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] state Value to be assigned
-
1
def state=(state)
-
8
if state.nil?
-
1
fail ArgumentError, 'state cannot be nil'
-
end
-
-
7
@state = state
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
state == o.state
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[state].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
1
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
1
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
1
elsif !attributes[attribute_map[key]].nil?
-
1
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
3
value = self.send(attr)
-
3
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
3
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class UpdateConference < ApiModelBase
-
1
attr_accessor :status
-
-
# The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`.
-
1
attr_accessor :redirect_url
-
-
1
attr_accessor :redirect_method
-
-
# Basic auth username.
-
1
attr_accessor :username
-
-
# Basic auth password.
-
1
attr_accessor :password
-
-
# A fallback url which, if provided, will be used to retry the `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not allowed if `state` is `completed`.
-
1
attr_accessor :redirect_fallback_url
-
-
1
attr_accessor :redirect_fallback_method
-
-
# Basic auth username.
-
1
attr_accessor :fallback_username
-
-
# Basic auth password.
-
1
attr_accessor :fallback_password
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
53
{
-
:'status' => :'status',
-
:'redirect_url' => :'redirectUrl',
-
:'redirect_method' => :'redirectMethod',
-
:'username' => :'username',
-
:'password' => :'password',
-
:'redirect_fallback_url' => :'redirectFallbackUrl',
-
:'redirect_fallback_method' => :'redirectFallbackMethod',
-
:'fallback_username' => :'fallbackUsername',
-
:'fallback_password' => :'fallbackPassword'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
13
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'status' => :'ConferenceStateEnum',
-
:'redirect_url' => :'String',
-
:'redirect_method' => :'RedirectMethodEnum',
-
:'username' => :'String',
-
:'password' => :'String',
-
:'redirect_fallback_url' => :'String',
-
:'redirect_fallback_method' => :'RedirectMethodEnum',
-
:'fallback_username' => :'String',
-
:'fallback_password' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'status',
-
:'redirect_url',
-
:'redirect_method',
-
:'username',
-
:'password',
-
:'redirect_fallback_url',
-
:'redirect_fallback_method',
-
:'fallback_username',
-
:'fallback_password'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
13
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::UpdateConference` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
12
acceptable_attribute_map = self.class.acceptable_attribute_map
-
12
attributes = attributes.each_with_object({}) { |(k, v), h|
-
50
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateConference`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
49
h[k.to_sym] = v
-
}
-
-
11
if attributes.key?(:'status')
-
5
self.status = attributes[:'status']
-
else
-
6
self.status = 'active'
-
end
-
-
11
if attributes.key?(:'redirect_url')
-
5
self.redirect_url = attributes[:'redirect_url']
-
end
-
-
11
if attributes.key?(:'redirect_method')
-
5
self.redirect_method = attributes[:'redirect_method']
-
else
-
6
self.redirect_method = 'POST'
-
end
-
-
11
if attributes.key?(:'username')
-
6
self.username = attributes[:'username']
-
end
-
-
10
if attributes.key?(:'password')
-
6
self.password = attributes[:'password']
-
end
-
-
9
if attributes.key?(:'redirect_fallback_url')
-
5
self.redirect_fallback_url = attributes[:'redirect_fallback_url']
-
end
-
-
9
if attributes.key?(:'redirect_fallback_method')
-
5
self.redirect_fallback_method = attributes[:'redirect_fallback_method']
-
else
-
4
self.redirect_fallback_method = 'POST'
-
end
-
-
9
if attributes.key?(:'fallback_username')
-
6
self.fallback_username = attributes[:'fallback_username']
-
end
-
-
8
if attributes.key?(:'fallback_password')
-
6
self.fallback_password = attributes[:'fallback_password']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@username.nil? && @username.to_s.length > 1024
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@password.nil? && @password.to_s.length > 1024
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@username.nil? && @username.to_s.length > 1024
-
return false if !@password.nil? && @password.to_s.length > 1024
-
return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
-
return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
6
if !username.nil? && username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
6
if !password.nil? && password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@password = password
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_username Value to be assigned
-
1
def fallback_username=(fallback_username)
-
6
if !fallback_username.nil? && fallback_username.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_username = fallback_username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] fallback_password Value to be assigned
-
1
def fallback_password=(fallback_password)
-
6
if !fallback_password.nil? && fallback_password.to_s.length > 1024
-
1
fail ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.'
-
end
-
-
5
@fallback_password = fallback_password
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
status == o.status &&
-
redirect_url == o.redirect_url &&
-
redirect_method == o.redirect_method &&
-
username == o.username &&
-
password == o.password &&
-
redirect_fallback_url == o.redirect_fallback_url &&
-
redirect_fallback_method == o.redirect_fallback_method &&
-
fallback_username == o.fallback_username &&
-
fallback_password == o.fallback_password
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[status, redirect_url, redirect_method, username, password, redirect_fallback_url, redirect_fallback_method, fallback_username, fallback_password].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
9
elsif !attributes[attribute_map[key]].nil?
-
9
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
27
value = self.send(attr)
-
27
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
27
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class UpdateConferenceMember < ApiModelBase
-
# Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted.
-
1
attr_accessor :mute
-
-
# Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. Updates this member's hold status. Has no effect if omitted.
-
1
attr_accessor :hold
-
-
# If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join.
-
1
attr_accessor :call_ids_to_coach
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
25
{
-
:'mute' => :'mute',
-
:'hold' => :'hold',
-
:'call_ids_to_coach' => :'callIdsToCoach'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'mute' => :'Boolean',
-
:'hold' => :'Boolean',
-
:'call_ids_to_coach' => :'Array<String>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
:'call_ids_to_coach'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::UpdateConferenceMember` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
14
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
13
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'mute')
-
5
self.mute = attributes[:'mute']
-
end
-
-
7
if attributes.key?(:'hold')
-
4
self.hold = attributes[:'hold']
-
end
-
-
7
if attributes.key?(:'call_ids_to_coach')
-
4
if (value = attributes[:'call_ids_to_coach']).is_a?(Array)
-
4
self.call_ids_to_coach = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
mute == o.mute &&
-
hold == o.hold &&
-
call_ids_to_coach == o.call_ids_to_coach
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[mute, hold, call_ids_to_coach].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
9
value = self.send(attr)
-
9
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
7
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerificationDenialWebhook < ApiModelBase
-
# User's account ID.
-
1
attr_accessor :account_id
-
-
# An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply.
-
1
attr_accessor :additional_denial_reasons
-
-
# Explanation for why a verification request was declined.
-
1
attr_accessor :decline_reason_description
-
-
# Reason code for denial.
-
1
attr_accessor :denial_status_code
-
-
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
-
1
attr_accessor :internal_ticket_number
-
-
# Toll-free telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
# Whether a Toll-Free Verification request qualifies for resubmission via PUT.
-
1
attr_accessor :resubmit_allowed
-
-
1
attr_accessor :status
-
-
# Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked
-
-
# The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
-
1
attr_accessor :blocked_reason
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
55
{
-
:'account_id' => :'accountId',
-
:'additional_denial_reasons' => :'additionalDenialReasons',
-
:'decline_reason_description' => :'declineReasonDescription',
-
:'denial_status_code' => :'denialStatusCode',
-
:'internal_ticket_number' => :'internalTicketNumber',
-
:'phone_number' => :'phoneNumber',
-
:'resubmit_allowed' => :'resubmitAllowed',
-
:'status' => :'status',
-
:'blocked' => :'blocked',
-
:'blocked_reason' => :'blockedReason'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'account_id' => :'String',
-
:'additional_denial_reasons' => :'Array<AdditionalDenialReason>',
-
:'decline_reason_description' => :'String',
-
:'denial_status_code' => :'Integer',
-
:'internal_ticket_number' => :'String',
-
:'phone_number' => :'String',
-
:'resubmit_allowed' => :'Boolean',
-
:'status' => :'String',
-
:'blocked' => :'Boolean',
-
:'blocked_reason' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationDenialWebhook` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
45
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationDenialWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
44
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
10
if attributes.key?(:'additional_denial_reasons')
-
4
if (value = attributes[:'additional_denial_reasons']).is_a?(Array)
-
4
self.additional_denial_reasons = value
-
end
-
end
-
-
10
if attributes.key?(:'decline_reason_description')
-
4
self.decline_reason_description = attributes[:'decline_reason_description']
-
end
-
-
10
if attributes.key?(:'denial_status_code')
-
4
self.denial_status_code = attributes[:'denial_status_code']
-
end
-
-
10
if attributes.key?(:'internal_ticket_number')
-
4
self.internal_ticket_number = attributes[:'internal_ticket_number']
-
end
-
-
10
if attributes.key?(:'phone_number')
-
8
self.phone_number = attributes[:'phone_number']
-
end
-
-
6
if attributes.key?(:'resubmit_allowed')
-
4
self.resubmit_allowed = attributes[:'resubmit_allowed']
-
end
-
-
6
if attributes.key?(:'status')
-
4
self.status = attributes[:'status']
-
else
-
2
self.status = 'UNVERIFIED'
-
end
-
-
6
if attributes.key?(:'blocked')
-
4
self.blocked = attributes[:'blocked']
-
end
-
-
6
if attributes.key?(:'blocked_reason')
-
4
self.blocked_reason = attributes[:'blocked_reason']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@phone_number.nil? && @phone_number.to_s.length > 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
end
-
-
if !@phone_number.nil? && @phone_number.to_s.length < 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
end
-
-
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
if !@phone_number.nil? && @phone_number !~ pattern
-
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
-
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
-
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
8
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
7
if phone_number.to_s.length > 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
-
end
-
-
6
if phone_number.to_s.length < 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.'
-
end
-
-
5
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
5
if phone_number !~ pattern
-
1
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
-
end
-
-
4
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
additional_denial_reasons == o.additional_denial_reasons &&
-
decline_reason_description == o.decline_reason_description &&
-
denial_status_code == o.denial_status_code &&
-
internal_ticket_number == o.internal_ticket_number &&
-
phone_number == o.phone_number &&
-
resubmit_allowed == o.resubmit_allowed &&
-
status == o.status &&
-
blocked == o.blocked &&
-
blocked_reason == o.blocked_reason
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, additional_denial_reasons, decline_reason_description, denial_status_code, internal_ticket_number, phone_number, resubmit_allowed, status, blocked, blocked_reason].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
9
elsif !attributes[attribute_map[key]].nil?
-
9
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
20
value = self.send(attr)
-
20
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerificationRequest < ApiModelBase
-
1
attr_accessor :business_address
-
-
1
attr_accessor :business_contact
-
-
# Estimated monthly volume of messages from the toll-free number.
-
1
attr_accessor :message_volume
-
-
1
attr_accessor :phone_numbers
-
-
# The category of the use case.
-
1
attr_accessor :use_case
-
-
# A general idea of the use case and customer.
-
1
attr_accessor :use_case_summary
-
-
# Example of message content.
-
1
attr_accessor :production_message_content
-
-
1
attr_accessor :opt_in_workflow
-
-
# Any additional information.
-
1
attr_accessor :additional_information
-
-
# ISV name.
-
1
attr_accessor :isv_reseller
-
-
# The Toll-Free Verification request privacy policy URL.
-
1
attr_accessor :privacy_policy_url
-
-
# The Toll-Free Verification request terms and conditions policy URL.
-
1
attr_accessor :terms_and_conditions_url
-
-
# The company 'Doing Business As'.
-
1
attr_accessor :business_dba
-
-
# Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.**
-
1
attr_accessor :business_registration_number
-
-
1
attr_accessor :business_registration_type
-
-
# The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code |
-
1
attr_accessor :business_registration_issuing_country
-
-
1
attr_accessor :business_entity_type
-
-
# A message that gets sent to users requesting help.
-
1
attr_accessor :help_message_response
-
-
# Indicates whether the content is age-gated.
-
1
attr_accessor :age_gated_content
-
-
# The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection.
-
1
attr_accessor :cv_token
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
110
{
-
:'business_address' => :'businessAddress',
-
:'business_contact' => :'businessContact',
-
:'message_volume' => :'messageVolume',
-
:'phone_numbers' => :'phoneNumbers',
-
:'use_case' => :'useCase',
-
:'use_case_summary' => :'useCaseSummary',
-
:'production_message_content' => :'productionMessageContent',
-
:'opt_in_workflow' => :'optInWorkflow',
-
:'additional_information' => :'additionalInformation',
-
:'isv_reseller' => :'isvReseller',
-
:'privacy_policy_url' => :'privacyPolicyUrl',
-
:'terms_and_conditions_url' => :'termsAndConditionsUrl',
-
:'business_dba' => :'businessDba',
-
:'business_registration_number' => :'businessRegistrationNumber',
-
:'business_registration_type' => :'businessRegistrationType',
-
:'business_registration_issuing_country' => :'businessRegistrationIssuingCountry',
-
:'business_entity_type' => :'businessEntityType',
-
:'help_message_response' => :'helpMessageResponse',
-
:'age_gated_content' => :'ageGatedContent',
-
:'cv_token' => :'cvToken'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
26
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'business_address' => :'Address',
-
:'business_contact' => :'Contact',
-
:'message_volume' => :'Integer',
-
:'phone_numbers' => :'Array<String>',
-
:'use_case' => :'String',
-
:'use_case_summary' => :'String',
-
:'production_message_content' => :'String',
-
:'opt_in_workflow' => :'OptInWorkflow',
-
:'additional_information' => :'String',
-
:'isv_reseller' => :'String',
-
:'privacy_policy_url' => :'String',
-
:'terms_and_conditions_url' => :'String',
-
:'business_dba' => :'String',
-
:'business_registration_number' => :'String',
-
:'business_registration_type' => :'BusinessRegistrationTypeEnum',
-
:'business_registration_issuing_country' => :'String',
-
:'business_entity_type' => :'BusinessEntityTypeEnum',
-
:'help_message_response' => :'String',
-
:'age_gated_content' => :'Boolean',
-
:'cv_token' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
7
Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country',
-
:'help_message_response',
-
:'cv_token'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
26
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
25
acceptable_attribute_map = self.class.acceptable_attribute_map
-
25
attributes = attributes.each_with_object({}) { |(k, v), h|
-
453
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
452
h[k.to_sym] = v
-
}
-
-
24
if attributes.key?(:'business_address')
-
24
self.business_address = attributes[:'business_address']
-
else
-
self.business_address = nil
-
end
-
-
24
if attributes.key?(:'business_contact')
-
24
self.business_contact = attributes[:'business_contact']
-
else
-
self.business_contact = nil
-
end
-
-
24
if attributes.key?(:'message_volume')
-
24
self.message_volume = attributes[:'message_volume']
-
else
-
self.message_volume = nil
-
end
-
-
24
if attributes.key?(:'phone_numbers')
-
24
if (value = attributes[:'phone_numbers']).is_a?(Array)
-
24
self.phone_numbers = value
-
end
-
else
-
self.phone_numbers = nil
-
end
-
-
24
if attributes.key?(:'use_case')
-
24
self.use_case = attributes[:'use_case']
-
else
-
self.use_case = nil
-
end
-
-
24
if attributes.key?(:'use_case_summary')
-
24
self.use_case_summary = attributes[:'use_case_summary']
-
else
-
self.use_case_summary = nil
-
end
-
-
24
if attributes.key?(:'production_message_content')
-
24
self.production_message_content = attributes[:'production_message_content']
-
else
-
self.production_message_content = nil
-
end
-
-
24
if attributes.key?(:'opt_in_workflow')
-
24
self.opt_in_workflow = attributes[:'opt_in_workflow']
-
else
-
self.opt_in_workflow = nil
-
end
-
-
24
if attributes.key?(:'additional_information')
-
22
self.additional_information = attributes[:'additional_information']
-
end
-
-
24
if attributes.key?(:'isv_reseller')
-
22
self.isv_reseller = attributes[:'isv_reseller']
-
end
-
-
24
if attributes.key?(:'privacy_policy_url')
-
21
self.privacy_policy_url = attributes[:'privacy_policy_url']
-
end
-
-
24
if attributes.key?(:'terms_and_conditions_url')
-
21
self.terms_and_conditions_url = attributes[:'terms_and_conditions_url']
-
end
-
-
24
if attributes.key?(:'business_dba')
-
21
self.business_dba = attributes[:'business_dba']
-
end
-
-
24
if attributes.key?(:'business_registration_number')
-
22
self.business_registration_number = attributes[:'business_registration_number']
-
end
-
-
24
if attributes.key?(:'business_registration_type')
-
22
self.business_registration_type = attributes[:'business_registration_type']
-
end
-
-
24
if attributes.key?(:'business_registration_issuing_country')
-
22
self.business_registration_issuing_country = attributes[:'business_registration_issuing_country']
-
end
-
-
24
if attributes.key?(:'business_entity_type')
-
24
self.business_entity_type = attributes[:'business_entity_type']
-
else
-
self.business_entity_type = nil
-
end
-
-
24
if attributes.key?(:'help_message_response')
-
21
self.help_message_response = attributes[:'help_message_response']
-
end
-
-
24
if attributes.key?(:'age_gated_content')
-
21
self.age_gated_content = attributes[:'age_gated_content']
-
end
-
-
24
if attributes.key?(:'cv_token')
-
21
self.cv_token = attributes[:'cv_token']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @business_address.nil?
-
invalid_properties.push('invalid value for "business_address", business_address cannot be nil.')
-
end
-
-
if @business_contact.nil?
-
invalid_properties.push('invalid value for "business_contact", business_contact cannot be nil.')
-
end
-
-
if @message_volume.nil?
-
invalid_properties.push('invalid value for "message_volume", message_volume cannot be nil.')
-
end
-
-
if @message_volume > 10000000
-
invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
end
-
-
if @message_volume < 10
-
invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
if @phone_numbers.nil?
-
invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
-
end
-
-
if @phone_numbers.length > 10
-
invalid_properties.push('invalid value for "phone_numbers", number of items must be less than or equal to 10.')
-
end
-
-
if @phone_numbers.length < 1
-
invalid_properties.push('invalid value for "phone_numbers", number of items must be greater than or equal to 1.')
-
end
-
-
if @use_case.nil?
-
invalid_properties.push('invalid value for "use_case", use_case cannot be nil.')
-
end
-
-
if @use_case.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
if @use_case.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.')
-
end
-
-
if @use_case_summary.nil?
-
invalid_properties.push('invalid value for "use_case_summary", use_case_summary cannot be nil.')
-
end
-
-
if @use_case_summary.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
if @use_case_summary.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.')
-
end
-
-
if @production_message_content.nil?
-
invalid_properties.push('invalid value for "production_message_content", production_message_content cannot be nil.')
-
end
-
-
if @production_message_content.to_s.length > 500
-
invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
if @production_message_content.to_s.length < 0
-
invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.')
-
end
-
-
if @opt_in_workflow.nil?
-
invalid_properties.push('invalid value for "opt_in_workflow", opt_in_workflow cannot be nil.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length > 500
-
invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length < 0
-
invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.')
-
end
-
-
if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
invalid_properties.push('invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
invalid_properties.push('invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_dba.nil? && @business_dba.to_s.length > 500
-
invalid_properties.push('invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
invalid_properties.push('invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
-
if @business_entity_type.nil?
-
invalid_properties.push('invalid value for "business_entity_type", business_entity_type cannot be nil.')
-
end
-
-
if !@help_message_response.nil? && @help_message_response.to_s.length > 500
-
invalid_properties.push('invalid value for "help_message_response", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length > 500
-
invalid_properties.push('invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length < 0
-
invalid_properties.push('invalid value for "cv_token", the character length must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @business_address.nil?
-
return false if @business_contact.nil?
-
return false if @message_volume.nil?
-
return false if @message_volume > 10000000
-
return false if @message_volume < 10
-
return false if @phone_numbers.nil?
-
return false if @phone_numbers.length > 10
-
return false if @phone_numbers.length < 1
-
return false if @use_case.nil?
-
return false if @use_case.to_s.length > 500
-
return false if @use_case.to_s.length < 0
-
return false if @use_case_summary.nil?
-
return false if @use_case_summary.to_s.length > 500
-
return false if @use_case_summary.to_s.length < 0
-
return false if @production_message_content.nil?
-
return false if @production_message_content.to_s.length > 500
-
return false if @production_message_content.to_s.length < 0
-
return false if @opt_in_workflow.nil?
-
return false if !@additional_information.nil? && @additional_information.to_s.length > 500
-
return false if !@additional_information.nil? && @additional_information.to_s.length < 0
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
return false if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
return false if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
return false if !@business_dba.nil? && @business_dba.to_s.length > 500
-
return false if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
return false if @business_entity_type.nil?
-
return false if !@help_message_response.nil? && @help_message_response.to_s.length > 500
-
return false if !@cv_token.nil? && @cv_token.to_s.length > 500
-
return false if !@cv_token.nil? && @cv_token.to_s.length < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_address Value to be assigned
-
1
def business_address=(business_address)
-
25
if business_address.nil?
-
1
fail ArgumentError, 'business_address cannot be nil'
-
end
-
-
24
@business_address = business_address
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_contact Value to be assigned
-
1
def business_contact=(business_contact)
-
25
if business_contact.nil?
-
1
fail ArgumentError, 'business_contact cannot be nil'
-
end
-
-
24
@business_contact = business_contact
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message_volume Value to be assigned
-
1
def message_volume=(message_volume)
-
27
if message_volume.nil?
-
1
fail ArgumentError, 'message_volume cannot be nil'
-
end
-
-
26
if message_volume > 10000000
-
1
fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.'
-
end
-
-
25
if message_volume < 10
-
1
fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.'
-
end
-
-
24
@message_volume = message_volume
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_numbers Value to be assigned
-
1
def phone_numbers=(phone_numbers)
-
27
if phone_numbers.nil?
-
1
fail ArgumentError, 'phone_numbers cannot be nil'
-
end
-
-
26
if phone_numbers.length > 10
-
1
fail ArgumentError, 'invalid value for "phone_numbers", number of items must be less than or equal to 10.'
-
end
-
-
25
if phone_numbers.length < 1
-
1
fail ArgumentError, 'invalid value for "phone_numbers", number of items must be greater than or equal to 1.'
-
end
-
-
24
@phone_numbers = phone_numbers
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case Value to be assigned
-
1
def use_case=(use_case)
-
26
if use_case.nil?
-
1
fail ArgumentError, 'use_case cannot be nil'
-
end
-
-
25
if use_case.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.'
-
end
-
-
24
if use_case.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.'
-
end
-
-
24
@use_case = use_case
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case_summary Value to be assigned
-
1
def use_case_summary=(use_case_summary)
-
26
if use_case_summary.nil?
-
1
fail ArgumentError, 'use_case_summary cannot be nil'
-
end
-
-
25
if use_case_summary.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.'
-
end
-
-
24
if use_case_summary.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.'
-
end
-
-
24
@use_case_summary = use_case_summary
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] production_message_content Value to be assigned
-
1
def production_message_content=(production_message_content)
-
26
if production_message_content.nil?
-
1
fail ArgumentError, 'production_message_content cannot be nil'
-
end
-
-
25
if production_message_content.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.'
-
end
-
-
24
if production_message_content.to_s.length < 0
-
fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.'
-
end
-
-
24
@production_message_content = production_message_content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] opt_in_workflow Value to be assigned
-
1
def opt_in_workflow=(opt_in_workflow)
-
25
if opt_in_workflow.nil?
-
1
fail ArgumentError, 'opt_in_workflow cannot be nil'
-
end
-
-
24
@opt_in_workflow = opt_in_workflow
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] additional_information Value to be assigned
-
1
def additional_information=(additional_information)
-
23
if !additional_information.nil? && additional_information.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.'
-
end
-
-
22
if !additional_information.nil? && additional_information.to_s.length < 0
-
fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.'
-
end
-
-
22
@additional_information = additional_information
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] isv_reseller Value to be assigned
-
1
def isv_reseller=(isv_reseller)
-
23
if !isv_reseller.nil? && isv_reseller.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.'
-
end
-
-
22
if !isv_reseller.nil? && isv_reseller.to_s.length < 0
-
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.'
-
end
-
-
22
@isv_reseller = isv_reseller
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] privacy_policy_url Value to be assigned
-
1
def privacy_policy_url=(privacy_policy_url)
-
23
if privacy_policy_url.nil?
-
1
fail ArgumentError, 'privacy_policy_url cannot be nil'
-
end
-
-
22
if privacy_policy_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.'
-
end
-
-
21
@privacy_policy_url = privacy_policy_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] terms_and_conditions_url Value to be assigned
-
1
def terms_and_conditions_url=(terms_and_conditions_url)
-
23
if terms_and_conditions_url.nil?
-
1
fail ArgumentError, 'terms_and_conditions_url cannot be nil'
-
end
-
-
22
if terms_and_conditions_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.'
-
end
-
-
21
@terms_and_conditions_url = terms_and_conditions_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_dba Value to be assigned
-
1
def business_dba=(business_dba)
-
23
if business_dba.nil?
-
1
fail ArgumentError, 'business_dba cannot be nil'
-
end
-
-
22
if business_dba.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.'
-
end
-
-
21
@business_dba = business_dba
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_registration_number Value to be assigned
-
1
def business_registration_number=(business_registration_number)
-
23
if !business_registration_number.nil? && business_registration_number.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.'
-
end
-
-
22
@business_registration_number = business_registration_number
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_entity_type Value to be assigned
-
1
def business_entity_type=(business_entity_type)
-
25
if business_entity_type.nil?
-
1
fail ArgumentError, 'business_entity_type cannot be nil'
-
end
-
-
24
@business_entity_type = business_entity_type
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] help_message_response Value to be assigned
-
1
def help_message_response=(help_message_response)
-
22
if !help_message_response.nil? && help_message_response.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "help_message_response", the character length must be smaller than or equal to 500.'
-
end
-
-
21
@help_message_response = help_message_response
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] cv_token Value to be assigned
-
1
def cv_token=(cv_token)
-
22
if !cv_token.nil? && cv_token.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.'
-
end
-
-
21
if !cv_token.nil? && cv_token.to_s.length < 0
-
fail ArgumentError, 'invalid value for "cv_token", the character length must be greater than or equal to 0.'
-
end
-
-
21
@cv_token = cv_token
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
business_address == o.business_address &&
-
business_contact == o.business_contact &&
-
message_volume == o.message_volume &&
-
phone_numbers == o.phone_numbers &&
-
use_case == o.use_case &&
-
use_case_summary == o.use_case_summary &&
-
production_message_content == o.production_message_content &&
-
opt_in_workflow == o.opt_in_workflow &&
-
additional_information == o.additional_information &&
-
isv_reseller == o.isv_reseller &&
-
privacy_policy_url == o.privacy_policy_url &&
-
terms_and_conditions_url == o.terms_and_conditions_url &&
-
business_dba == o.business_dba &&
-
business_registration_number == o.business_registration_number &&
-
business_registration_type == o.business_registration_type &&
-
business_registration_issuing_country == o.business_registration_issuing_country &&
-
business_entity_type == o.business_entity_type &&
-
help_message_response == o.help_message_response &&
-
age_gated_content == o.age_gated_content &&
-
cv_token == o.cv_token
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[business_address, business_contact, message_volume, phone_numbers, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller, privacy_policy_url, terms_and_conditions_url, business_dba, business_registration_number, business_registration_type, business_registration_issuing_country, business_entity_type, help_message_response, age_gated_content, cv_token].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
20
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
20
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
1
if attributes[attribute_map[key]].is_a?(Array)
-
2
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
19
elsif !attributes[attribute_map[key]].nil?
-
19
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
60
value = self.send(attr)
-
60
if value.nil?
-
6
is_nullable = self.class.openapi_nullable.include?(attr)
-
6
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
54
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerificationUpdateRequest < ApiModelBase
-
1
attr_accessor :business_address
-
-
1
attr_accessor :business_contact
-
-
# Estimated monthly volume of messages from the toll-free number.
-
1
attr_accessor :message_volume
-
-
# The category of the use case.
-
1
attr_accessor :use_case
-
-
# A general idea of the use case and customer.
-
1
attr_accessor :use_case_summary
-
-
# Example of message content.
-
1
attr_accessor :production_message_content
-
-
1
attr_accessor :opt_in_workflow
-
-
# Any additional information.
-
1
attr_accessor :additional_information
-
-
# ISV name.
-
1
attr_accessor :isv_reseller
-
-
# The Toll-Free Verification request privacy policy URL.
-
1
attr_accessor :privacy_policy_url
-
-
# The Toll-Free Verification request terms and conditions policy URL.
-
1
attr_accessor :terms_and_conditions_url
-
-
# The company 'Doing Business As'.
-
1
attr_accessor :business_dba
-
-
# Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.**
-
1
attr_accessor :business_registration_number
-
-
1
attr_accessor :business_registration_type
-
-
1
attr_accessor :business_entity_type
-
-
# The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code |
-
1
attr_accessor :business_registration_issuing_country
-
-
# A message that gets sent to users requesting help.
-
1
attr_accessor :help_message_response
-
-
# Indicates whether the content is age-gated.
-
1
attr_accessor :age_gated_content
-
-
# The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection.
-
1
attr_accessor :cv_token
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
163
{
-
:'business_address' => :'businessAddress',
-
:'business_contact' => :'businessContact',
-
:'message_volume' => :'messageVolume',
-
:'use_case' => :'useCase',
-
:'use_case_summary' => :'useCaseSummary',
-
:'production_message_content' => :'productionMessageContent',
-
:'opt_in_workflow' => :'optInWorkflow',
-
:'additional_information' => :'additionalInformation',
-
:'isv_reseller' => :'isvReseller',
-
:'privacy_policy_url' => :'privacyPolicyUrl',
-
:'terms_and_conditions_url' => :'termsAndConditionsUrl',
-
:'business_dba' => :'businessDba',
-
:'business_registration_number' => :'businessRegistrationNumber',
-
:'business_registration_type' => :'businessRegistrationType',
-
:'business_entity_type' => :'businessEntityType',
-
:'business_registration_issuing_country' => :'businessRegistrationIssuingCountry',
-
:'help_message_response' => :'helpMessageResponse',
-
:'age_gated_content' => :'ageGatedContent',
-
:'cv_token' => :'cvToken'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
25
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'business_address' => :'Address',
-
:'business_contact' => :'Contact',
-
:'message_volume' => :'Integer',
-
:'use_case' => :'String',
-
:'use_case_summary' => :'String',
-
:'production_message_content' => :'String',
-
:'opt_in_workflow' => :'OptInWorkflow',
-
:'additional_information' => :'String',
-
:'isv_reseller' => :'String',
-
:'privacy_policy_url' => :'String',
-
:'terms_and_conditions_url' => :'String',
-
:'business_dba' => :'String',
-
:'business_registration_number' => :'String',
-
:'business_registration_type' => :'BusinessRegistrationTypeEnum',
-
:'business_entity_type' => :'BusinessEntityTypeEnum',
-
:'business_registration_issuing_country' => :'String',
-
:'help_message_response' => :'String',
-
:'age_gated_content' => :'Boolean',
-
:'cv_token' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
7
Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country',
-
:'help_message_response',
-
:'cv_token'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
25
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationUpdateRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
24
acceptable_attribute_map = self.class.acceptable_attribute_map
-
24
attributes = attributes.each_with_object({}) { |(k, v), h|
-
399
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
398
h[k.to_sym] = v
-
}
-
-
23
if attributes.key?(:'business_address')
-
23
self.business_address = attributes[:'business_address']
-
else
-
self.business_address = nil
-
end
-
-
23
if attributes.key?(:'business_contact')
-
23
self.business_contact = attributes[:'business_contact']
-
else
-
self.business_contact = nil
-
end
-
-
23
if attributes.key?(:'message_volume')
-
23
self.message_volume = attributes[:'message_volume']
-
else
-
self.message_volume = nil
-
end
-
-
23
if attributes.key?(:'use_case')
-
23
self.use_case = attributes[:'use_case']
-
else
-
self.use_case = nil
-
end
-
-
23
if attributes.key?(:'use_case_summary')
-
23
self.use_case_summary = attributes[:'use_case_summary']
-
else
-
self.use_case_summary = nil
-
end
-
-
23
if attributes.key?(:'production_message_content')
-
23
self.production_message_content = attributes[:'production_message_content']
-
else
-
self.production_message_content = nil
-
end
-
-
23
if attributes.key?(:'opt_in_workflow')
-
23
self.opt_in_workflow = attributes[:'opt_in_workflow']
-
else
-
self.opt_in_workflow = nil
-
end
-
-
23
if attributes.key?(:'additional_information')
-
20
self.additional_information = attributes[:'additional_information']
-
end
-
-
23
if attributes.key?(:'isv_reseller')
-
20
self.isv_reseller = attributes[:'isv_reseller']
-
end
-
-
23
if attributes.key?(:'privacy_policy_url')
-
20
self.privacy_policy_url = attributes[:'privacy_policy_url']
-
end
-
-
23
if attributes.key?(:'terms_and_conditions_url')
-
20
self.terms_and_conditions_url = attributes[:'terms_and_conditions_url']
-
end
-
-
23
if attributes.key?(:'business_dba')
-
20
self.business_dba = attributes[:'business_dba']
-
end
-
-
23
if attributes.key?(:'business_registration_number')
-
20
self.business_registration_number = attributes[:'business_registration_number']
-
end
-
-
23
if attributes.key?(:'business_registration_type')
-
20
self.business_registration_type = attributes[:'business_registration_type']
-
end
-
-
23
if attributes.key?(:'business_entity_type')
-
20
self.business_entity_type = attributes[:'business_entity_type']
-
end
-
-
23
if attributes.key?(:'business_registration_issuing_country')
-
20
self.business_registration_issuing_country = attributes[:'business_registration_issuing_country']
-
end
-
-
23
if attributes.key?(:'help_message_response')
-
19
self.help_message_response = attributes[:'help_message_response']
-
end
-
-
23
if attributes.key?(:'age_gated_content')
-
19
self.age_gated_content = attributes[:'age_gated_content']
-
end
-
-
23
if attributes.key?(:'cv_token')
-
19
self.cv_token = attributes[:'cv_token']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @business_address.nil?
-
invalid_properties.push('invalid value for "business_address", business_address cannot be nil.')
-
end
-
-
if @business_contact.nil?
-
invalid_properties.push('invalid value for "business_contact", business_contact cannot be nil.')
-
end
-
-
if @message_volume.nil?
-
invalid_properties.push('invalid value for "message_volume", message_volume cannot be nil.')
-
end
-
-
if @message_volume > 10000000
-
invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
end
-
-
if @message_volume < 10
-
invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
if @use_case.nil?
-
invalid_properties.push('invalid value for "use_case", use_case cannot be nil.')
-
end
-
-
if @use_case.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
if @use_case.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.')
-
end
-
-
if @use_case_summary.nil?
-
invalid_properties.push('invalid value for "use_case_summary", use_case_summary cannot be nil.')
-
end
-
-
if @use_case_summary.to_s.length > 500
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
if @use_case_summary.to_s.length < 0
-
invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.')
-
end
-
-
if @production_message_content.nil?
-
invalid_properties.push('invalid value for "production_message_content", production_message_content cannot be nil.')
-
end
-
-
if @production_message_content.to_s.length > 500
-
invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
if @production_message_content.to_s.length < 0
-
invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.')
-
end
-
-
if @opt_in_workflow.nil?
-
invalid_properties.push('invalid value for "opt_in_workflow", opt_in_workflow cannot be nil.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length > 500
-
invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@additional_information.nil? && @additional_information.to_s.length < 0
-
invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.')
-
end
-
-
if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
invalid_properties.push('invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
invalid_properties.push('invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_dba.nil? && @business_dba.to_s.length > 500
-
invalid_properties.push('invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
invalid_properties.push('invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@help_message_response.nil? && @help_message_response.to_s.length > 500
-
invalid_properties.push('invalid value for "help_message_response", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length > 500
-
invalid_properties.push('invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
-
if !@cv_token.nil? && @cv_token.to_s.length < 0
-
invalid_properties.push('invalid value for "cv_token", the character length must be greater than or equal to 0.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @business_address.nil?
-
return false if @business_contact.nil?
-
return false if @message_volume.nil?
-
return false if @message_volume > 10000000
-
return false if @message_volume < 10
-
return false if @use_case.nil?
-
return false if @use_case.to_s.length > 500
-
return false if @use_case.to_s.length < 0
-
return false if @use_case_summary.nil?
-
return false if @use_case_summary.to_s.length > 500
-
return false if @use_case_summary.to_s.length < 0
-
return false if @production_message_content.nil?
-
return false if @production_message_content.to_s.length > 500
-
return false if @production_message_content.to_s.length < 0
-
return false if @opt_in_workflow.nil?
-
return false if !@additional_information.nil? && @additional_information.to_s.length > 500
-
return false if !@additional_information.nil? && @additional_information.to_s.length < 0
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
-
return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
-
return false if !@privacy_policy_url.nil? && @privacy_policy_url.to_s.length > 500
-
return false if !@terms_and_conditions_url.nil? && @terms_and_conditions_url.to_s.length > 500
-
return false if !@business_dba.nil? && @business_dba.to_s.length > 500
-
return false if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500
-
return false if !@help_message_response.nil? && @help_message_response.to_s.length > 500
-
return false if !@cv_token.nil? && @cv_token.to_s.length > 500
-
return false if !@cv_token.nil? && @cv_token.to_s.length < 0
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_address Value to be assigned
-
1
def business_address=(business_address)
-
24
if business_address.nil?
-
1
fail ArgumentError, 'business_address cannot be nil'
-
end
-
-
23
@business_address = business_address
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_contact Value to be assigned
-
1
def business_contact=(business_contact)
-
24
if business_contact.nil?
-
1
fail ArgumentError, 'business_contact cannot be nil'
-
end
-
-
23
@business_contact = business_contact
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] message_volume Value to be assigned
-
1
def message_volume=(message_volume)
-
26
if message_volume.nil?
-
1
fail ArgumentError, 'message_volume cannot be nil'
-
end
-
-
25
if message_volume > 10000000
-
1
fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.'
-
end
-
-
24
if message_volume < 10
-
1
fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.'
-
end
-
-
23
@message_volume = message_volume
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case Value to be assigned
-
1
def use_case=(use_case)
-
25
if use_case.nil?
-
1
fail ArgumentError, 'use_case cannot be nil'
-
end
-
-
24
if use_case.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.'
-
end
-
-
23
if use_case.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.'
-
end
-
-
23
@use_case = use_case
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] use_case_summary Value to be assigned
-
1
def use_case_summary=(use_case_summary)
-
25
if use_case_summary.nil?
-
1
fail ArgumentError, 'use_case_summary cannot be nil'
-
end
-
-
24
if use_case_summary.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.'
-
end
-
-
23
if use_case_summary.to_s.length < 0
-
fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.'
-
end
-
-
23
@use_case_summary = use_case_summary
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] production_message_content Value to be assigned
-
1
def production_message_content=(production_message_content)
-
25
if production_message_content.nil?
-
1
fail ArgumentError, 'production_message_content cannot be nil'
-
end
-
-
24
if production_message_content.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.'
-
end
-
-
23
if production_message_content.to_s.length < 0
-
fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.'
-
end
-
-
23
@production_message_content = production_message_content
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] opt_in_workflow Value to be assigned
-
1
def opt_in_workflow=(opt_in_workflow)
-
24
if opt_in_workflow.nil?
-
1
fail ArgumentError, 'opt_in_workflow cannot be nil'
-
end
-
-
23
@opt_in_workflow = opt_in_workflow
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] additional_information Value to be assigned
-
1
def additional_information=(additional_information)
-
21
if !additional_information.nil? && additional_information.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.'
-
end
-
-
20
if !additional_information.nil? && additional_information.to_s.length < 0
-
fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.'
-
end
-
-
20
@additional_information = additional_information
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] isv_reseller Value to be assigned
-
1
def isv_reseller=(isv_reseller)
-
21
if !isv_reseller.nil? && isv_reseller.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.'
-
end
-
-
20
if !isv_reseller.nil? && isv_reseller.to_s.length < 0
-
fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.'
-
end
-
-
20
@isv_reseller = isv_reseller
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] privacy_policy_url Value to be assigned
-
1
def privacy_policy_url=(privacy_policy_url)
-
22
if privacy_policy_url.nil?
-
1
fail ArgumentError, 'privacy_policy_url cannot be nil'
-
end
-
-
21
if privacy_policy_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.'
-
end
-
-
20
@privacy_policy_url = privacy_policy_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] terms_and_conditions_url Value to be assigned
-
1
def terms_and_conditions_url=(terms_and_conditions_url)
-
22
if terms_and_conditions_url.nil?
-
1
fail ArgumentError, 'terms_and_conditions_url cannot be nil'
-
end
-
-
21
if terms_and_conditions_url.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.'
-
end
-
-
20
@terms_and_conditions_url = terms_and_conditions_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_dba Value to be assigned
-
1
def business_dba=(business_dba)
-
22
if business_dba.nil?
-
1
fail ArgumentError, 'business_dba cannot be nil'
-
end
-
-
21
if business_dba.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.'
-
end
-
-
20
@business_dba = business_dba
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] business_registration_number Value to be assigned
-
1
def business_registration_number=(business_registration_number)
-
21
if !business_registration_number.nil? && business_registration_number.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.'
-
end
-
-
20
@business_registration_number = business_registration_number
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] help_message_response Value to be assigned
-
1
def help_message_response=(help_message_response)
-
20
if !help_message_response.nil? && help_message_response.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "help_message_response", the character length must be smaller than or equal to 500.'
-
end
-
-
19
@help_message_response = help_message_response
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] cv_token Value to be assigned
-
1
def cv_token=(cv_token)
-
20
if !cv_token.nil? && cv_token.to_s.length > 500
-
1
fail ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.'
-
end
-
-
19
if !cv_token.nil? && cv_token.to_s.length < 0
-
fail ArgumentError, 'invalid value for "cv_token", the character length must be greater than or equal to 0.'
-
end
-
-
19
@cv_token = cv_token
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
business_address == o.business_address &&
-
business_contact == o.business_contact &&
-
message_volume == o.message_volume &&
-
use_case == o.use_case &&
-
use_case_summary == o.use_case_summary &&
-
production_message_content == o.production_message_content &&
-
opt_in_workflow == o.opt_in_workflow &&
-
additional_information == o.additional_information &&
-
isv_reseller == o.isv_reseller &&
-
privacy_policy_url == o.privacy_policy_url &&
-
terms_and_conditions_url == o.terms_and_conditions_url &&
-
business_dba == o.business_dba &&
-
business_registration_number == o.business_registration_number &&
-
business_registration_type == o.business_registration_type &&
-
business_entity_type == o.business_entity_type &&
-
business_registration_issuing_country == o.business_registration_issuing_country &&
-
help_message_response == o.help_message_response &&
-
age_gated_content == o.age_gated_content &&
-
cv_token == o.cv_token
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[business_address, business_contact, message_volume, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller, privacy_policy_url, terms_and_conditions_url, business_dba, business_registration_number, business_registration_type, business_entity_type, business_registration_issuing_country, help_message_response, age_gated_content, cv_token].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
38
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
38
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
38
elsif !attributes[attribute_map[key]].nil?
-
29
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
57
value = self.send(attr)
-
57
if value.nil?
-
6
is_nullable = self.class.openapi_nullable.include?(attr)
-
6
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
51
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerificationWebhook < ApiModelBase
-
# User's account ID.
-
1
attr_accessor :account_id
-
-
# Toll-free telephone number in E.164 format.
-
1
attr_accessor :phone_number
-
-
1
attr_accessor :status
-
-
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
-
1
attr_accessor :internal_ticket_number
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
31
{
-
:'account_id' => :'accountId',
-
:'phone_number' => :'phoneNumber',
-
:'status' => :'status',
-
:'internal_ticket_number' => :'internalTicketNumber'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'account_id' => :'String',
-
:'phone_number' => :'String',
-
:'status' => :'TfvCallbackStatusEnum',
-
:'internal_ticket_number' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationWebhook` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'account_id')
-
4
self.account_id = attributes[:'account_id']
-
end
-
-
10
if attributes.key?(:'phone_number')
-
8
self.phone_number = attributes[:'phone_number']
-
end
-
-
6
if attributes.key?(:'status')
-
4
self.status = attributes[:'status']
-
end
-
-
6
if attributes.key?(:'internal_ticket_number')
-
4
self.internal_ticket_number = attributes[:'internal_ticket_number']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if !@phone_number.nil? && @phone_number.to_s.length > 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
end
-
-
if !@phone_number.nil? && @phone_number.to_s.length < 12
-
invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
end
-
-
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
if !@phone_number.nil? && @phone_number !~ pattern
-
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
-
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
-
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] phone_number Value to be assigned
-
1
def phone_number=(phone_number)
-
8
if phone_number.nil?
-
1
fail ArgumentError, 'phone_number cannot be nil'
-
end
-
-
7
if phone_number.to_s.length > 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
-
end
-
-
6
if phone_number.to_s.length < 12
-
1
fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.'
-
end
-
-
5
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
-
5
if phone_number !~ pattern
-
1
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
-
end
-
-
4
@phone_number = phone_number
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
account_id == o.account_id &&
-
phone_number == o.phone_number &&
-
status == o.status &&
-
internal_ticket_number == o.internal_ticket_number
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[account_id, phone_number, status, internal_ticket_number].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerifyCodeRequest < ApiModelBase
-
# The phone number to send the mfa code to.
-
1
attr_accessor :to
-
-
# An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\".
-
1
attr_accessor :scope
-
-
# The time period, in minutes, to validate the mfa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively.
-
1
attr_accessor :expiration_time_in_minutes
-
-
# The generated mfa code to check if valid.
-
1
attr_accessor :code
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
37
{
-
:'to' => :'to',
-
:'scope' => :'scope',
-
:'expiration_time_in_minutes' => :'expirationTimeInMinutes',
-
:'code' => :'code'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'to' => :'String',
-
:'scope' => :'String',
-
:'expiration_time_in_minutes' => :'Float',
-
:'code' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerifyCodeRequest` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
44
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerifyCodeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
43
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'to')
-
15
self.to = attributes[:'to']
-
else
-
self.to = nil
-
end
-
-
13
if attributes.key?(:'scope')
-
5
self.scope = attributes[:'scope']
-
end
-
-
13
if attributes.key?(:'expiration_time_in_minutes')
-
13
self.expiration_time_in_minutes = attributes[:'expiration_time_in_minutes']
-
else
-
self.expiration_time_in_minutes = nil
-
end
-
-
10
if attributes.key?(:'code')
-
10
self.code = attributes[:'code']
-
else
-
self.code = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @to.nil?
-
invalid_properties.push('invalid value for "to", to cannot be nil.')
-
end
-
-
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
if @to !~ pattern
-
invalid_properties.push("invalid value for \"to\", must conform to the pattern #{pattern}.")
-
end
-
-
if @expiration_time_in_minutes.nil?
-
invalid_properties.push('invalid value for "expiration_time_in_minutes", expiration_time_in_minutes cannot be nil.')
-
end
-
-
if @expiration_time_in_minutes > 15
-
invalid_properties.push('invalid value for "expiration_time_in_minutes", must be smaller than or equal to 15.')
-
end
-
-
if @expiration_time_in_minutes < 1
-
invalid_properties.push('invalid value for "expiration_time_in_minutes", must be greater than or equal to 1.')
-
end
-
-
if @code.nil?
-
invalid_properties.push('invalid value for "code", code cannot be nil.')
-
end
-
-
if @code.to_s.length > 8
-
invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 8.')
-
end
-
-
if @code.to_s.length < 4
-
invalid_properties.push('invalid value for "code", the character length must be greater than or equal to 4.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @to.nil?
-
return false if @to !~ Regexp.new(/^\+[1-9]\d{1,14}$/)
-
return false if @expiration_time_in_minutes.nil?
-
return false if @expiration_time_in_minutes > 15
-
return false if @expiration_time_in_minutes < 1
-
return false if @code.nil?
-
return false if @code.to_s.length > 8
-
return false if @code.to_s.length < 4
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] to Value to be assigned
-
1
def to=(to)
-
15
if to.nil?
-
1
fail ArgumentError, 'to cannot be nil'
-
end
-
-
14
pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
-
14
if to !~ pattern
-
1
fail ArgumentError, "invalid value for \"to\", must conform to the pattern #{pattern}."
-
end
-
-
13
@to = to
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] expiration_time_in_minutes Value to be assigned
-
1
def expiration_time_in_minutes=(expiration_time_in_minutes)
-
13
if expiration_time_in_minutes.nil?
-
1
fail ArgumentError, 'expiration_time_in_minutes cannot be nil'
-
end
-
-
12
if expiration_time_in_minutes > 15
-
1
fail ArgumentError, 'invalid value for "expiration_time_in_minutes", must be smaller than or equal to 15.'
-
end
-
-
11
if expiration_time_in_minutes < 1
-
1
fail ArgumentError, 'invalid value for "expiration_time_in_minutes", must be greater than or equal to 1.'
-
end
-
-
10
@expiration_time_in_minutes = expiration_time_in_minutes
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] code Value to be assigned
-
1
def code=(code)
-
10
if code.nil?
-
1
fail ArgumentError, 'code cannot be nil'
-
end
-
-
9
if code.to_s.length > 8
-
1
fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 8.'
-
end
-
-
8
if code.to_s.length < 4
-
1
fail ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 4.'
-
end
-
-
7
@code = code
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
to == o.to &&
-
scope == o.scope &&
-
expiration_time_in_minutes == o.expiration_time_in_minutes &&
-
code == o.code
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[to, scope, expiration_time_in_minutes, code].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
4
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
4
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
4
elsif !attributes[attribute_map[key]].nil?
-
4
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VerifyCodeResponse < ApiModelBase
-
# Whether or not the supplied code is valid.
-
1
attr_accessor :valid
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
27
{
-
:'valid' => :'valid'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
11
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'valid' => :'Boolean'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
11
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerifyCodeResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
10
acceptable_attribute_map = self.class.acceptable_attribute_map
-
10
attributes = attributes.each_with_object({}) { |(k, v), h|
-
8
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerifyCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
7
h[k.to_sym] = v
-
}
-
-
9
if attributes.key?(:'valid')
-
7
self.valid = attributes[:'valid']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
valid == o.valid
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[valid].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
3
hash = {}
-
3
self.class.attribute_map.each_pair do |attr, param|
-
3
value = self.send(attr)
-
3
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
3
hash[param] = _to_hash(value)
-
end
-
3
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VoiceApiError < ApiModelBase
-
1
attr_accessor :type
-
-
1
attr_accessor :description
-
-
1
attr_accessor :id
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
23
{
-
:'type' => :'type',
-
:'description' => :'description',
-
:'id' => :'id'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
8
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'type' => :'String',
-
:'description' => :'String',
-
:'id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'id'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
8
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VoiceApiError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
7
acceptable_attribute_map = self.class.acceptable_attribute_map
-
7
attributes = attributes.each_with_object({}) { |(k, v), h|
-
13
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VoiceApiError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
12
h[k.to_sym] = v
-
}
-
-
6
if attributes.key?(:'type')
-
4
self.type = attributes[:'type']
-
end
-
-
6
if attributes.key?(:'description')
-
4
self.description = attributes[:'description']
-
end
-
-
6
if attributes.key?(:'id')
-
4
self.id = attributes[:'id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
type == o.type &&
-
description == o.description &&
-
id == o.id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[type, description, id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class VoiceCodeResponse < ApiModelBase
-
# Programmable Voice API Call ID.
-
1
attr_accessor :call_id
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
20
{
-
:'call_id' => :'callId'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
9
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'call_id' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
9
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VoiceCodeResponse` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
8
acceptable_attribute_map = self.class.acceptable_attribute_map
-
8
attributes = attributes.each_with_object({}) { |(k, v), h|
-
6
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VoiceCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
5
h[k.to_sym] = v
-
}
-
-
7
if attributes.key?(:'call_id')
-
5
self.call_id = attributes[:'call_id']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
call_id == o.call_id
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[call_id].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
2
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
2
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
2
value = self.send(attr)
-
2
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
2
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to.
-
1
class WebhookSubscription < ApiModelBase
-
1
attr_accessor :id
-
-
1
attr_accessor :account_id
-
-
# Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID.
-
1
attr_accessor :callback_url
-
-
1
attr_accessor :type
-
-
1
attr_accessor :basic_authentication
-
-
1
attr_accessor :created_date
-
-
1
attr_accessor :modified_date
-
-
1
class EnumAttributeValidator
-
1
attr_reader :datatype
-
1
attr_reader :allowable_values
-
-
1
def initialize(datatype, allowable_values)
-
@allowable_values = allowable_values.map do |value|
-
case datatype.to_s
-
when /Integer/i
-
value.to_i
-
when /Float/i
-
value.to_f
-
else
-
value
-
end
-
end
-
end
-
-
1
def valid?(value)
-
!value || allowable_values.include?(value)
-
end
-
end
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
152
{
-
:'id' => :'id',
-
:'account_id' => :'accountId',
-
:'callback_url' => :'callbackUrl',
-
:'type' => :'type',
-
:'basic_authentication' => :'basicAuthentication',
-
:'created_date' => :'createdDate',
-
:'modified_date' => :'modifiedDate'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
17
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'id' => :'String',
-
:'account_id' => :'String',
-
:'callback_url' => :'String',
-
:'type' => :'WebhookSubscriptionTypeEnum',
-
:'basic_authentication' => :'WebhookSubscriptionBasicAuthentication',
-
:'created_date' => :'Time',
-
:'modified_date' => :'Time'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
11
Set.new([
-
:'callback_url',
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
17
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscription` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
16
acceptable_attribute_map = self.class.acceptable_attribute_map
-
16
attributes = attributes.each_with_object({}) { |(k, v), h|
-
67
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
66
h[k.to_sym] = v
-
}
-
-
15
if attributes.key?(:'id')
-
13
self.id = attributes[:'id']
-
end
-
-
15
if attributes.key?(:'account_id')
-
13
self.account_id = attributes[:'account_id']
-
end
-
-
15
if attributes.key?(:'callback_url')
-
8
self.callback_url = attributes[:'callback_url']
-
else
-
7
self.callback_url = nil
-
end
-
-
15
if attributes.key?(:'type')
-
8
self.type = attributes[:'type']
-
end
-
-
15
if attributes.key?(:'basic_authentication')
-
8
self.basic_authentication = attributes[:'basic_authentication']
-
end
-
-
15
if attributes.key?(:'created_date')
-
8
self.created_date = attributes[:'created_date']
-
end
-
-
15
if attributes.key?(:'modified_date')
-
8
self.modified_date = attributes[:'modified_date']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @callback_url.to_s.length > 2000
-
invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2000.')
-
end
-
-
if @callback_url.to_s.length < 0
-
invalid_properties.push('invalid value for "callback_url", the character length must be greater than or equal to 0.')
-
end
-
-
pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
if @callback_url !~ pattern
-
invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @callback_url.to_s.length > 2000
-
return false if @callback_url.to_s.length < 0
-
return false if @callback_url !~ Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] callback_url Value to be assigned
-
1
def callback_url=(callback_url)
-
17
if !callback_url.nil? && callback_url.to_s.length > 2000
-
1
fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.'
-
end
-
-
16
if !callback_url.nil? && callback_url.to_s.length < 0
-
fail ArgumentError, 'invalid value for "callback_url", the character length must be greater than or equal to 0.'
-
end
-
-
16
pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
16
if !callback_url.nil? && callback_url !~ pattern
-
1
fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}."
-
end
-
-
15
@callback_url = callback_url
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
id == o.id &&
-
account_id == o.account_id &&
-
callback_url == o.callback_url &&
-
type == o.type &&
-
basic_authentication == o.basic_authentication &&
-
created_date == o.created_date &&
-
modified_date == o.modified_date
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[id, account_id, callback_url, type, basic_authentication, created_date, modified_date].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
35
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
35
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
35
elsif !attributes[attribute_map[key]].nil?
-
30
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
28
value = self.send(attr)
-
28
if value.nil?
-
10
is_nullable = self.class.openapi_nullable.include?(attr)
-
10
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
20
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# Basic authentication credentials are not required, but if present, both username and password must be provided.
-
1
class WebhookSubscriptionBasicAuthentication < ApiModelBase
-
1
attr_accessor :username
-
-
1
attr_accessor :password
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
65
{
-
:'username' => :'username',
-
:'password' => :'password'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
20
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
5
{
-
:'username' => :'String',
-
:'password' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
20
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionBasicAuthentication` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
19
acceptable_attribute_map = self.class.acceptable_attribute_map
-
19
attributes = attributes.each_with_object({}) { |(k, v), h|
-
37
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionBasicAuthentication`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
36
h[k.to_sym] = v
-
}
-
-
18
if attributes.key?(:'username')
-
18
self.username = attributes[:'username']
-
else
-
self.username = nil
-
end
-
-
16
if attributes.key?(:'password')
-
16
self.password = attributes[:'password']
-
else
-
self.password = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @username.nil?
-
invalid_properties.push('invalid value for "username", username cannot be nil.')
-
end
-
-
if @username.to_s.length > 100
-
invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 100.')
-
end
-
-
if @password.nil?
-
invalid_properties.push('invalid value for "password", password cannot be nil.')
-
end
-
-
if @password.to_s.length > 200
-
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 200.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @username.nil?
-
return false if @username.to_s.length > 100
-
return false if @password.nil?
-
return false if @password.to_s.length > 200
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] username Value to be assigned
-
1
def username=(username)
-
18
if username.nil?
-
1
fail ArgumentError, 'username cannot be nil'
-
end
-
-
17
if username.to_s.length > 100
-
1
fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.'
-
end
-
-
16
@username = username
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] password Value to be assigned
-
1
def password=(password)
-
16
if password.nil?
-
1
fail ArgumentError, 'password cannot be nil'
-
end
-
-
15
if password.to_s.length > 200
-
1
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.'
-
end
-
-
14
@password = password
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
username == o.username &&
-
password == o.password
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[username, password].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
5
return nil unless attributes.is_a?(Hash)
-
5
attributes = attributes.transform_keys(&:to_sym)
-
5
transformed_hash = {}
-
5
openapi_types.each_pair do |key, type|
-
10
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
10
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
10
elsif !attributes[attribute_map[key]].nil?
-
10
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
5
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
8
value = self.send(attr)
-
8
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
8
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class WebhookSubscriptionError < ApiModelBase
-
1
attr_accessor :code
-
-
1
attr_accessor :description
-
-
1
attr_accessor :telephone_numbers
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
53
{
-
:'code' => :'code',
-
:'description' => :'description',
-
:'telephone_numbers' => :'telephoneNumbers'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
14
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
3
{
-
:'code' => :'Integer',
-
:'description' => :'String',
-
:'telephone_numbers' => :'Array<TelephoneNumber>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
3
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
14
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionError` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
13
acceptable_attribute_map = self.class.acceptable_attribute_map
-
13
attributes = attributes.each_with_object({}) { |(k, v), h|
-
26
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
25
h[k.to_sym] = v
-
}
-
-
12
if attributes.key?(:'code')
-
10
self.code = attributes[:'code']
-
end
-
-
12
if attributes.key?(:'description')
-
10
self.description = attributes[:'description']
-
end
-
-
12
if attributes.key?(:'telephone_numbers')
-
5
if (value = attributes[:'telephone_numbers']).is_a?(Array)
-
5
self.telephone_numbers = value
-
end
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
true
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
code == o.code &&
-
description == o.description &&
-
telephone_numbers == o.telephone_numbers
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[code, description, telephone_numbers].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
3
return nil unless attributes.is_a?(Hash)
-
3
attributes = attributes.transform_keys(&:to_sym)
-
3
transformed_hash = {}
-
3
openapi_types.each_pair do |key, type|
-
9
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
9
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
3
if attributes[attribute_map[key]].is_a?(Array)
-
4
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
6
elsif !attributes[attribute_map[key]].nil?
-
6
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
3
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
2
is_nullable = self.class.openapi_nullable.include?(attr)
-
2
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
10
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class WebhookSubscriptionRequestSchema < ApiModelBase
-
1
attr_accessor :basic_authentication
-
-
# Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID.
-
1
attr_accessor :callback_url
-
-
# An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks.
-
1
attr_accessor :shared_secret_key
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
29
{
-
:'basic_authentication' => :'basicAuthentication',
-
:'callback_url' => :'callbackUrl',
-
:'shared_secret_key' => :'sharedSecretKey'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
12
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
1
{
-
:'basic_authentication' => :'TfvBasicAuthentication',
-
:'callback_url' => :'String',
-
:'shared_secret_key' => :'String'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
:'callback_url',
-
:'shared_secret_key'
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
12
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionRequestSchema` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
11
acceptable_attribute_map = self.class.acceptable_attribute_map
-
11
attributes = attributes.each_with_object({}) { |(k, v), h|
-
25
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionRequestSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
24
h[k.to_sym] = v
-
}
-
-
10
if attributes.key?(:'basic_authentication')
-
8
self.basic_authentication = attributes[:'basic_authentication']
-
end
-
-
10
if attributes.key?(:'callback_url')
-
8
self.callback_url = attributes[:'callback_url']
-
else
-
2
self.callback_url = nil
-
end
-
-
10
if attributes.key?(:'shared_secret_key')
-
8
self.shared_secret_key = attributes[:'shared_secret_key']
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @callback_url.to_s.length > 2000
-
invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2000.')
-
end
-
-
if @callback_url.to_s.length < 0
-
invalid_properties.push('invalid value for "callback_url", the character length must be greater than or equal to 0.')
-
end
-
-
pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
if @callback_url !~ pattern
-
invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.")
-
end
-
-
if !@shared_secret_key.nil? && @shared_secret_key.to_s.length > 64
-
invalid_properties.push('invalid value for "shared_secret_key", the character length must be smaller than or equal to 64.')
-
end
-
-
if !@shared_secret_key.nil? && @shared_secret_key.to_s.length < 16
-
invalid_properties.push('invalid value for "shared_secret_key", the character length must be greater than or equal to 16.')
-
end
-
-
pattern = Regexp.new(/^[ -~]{16,64}$/)
-
if !@shared_secret_key.nil? && @shared_secret_key !~ pattern
-
invalid_properties.push("invalid value for \"shared_secret_key\", must conform to the pattern #{pattern}.")
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @callback_url.to_s.length > 2000
-
return false if @callback_url.to_s.length < 0
-
return false if @callback_url !~ Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
return false if !@shared_secret_key.nil? && @shared_secret_key.to_s.length > 64
-
return false if !@shared_secret_key.nil? && @shared_secret_key.to_s.length < 16
-
return false if !@shared_secret_key.nil? && @shared_secret_key !~ Regexp.new(/^[ -~]{16,64}$/)
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] callback_url Value to be assigned
-
1
def callback_url=(callback_url)
-
12
if !callback_url.nil? && callback_url.to_s.length > 2000
-
1
fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.'
-
end
-
-
11
if !callback_url.nil? && callback_url.to_s.length < 0
-
fail ArgumentError, 'invalid value for "callback_url", the character length must be greater than or equal to 0.'
-
end
-
-
11
pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
-
11
if !callback_url.nil? && callback_url !~ pattern
-
1
fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}."
-
end
-
-
10
@callback_url = callback_url
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] shared_secret_key Value to be assigned
-
1
def shared_secret_key=(shared_secret_key)
-
10
if !shared_secret_key.nil? && shared_secret_key.to_s.length > 64
-
1
fail ArgumentError, 'invalid value for "shared_secret_key", the character length must be smaller than or equal to 64.'
-
end
-
-
9
if !shared_secret_key.nil? && shared_secret_key.to_s.length < 16
-
1
fail ArgumentError, 'invalid value for "shared_secret_key", the character length must be greater than or equal to 16.'
-
end
-
-
8
pattern = Regexp.new(/^[ -~]{16,64}$/)
-
8
if !shared_secret_key.nil? && shared_secret_key !~ pattern
-
fail ArgumentError, "invalid value for \"shared_secret_key\", must conform to the pattern #{pattern}."
-
end
-
-
8
@shared_secret_key = shared_secret_key
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
basic_authentication == o.basic_authentication &&
-
callback_url == o.callback_url &&
-
shared_secret_key == o.shared_secret_key
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[basic_authentication, callback_url, shared_secret_key].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
1
return nil unless attributes.is_a?(Hash)
-
1
attributes = attributes.transform_keys(&:to_sym)
-
1
transformed_hash = {}
-
1
openapi_types.each_pair do |key, type|
-
3
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
3
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
if attributes[attribute_map[key]].is_a?(Array)
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
3
elsif !attributes[attribute_map[key]].nil?
-
3
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
1
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
4
hash = {}
-
4
self.class.attribute_map.each_pair do |attr, param|
-
12
value = self.send(attr)
-
12
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
12
hash[param] = _to_hash(value)
-
end
-
4
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
1
class WebhookSubscriptionTypeEnum
-
1
TOLLFREE_VERIFICATION_STATUS = 'TOLLFREE_VERIFICATION_STATUS'.freeze
-
1
MESSAGING_PORTOUT_APPROVAL_STATUS = 'MESSAGING_PORTOUT_APPROVAL_STATUS'.freeze
-
-
1
def self.all_vars
-
11
@all_vars ||= [TOLLFREE_VERIFICATION_STATUS, MESSAGING_PORTOUT_APPROVAL_STATUS].freeze
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def self.build_from_hash(value)
-
7
new.build_from_hash(value)
-
end
-
-
# Builds the enum from string
-
# @param [String] The enum value in the form of the string
-
# @return [String] The enum value
-
1
def build_from_hash(value)
-
7
return value if WebhookSubscriptionTypeEnum.all_vars.include?(value)
-
1
raise "Invalid ENUM value #{value} for class #WebhookSubscriptionTypeEnum"
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
require 'date'
-
1
require 'time'
-
-
1
module Bandwidth
-
# A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated).
-
1
class WebhookSubscriptionsListBody < ApiModelBase
-
1
attr_accessor :links
-
-
1
attr_accessor :errors
-
-
1
attr_accessor :data
-
-
# Attribute mapping from ruby-style variable name to JSON key.
-
1
def self.attribute_map
-
37
{
-
:'links' => :'links',
-
:'errors' => :'errors',
-
:'data' => :'data'
-
}
-
end
-
-
# Returns attribute mapping this model knows about
-
1
def self.acceptable_attribute_map
-
10
attribute_map
-
end
-
-
# Returns all the JSON keys this model knows about
-
1
def self.acceptable_attributes
-
1
acceptable_attribute_map.values
-
end
-
-
# Attribute type mapping.
-
1
def self.openapi_types
-
2
{
-
:'links' => :'LinksObject',
-
:'errors' => :'Array<WebhookSubscriptionError>',
-
:'data' => :'Array<WebhookSubscription>'
-
}
-
end
-
-
# List of attributes with nullable: true
-
1
def self.openapi_nullable
-
1
Set.new([
-
])
-
end
-
-
# Initializes the object
-
# @param [Hash] attributes Model attributes in the form of hash
-
1
def initialize(attributes = {})
-
10
if (!attributes.is_a?(Hash))
-
1
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionsListBody` initialize method'
-
end
-
-
# check to see if the attribute exists and convert string to symbol for hash key
-
9
acceptable_attribute_map = self.class.acceptable_attribute_map
-
9
attributes = attributes.each_with_object({}) { |(k, v), h|
-
21
if (!acceptable_attribute_map.key?(k.to_sym))
-
1
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionsListBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
-
end
-
20
h[k.to_sym] = v
-
}
-
-
8
if attributes.key?(:'links')
-
6
self.links = attributes[:'links']
-
end
-
-
8
if attributes.key?(:'errors')
-
6
if (value = attributes[:'errors']).is_a?(Array)
-
6
self.errors = value
-
end
-
end
-
-
8
if attributes.key?(:'data')
-
8
if (value = attributes[:'data']).is_a?(Array)
-
8
self.data = value
-
end
-
else
-
self.data = nil
-
end
-
end
-
-
# Show invalid properties with the reasons. Usually used together with valid?
-
# @return Array for valid properties with the reasons
-
1
def list_invalid_properties
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
-
invalid_properties = Array.new
-
if @data.nil?
-
invalid_properties.push('invalid value for "data", data cannot be nil.')
-
end
-
-
invalid_properties
-
end
-
-
# Check to see if the all the properties in the model are valid
-
# @return true if the model is valid
-
1
def valid?
-
warn '[DEPRECATED] the `valid?` method is obsolete'
-
return false if @data.nil?
-
true
-
end
-
-
# Custom attribute writer method with validation
-
# @param [Object] data Value to be assigned
-
1
def data=(data)
-
9
if data.nil?
-
1
fail ArgumentError, 'data cannot be nil'
-
end
-
-
8
@data = data
-
end
-
-
# Checks equality by comparing each attribute.
-
# @param [Object] Object to be compared
-
1
def ==(o)
-
2
return true if self.equal?(o)
-
2
self.class == o.class &&
-
links == o.links &&
-
errors == o.errors &&
-
data == o.data
-
end
-
-
# @see the `==` method
-
# @param [Object] Object to be compared
-
1
def eql?(o)
-
2
self == o
-
end
-
-
# Calculates hash code according to all attributes.
-
# @return [Integer] Hash code
-
1
def hash
-
[links, errors, data].hash
-
end
-
-
# Builds the object from hash
-
# @param [Hash] attributes Model attributes in the form of hash
-
# @return [Object] Returns the model itself
-
1
def self.build_from_hash(attributes)
-
2
return nil unless attributes.is_a?(Hash)
-
2
attributes = attributes.transform_keys(&:to_sym)
-
2
transformed_hash = {}
-
2
openapi_types.each_pair do |key, type|
-
6
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
-
transformed_hash["#{key}"] = nil
-
6
elsif type =~ /\AArray<(.*)>/i
-
# check to ensure the input is an array given that the attribute
-
# is documented as an array but the input is not
-
4
if attributes[attribute_map[key]].is_a?(Array)
-
8
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
-
end
-
2
elsif !attributes[attribute_map[key]].nil?
-
2
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
-
end
-
end
-
2
new(transformed_hash)
-
end
-
-
# Returns the object in the form of hash
-
# @return [Hash] Returns the object in the form of hash
-
1
def to_hash
-
2
hash = {}
-
2
self.class.attribute_map.each_pair do |attr, param|
-
6
value = self.send(attr)
-
6
if value.nil?
-
is_nullable = self.class.openapi_nullable.include?(attr)
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
-
end
-
-
6
hash[param] = _to_hash(value)
-
end
-
2
hash
-
end
-
end
-
end
-
=begin
-
#Bandwidth
-
-
#Bandwidth's Communication APIs
-
-
The version of the OpenAPI document: 1.0.0
-
Contact: letstalk@bandwidth.com
-
Generated by: https://openapi-generator.tech
-
Generator version: 7.17.0
-
-
=end
-
-
1
module Bandwidth
-
1
VERSION = '18.1.1'
-
end
-
# Unit tests for Bandwidth::CallsApi
-
1
describe 'CallsApi' do
-
4
let(:call_id) { 'c-1234' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@calls_api_instance = Bandwidth::CallsApi.new
-
end
-
-
1
describe 'test an instance of CallsApi' do
-
1
it 'should create an instance of CallsApi' do
-
1
expect(@calls_api_instance).to be_instance_of(Bandwidth::CallsApi)
-
end
-
end
-
-
# Create Call
-
1
describe '#create_call' do
-
1
it 'creates a call with amd' do
-
1
amd_config = Bandwidth::MachineDetectionConfiguration.new(
-
mode: Bandwidth::MachineDetectionModeEnum::ASYNC,
-
detection_timeout: 15.0,
-
silence_timeout: 10.0,
-
speech_threshold: 10.0,
-
speech_end_threshold: 5.0,
-
machine_speech_end_threshold: 5.0,
-
delay_result: false,
-
callback_url: 'https://myServer.com/bandwidth/webhooks/machineDetectionComplete',
-
callback_method: Bandwidth::CallbackMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword1!',
-
fallback_url: 'https://myFallbackServer.com/bandwidth/webhooks/machineDetectionComplete',
-
fallback_method: Bandwidth::CallbackMethodEnum::POST,
-
fallback_username: 'mySecretUsername',
-
fallback_password: 'mySecretPassword1!',
-
)
-
-
1
call_body = Bandwidth::CreateCall.new(
-
to: USER_NUMBER,
-
from: BW_NUMBER,
-
application_id: BW_VOICE_APPLICATION_ID,
-
answer_url: BASE_CALLBACK_URL,
-
answer_method: Bandwidth::CallbackMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword1!',
-
answer_fallback_url: 'https://www.myFallbackServer.com/webhooks/answer',
-
answer_fallback_method: Bandwidth::CallbackMethodEnum::POST,
-
fallback_username: 'mySecretUsername',
-
fallback_password: 'mySecretPassword1!',
-
disconnect_url: 'https://myServer.com/bandwidth/webhooks/disconnectUrl',
-
disconnect_method: Bandwidth::CallbackMethodEnum::POST,
-
call_timeout: 30.0,
-
callback_timeout: 15.0,
-
machine_detection: amd_config,
-
priority: 5,
-
tag: 'tag_example',
-
)
-
-
1
data, status_code = @calls_api_instance.create_call_with_http_info(BW_ACCOUNT_ID, call_body)
-
-
1
expect(status_code).to eq(201)
-
1
expect(data).to be_instance_of(Bandwidth::CreateCallResponse)
-
1
expect(data.application_id.length).to eq(36)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.call_id.length).to eq(47)
-
1
expect(data.to.length).to eq(12)
-
1
expect(data.from.length).to eq(12)
-
1
expect(data.enqueued_time).to be_instance_of(Time)
-
1
expect(data.call_url).to start_with('http')
-
1
expect(data.call_timeout).to be_instance_of(Float)
-
1
expect(data.callback_timeout).to be_instance_of(Float)
-
1
expect(data.tag).to be_instance_of(String)
-
1
expect(data.answer_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
-
1
expect(data.answer_url).to start_with('http')
-
1
expect(data.answer_fallback_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
-
1
expect(data.answer_fallback_url).to start_with('http')
-
1
expect(data.disconnect_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
-
1
expect(data.disconnect_url).to start_with('http')
-
1
expect(data.username).to be_instance_of(String)
-
1
expect(data.password).to be_instance_of(String)
-
1
expect(data.fallback_username).to be_instance_of(String)
-
1
expect(data.fallback_password).to be_instance_of(String)
-
1
expect(data.priority).to be_instance_of(Integer)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@calls_api_instance.create_call(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing create_call' do
-
1
expect {
-
1
@calls_api_instance.create_call(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Calls
-
1
describe '#list_calls' do
-
1
it 'gets a list of calls' do
-
1
data, status_code = @calls_api_instance.list_calls_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::CallState)
-
1
expect(data[0].application_id.length).to eq(36)
-
1
expect(data[0].account_id.length).to eq(7)
-
1
expect(data[0].call_id.length).to eq(47)
-
1
expect(data[0].parent_call_id.length).to eq(47)
-
1
expect(data[0].to.length).to eq(12)
-
1
expect(data[0].from.length).to eq(12)
-
1
expect(data[0].direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
-
1
expect(data[0].state).to be_instance_of(String)
-
1
expect(data[0].stir_shaken).to be_instance_of(Hash)
-
1
expect(data[0].identity).to be_instance_of(String)
-
1
expect(data[0].enqueued_time).to be_instance_of(Time)
-
1
expect(data[0].start_time).to be_instance_of(Time)
-
1
expect(data[0].answer_time).to be_instance_of(Time)
-
1
expect(data[0].end_time).to be_instance_of(Time)
-
1
expect(data[0].disconnect_cause).to be_instance_of(String)
-
1
expect(data[0]).to respond_to(:error_message)
-
1
expect(data[0]).to respond_to(:error_id)
-
1
expect(data[0].last_update).to be_instance_of(Time)
-
end
-
end
-
-
# # Get Call State Information
-
1
describe '#get_call_state' do
-
1
it 'gets the call state' do
-
1
data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, call_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::CallState)
-
1
expect(data.application_id.length).to eq(36)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.call_id.length).to eq(47)
-
1
expect(data.parent_call_id.length).to eq(47)
-
1
expect(data.to.length).to eq(12)
-
1
expect(data.from.length).to eq(12)
-
1
expect(data.direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
-
1
expect(data.state).to be_instance_of(String)
-
1
expect(data.stir_shaken).to be_instance_of(Hash)
-
1
expect(data.identity).to be_instance_of(String)
-
1
expect(data.enqueued_time).to be_instance_of(Time)
-
1
expect(data.start_time).to be_instance_of(Time)
-
1
expect(data.answer_time).to be_instance_of(Time)
-
1
expect(data.end_time).to be_instance_of(Time)
-
1
expect(data.disconnect_cause).to be_instance_of(String)
-
1
expect(data).to respond_to(:error_message)
-
1
expect(data).to respond_to(:error_id)
-
1
expect(data.last_update).to be_instance_of(Time)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@calls_api_instance.get_call_state(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@calls_api_instance.get_call_state(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# # Update Call
-
1
describe '#update_call' do
-
1
it 'creates and updates a call' do
-
1
update_call_body = Bandwidth::UpdateCall.new(
-
state: Bandwidth::CallStateEnum::ACTIVE,
-
redirect_url: MANTECA_BASE_URL + '/bxml/pause'
-
)
-
-
1
_data, status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, call_id, update_call_body)
-
-
1
expect(status_code).to eq(200)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@calls_api_instance.update_call(nil, '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@calls_api_instance.update_call(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing update_call' do
-
1
expect {
-
1
@calls_api_instance.update_call(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Call BXML
-
1
describe '#update_call_bxml' do
-
1
it 'updates a call using bxml' do
-
1
update_bxml = "<?xml version='1.0' encoding='UTF-8'?><Bxml><SpeakSentence locale='en_US' gender='female' voice='susan'>This is a test bxml response</SpeakSentence><Pause duration='3'/></Bxml>"
-
-
1
_data, status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, call_id, update_bxml)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@calls_api_instance.update_call_bxml(nil, '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@calls_api_instance.update_call_bxml(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing body' do
-
1
expect {
-
1
@calls_api_instance.update_call_bxml(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferencesApi
-
1
describe 'ConferencesApi' do
-
4
let(:call_id) { 'c-1234' }
-
9
let(:conference_id) { 'c-4321' }
-
3
let(:recording_id) { 'r-1234' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.return_binary_data = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@conferences_api_instance = Bandwidth::ConferencesApi.new
-
end
-
-
1
describe 'test an instance of ConferencesApi' do
-
1
it 'should create an instance of ConferencesApi' do
-
1
expect(@conferences_api_instance).to be_instance_of(Bandwidth::ConferencesApi)
-
end
-
end
-
-
# Download Conference Recording
-
1
describe 'download_conference_recording test' do
-
1
it 'download a conference recording' do
-
1
data, status_code = @conferences_api_instance.download_conference_recording_with_http_info(
-
BW_ACCOUNT_ID, conference_id, recording_id, { header_params: { 'Accept' => 'audio/vnd.wave' } })
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.download_conference_recording(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.download_conference_recording(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@conferences_api_instance.download_conference_recording(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Conference Information
-
1
describe 'get_conference' do
-
1
it 'get a conference by id' do
-
1
data, status_code = @conferences_api_instance.get_conference_with_http_info(BW_ACCOUNT_ID, conference_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::Conference)
-
1
expect(data.id.length).to eq(50)
-
1
expect(data.name).to be_instance_of(String)
-
1
expect(data.created_time).to be_instance_of(Time)
-
1
expect(data.completed_time).to be_instance_of(Time)
-
1
expect(data.conference_event_url).to start_with('http')
-
1
expect(data.conference_event_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
-
1
expect(data.tag).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Conference Member
-
1
describe 'get_conference_member' do
-
1
it 'gets a conference member by call id' do
-
1
data, status_code = @conferences_api_instance.get_conference_member_with_http_info(BW_ACCOUNT_ID, conference_id, call_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::ConferenceMember)
-
1
expect(data.call_id.length).to eq(47)
-
1
expect(data.conference_id.length).to eq(50)
-
1
expect(data.member_url).to start_with('http')
-
1
expect(data.mute).to be_one_of([true, false])
-
1
expect(data.hold).to be_one_of([true, false])
-
1
expect(data.call_ids_to_coach).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_member(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_member(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing member_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_member(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Conference Recording Information
-
1
describe 'get_conference_recording' do
-
1
it 'gets a conference recording by id' do
-
1
data, status_code = @conferences_api_instance.get_conference_recording_with_http_info(BW_ACCOUNT_ID, conference_id, recording_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::ConferenceRecordingMetadata)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.conference_id.length).to eq(50)
-
1
expect(data.name).to be_instance_of(String)
-
1
expect(data.recording_id.length).to eq(47)
-
1
expect(data.duration).to start_with('PT')
-
1
expect(data.channels).to be_instance_of(Integer)
-
1
expect(data.start_time).to be_instance_of(Time)
-
1
expect(data.end_time).to be_instance_of(Time)
-
1
expect(data.file_format).to be_one_of(Bandwidth::FileFormatEnum.all_vars)
-
1
expect(data.status).to be_instance_of(String)
-
1
expect(data.media_url).to start_with('http')
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_recording(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_recording(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@conferences_api_instance.get_conference_recording(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Conference Recordings
-
1
describe 'list_conference_recordings' do
-
1
it 'lists recordings for a conference' do
-
1
data, status_code = @conferences_api_instance.list_conference_recordings_with_http_info(BW_ACCOUNT_ID, conference_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::ConferenceRecordingMetadata)
-
1
expect(data[0].account_id.length).to eq(7)
-
1
expect(data[0].conference_id.length).to eq(50)
-
1
expect(data[0].name).to be_instance_of(String)
-
1
expect(data[0].recording_id.length).to eq(47)
-
1
expect(data[0].duration).to start_with('PT')
-
1
expect(data[0].channels).to be_instance_of(Integer)
-
1
expect(data[0].start_time).to be_instance_of(Time)
-
1
expect(data[0].end_time).to be_instance_of(Time)
-
1
expect(data[0].file_format).to be_one_of(Bandwidth::FileFormatEnum.all_vars)
-
1
expect(data[0].status).to be_instance_of(String)
-
1
expect(data[0].media_url).to start_with('http')
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.list_conference_recordings(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.list_conference_recordings(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Conferences
-
1
describe 'list_conferences' do
-
1
it 'list all conferences' do
-
conference_opts = {
-
1
name: call_id
-
}
-
-
1
data, status_code = @conferences_api_instance.list_conferences_with_http_info(BW_ACCOUNT_ID, conference_opts)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::Conference)
-
1
expect(data[0].id.length).to eq(50)
-
1
expect(data[0].name).to be_instance_of(String)
-
1
expect(data[0].created_time).to be_instance_of(Time)
-
1
expect(data[0].completed_time).to be_instance_of(Time)
-
1
expect(data[0].conference_event_url).to start_with('http')
-
1
expect(data[0].conference_event_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
-
1
expect(data[0].tag).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.list_conferences(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for an invalid page_size' do
-
1
expect {
-
1
@conferences_api_instance.list_conferences(BW_ACCOUNT_ID, { page_size: 1001 })
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for an invalid page_size' do
-
1
expect {
-
1
@conferences_api_instance.list_conferences(BW_ACCOUNT_ID, { page_size: 0 })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Conference
-
1
describe 'update_conference' do
-
1
it 'updates a conference' do
-
1
update_conference_body = Bandwidth::UpdateConference.new(
-
status: Bandwidth::ConferenceStateEnum::ACTIVE,
-
redirect_url: BASE_CALLBACK_URL + '/bxml/pause',
-
redirect_method: Bandwidth::RedirectMethodEnum::POST,
-
username: 'username',
-
password: 'password',
-
redirect_fallback_url: BASE_CALLBACK_URL + '/bxml/pause',
-
redirect_fallback_method: Bandwidth::RedirectMethodEnum::POST,
-
fallback_username: 'username',
-
fallback_password: 'password'
-
)
-
-
1
_data, status_code = @conferences_api_instance.update_conference_with_http_info(BW_ACCOUNT_ID, conference_id, update_conference_body)
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing update_conference' do
-
1
expect {
-
1
@conferences_api_instance.update_conference(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Conference BXML
-
1
describe 'update_conference_bxml' do
-
1
it 'updates a conference using bxml' do
-
1
update_bxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><StartRecording/><SpeakSentence locale="en_US" gender="female" voice="susan">This should be a conference recording.</SpeakSentence><StopRecording/></Bxml>'
-
-
1
_data, status_code = @conferences_api_instance.update_conference_bxml_with_http_info(BW_ACCOUNT_ID, conference_id, update_bxml)
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_bxml(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_bxml(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing body' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_bxml(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Conference Member
-
1
describe 'update_conference_member' do
-
1
it 'updates a conference member by call id' do
-
1
update_conference_member = Bandwidth::UpdateConferenceMember.new(
-
mute: false
-
)
-
-
1
_data, status_code = @conferences_api_instance.update_conference_member_with_http_info(BW_ACCOUNT_ID, conference_id, call_id, update_conference_member)
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_member(nil, '', '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing conference_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_member(BW_ACCOUNT_ID, nil, '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing member_id' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_member(BW_ACCOUNT_ID, '', nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing update_conference_member' do
-
1
expect {
-
1
@conferences_api_instance.update_conference_member(BW_ACCOUNT_ID, '', '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointsApi
-
1
describe 'EndpointsApi' do
-
4
let(:endpoint_id) { 'ep-abc123' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@endpoints_api_instance = Bandwidth::EndpointsApi.new
-
end
-
-
1
describe 'test an instance of EndpointsApi' do
-
1
it 'should create an instance of EndpointsApi' do
-
1
expect(@endpoints_api_instance).to be_instance_of(Bandwidth::EndpointsApi)
-
end
-
end
-
-
# Create Endpoint
-
1
describe '#create_endpoint' do
-
1
it 'creates a WebRTC endpoint' do
-
1
create_endpoint_body = Bandwidth::CreateWebRtcConnectionRequest.new(
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL,
-
event_callback_url: 'https://myServer.com/bandwidth/webhooks/endpoint',
-
event_fallback_url: 'https://myFallbackServer.com/bandwidth/webhooks/endpoint',
-
tag: 'test-endpoint',
-
connection_metadata: { 'key1' => 'value1', 'key2' => 'value2' }
-
)
-
-
1
data, status_code = @endpoints_api_instance.create_endpoint_with_http_info(BW_ACCOUNT_ID, create_endpoint_body)
-
-
1
expect(status_code).to eq(201)
-
1
expect(data).to be_instance_of(Bandwidth::CreateEndpointResponse)
-
1
expect(data.links).to be_instance_of(Array)
-
1
expect(data.data).to be_instance_of(Bandwidth::CreateEndpointResponseData)
-
1
expect(data.data.endpoint_id).to be_instance_of(String)
-
1
expect(data.data.type).to be_one_of(Bandwidth::EndpointTypeEnum.all_vars)
-
1
expect(data.data.status).to be_one_of(Bandwidth::EndpointStatusEnum.all_vars)
-
1
expect(data.data.creation_timestamp).to be_instance_of(Time)
-
1
expect(data.data.expiration_timestamp).to be_instance_of(Time)
-
1
expect(data.data.token).to be_instance_of(String)
-
1
expect(data.data.tag).to be_instance_of(String)
-
1
expect(data.data.devices).to be_instance_of(Array)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@endpoints_api_instance.create_endpoint(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing body' do
-
1
expect {
-
1
@endpoints_api_instance.create_endpoint(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Endpoints
-
1
describe '#list_endpoints' do
-
1
it 'gets a list of endpoints' do
-
1
data, status_code = @endpoints_api_instance.list_endpoints_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::ListEndpointsResponse)
-
1
expect(data.links).to be_instance_of(Array)
-
1
expect(data.page).to be_instance_of(Bandwidth::Page)
-
1
expect(data.data).to be_instance_of(Array)
-
1
expect(data.data[0]).to be_instance_of(Bandwidth::Endpoints)
-
1
expect(data.data[0].endpoint_id).to be_instance_of(String)
-
1
expect(data.data[0].type).to be_one_of(Bandwidth::EndpointTypeEnum.all_vars)
-
1
expect(data.data[0].status).to be_one_of(Bandwidth::EndpointStatusEnum.all_vars)
-
1
expect(data.data[0].creation_timestamp).to be_instance_of(Time)
-
1
expect(data.data[0].expiration_timestamp).to be_instance_of(Time)
-
1
expect(data.data[0].tag).to be_instance_of(String)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@endpoints_api_instance.list_endpoints(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Endpoint
-
1
describe '#get_endpoint' do
-
1
it 'gets an endpoint' do
-
1
data, status_code = @endpoints_api_instance.get_endpoint_with_http_info(BW_ACCOUNT_ID, endpoint_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::EndpointResponse)
-
1
expect(data.links).to be_instance_of(Array)
-
1
expect(data.data).to be_instance_of(Bandwidth::Endpoint)
-
1
expect(data.data.endpoint_id).to be_instance_of(String)
-
1
expect(data.data.type).to be_one_of(Bandwidth::EndpointTypeEnum.all_vars)
-
1
expect(data.data.status).to be_one_of(Bandwidth::EndpointStatusEnum.all_vars)
-
1
expect(data.data.creation_timestamp).to be_instance_of(Time)
-
1
expect(data.data.expiration_timestamp).to be_instance_of(Time)
-
1
expect(data.data.tag).to be_instance_of(String)
-
1
expect(data.data.devices).to be_instance_of(Array)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@endpoints_api_instance.get_endpoint(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing endpoint_id' do
-
1
expect {
-
1
@endpoints_api_instance.get_endpoint(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Endpoint BXML
-
1
describe '#update_endpoint_bxml' do
-
1
it 'updates an endpoint using bxml' do
-
1
update_bxml = "<?xml version='1.0' encoding='UTF-8'?><Bxml><SpeakSentence>Hello</SpeakSentence></Bxml>"
-
-
1
_data, status_code = @endpoints_api_instance.update_endpoint_bxml_with_http_info(BW_ACCOUNT_ID, endpoint_id, update_bxml)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@endpoints_api_instance.update_endpoint_bxml(nil, '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing endpoint_id' do
-
1
expect {
-
1
@endpoints_api_instance.update_endpoint_bxml(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing body' do
-
1
expect {
-
1
@endpoints_api_instance.update_endpoint_bxml(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Delete Endpoint
-
1
describe '#delete_endpoint' do
-
1
it 'deletes an endpoint' do
-
1
_data, status_code = @endpoints_api_instance.delete_endpoint_with_http_info(BW_ACCOUNT_ID, endpoint_id)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@endpoints_api_instance.delete_endpoint(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing endpoint_id' do
-
1
expect {
-
1
@endpoints_api_instance.delete_endpoint(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MediaApi
-
1
describe 'MediaApi' do
-
# media info
-
4
let(:media_name) { 'ruby_media.jpeg' }
-
2
let(:media_file_data) { File.open('spec/fixtures/ruby_cat.jpeg').read }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.return_binary_data = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@media_api_instance = Bandwidth::MediaApi.new
-
end
-
-
1
describe 'test an instance of MediaApi' do
-
1
it 'should create an instance of MediaApi' do
-
1
expect(@media_api_instance).to be_instance_of(Bandwidth::MediaApi)
-
end
-
end
-
-
# Delete Media
-
1
describe 'delete_media' do
-
1
it 'deletes the binary media' do
-
1
_data, status_code = @media_api_instance.delete_media_with_http_info(BW_ACCOUNT_ID, media_name)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@media_api_instance.delete_media(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing media_id' do
-
1
expect {
-
1
@media_api_instance.delete_media(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Media
-
1
describe 'get_media' do
-
1
it 'gets uploaded binary media' do
-
1
data, status_code = @media_api_instance.get_media_with_http_info(
-
BW_ACCOUNT_ID, media_name, { header_params: { 'Accept' => 'application/octet-stream' } })
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@media_api_instance.get_media(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing media_id' do
-
1
expect {
-
1
@media_api_instance.get_media(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Media
-
1
describe 'list_media' do
-
1
it 'lists media' do
-
1
data, status_code = @media_api_instance.list_media_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::Media)
-
1
expect(data[0].content).to be_instance_of(String)
-
1
expect(data[0].content_length).to be_instance_of(Integer)
-
1
expect(data[0].media_name).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@media_api_instance.list_media(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Upload Media
-
1
describe 'upload_media' do
-
1
it 'uploads media' do
-
1
_data, status_code = @media_api_instance.upload_media_with_http_info(
-
BW_ACCOUNT_ID, media_name, media_file_data, { content_type: 'image/jpeg' })
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@media_api_instance.upload_media(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing media_id' do
-
1
expect {
-
1
@media_api_instance.upload_media(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing body' do
-
1
expect {
-
1
@media_api_instance.upload_media(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessagesApi
-
1
describe 'MessagesApi' do
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@messaging_api_instance = Bandwidth::MessagesApi.new
-
end
-
-
1
describe 'test an instance of MessagesApi' do
-
1
it 'should create an instance of MessagesApi' do
-
1
expect(@messaging_api_instance).to be_instance_of(Bandwidth::MessagesApi)
-
end
-
end
-
-
# Create Message
-
1
describe 'create_message' do
-
1
it 'creates a message' do
-
1
message_request = Bandwidth::MessageRequest.new(
-
application_id: BW_MESSAGING_APPLICATION_ID,
-
to: [USER_NUMBER],
-
from: BW_NUMBER,
-
text: 'Hello',
-
)
-
-
1
data, status_code = @messaging_api_instance.create_message_with_http_info(BW_ACCOUNT_ID, message_request)
-
-
1
expect(status_code).to eq(202)
-
1
expect(data).to be_instance_of(Bandwidth::Message)
-
1
expect(data.id.length).to eq(29)
-
1
expect(data.owner.length).to eq(12)
-
1
expect(data.application_id.length).to eq(36)
-
1
expect(data.time).to be_instance_of(Time)
-
1
expect(data.segment_count).to be_instance_of(Integer)
-
1
expect(data.direction).to be_one_of(Bandwidth::MessageDirectionEnum.all_vars)
-
1
expect(data.to).to be_instance_of(Array)
-
1
expect(data.to[0].length).to eq(12)
-
1
expect(data.from.length).to eq(12)
-
1
expect(data.media).to be_instance_of(Array)
-
1
expect(data.media[0]).to start_with('http')
-
1
expect(data.text).to be_instance_of(String)
-
1
expect(data.tag).to be_instance_of(String)
-
1
expect(data.priority).to be_one_of(Bandwidth::PriorityEnum.all_vars)
-
1
expect(data.expiration).to be_instance_of(Time)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@messaging_api_instance.create_message(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing message_request' do
-
1
expect {
-
1
@messaging_api_instance.create_message(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Messages
-
1
describe 'list_messages' do
-
1
it 'lists messages' do
-
1
data, status_code = @messaging_api_instance.list_messages_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::MessagesList)
-
1
expect(data.total_count).to be_instance_of(Integer)
-
1
expect(data.page_info).to be_instance_of(Bandwidth::PageInfo)
-
1
expect(data.page_info.prev_page).to start_with('http')
-
1
expect(data.page_info.next_page).to start_with('http')
-
1
expect(data.page_info.prev_page_token).to be_instance_of(String)
-
1
expect(data.page_info.next_page_token).to be_instance_of(String)
-
1
expect(data.messages).to be_instance_of(Array)
-
1
expect(data.messages[0]).to be_instance_of(Bandwidth::ListMessageItem)
-
1
expect(data.messages[0].message_id.length).to eq(29)
-
1
expect(data.messages[0].account_id.length).to eq(7)
-
1
expect(data.messages[0].source_tn.length).to eq(12)
-
1
expect(data.messages[0].destination_tn.length).to eq(12)
-
1
expect(data.messages[0].message_status).to be_one_of(Bandwidth::MessageStatusEnum.all_vars)
-
1
expect(data.messages[0].message_direction).to be_one_of(Bandwidth::ListMessageDirectionEnum.all_vars)
-
1
expect(data.messages[0].message_type).to be_one_of(Bandwidth::MessageTypeEnum.all_vars)
-
1
expect(data.messages[0].segment_count).to be_instance_of(Integer)
-
1
expect(data.messages[0].error_code).to be_instance_of(Integer)
-
1
expect(data.messages[0].receive_time).to be_instance_of(Time)
-
1
expect(data.messages[0].carrier_name).to be_instance_of(String)
-
1
expect(data.messages[0].message_size).to be_instance_of(Integer)
-
1
expect(data.messages[0].message_length).to be_instance_of(Integer)
-
1
expect(data.messages[0].attachment_count).to be_instance_of(Integer)
-
1
expect(data.messages[0].recipient_count).to be_instance_of(Integer)
-
1
expect(data.messages[0].campaign_class).to be_instance_of(String)
-
1
expect(data.messages[0].campaign_id).to be_instance_of(String)
-
1
expect(data.messages[0].bw_latency).to be_instance_of(Integer)
-
1
expect(data.messages[0].calling_number_country_a3).to be_instance_of(String)
-
1
expect(data.messages[0].called_number_country_a3).to be_instance_of(String)
-
1
expect(data.messages[0].product).to be_one_of(Bandwidth::ProductTypeEnum.all_vars)
-
1
expect(data.messages[0].location).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@messaging_api_instance.list_messages(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MFAApi
-
1
describe 'MFAApi' do
-
3
let(:message) { 'Your temporary {NAME} {SCOPE} code is: {CODE}' }
-
3
let(:digits) { 6 }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@mfa_api_instance = Bandwidth::MFAApi.new
-
end
-
-
1
describe 'test an instance of MFAApi' do
-
1
it 'should create an instance of MFAApi' do
-
1
expect(@mfa_api_instance).to be_instance_of(Bandwidth::MFAApi)
-
end
-
end
-
-
# Messaging Authentication Code
-
1
describe 'generate_messaging_code' do
-
1
it 'generates messaging mfa code' do
-
1
req_schema = Bandwidth::CodeRequest.new(
-
to: USER_NUMBER,
-
from: BW_NUMBER,
-
application_id: BW_MESSAGING_APPLICATION_ID,
-
message: message,
-
digits: digits
-
)
-
-
1
data, status_code = @mfa_api_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::MessagingCodeResponse)
-
1
expect(data.message_id.length).to eq(29)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@mfa_api_instance.generate_messaging_code(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing code_request' do
-
1
expect {
-
1
@mfa_api_instance.generate_messaging_code(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Voice Authentication Code
-
1
describe 'generate_voice_code' do
-
1
it 'generates voice mfa code' do
-
1
req_schema = Bandwidth::CodeRequest.new(
-
to: USER_NUMBER,
-
from: BW_NUMBER,
-
application_id: BW_VOICE_APPLICATION_ID,
-
message: message,
-
digits: digits
-
)
-
-
1
data, status_code = @mfa_api_instance.generate_voice_code_with_http_info(BW_ACCOUNT_ID, req_schema)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::VoiceCodeResponse)
-
1
expect(data.call_id.length).to eq(47)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@mfa_api_instance.generate_voice_code(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing code_request' do
-
1
expect {
-
1
@mfa_api_instance.generate_voice_code(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Verify Authentication Code
-
1
describe 'verify_code' do
-
1
it 'verifies mfa code' do
-
1
req_schema = Bandwidth::VerifyCodeRequest.new(
-
to: USER_NUMBER,
-
scope: '2FA',
-
expiration_time_in_minutes: 3,
-
code: '12345'
-
)
-
-
1
data, status_code = @mfa_api_instance.verify_code_with_http_info(BW_ACCOUNT_ID, req_schema)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::VerifyCodeResponse)
-
1
expect(data.valid).to be_one_of([true, false])
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@mfa_api_instance.verify_code(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing verify_code_request' do
-
1
expect {
-
1
@mfa_api_instance.verify_code(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelApi
-
1
describe 'MultiChannelApi' do
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@multi_channel_api_instance = Bandwidth::MultiChannelApi.new
-
-
1
@expiration_time = (Time.now + 60).round.to_datetime.rfc3339
-
end
-
-
1
describe 'test an instance of MultiChannelApi' do
-
1
it 'should create an instance of MultiChannelApi' do
-
1
expect(@multi_channel_api_instance).to be_instance_of(Bandwidth::MultiChannelApi)
-
end
-
end
-
-
# Create Multi-Channel Message
-
1
describe 'create_multi_channel_message' do
-
1
it 'creates a multi channel message' do
-
1
message_body = Bandwidth::MultiChannelChannelListSMSObject.new(
-
from: BW_NUMBER,
-
application_id: BW_MESSAGING_APPLICATION_ID,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new(
-
text: 'Hello, this is a test message.',
-
)
-
)
-
-
1
multi_channel_message_request = Bandwidth::MultiChannelMessageRequest.new(
-
to: USER_NUMBER,
-
channel_list: [message_body],
-
tag: 'tag',
-
priority: 'high',
-
expiration: @expiration_time,
-
)
-
-
1
data, status_code = @multi_channel_api_instance.create_multi_channel_message_with_http_info(BW_ACCOUNT_ID, multi_channel_message_request)
-
-
1
expect(status_code).to eq(202)
-
1
expect(data).to be_instance_of(Bandwidth::CreateMultiChannelMessageResponse)
-
1
expect(data.links).to be_instance_of(Array)
-
1
expect(data.data).to be_instance_of(Bandwidth::MultiChannelMessageResponseData)
-
1
expect(data.data.id).to be_instance_of(String)
-
1
expect(data.data.time).to be_instance_of(Time)
-
1
expect(data.data.direction).to be_one_of(Bandwidth::MessageDirectionEnum.all_vars)
-
1
expect(data.data.to).to be_instance_of(Array)
-
1
expect(data.data.tag).to be_instance_of(String)
-
1
expect(data.data.priority).to be_one_of(Bandwidth::PriorityEnum.all_vars)
-
1
expect(data.data.expiration).to be_instance_of(Time)
-
1
expect(data.data.channel_list).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@multi_channel_api_instance.create_multi_channel_message(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing message_request' do
-
1
expect {
-
1
@multi_channel_api_instance.create_multi_channel_message(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::PhoneNumberLookupApi
-
1
describe 'PhoneNumberLookupApi' do
-
5
let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }
-
3
let(:request_id) { '123e4567-e89b-12d3-a456-426614174000' }
-
3
let(:rcs_agent) { 'TestAgent' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@api_instance = Bandwidth::PhoneNumberLookupApi.new
-
end
-
1
describe 'test an instance of PhoneNumberLookupApi' do
-
1
it 'should create an instance of PhoneNumberLookupApi' do
-
1
expect(@api_instance).to be_instance_of(Bandwidth::PhoneNumberLookupApi)
-
end
-
end
-
-
# Create Asynchronous Bulk Number Lookup
-
1
describe 'create_async_bulk_lookup test' do
-
1
it 'should work' do
-
1
request = Bandwidth::AsyncLookupRequest.new(
-
phone_numbers: phone_numbers,
-
)
-
-
1
data, status_code = @api_instance.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request)
-
-
1
expect(status_code).to eq(202)
-
1
expect(data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponse)
-
1
expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(data.links[0].rel).to be_instance_of(String)
-
1
expect(data.links[0].href).to be_instance_of(String)
-
1
expect(data.links[0].method).to be_instance_of(String)
-
1
expect(data.data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData)
-
1
expect(data.data.request_id).to be_instance_of(String)
-
1
expect(data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::IN_PROGRESS)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@api_instance.create_async_bulk_lookup(nil, Bandwidth::AsyncLookupRequest.new(phone_numbers: phone_numbers))
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing async_lookup_request' do
-
1
expect {
-
1
@api_instance.create_async_bulk_lookup(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Create Synchronous Number Lookup
-
1
describe 'create_sync_lookup test' do
-
1
it 'should work' do
-
1
request = Bandwidth::SyncLookupRequest.new(
-
phone_numbers: phone_numbers,
-
rcs_agent: rcs_agent,
-
)
-
-
1
data, status_code = @api_instance.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::CreateSyncLookupResponse)
-
1
expect(data.data.request_id).to be_instance_of(String)
-
1
expect(data.data.status).to eq(Bandwidth::CompletedLookupStatusEnum::COMPLETE)
-
1
expect(data.data.results).to be_instance_of(Array)
-
1
expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult)
-
1
expect(data.data.results[0].phone_number).to be_instance_of(String)
-
1
expect(data.data.results[0].line_type).to eq(Bandwidth::LineTypeEnum::MOBILE)
-
1
expect(data.data.results[0].messaging_provider).to be_instance_of(String)
-
1
expect(data.data.results[0].voice_provider).to be_instance_of(String)
-
1
expect(data.data.results[0].country_code_a3).to be_instance_of(String)
-
1
expect(data.data.results[0].latest_message_delivery_status).to eq(Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE)
-
1
expect(data.data.results[0].initial_message_delivery_status_date).to be_instance_of(Date)
-
1
expect(data.data.results[0].latest_message_delivery_status_date).to be_instance_of(Date)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@api_instance.create_sync_lookup(nil, Bandwidth::SyncLookupRequest.new(phone_numbers: phone_numbers, rcs_agent: rcs_agent))
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing sync_lookup_request' do
-
1
expect {
-
1
@api_instance.create_sync_lookup(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Asynchronous Bulk Number Lookup
-
1
describe 'get_async_bulk_lookup test' do
-
1
it 'should work' do
-
1
data, status_code = @api_instance.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponse)
-
1
expect(data.data.request_id).to be_instance_of(String)
-
1
expect(data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::COMPLETE)
-
1
expect(data.data.results).to be_instance_of(Array)
-
1
expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult)
-
1
expect(data.data.results[0].phone_number).to be_instance_of(String)
-
1
expect(data.data.results[0].line_type).to eq(Bandwidth::LineTypeEnum::MOBILE)
-
1
expect(data.data.results[0].messaging_provider).to be_instance_of(String)
-
1
expect(data.data.results[0].voice_provider).to be_instance_of(String)
-
1
expect(data.data.results[0].country_code_a3).to be_instance_of(String)
-
1
expect(data.data.results[0].latest_message_delivery_status).to eq(Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE)
-
1
expect(data.data.results[0].initial_message_delivery_status_date).to be_instance_of(Date)
-
1
expect(data.data.results[0].latest_message_delivery_status_date).to be_instance_of(Date)
-
1
expect(data.errors).to be_instance_of(Array)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@api_instance.get_async_bulk_lookup(nil, request_id)
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing request_id' do
-
1
expect {
-
1
@api_instance.get_async_bulk_lookup(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingsApi
-
1
describe 'RecordingsApi' do
-
9
let(:call_id) { 'c-1234' }
-
7
let(:recording_id) { 'r-1234' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.return_binary_data = true
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@recordings_api_instance = Bandwidth::RecordingsApi.new
-
end
-
-
1
describe 'test an instance of RecordingsApi' do
-
1
it 'should create an instance of RecordingsApi' do
-
1
expect(@recordings_api_instance).to be_instance_of(Bandwidth::RecordingsApi)
-
end
-
end
-
-
# Delete Recording Transcription
-
1
describe 'delete_recording_transcription' do
-
1
it 'deletes the completed call recording transcription' do
-
1
_data, status_code = @recordings_api_instance.delete_recording_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_transcription(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_transcription(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_transcription(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Delete Recording
-
1
describe 'delete_recording' do
-
1
it 'deletes the completed call recording data' do
-
1
_data, status_code = @recordings_api_instance.delete_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Delete Recording Media
-
1
describe 'delete_recording_media' do
-
1
it 'deletes the completed call recording media' do
-
1
_data, status_code = @recordings_api_instance.delete_recording_media_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_media(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_media(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.delete_recording_media(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Download Recording
-
1
describe 'download_call_recording' do
-
1
it 'downloads a call recording by id' do
-
1
data, status_code = @recordings_api_instance.download_call_recording_with_http_info(
-
BW_ACCOUNT_ID, call_id, recording_id, { header_params: { 'Accept' => 'audio/vnd.wave' } })
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.download_call_recording(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.download_call_recording(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.download_call_recording(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Call Recording
-
1
describe 'get_call_recording' do
-
it 'gets a call recording by id' do
-
data, status_code = @recordings_api_instance.get_call_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
-
-
expect(status_code).to eq(200)
-
expect(data).to be_instance_of(Bandwidth::CallRecordingMetadata)
-
expect(data.application_id.length).to eq(36)
-
expect(data.account_id.length).to eq(7)
-
expect(data.call_id.length).to eq(47)
-
expect(data.parent_call_id.length).to eq(47)
-
expect(data.recording_id.length).to eq(47)
-
expect(data.to.length).to eq(12)
-
expect(data.from.length).to eq(12)
-
expect(data.transfer_caller_id.length).to eq(12)
-
expect(data.transfer_to.length).to eq(12)
-
expect(data.duration).to start_with('PT')
-
expect(data.direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
-
expect(data.channels).to be_instance_of(Integer)
-
expect(data.start_time).to be_instance_of(Time)
-
expect(data.end_time).to be_instance_of(Time)
-
expect(data.file_format).to be_one_of(Bandwidth::FileFormatEnum.all_vars)
-
expect(data.status).to be_instance_of(String)
-
expect(data.media_url).to start_with('http')
-
expect(data.transcription).to be_instance_of(Bandwidth::RecordingTranscriptionMetadata)
-
expect(data.transcription.id.length).to eq(38)
-
expect(data.transcription.status).to be_instance_of(String)
-
expect(data.transcription.completed_time).to be_instance_of(Time)
-
expect(data.transcription.url).to start_with('http')
-
expect(data.recording_name).to be_instance_of(String)
-
end if false # skip due to prism error
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.get_call_recording(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.get_call_recording(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.get_call_recording(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Recording Transcription
-
1
describe 'get_recording_transcription' do
-
1
it 'gets the completed call recording transcription' do
-
1
data, status_code = @recordings_api_instance.get_recording_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::RecordingTranscriptions)
-
1
expect(data.transcripts).to be_instance_of(Array)
-
1
expect(data.transcripts[0]).to be_instance_of(Bandwidth::Transcription)
-
1
expect(data.transcripts[0].text).to be_instance_of(String)
-
1
expect(data.transcripts[0].confidence).to be_instance_of(Float)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.get_recording_transcription(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.get_recording_transcription(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.get_recording_transcription(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Call Recordings
-
1
describe 'list_account_call_recordings' do
-
1
it 'lists account call recordings' do
-
1
data, status_code = @recordings_api_instance.list_account_call_recordings_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::CallRecordingMetadata)
-
1
expect(data[0].application_id.length).to eq(36)
-
1
expect(data[0].account_id.length).to eq(7)
-
1
expect(data[0].call_id.length).to eq(47)
-
1
expect(data[0].parent_call_id.length).to eq(47)
-
1
expect(data[0].recording_id.length).to eq(47)
-
1
expect(data[0].to.length).to eq(12)
-
1
expect(data[0].from.length).to eq(12)
-
1
expect(data[0].transfer_caller_id.length).to eq(12)
-
1
expect(data[0].transfer_to.length).to eq(12)
-
1
expect(data[0].duration).to start_with('PT')
-
1
expect(data[0].direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
-
1
expect(data[0].channels).to be_instance_of(Integer)
-
1
expect(data[0].start_time).to be_instance_of(Time)
-
1
expect(data[0].end_time).to be_instance_of(Time)
-
1
expect(data[0].file_format).to be_one_of(Bandwidth::FileFormatEnum.all_vars)
-
1
expect(data[0].status).to be_instance_of(String)
-
1
expect(data[0].media_url).to start_with('http')
-
1
expect(data[0].transcription).to be_instance_of(Bandwidth::RecordingTranscriptionMetadata)
-
1
expect(data[0].transcription.id.length).to eq(38)
-
1
expect(data[0].transcription.status).to be_instance_of(String)
-
1
expect(data[0].transcription.completed_time).to be_instance_of(Time)
-
1
expect(data[0].transcription.url).to start_with('http')
-
1
expect(data[0].recording_name).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.list_account_call_recordings(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Call Recordings
-
1
describe 'list_call_recordings' do
-
1
it 'lists all recordings for a single call' do
-
1
data, status_code = @recordings_api_instance.list_call_recordings_with_http_info(BW_ACCOUNT_ID, call_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::CallRecordingMetadata)
-
1
expect(data[0].application_id.length).to eq(36)
-
1
expect(data[0].account_id.length).to eq(7)
-
1
expect(data[0].call_id.length).to eq(47)
-
1
expect(data[0].parent_call_id.length).to eq(47)
-
1
expect(data[0].recording_id.length).to eq(47)
-
1
expect(data[0].to.length).to eq(12)
-
1
expect(data[0].from.length).to eq(12)
-
1
expect(data[0].transfer_caller_id.length).to eq(12)
-
1
expect(data[0].transfer_to.length).to eq(12)
-
1
expect(data[0].duration).to start_with('PT')
-
1
expect(data[0].direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
-
1
expect(data[0].channels).to be_instance_of(Integer)
-
1
expect(data[0].start_time).to be_instance_of(Time)
-
1
expect(data[0].end_time).to be_instance_of(Time)
-
1
expect(data[0].file_format).to be_one_of(Bandwidth::FileFormatEnum.all_vars)
-
1
expect(data[0].status).to be_instance_of(String)
-
1
expect(data[0].media_url).to start_with('http')
-
1
expect(data[0].transcription).to be_instance_of(Bandwidth::RecordingTranscriptionMetadata)
-
1
expect(data[0].transcription.id.length).to eq(38)
-
1
expect(data[0].transcription.status).to be_instance_of(String)
-
1
expect(data[0].transcription.completed_time).to be_instance_of(Time)
-
1
expect(data[0].transcription.url).to start_with('http')
-
1
expect(data[0].recording_name).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.list_call_recordings(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.list_call_recordings(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Create Transcription Request
-
1
describe 'transcribe_call_recording' do
-
1
it 'creates a transcription request' do
-
1
transcribe_recording = Bandwidth::TranscribeRecording.new(
-
callback_url: BASE_CALLBACK_URL + '/transcriptions',
-
tag: call_id
-
)
-
-
1
_data, status_code = @recordings_api_instance.transcribe_call_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id, transcribe_recording)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.transcribe_call_recording(nil, '', '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.transcribe_call_recording(BW_ACCOUNT_ID, nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing recording_id' do
-
1
expect {
-
1
@recordings_api_instance.transcribe_call_recording(BW_ACCOUNT_ID, '', nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing transcribe_recording' do
-
1
expect {
-
1
@recordings_api_instance.transcribe_call_recording(BW_ACCOUNT_ID, '', '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Recording
-
1
describe 'update_call_recording_state' do
-
1
it 'updates call recording' do
-
1
pause_recording = Bandwidth::UpdateCallRecording.new(
-
state: Bandwidth::RecordingStateEnum::PAUSED
-
)
-
-
1
_data, status_code = @recordings_api_instance.update_call_recording_state_with_http_info(BW_ACCOUNT_ID, call_id, pause_recording)
-
-
1
expect(status_code).to eq(200)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@recordings_api_instance.update_call_recording_state(nil, '', {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@recordings_api_instance.update_call_recording_state(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing update_call_recording' do
-
1
expect {
-
1
@recordings_api_instance.update_call_recording_state(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StatisticsApi
-
1
describe 'StatisticsApi' do
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@statistics_api_instance = Bandwidth::StatisticsApi.new
-
end
-
-
1
describe 'test an instance of StatisticsApi' do
-
1
it 'should create an instance of StatisticsApi' do
-
1
expect(@statistics_api_instance).to be_instance_of(Bandwidth::StatisticsApi)
-
end
-
end
-
-
# Get Account Statistics
-
1
describe 'get_statistics' do
-
1
it 'gets account statistics' do
-
1
data, status_code = @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::AccountStatistics)
-
1
expect(data.current_call_queue_size).to be_instance_of(Integer)
-
1
expect(data.max_call_queue_size).to be_instance_of(Integer)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@statistics_api_instance.get_statistics(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TollFreeVerificationApi
-
1
describe 'TollFreeVerificationApi' do
-
3
let (:webhook_subscription_request_schema) { Bandwidth::WebhookSubscriptionRequestSchema.new(
-
basic_authentication: {
-
username: 'username',
-
password: 'password'
-
},
-
callback_url: 'https://example.com',
-
shared_secret_key: 'shared-secret-key'
-
) }
-
1
let (:verification) { {
-
2
business_address: Bandwidth::Address.new(
-
name: 'name',
-
addr1: 'addr1',
-
addr2: 'addr2',
-
city: 'city',
-
state: 'state',
-
zip: 'zip',
-
url: 'https://example.com'
-
),
-
business_contact: Bandwidth::Contact.new(
-
first_name: 'first-name',
-
last_name: 'last-name',
-
email: 'email@email.com',
-
phone_number: '+19195551234'
-
),
-
message_volume: 12,
-
use_case: 'useCase',
-
use_case_summary: 'useCaseSummary',
-
production_message_content: 'productionMessageContent',
-
opt_in_workflow: Bandwidth::OptInWorkflow.new(
-
description: 'description',
-
image_urls: ['https://example.com']
-
),
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PUBLIC_PROFIT,
-
business_registration_number: '123456789',
-
business_registration_type: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
business_registration_issuing_country: 'USA',
-
additional_information: 'additionalInformation',
-
isv_reseller: 'isvReseller'
-
} }
-
6
let (:subscription_id) { 'test-id-1234' }
-
9
let (:tf_phone_number) { '+18005551234' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@tfv_api_instance = Bandwidth::TollFreeVerificationApi.new
-
end
-
-
1
describe 'test an instance of TollFreeVerificationApi' do
-
1
it 'should create an instance of TollFreeVerificationApi' do
-
1
expect(@tfv_api_instance).to be_instance_of(Bandwidth::TollFreeVerificationApi)
-
end
-
end
-
-
# Create Webhook Subscription
-
1
describe 'create_webhook_subscription test' do
-
1
it 'creates webhook subscription' do
-
1
data, status_code = @tfv_api_instance.create_webhook_subscription_with_http_info(BW_ACCOUNT_ID, webhook_subscription_request_schema)
-
-
1
expect(status_code).to eq(201)
-
1
expect(data).to be_instance_of(Bandwidth::WebhookSubscription)
-
1
expect(data.id).to be_instance_of(String)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.callback_url).to be_instance_of(String)
-
1
expect(data.type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars)
-
1
expect(data.basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication)
-
1
expect(data.basic_authentication.username).to be_instance_of(String)
-
1
expect(data.basic_authentication.password).to be_instance_of(String)
-
1
expect(data.created_date).to be_instance_of(Time)
-
1
expect(data.modified_date).to be_instance_of(Time)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.create_webhook_subscription(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing webhook_subscription_request_schema' do
-
1
expect {
-
1
@tfv_api_instance.create_webhook_subscription(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Delete Webhook Subscription
-
1
describe 'delete_webhook_subscription test' do
-
1
it 'deletes webhook subscription' do
-
1
_data, status_code = @tfv_api_instance.delete_webhook_subscription_with_http_info(BW_ACCOUNT_ID, subscription_id)
-
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.delete_webhook_subscription(nil, subscription_id)
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing subscription_id' do
-
1
expect {
-
1
@tfv_api_instance.delete_webhook_subscription(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Toll-Free Verification Status
-
1
describe 'get_toll_free_verification_status test' do
-
1
it 'gets toll free verification status' do
-
1
data, status_code = @tfv_api_instance.get_toll_free_verification_status_with_http_info(BW_ACCOUNT_ID, tf_phone_number)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::TfvStatus)
-
1
expect(data.phone_number).to be_instance_of(String)
-
1
expect(data.status).to be_one_of(Bandwidth::TfvStatusEnum.all_vars)
-
1
expect(data.internal_ticket_number).to be_instance_of(String)
-
1
expect(data.decline_reason_description).to be_instance_of(String)
-
1
expect(data.resubmit_allowed).to be_one_of([true, false])
-
1
expect(data.created_date_time).to be_instance_of(Time)
-
1
expect(data.modified_date_time).to be_instance_of(Time)
-
1
expect(data.submission).to be_instance_of(Bandwidth::TfvSubmissionInfo)
-
1
expect(data.blocked).to be_one_of([true, false])
-
1
expect(data.blocked_reason).to be_instance_of(String)
-
1
expect(data.cv_token).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.get_toll_free_verification_status(nil, tf_phone_number)
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing phone_number' do
-
1
expect {
-
1
@tfv_api_instance.get_toll_free_verification_status(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Delete a Toll-Free Verification Submission
-
1
describe 'delete_verification_request' do
-
1
it 'deletes a toll free verification submission' do
-
1
_data, status_code = @tfv_api_instance.delete_verification_request_with_http_info(BW_ACCOUNT_ID, tf_phone_number)
-
1
expect(status_code).to eq(204)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.delete_verification_request(nil, tf_phone_number)
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing phone_number' do
-
1
expect {
-
1
@tfv_api_instance.delete_verification_request(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Toll-Free Use Cases
-
1
describe 'list_toll_free_use_cases test' do
-
1
it 'lists toll free use cases' do
-
1
data, status_code = @tfv_api_instance.list_toll_free_use_cases_with_http_info
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data.length).to be > 0
-
1
expect(data[0]).to be_instance_of(String)
-
end
-
end
-
-
# List Webhook Subscriptions
-
1
describe 'list_webhook_subscriptions test' do
-
1
it 'lists webhook subscriptions' do
-
1
data, status_code = @tfv_api_instance.list_webhook_subscriptions_with_http_info(BW_ACCOUNT_ID)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::WebhookSubscriptionsListBody)
-
1
expect(data.links).to be_instance_of(Bandwidth::LinksObject)
-
1
expect(data.links.first).to be_instance_of(String)
-
1
expect(data.links._next).to be_instance_of(String)
-
1
expect(data.links.previous).to be_instance_of(String)
-
1
expect(data.links.last).to be_instance_of(String)
-
1
expect(data.errors).to be_instance_of(Array)
-
1
expect(data.errors[0].code).to be_instance_of(Integer)
-
1
expect(data.errors[0].description).to be_instance_of(String)
-
1
expect(data.errors[0].telephone_numbers).to be_instance_of(Array)
-
1
expect(data.errors[0].telephone_numbers[0]).to be_instance_of(Bandwidth::TelephoneNumber)
-
1
expect(data.errors[0].telephone_numbers[0].telephone_number).to be_instance_of(String)
-
1
expect(data.data).to be_instance_of(Array)
-
1
expect(data.data[0]).to be_instance_of(Bandwidth::WebhookSubscription)
-
1
expect(data.data[0].id).to be_instance_of(String)
-
1
expect(data.data[0].account_id).to be_instance_of(String)
-
1
expect(data.data[0].callback_url).to be_instance_of(String)
-
1
expect(data.data[0].type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars)
-
1
expect(data.data[0].basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication)
-
1
expect(data.data[0].basic_authentication.username).to be_instance_of(String)
-
1
expect(data.data[0].basic_authentication.password).to be_instance_of(String)
-
1
expect(data.data[0].created_date).to be_instance_of(Time)
-
1
expect(data.data[0].modified_date).to be_instance_of(Time)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.list_webhook_subscriptions(nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Request Toll-Free Verification
-
1
describe 'request_toll_free_verification test' do
-
1
it 'requests toll free verification' do
-
1
verification_request = Bandwidth::VerificationRequest.new(verification.merge(phone_numbers: [tf_phone_number]))
-
1
_data, status_code = @tfv_api_instance.request_toll_free_verification_with_http_info(BW_ACCOUNT_ID, verification_request)
-
-
1
expect(status_code).to eq(202)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.request_toll_free_verification(nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing verification_request' do
-
1
expect {
-
1
@tfv_api_instance.request_toll_free_verification(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Toll-Free Verification Request
-
1
describe 'update_toll_free_verification_request test' do
-
1
it 'updates toll free verification request' do
-
1
tfv_submission_wrapper = Bandwidth::TfvSubmissionWrapper.new(
-
submission: Bandwidth::VerificationUpdateRequest.new(verification)
-
)
-
-
1
_data, status_code = @tfv_api_instance.update_toll_free_verification_request_with_http_info(BW_ACCOUNT_ID, tf_phone_number, tfv_submission_wrapper)
-
-
1
expect(status_code).to eq(202)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.update_toll_free_verification_request(nil, tf_phone_number, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing phone_number' do
-
1
expect {
-
1
@tfv_api_instance.update_toll_free_verification_request(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing tfv_submission_wrapper' do
-
1
expect {
-
1
@tfv_api_instance.update_toll_free_verification_request(BW_ACCOUNT_ID, tf_phone_number, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Update Webhook Subscription
-
1
describe 'update_webhook_subscription test' do
-
1
it 'updates webhook subscription' do
-
1
data, status_code = @tfv_api_instance.update_webhook_subscription_with_http_info(BW_ACCOUNT_ID, subscription_id, webhook_subscription_request_schema)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::WebhookSubscription)
-
1
expect(data.id).to be_instance_of(String)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.callback_url).to be_instance_of(String)
-
1
expect(data.type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars)
-
1
expect(data.basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication)
-
1
expect(data.basic_authentication.username).to be_instance_of(String)
-
1
expect(data.basic_authentication.password).to be_instance_of(String)
-
1
expect(data.created_date).to be_instance_of(Time)
-
1
expect(data.modified_date).to be_instance_of(Time)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@tfv_api_instance.update_webhook_subscription(nil, subscription_id, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing subscription_id' do
-
1
expect {
-
1
@tfv_api_instance.update_webhook_subscription(BW_ACCOUNT_ID, nil, {})
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing webhook_subscription_request_schema' do
-
1
expect {
-
1
@tfv_api_instance.update_webhook_subscription(BW_ACCOUNT_ID, subscription_id, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TranscriptionsApi
-
1
describe 'TranscriptionsApi' do
-
4
let(:call_id) { 'c-1234' }
-
3
let(:transcription_id) { 't-1234' }
-
-
1
before(:all) do
-
1
Bandwidth.configure do |config|
-
1
config.debugging = true
-
1
config.username = BW_USERNAME
-
1
config.password = BW_PASSWORD
-
1
config.ignore_operation_servers = true
-
1
config.host = '127.0.0.1:4010'
-
end
-
1
@transcriptions_api_instance = Bandwidth::TranscriptionsApi.new
-
end
-
-
1
describe 'test an instance of TranscriptionsApi' do
-
1
it 'should create an instance of TranscriptionsApi' do
-
1
expect(@transcriptions_api_instance).to be_instance_of(Bandwidth::TranscriptionsApi)
-
end
-
end
-
-
# Delete Call Transcription
-
1
describe 'delete_real_time_transcription' do
-
1
it 'deletes the specified call transcription' do
-
1
_data, status_code = @transcriptions_api_instance.delete_real_time_transcription_with_http_info(BW_ACCOUNT_ID, call_id, transcription_id)
-
-
1
expect(status_code).to eq(200)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@transcriptions_api_instance.delete_real_time_transcription(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@transcriptions_api_instance.delete_real_time_transcription(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing transcription_id' do
-
1
expect {
-
1
@transcriptions_api_instance.delete_real_time_transcription(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# List Call Transcriptions
-
1
describe 'list_real_time_transcriptions' do
-
1
it 'lists call transcriptions' do
-
1
data, status_code = @transcriptions_api_instance.list_real_time_transcriptions_with_http_info(BW_ACCOUNT_ID, call_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Array)
-
1
expect(data[0]).to be_instance_of(Bandwidth::CallTranscriptionMetadata)
-
1
expect(data[0].transcription_id).to be_instance_of(String)
-
1
expect(data[0].transcription_url).to be_instance_of(String)
-
1
expect(data[0].transcription_name).to be_instance_of(String)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@transcriptions_api_instance.list_real_time_transcriptions(nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@transcriptions_api_instance.list_real_time_transcriptions(BW_ACCOUNT_ID, nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
# Get Call Transcription
-
1
describe 'get_real_time_transcription' do
-
1
it 'gets the specified call transcription' do
-
1
data, status_code = @transcriptions_api_instance.get_real_time_transcription_with_http_info(BW_ACCOUNT_ID, call_id, transcription_id)
-
-
1
expect(status_code).to eq(200)
-
1
expect(data).to be_instance_of(Bandwidth::CallTranscriptionResponse)
-
1
expect(data.account_id.length).to eq(7)
-
1
expect(data.call_id.length).to eq(47)
-
1
expect(data.transcription_id).to be_instance_of(String)
-
1
expect(data.tracks).to be_instance_of(Array)
-
1
expect(data.tracks[0]).to be_instance_of(Bandwidth::CallTranscription)
-
1
expect(data.tracks[0].detected_language).to be_one_of(Bandwidth::CallTranscriptionDetectedLanguageEnum.all_vars)
-
1
expect(data.tracks[0].track).to be_one_of(Bandwidth::CallTranscriptionTrackEnum.all_vars)
-
1
expect(data.tracks[0].transcript).to be_instance_of(String)
-
1
expect(data.tracks[0].confidence).to be_instance_of(Float)
-
end
-
-
1
it 'causes an ArgumentError for a missing account_id' do
-
1
expect {
-
1
@transcriptions_api_instance.get_real_time_transcription(nil, '', '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing call_id' do
-
1
expect {
-
1
@transcriptions_api_instance.get_real_time_transcription(BW_ACCOUNT_ID, nil, '')
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError for a missing transcription_id' do
-
1
expect {
-
1
@transcriptions_api_instance.get_real_time_transcription(BW_ACCOUNT_ID, '', nil)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ApiClient
-
1
describe Bandwidth::ApiClient do
-
17
let(:api_client_default) { Bandwidth::ApiClient.new }
-
2
let(:config) { Bandwidth::Configuration.new }
-
2
let(:faraday_connection) { Faraday::Connection.new }
-
2
let(:api_client) { Bandwidth::ApiClient.new(config) }
-
1
let(:named_media_headers) { { 'content-disposition' => 'filename=test', 'content-type' => 'text/plain' } }
-
1
let(:media_data) { '123456' }
-
1
let(:media_headers) { { 'content-type' => 'text/plain' } }
-
1
let(:json_headers) { { 'content-type' => 'application/json' } }
-
1
let(:multipart_headers) { { 'Content-Type' => 'multipart/form-data' } }
-
2
let(:form_encoded_headers) { { 'Content-Type' => 'application/x-www-form-urlencoded' } }
-
1
let(:error_data) { '{"error": true}' }
-
-
describe '#call_api' do
-
it 'calls api and returns a tempfile with name from content-disposition header' do
-
stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 200, headers: media_headers, body: media_data)
-
-
opts = {
-
operation: :"MediaApi.get_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: nil,
-
auth_names: ['Basic'],
-
return_type: 'File'
-
}
-
data, status_code, headers = api_client.call_api(:GET, 'path', opts)
-
-
expect(status_code).to eq(200)
-
expect(headers).to eq(media_headers)
-
expect(data).to be_a(Tempfile)
-
end
-
-
it 'calls api and returns a tempfile' do
-
stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 200, headers: named_media_headers, body: media_data)
-
-
opts = {
-
operation: :"MediaApi.get_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: nil,
-
auth_names: ['Basic'],
-
return_type: 'File'
-
}
-
data, status_code, headers = api_client.call_api(:GET, 'path', opts)
-
-
expect(status_code).to eq(200)
-
expect(headers).to eq(named_media_headers)
-
expect(data).to be_a(Tempfile)
-
end
-
-
it 'calls api and returns binary data' do
-
stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 200, headers: media_headers, body: media_data)
-
-
api_client.config.return_binary_data = true
-
api_client.config.debugging = true
-
-
opts = {
-
operation: :"MediaApi.get_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: nil,
-
auth_names: ['Basic'],
-
return_type: 'File'
-
}
-
data, status_code, headers = api_client.call_api(:GET, 'path', opts)
-
-
expect(status_code).to eq(200)
-
expect(headers).to eq(media_headers)
-
expect(data).to eq(media_data)
-
end
-
-
it 'calls api and returns a hash' do
-
stub_request(:get, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 200, headers: json_headers, body: '{"id": 1}')
-
-
opts = {
-
operation: :"MessagesApi.list_messages",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: nil,
-
auth_names: ['Basic'],
-
return_type: 'Hash<String, Integer>'
-
}
-
data, status_code, headers = api_client.call_api(:GET, 'path', opts)
-
-
expect(status_code).to eq(200)
-
expect(headers).to eq(json_headers)
-
expect(data).to eq({ id: 1 })
-
end
-
-
it 'posts data and returns nothing' do
-
stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 204)
-
-
api_client.config.debugging = true
-
-
opts = {
-
operation: :"MediaApi.upload_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: { id: 1 },
-
auth_names: ['Basic'],
-
return_type: nil
-
}
-
data, status_code = api_client.call_api(:POST, 'path', opts)
-
-
expect(status_code).to eq(204)
-
expect(data).to be nil
-
end
-
-
it 'posts multipart/form-data and returns nothing' do
-
stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 204)
-
-
opts = {
-
operation: :"MediaApi.upload_media",
-
header_params: multipart_headers,
-
query_params: {},
-
form_params: { file: Tempfile.new('filename'), array: [1, 2, 3], string: '123' },
-
body: nil,
-
auth_names: ['Basic'],
-
return_type: nil
-
}
-
data, status_code = api_client.call_api(:POST, 'path', opts)
-
-
expect(status_code).to eq(204)
-
expect(data).to be nil
-
end
-
-
it 'calls api and handles HTTP error' do
-
stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path').
-
to_return(status: 400, headers: json_headers, body: error_data)
-
-
opts = {
-
operation: :"MediaApi.upload_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: { id: 1 },
-
auth_names: ['Basic'],
-
return_type: nil
-
}
-
-
expect {
-
api_client.call_api(:POST, 'path', opts)
-
}.to raise_error { |e|
-
expect(e).to be_instance_of(Bandwidth::ApiError)
-
expect(e.code).to eq(400)
-
expect(e.response_headers).to eq(json_headers)
-
expect(e.response_body).to eq('{"error": true}')
-
}
-
end
-
-
it 'calls api and handles timeout error' do
-
stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path').
-
to_raise(Faraday::TimeoutError)
-
-
opts = {
-
operation: :"MediaApi.upload_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: { id: 1 },
-
auth_names: ['Basic'],
-
return_type: nil
-
}
-
-
expect {
-
api_client.call_api(:POST, 'path', opts)
-
}.to raise_error { |e|
-
expect(e).to be_instance_of(Bandwidth::ApiError)
-
expect(e.message).to eq('Connection timed out')
-
}
-
end
-
-
it 'calls api and handles connection error' do
-
stub_request(:post, 'https://messaging.bandwidth.com/api/v2/path').
-
to_raise(Faraday::ConnectionFailed)
-
-
opts = {
-
operation: :"MediaApi.upload_media",
-
header_params: {},
-
query_params: {},
-
form_params: {},
-
body: { id: 1 },
-
auth_names: ['Basic'],
-
return_type: nil
-
}
-
-
expect {
-
api_client.call_api(:POST, 'path', opts)
-
}.to raise_error { |e|
-
expect(e).to be_instance_of(Bandwidth::ApiError)
-
expect(e.message).to eq('Connection failed')
-
}
-
end
-
end if false # not needed since the api unit tests cover this
-
-
1
describe '#build_request_body' do
-
1
it 'builds application/x-www-form-urlencoded' do
-
1
expect(api_client_default.build_request_body(form_encoded_headers, { id: 1 }, nil)).to eq('id=1')
-
end
-
-
1
it 'builds empty body' do
-
1
expect(api_client_default.build_request_body({}, {}, nil)).to be nil
-
end
-
end
-
-
1
describe '#deserialize' do
-
1
it 'throws on invalid JSON when expecting JSON' do
-
1
headers = { 'Content-Type' => 'application/json' }
-
1
response = double('response', headers: headers, body: '{id 1}')
-
1
expect {
-
1
api_client_default.deserialize(response, 'Hash<String, Integer>')
-
}.to raise_error(JSON::ParserError)
-
end
-
-
1
it 'rescues invalid JSON when expecting non-JSON' do
-
1
headers = { 'Content-Type' => 'application/json' }
-
1
response = double('response', headers: headers, body: '2022-06-16')
-
1
data = api_client_default.deserialize(response, 'Date')
-
1
expect(data).to eq(Date.parse('2022-06-16'))
-
end
-
end
-
-
1
describe '#basic_auth' do
-
1
it 'sets basic auth for the connection' do
-
1
api_client.config.username = 'username'
-
1
api_client.config.password = 'password'
-
1
api_client.basic_auth(faraday_connection)
-
1
expect(api_client.config.username).to eq('username')
-
1
expect(api_client.config.password).to eq('password')
-
end
-
end
-
-
1
describe '#json_mime?' do
-
1
it 'checks if the given MIME is a JSON MIME' do
-
1
expect(api_client_default.json_mime?(nil)).to eq false
-
1
expect(api_client_default.json_mime?('')).to eq false
-
-
1
expect(api_client_default.json_mime?('application/json')).to eq true
-
1
expect(api_client_default.json_mime?('application/json; charset=UTF8')).to eq true
-
1
expect(api_client_default.json_mime?('APPLICATION/JSON')).to eq true
-
-
1
expect(api_client_default.json_mime?('application/xml')).to eq false
-
1
expect(api_client_default.json_mime?('text/plain')).to eq false
-
1
expect(api_client_default.json_mime?('application/jsonp')).to eq false
-
end
-
end
-
-
1
describe '#convert_to_type' do
-
1
it 'converts data to the given return type' do
-
1
expect(api_client_default.convert_to_type(1, 'String')).to eq('1')
-
1
expect(api_client_default.convert_to_type('1', 'Integer')).to eq(1)
-
1
expect(api_client_default.convert_to_type('1', 'Float')).to eq(1.0)
-
1
expect(api_client_default.convert_to_type(1, 'Boolean')).to be false
-
1
expect(api_client_default.convert_to_type('2022-06-16T13:15:07.160Z', 'Time')).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(api_client_default.convert_to_type('2022-06-16', 'Date')).to eq(Date.parse('2022-06-16'))
-
1
expect(api_client_default.convert_to_type({ id: 1 }, 'Object')).to eq({ id: 1 })
-
1
expect(api_client_default.convert_to_type([[12, 34], [56]], 'Array<Array<Integer>>')).to eq([[12, 34], [56]])
-
1
expect(api_client_default.convert_to_type({ "id": 'test' }, 'Hash<String, String>')).to eq({ id: 'test' })
-
1
expect(api_client_default.convert_to_type({ valid: true }, 'VerifyCodeResponse')).to be_instance_of(Bandwidth::VerifyCodeResponse)
-
end
-
end
-
-
1
describe '#sanitize_filename' do
-
1
it 'sanitizes a filename by removing the path' do
-
1
expect(api_client_default.sanitize_filename('sun')).to eq('sun')
-
1
expect(api_client_default.sanitize_filename('sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('../sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('./sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('..\sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
-
1
expect(api_client_default.sanitize_filename('.\sun.gif')).to eq('sun.gif')
-
end
-
end
-
-
1
describe '#build_request_url' do
-
1
it 'adds leading and trailing slashes to path' do
-
1
expect(api_client_default.build_request_url('test/path')).to end_with('/test/path')
-
end
-
end
-
-
1
describe '#update_params_for_auth' do
-
1
it 'updates header and query params based on authentication settings' do
-
-
end
-
end
-
-
1
describe '#user_agent=' do
-
1
it 'sets user agent in HTTP header' do
-
1
api_client_default.user_agent = 'test-user-agent'
-
1
expect(api_client_default.default_headers['User-Agent']).to eq('test-user-agent')
-
end
-
end
-
-
1
describe '#select_header_accept' do
-
1
it 'returns Accept header based on an array of accepts provided' do
-
1
expect(api_client_default.select_header_accept(nil)).to be_nil
-
1
expect(api_client_default.select_header_accept([])).to be_nil
-
-
1
expect(api_client_default.select_header_accept(['application/json'])).to eq('application/json')
-
1
expect(api_client_default.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
-
1
expect(api_client_default.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
-
-
1
expect(api_client_default.select_header_accept(['application/xml'])).to eq('application/xml')
-
1
expect(api_client_default.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
-
end
-
end
-
-
1
describe '#select_header_content_type' do
-
1
it 'returns Content-Type header based on an array of content types provided' do
-
1
expect(api_client_default.select_header_content_type(nil)).to be_nil
-
1
expect(api_client_default.select_header_content_type([])).to be_nil
-
-
1
expect(api_client_default.select_header_content_type(['application/json'])).to eq('application/json')
-
1
expect(api_client_default.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
-
1
expect(api_client_default.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
-
1
expect(api_client_default.select_header_content_type(['application/xml'])).to eq('application/xml')
-
1
expect(api_client_default.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
-
end
-
end
-
-
1
describe '#object_to_http_body' do
-
1
it 'converts array to JSON string' do
-
1
model = [1, 2, 3]
-
1
expect(api_client_default.object_to_http_body(model)).to eq('[1,2,3]')
-
end
-
-
1
it 'converts hash to JSON string' do
-
1
model = { id: 1 }
-
1
expect(api_client_default.object_to_http_body(model)).to eq('{"id":1}')
-
end
-
end
-
-
1
describe '#object_to_hash' do
-
1
it 'returns object when object cannot be converted to hash' do
-
1
model = Object.new
-
1
model.instance_variable_set(:@id, 1)
-
1
expect(api_client_default.object_to_hash(model)).to be_instance_of(Object)
-
1
expect(api_client_default.object_to_hash(model).instance_variable_get('@id')).to eq(1)
-
end
-
-
1
it 'returns hash when object can be converted to hash' do
-
1
model = Bandwidth::VerifyCodeResponse.new({
-
valid: true
-
})
-
1
expected = { valid: true }
-
1
expect(api_client_default.object_to_hash(model)).to eq(expected)
-
end
-
end
-
-
1
describe '#build_collection_param' do
-
1
it 'builds parameter value according to the given collection format' do
-
1
param = ['aa', 'bb', 'cc']
-
1
expect(api_client_default.build_collection_param(param, :csv)).to eq('aa,bb,cc')
-
1
expect(api_client_default.build_collection_param(param, :ssv)).to eq('aa bb cc')
-
1
expect(api_client_default.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
-
1
expect(api_client_default.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
-
1
expect(api_client_default.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
-
1
expect {
-
1
api_client_default.build_collection_param(param, :INVALID)
-
}.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ApiError
-
1
describe Bandwidth::ApiError do
-
1
describe '#initialize' do
-
1
it 'initializes an instance of ApiError with message' do
-
1
api_error = Bandwidth::ApiError.new({ message: 'test' })
-
1
expect(api_error.message).to eq('test')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns message when to_s is called' do
-
1
api_error = Bandwidth::ApiError.new('test')
-
1
expect(api_error.to_s).to eq('test')
-
end
-
end
-
-
1
describe '#message' do
-
1
it 'returns default error message when none supplied' do
-
1
api_error = Bandwidth::ApiError.new
-
1
expect(api_error.message).to eq('Error message: the server returns an error')
-
end
-
end
-
end
-
1
require 'uri'
-
-
# Unit tests for Bandwidth::Configuration
-
1
describe Bandwidth::Configuration do
-
36
let(:config) { Bandwidth::Configuration.new }
-
4
let(:faraday_connection) { Faraday::Connection.new }
-
2
let(:uri) { URI.parse(BASE_CALLBACK_URL + '/path') }
-
8
let(:token) { 'abcd1234' }
-
1
let(:server) { [
-
{
-
2
url: 'https://voice.bandwidth.com/api/{enum_var}/{default_var}',
-
description: 'Production',
-
variables: {
-
enum_var: {
-
enum_values: ['v1', 'v2', 'v3'],
-
default_value: 'v2'
-
},
-
default_var: {
-
default_value: 'default_value'
-
}
-
}
-
}
-
] }
-
-
1
describe '#configure' do
-
1
it 'configures a Configuration instance using a a block' do
-
1
config.configure do |c|
-
1
c.scheme = uri.scheme
-
1
c.host = uri.host
-
1
c.base_path = uri.path
-
end
-
1
expect(config.scheme).to eq(uri.scheme)
-
1
expect(config.host).to eq(uri.host)
-
1
expect(config.base_path).to eq(uri.path)
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#scheme=' do
-
1
config.scheme = 'scheme://'
-
1
expect(config.scheme).to eq('scheme')
-
end
-
-
1
it '#host=' do
-
1
config.host = 'https://hostname'
-
1
expect(config.host).to eq('hostname')
-
end
-
-
1
it '#base_path=' do
-
1
config.base_path = 'basepath'
-
1
expect(config.base_path).to eq('/basepath')
-
end
-
end
-
-
1
describe '#base_url' do
-
1
it 'returns default value when invalid operation is passed' do
-
1
expect(config.base_url('invalid_operation')).to eq('http://localhost')
-
end
-
-
1
it 'returns proper base URL when server index is set' do
-
1
operation, server = config.operation_server_settings.first
-
1
expect(config.base_url(operation)).to eq(server[0][:url])
-
end
-
-
1
it 'should have the default value' do
-
1
expect(config.base_url).to eq('http://localhost')
-
end
-
-
1
it 'returns default value when invalid operation is passed' do
-
1
expect(config.base_url('invalid_operation')).to eq('http://localhost')
-
end
-
-
1
it 'throws argument error when attempting to use a server index that is out of bounds' do
-
1
config.server_operation_index = {
-
:'MediaApi.upload_media' => 10
-
}
-
1
expect {
-
1
config.base_url(:'MediaApi.upload_media')
-
}.to raise_error(ArgumentError, 'Invalid index 10 when selecting the server. Must not be nil and must be less than 1')
-
end
-
end
-
-
1
describe '#api_key_with_prefix' do
-
1
it 'gets API key without prefix' do
-
1
config.api_key['Authorization'] = token
-
1
expect(config.api_key_with_prefix('Authorization')).to eq(token)
-
end
-
-
1
it 'gets API key wit prefix' do
-
1
config.api_key_prefix['Authorization'] = 'Token'
-
1
config.api_key['Authorization'] = token
-
1
expect(config.api_key_with_prefix('Authorization')).to eq("Token #{token}")
-
end
-
end
-
-
1
describe '#access_token_with_refresh' do
-
1
it 'gets the static access_token when no access_token_getter is defined' do
-
1
config.access_token = token
-
1
expect(config.access_token_with_refresh).to eq(token)
-
end
-
-
1
it 'gets access_token using access_token_getter' do
-
2
config.access_token_getter = proc { token }
-
1
expect(config.access_token_with_refresh).to eq(token)
-
end
-
end
-
-
1
describe '#basic_auth_token' do
-
1
it 'gets Basic Auth token string' do
-
1
config.username = 'username'
-
1
config.password = 'password'
-
1
expect(config.basic_auth_token).to eq('Basic dXNlcm5hbWU6cGFzc3dvcmQ=')
-
end
-
end
-
-
1
describe '#oauth_bearer_token' do
-
1
it 'returns the Bearer string when a static access_token is set' do
-
1
config.access_token = token
-
1
config.access_token_getter = nil
-
1
expect(config.oauth_bearer_token).to eq("Bearer #{token}")
-
end
-
-
1
it 'returns the Bearer string using access_token_getter when defined' do
-
3
config.access_token_getter = proc { token }
-
1
expect(config.oauth_bearer_token).to eq("Bearer #{token}")
-
end
-
-
1
it 'returns nil when no access_token is available' do
-
1
config.access_token = nil
-
2
config.access_token_getter = proc { nil }
-
1
expect(config.oauth_bearer_token).to be_nil
-
end
-
end
-
-
1
describe 'default access_token_getter' do
-
4
let(:client_id) { 'test_client_id' }
-
4
let(:client_secret) { 'test_client_secret' }
-
7
let(:faraday_conn) { instance_double(Faraday::Connection) }
-
3
let(:success_response) { instance_double(Faraday::Response, status: 200, body: '{"access_token":"refreshed_token","expires_in":3600}') }
-
2
let(:error_response) { instance_double(Faraday::Response, status: 401, body: 'unauthorized') }
-
-
1
before do
-
6
allow(Faraday).to receive(:new).and_return(faraday_conn)
-
end
-
-
1
it 'returns the cached access_token when expiration is in the future' do
-
1
config.access_token = 'cached_token'
-
1
config.instance_variable_set(:@access_token_expiration, Time.now + 3600)
-
1
expect(faraday_conn).not_to receive(:post)
-
1
expect(config.access_token_getter.call).to eq('cached_token')
-
end
-
-
1
it 'returns the cached access_token when expiration has never been set' do
-
1
config.access_token = 'cached_token'
-
1
expect(faraday_conn).not_to receive(:post)
-
1
expect(config.access_token_getter.call).to eq('cached_token')
-
end
-
-
1
it 'returns nil when no cached token and no client credentials' do
-
1
expect(faraday_conn).not_to receive(:post)
-
1
expect(config.access_token_getter.call).to be_nil
-
end
-
-
1
it 'fetches a new token via the token endpoint when no cached token exists' do
-
1
config.client_id = client_id
-
1
config.client_secret = client_secret
-
1
allow(faraday_conn).to receive(:post).and_return(success_response)
-
1
expect(config.access_token_getter.call).to eq('refreshed_token')
-
1
expect(config.access_token).to eq('refreshed_token')
-
1
expect(config.instance_variable_get(:@access_token_expiration)).to be_a(Time)
-
end
-
-
1
it 'refreshes the token when the cached token is within the 60-second expiration buffer' do
-
1
config.client_id = client_id
-
1
config.client_secret = client_secret
-
1
config.access_token = 'expiring_soon'
-
1
config.instance_variable_set(:@access_token_expiration, Time.now + 30)
-
1
allow(faraday_conn).to receive(:post).and_return(success_response)
-
1
config.access_token_getter.call
-
1
expect(config.access_token).to eq('refreshed_token')
-
end
-
-
1
it 'raises when the token endpoint returns a non-200 response' do
-
1
config.client_id = client_id
-
1
config.client_secret = client_secret
-
1
allow(faraday_conn).to receive(:post).and_return(error_response)
-
1
expect {
-
1
config.access_token_getter.call
-
}.to raise_error(RuntimeError, /Failed to obtain access token: 401/)
-
end
-
end
-
-
1
describe '#auth_settings' do
-
1
it 'returns Basic auth entry for api client' do
-
1
basic_auth = config.auth_settings['Basic']
-
1
expect(basic_auth[:type]).to eq('basic')
-
1
expect(basic_auth[:in]).to eq('header')
-
1
expect(basic_auth[:key]).to eq('Authorization')
-
1
expect(basic_auth[:value]).to eq('Basic Og==')
-
end
-
-
1
it 'returns OAuth2 auth entry for api client' do
-
1
config.access_token = token
-
1
config.access_token_getter = nil
-
1
oauth2 = config.auth_settings['OAuth2']
-
1
expect(oauth2[:type]).to eq('oauth2')
-
1
expect(oauth2[:in]).to eq('header')
-
1
expect(oauth2[:key]).to eq('Authorization')
-
1
expect(oauth2[:value]).to eq("Bearer #{token}")
-
end
-
end
-
-
1
describe '#server_url' do
-
1
it 'returns URL with enum variable substituted' do
-
1
expect(config.server_url(0, { enum_var: 'v3' }, server)).to eq('https://voice.bandwidth.com/api/v3/default_value')
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid index' do
-
1
expect {
-
1
config.server_url(100)
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid value to an enum variable' do
-
1
expect {
-
1
config.server_url(0, { enum_var: 'v4' }, server)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe 'configure faraday connection' do
-
1
it '#configure_faraday_connection #configure_connection' do
-
1
config.configure_faraday_connection do |c|
-
1
config.username = 'username'
-
end
-
1
config.configure_connection(faraday_connection)
-
1
expect(config.username).to eq('username')
-
end
-
end
-
-
1
describe '#set_faraday_middleware' do
-
1
it '#use' do
-
1
config.use(Faraday::Request::UrlEncoded)
-
1
expect(config.instance_variable_get('@middlewares')[:use]).to eq([[Faraday::Request::UrlEncoded, [], nil]])
-
end
-
-
1
it '#request' do
-
1
config.request(:retry, max: 3, methods: [:get, :post], retry_statuses: [503])
-
1
expect(config.instance_variable_get('@middlewares')[:request]).to eq([[:retry, [{ :max => 3, :methods => [:get, :post], :retry_statuses => [503] }], nil]])
-
end
-
-
1
it '#response' do
-
1
config.response(:logger, nil, { bodies: true, log_level: :debug })
-
1
expect(config.instance_variable_get('@middlewares')[:response]).to eq([[:logger, [nil, { :bodies => true, :log_level => :debug }], nil]])
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid middleware operation' do
-
1
expect {
-
1
config.set_faraday_middleware(:invalid_operation, Faraday::Request::UrlEncoded)
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#configure_middleware' do
-
1
it 'builds connection using supplied response middleware' do
-
1
config.response(:logger)
-
1
config.configure_middleware(faraday_connection)
-
1
expect(faraday_connection.builder.handlers).to include(Faraday::Response::Logger)
-
end
-
-
1
it 'builds connection using deleted middleware' do
-
1
config.set_faraday_middleware(:delete, Faraday::Request::UrlEncoded)
-
1
config.configure_middleware(faraday_connection)
-
1
expect(faraday_connection.builder.handlers).to eq([])
-
end
-
end
-
end
-
# Unit tests for Bandwidth::AccountStatistics
-
1
describe Bandwidth::AccountStatistics do
-
2
let(:account_statistics_default) { Bandwidth::AccountStatistics.new }
-
4
let(:account_statistics_values) { Bandwidth::AccountStatistics.new({
-
current_call_queue_size: 1,
-
max_call_queue_size: 100
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::AccountStatistics.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::AccountStatistics.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::AccountStatistics.acceptable_attributes).to eq(Bandwidth::AccountStatistics.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::AccountStatistics.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of AccountStatistics created by the build_from_hash method' do
-
1
account_statistics_from_hash = Bandwidth::AccountStatistics.build_from_hash({
-
currentCallQueueSize: 1,
-
maxCallQueueSize: 100
-
})
-
1
expect(account_statistics_from_hash).to be_instance_of(Bandwidth::AccountStatistics)
-
1
expect(account_statistics_from_hash.current_call_queue_size).to eq(1)
-
1
expect(account_statistics_from_hash.max_call_queue_size).to eq(100)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(account_statistics_values.to_s).to eq('{:currentCallQueueSize=>1, :maxCallQueueSize=>100}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(account_statistics_default.eql?(Bandwidth::AccountStatistics.new)).to be true
-
1
expect(account_statistics_default.eql?(account_statistics_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(account_statistics_values.to_body).to eq({
-
currentCallQueueSize: 1,
-
maxCallQueueSize: 100
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::AdditionalDenialReason
-
1
describe Bandwidth::AdditionalDenialReason do
-
2
let(:additional_denial_reason_default) { Bandwidth::AdditionalDenialReason.new({
-
status_code: 100,
-
reason: 'baseline',
-
resubmit_allowed: false
-
}) }
-
4
let(:additional_denial_reason_values) { Bandwidth::AdditionalDenialReason.new({
-
status_code: 200,
-
reason: 'reason text',
-
resubmit_allowed: true
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::AdditionalDenialReason.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::AdditionalDenialReason.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::AdditionalDenialReason.acceptable_attributes).to eq(Bandwidth::AdditionalDenialReason.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::AdditionalDenialReason.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of AdditionalDenialReason created by the build_from_hash method' do
-
1
additional_denial_reason_from_hash = Bandwidth::AdditionalDenialReason.build_from_hash({
-
statusCode: 200,
-
reason: 'reason text',
-
resubmitAllowed: true
-
})
-
1
expect(additional_denial_reason_from_hash).to be_instance_of(Bandwidth::AdditionalDenialReason)
-
1
expect(additional_denial_reason_from_hash.status_code).to eq(200)
-
1
expect(additional_denial_reason_from_hash.reason).to eq('reason text')
-
1
expect(additional_denial_reason_from_hash.resubmit_allowed).to eq(true)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(additional_denial_reason_values.to_s).to eq('{:statusCode=>200, :reason=>"reason text", :resubmitAllowed=>true}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
additional_denial_reason_equal = Bandwidth::AdditionalDenialReason.new({
-
status_code: 100,
-
reason: 'baseline',
-
resubmit_allowed: false
-
})
-
1
expect(additional_denial_reason_default.eql?(additional_denial_reason_equal)).to be true
-
1
expect(additional_denial_reason_default.eql?(additional_denial_reason_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(additional_denial_reason_values.to_body).to eq({
-
statusCode: 200,
-
reason: 'reason text',
-
resubmitAllowed: true
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#status_code=' do
-
1
expect {
-
1
Bandwidth::AdditionalDenialReason.new({ status_code: nil, reason: 'a', resubmit_allowed: false })
-
}.to raise_error(ArgumentError, 'status_code cannot be nil')
-
end
-
-
1
it '#reason=' do
-
1
expect {
-
1
Bandwidth::AdditionalDenialReason.new({ status_code: 1, reason: nil, resubmit_allowed: false })
-
}.to raise_error(ArgumentError, 'reason cannot be nil')
-
end
-
-
1
it '#resubmit_allowed=' do
-
1
expect {
-
1
Bandwidth::AdditionalDenialReason.new({ status_code: 1, reason: 'a', resubmit_allowed: nil })
-
}.to raise_error(ArgumentError, 'resubmit_allowed cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Address
-
1
describe Bandwidth::Address do
-
2
let(:address_default) { Bandwidth::Address.new({
-
name: 'Bandwidth',
-
addr1: '900 Main Campus Dr',
-
city: 'Raleigh',
-
state: 'NC',
-
zip: '27606',
-
url: 'https://www.bandwidth.com'
-
}) }
-
4
let(:address_values) { Bandwidth::Address.new({
-
name: 'Bandwidth',
-
addr1: '900 Main Campus Dr',
-
addr2: 'Suite 100',
-
city: 'Raleigh',
-
state: 'NC',
-
zip: '27606',
-
url: 'https://www.bandwidth.com'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Address.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Address.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Address.acceptable_attributes).to eq(Bandwidth::Address.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::Address.openapi_nullable).to eq(Set.new([:'addr2']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Address created by the build_from_hash method' do
-
1
address_from_hash = Bandwidth::Address.build_from_hash({
-
name: 'Bandwidth',
-
addr1: '900 Main Campus Dr',
-
addr2: 'Suite 100',
-
city: 'Raleigh',
-
state: 'NC',
-
zip: '27606',
-
url: 'https://www.bandwidth.com'
-
})
-
1
expect(address_from_hash).to be_instance_of(Bandwidth::Address)
-
1
expect(address_from_hash.name).to eq('Bandwidth')
-
1
expect(address_from_hash.addr1).to eq('900 Main Campus Dr')
-
1
expect(address_from_hash.addr2).to eq('Suite 100')
-
1
expect(address_from_hash.city).to eq('Raleigh')
-
1
expect(address_from_hash.state).to eq('NC')
-
1
expect(address_from_hash.zip).to eq('27606')
-
1
expect(address_from_hash.url).to eq('https://www.bandwidth.com')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(address_values.to_s).to eq('{:name=>"Bandwidth", :addr1=>"900 Main Campus Dr", :addr2=>"Suite 100", :city=>"Raleigh", :state=>"NC", :zip=>"27606", :url=>"https://www.bandwidth.com"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
address_equal = Bandwidth::Address.new({
-
name: 'Bandwidth',
-
addr1: '900 Main Campus Dr',
-
city: 'Raleigh',
-
state: 'NC',
-
zip: '27606',
-
url: 'https://www.bandwidth.com'
-
})
-
1
expect(address_default.eql?(address_equal)).to be true
-
1
expect(address_default.eql?(address_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(address_values.to_body).to eq({
-
name: 'Bandwidth',
-
addr1: '900 Main Campus Dr',
-
addr2: 'Suite 100',
-
city: 'Raleigh',
-
state: 'NC',
-
zip: '27606',
-
url: 'https://www.bandwidth.com'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#name=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: nil })
-
}.to raise_error(ArgumentError, 'name cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#addr1=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: nil })
-
}.to raise_error(ArgumentError, 'addr1 cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "addr1", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "addr1", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#addr2=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', addr2: 'a' * 501, city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' })
-
}.to raise_error(ArgumentError, 'invalid value for "addr2", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#city=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: nil })
-
}.to raise_error(ArgumentError, 'city cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "city", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#state=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: nil })
-
}.to raise_error(ArgumentError, 'state cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "state", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#zip=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: nil })
-
}.to raise_error(ArgumentError, 'zip cannot be nil')
-
end
-
-
1
it '#url=' do
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: nil })
-
}.to raise_error(ArgumentError, 'url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Address.new({ name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "url", the character length must be greater than or equal to 1.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::AnswerCallback
-
1
describe Bandwidth::AnswerCallback do
-
2
let(:answer_callback_default) { Bandwidth::AnswerCallback.new }
-
4
let(:answer_callback_values) { Bandwidth::AnswerCallback.new({
-
event_type: 'answer',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machine_detection_result: { value: 'human', duration: 'PT5S' }
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::AnswerCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::AnswerCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::AnswerCallback.acceptable_attributes).to eq(Bandwidth::AnswerCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::AnswerCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'machine_detection_result'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of AnswerCallback created by the build_from_hash method' do
-
1
answer_callback_from_hash = Bandwidth::AnswerCallback.build_from_hash({
-
eventType: 'answer',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machineDetectionResult: { value: 'human', duration: 'PT5S' }
-
})
-
1
expect(answer_callback_from_hash).to be_instance_of(Bandwidth::AnswerCallback)
-
1
expect(answer_callback_from_hash.event_type).to eq('answer')
-
1
expect(answer_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(answer_callback_from_hash.account_id).to eq('9900000')
-
1
expect(answer_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(answer_callback_from_hash.from).to eq('+19195554321')
-
1
expect(answer_callback_from_hash.to).to eq('+19195551234')
-
1
expect(answer_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(answer_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(answer_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(answer_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(answer_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(answer_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(answer_callback_from_hash.tag).to eq('custom tag')
-
1
expect(answer_callback_from_hash.machine_detection_result).to be_instance_of(Bandwidth::MachineDetectionResult)
-
1
expect(answer_callback_from_hash.machine_detection_result.value).to eq('human')
-
1
expect(answer_callback_from_hash.machine_detection_result.duration).to eq('PT5S')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(answer_callback_values.to_s).to eq('{:eventType=>"answer", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :machineDetectionResult=>{:value=>"human", :duration=>"PT5S"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(answer_callback_default.eql?(Bandwidth::AnswerCallback.new)).to be true
-
1
expect(answer_callback_default.eql?(answer_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(answer_callback_values.to_body).to eq({
-
eventType: 'answer',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machineDetectionResult: { value: 'human', duration: 'PT5S' }
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::AsyncLookupRequest
-
1
describe Bandwidth::AsyncLookupRequest do
-
2
let(:async_lookup_request_default) { Bandwidth::AsyncLookupRequest.new({
-
phone_numbers: ['+19195551234']
-
}) }
-
5
let(:async_lookup_request_values) { Bandwidth::AsyncLookupRequest.new({
-
phone_numbers: ['+19195551234', '+19195554321']
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::AsyncLookupRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::AsyncLookupRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::AsyncLookupRequest.acceptable_attributes).to eq(Bandwidth::AsyncLookupRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::AsyncLookupRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of AsyncLookupRequest created by the build_from_hash method' do
-
1
async_lookup_request_from_hash = Bandwidth::AsyncLookupRequest.build_from_hash({
-
phoneNumbers: ['+19195551234', '+19195554321']
-
})
-
1
expect(async_lookup_request_from_hash).to be_instance_of(Bandwidth::AsyncLookupRequest)
-
1
expect(async_lookup_request_from_hash.phone_numbers).to eq(['+19195551234', '+19195554321'])
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(async_lookup_request_values.to_s).to eq('{:phoneNumbers=>["+19195551234", "+19195554321"]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
async_lookup_request_equal = Bandwidth::AsyncLookupRequest.new({
-
phone_numbers: ['+19195551234']
-
})
-
1
expect(async_lookup_request_default.eql?(async_lookup_request_equal)).to be true
-
1
expect(async_lookup_request_default.eql?(async_lookup_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(async_lookup_request_values.to_body).to eq({
-
phoneNumbers: ['+19195551234', '+19195554321']
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_numbers=' do
-
1
expect {
-
1
async_lookup_request_values.phone_numbers = nil
-
}.to raise_error(ArgumentError, 'phone_numbers cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BlockedWebhook
-
1
describe Bandwidth::BlockedWebhook do
-
2
let(:blocked_webhook_default) { Bandwidth::BlockedWebhook.new }
-
4
let(:blocked_webhook_values) { Bandwidth::BlockedWebhook.new({
-
account_id: '9900000',
-
phone_number: '+18005551234',
-
status: 'VERIFIED',
-
internal_ticket_number: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
-
blocked: true,
-
blocked_reason: 'spam'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BlockedWebhook.acceptable_attributes).to eq(Bandwidth::BlockedWebhook.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::BlockedWebhook.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BlockedWebhook created by the build_from_hash method' do
-
1
blocked_webhook_from_hash = Bandwidth::BlockedWebhook.build_from_hash({
-
accountId: '9900000',
-
phoneNumber: '+18005551234',
-
status: 'VERIFIED',
-
internalTicketNumber: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
-
blocked: true,
-
blockedReason: 'spam'
-
})
-
1
expect(blocked_webhook_from_hash).to be_instance_of(Bandwidth::BlockedWebhook)
-
1
expect(blocked_webhook_from_hash.account_id).to eq('9900000')
-
1
expect(blocked_webhook_from_hash.phone_number).to eq('+18005551234')
-
1
expect(blocked_webhook_from_hash.status).to eq('VERIFIED')
-
1
expect(blocked_webhook_from_hash.internal_ticket_number).to eq('aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee')
-
1
expect(blocked_webhook_from_hash.blocked).to eq(true)
-
1
expect(blocked_webhook_from_hash.blocked_reason).to eq('spam')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(blocked_webhook_values.to_s).to eq('{:accountId=>"9900000", :phoneNumber=>"+18005551234", :status=>"VERIFIED", :internalTicketNumber=>"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", :blocked=>true, :blockedReason=>"spam"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(blocked_webhook_default.eql?(Bandwidth::BlockedWebhook.new)).to be true
-
1
expect(blocked_webhook_default.eql?(blocked_webhook_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(blocked_webhook_values.to_body).to eq({
-
accountId: '9900000',
-
phoneNumber: '+18005551234',
-
status: 'VERIFIED',
-
internalTicketNumber: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
-
blocked: true,
-
blockedReason: 'spam'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new({ phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new({ phone_number: '+1800555123456' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new({ phone_number: '+1800555' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::BlockedWebhook.new({ phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, /invalid value for "phone_number", must conform to the pattern/)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BridgeCompleteCallback
-
1
describe Bandwidth::BridgeCompleteCallback do
-
2
let(:bridge_complete_callback_default) { Bandwidth::BridgeCompleteCallback.new }
-
4
let(:bridge_complete_callback_values) { Bandwidth::BridgeCompleteCallback.new({
-
event_type: 'bridgeComplete',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
cause: 'hangup',
-
error_message: 'call rejected',
-
error_id: '4642074b-7b58-478b-96e4-3a60955c6765'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BridgeCompleteCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BridgeCompleteCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BridgeCompleteCallback.acceptable_attributes).to eq(Bandwidth::BridgeCompleteCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::BridgeCompleteCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BridgeCompleteCallback created by the build_from_hash method' do
-
1
bridge_complete_callback_from_hash = Bandwidth::BridgeCompleteCallback.build_from_hash({
-
eventType: 'bridgeComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
1
expect(bridge_complete_callback_from_hash).to be_instance_of(Bandwidth::BridgeCompleteCallback)
-
1
expect(bridge_complete_callback_from_hash.event_type).to eq('bridgeComplete')
-
1
expect(bridge_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_complete_callback_from_hash.account_id).to eq('9900000')
-
1
expect(bridge_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(bridge_complete_callback_from_hash.from).to eq('+19195554321')
-
1
expect(bridge_complete_callback_from_hash.to).to eq('+19195551234')
-
1
expect(bridge_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(bridge_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(bridge_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(bridge_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(bridge_complete_callback_from_hash.tag).to eq('custom tag')
-
1
expect(bridge_complete_callback_from_hash.cause).to eq('hangup')
-
1
expect(bridge_complete_callback_from_hash.error_message).to eq('call rejected')
-
1
expect(bridge_complete_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(bridge_complete_callback_values.to_s).to eq('{:eventType=>"bridgeComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(bridge_complete_callback_default.eql?(Bandwidth::BridgeCompleteCallback.new)).to be true
-
1
expect(bridge_complete_callback_default.eql?(bridge_complete_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(bridge_complete_callback_values.to_body).to eq({
-
eventType: 'bridgeComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BridgeTargetCompleteCallback
-
1
describe Bandwidth::BridgeTargetCompleteCallback do
-
2
let(:bridge_target_complete_callback_default) { Bandwidth::BridgeTargetCompleteCallback.new }
-
4
let(:bridge_target_complete_callback_values) { Bandwidth::BridgeTargetCompleteCallback.new({
-
event_type: 'bridgeTargetComplete',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BridgeTargetCompleteCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BridgeTargetCompleteCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BridgeTargetCompleteCallback.acceptable_attributes).to eq(Bandwidth::BridgeTargetCompleteCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::BridgeTargetCompleteCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BridgeTargetCompleteCallback created by the build_from_hash method' do
-
1
bridge_target_complete_callback_from_hash = Bandwidth::BridgeTargetCompleteCallback.build_from_hash({
-
eventType: 'bridgeTargetComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag'
-
})
-
1
expect(bridge_target_complete_callback_from_hash).to be_instance_of(Bandwidth::BridgeTargetCompleteCallback)
-
1
expect(bridge_target_complete_callback_from_hash.event_type).to eq('bridgeTargetComplete')
-
1
expect(bridge_target_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_target_complete_callback_from_hash.account_id).to eq('9900000')
-
1
expect(bridge_target_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(bridge_target_complete_callback_from_hash.from).to eq('+19195554321')
-
1
expect(bridge_target_complete_callback_from_hash.to).to eq('+19195551234')
-
1
expect(bridge_target_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(bridge_target_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(bridge_target_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(bridge_target_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_target_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(bridge_target_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(bridge_target_complete_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(bridge_target_complete_callback_values.to_s).to eq('{:eventType=>"bridgeTargetComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(bridge_target_complete_callback_default.eql?(Bandwidth::BridgeTargetCompleteCallback.new)).to be true
-
1
expect(bridge_target_complete_callback_default.eql?(bridge_target_complete_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(bridge_target_complete_callback_values.to_body).to eq({
-
eventType: 'bridgeTargetComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BrtcErrorResponse
-
1
describe Bandwidth::BrtcErrorResponse do
-
2
let(:brtc_error_response_default) { Bandwidth::BrtcErrorResponse.new({
-
links: [],
-
errors: []
-
}) }
-
6
let(:brtc_error_response_values) { Bandwidth::BrtcErrorResponse.new({
-
links: [Bandwidth::BrtcLink.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: { foo: 'bar' },
-
errors: [Bandwidth::BrtcError.new({ type: 'validation', description: 'bad input' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcErrorResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcErrorResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BrtcErrorResponse.acceptable_attributes).to eq(Bandwidth::BrtcErrorResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::BrtcErrorResponse.openapi_nullable).to eq(Set.new([:'data']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BrtcErrorResponse created by the build_from_hash method' do
-
1
brtc_error_response_from_hash = Bandwidth::BrtcErrorResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { foo: 'bar' },
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
1
expect(brtc_error_response_from_hash).to be_instance_of(Bandwidth::BrtcErrorResponse)
-
1
expect(brtc_error_response_from_hash.links.first).to be_instance_of(Bandwidth::BrtcLink)
-
1
expect(brtc_error_response_from_hash.data).to eq({ foo: 'bar' })
-
1
expect(brtc_error_response_from_hash.errors.first).to be_instance_of(Bandwidth::BrtcError)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(brtc_error_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:foo=>"bar"}, :errors=>[{:type=>"validation", :description=>"bad input"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
brtc_error_response_equal = Bandwidth::BrtcErrorResponse.new({
-
links: [],
-
errors: []
-
})
-
1
expect(brtc_error_response_default.eql?(brtc_error_response_equal)).to be true
-
1
expect(brtc_error_response_default.eql?(brtc_error_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(brtc_error_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { foo: 'bar' },
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#links=' do
-
1
expect {
-
1
brtc_error_response_values.links = nil
-
}.to raise_error(ArgumentError, 'links cannot be nil')
-
end
-
-
1
it '#errors=' do
-
1
expect {
-
1
brtc_error_response_values.errors = nil
-
}.to raise_error(ArgumentError, 'errors cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BrtcErrorSource
-
1
describe Bandwidth::BrtcErrorSource do
-
2
let(:brtc_error_source_default) { Bandwidth::BrtcErrorSource.new }
-
4
let(:brtc_error_source_values) { Bandwidth::BrtcErrorSource.new({
-
parameter: 'limit',
-
field: 'phoneNumber',
-
header: 'Authorization',
-
reference: '/accounts/9900000'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcErrorSource.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcErrorSource.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BrtcErrorSource.acceptable_attributes).to eq(Bandwidth::BrtcErrorSource.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::BrtcErrorSource.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BrtcErrorSource created by the build_from_hash method' do
-
1
brtc_error_source_from_hash = Bandwidth::BrtcErrorSource.build_from_hash({
-
parameter: 'limit',
-
field: 'phoneNumber',
-
header: 'Authorization',
-
reference: '/accounts/9900000'
-
})
-
1
expect(brtc_error_source_from_hash).to be_instance_of(Bandwidth::BrtcErrorSource)
-
1
expect(brtc_error_source_from_hash.parameter).to eq('limit')
-
1
expect(brtc_error_source_from_hash.field).to eq('phoneNumber')
-
1
expect(brtc_error_source_from_hash.header).to eq('Authorization')
-
1
expect(brtc_error_source_from_hash.reference).to eq('/accounts/9900000')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(brtc_error_source_values.to_s).to eq('{:parameter=>"limit", :field=>"phoneNumber", :header=>"Authorization", :reference=>"/accounts/9900000"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(brtc_error_source_default.eql?(Bandwidth::BrtcErrorSource.new)).to be true
-
1
expect(brtc_error_source_default.eql?(brtc_error_source_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(brtc_error_source_values.to_body).to eq({
-
parameter: 'limit',
-
field: 'phoneNumber',
-
header: 'Authorization',
-
reference: '/accounts/9900000'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BrtcError
-
1
describe Bandwidth::BrtcError do
-
2
let(:brtc_error_default) { Bandwidth::BrtcError.new({
-
type: 'baseline',
-
description: 'baseline description'
-
}) }
-
4
let(:brtc_error_values) { Bandwidth::BrtcError.new({
-
id: 'abc-123',
-
type: 'validation',
-
description: 'bad input',
-
code: 'E1001',
-
source: Bandwidth::BrtcErrorSource.new({ field: 'phoneNumber' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BrtcError.acceptable_attributes).to eq(Bandwidth::BrtcError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::BrtcError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BrtcError created by the build_from_hash method' do
-
1
brtc_error_from_hash = Bandwidth::BrtcError.build_from_hash({
-
id: 'abc-123',
-
type: 'validation',
-
description: 'bad input',
-
code: 'E1001',
-
source: { field: 'phoneNumber' }
-
})
-
1
expect(brtc_error_from_hash).to be_instance_of(Bandwidth::BrtcError)
-
1
expect(brtc_error_from_hash.id).to eq('abc-123')
-
1
expect(brtc_error_from_hash.type).to eq('validation')
-
1
expect(brtc_error_from_hash.description).to eq('bad input')
-
1
expect(brtc_error_from_hash.code).to eq('E1001')
-
1
expect(brtc_error_from_hash.source).to be_instance_of(Bandwidth::BrtcErrorSource)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(brtc_error_values.to_s).to eq('{:id=>"abc-123", :type=>"validation", :description=>"bad input", :code=>"E1001", :source=>{:field=>"phoneNumber"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
brtc_error_equal = Bandwidth::BrtcError.new({
-
type: 'baseline',
-
description: 'baseline description'
-
})
-
1
expect(brtc_error_default.eql?(brtc_error_equal)).to be true
-
1
expect(brtc_error_default.eql?(brtc_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(brtc_error_values.to_body).to eq({
-
id: 'abc-123',
-
type: 'validation',
-
description: 'bad input',
-
code: 'E1001',
-
source: { field: 'phoneNumber' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::BrtcError.new({ type: nil, description: 'a' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::BrtcError.new({ type: 'a', description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BrtcLink
-
1
describe Bandwidth::BrtcLink do
-
2
let(:brtc_link_default) { Bandwidth::BrtcLink.new }
-
4
let(:brtc_link_values) { Bandwidth::BrtcLink.new({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcLink.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::BrtcLink.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::BrtcLink.acceptable_attributes).to eq(Bandwidth::BrtcLink.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::BrtcLink.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of BrtcLink created by the build_from_hash method' do
-
1
brtc_link_from_hash = Bandwidth::BrtcLink.build_from_hash({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
})
-
1
expect(brtc_link_from_hash).to be_instance_of(Bandwidth::BrtcLink)
-
1
expect(brtc_link_from_hash.href).to eq('https://example.com')
-
1
expect(brtc_link_from_hash.rel).to eq('self')
-
1
expect(brtc_link_from_hash.method).to eq('GET')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(brtc_link_values.to_s).to eq('{:href=>"https://example.com", :rel=>"self", :method=>"GET"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(brtc_link_default.eql?(Bandwidth::BrtcLink.new)).to be true
-
1
expect(brtc_link_default.eql?(brtc_link_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(brtc_link_values.to_body).to eq({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BusinessEntityTypeEnum
-
1
describe Bandwidth::BusinessEntityTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines SOLE_PROPRIETOR' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum::SOLE_PROPRIETOR).to eq('SOLE_PROPRIETOR')
-
end
-
-
1
it 'defines PRIVATE_PROFIT' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT).to eq('PRIVATE_PROFIT')
-
end
-
-
1
it 'defines PUBLIC_PROFIT' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum::PUBLIC_PROFIT).to eq('PUBLIC_PROFIT')
-
end
-
-
1
it 'defines NON_PROFIT' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum::NON_PROFIT).to eq('NON_PROFIT')
-
end
-
-
1
it 'defines GOVERNMENT' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum::GOVERNMENT).to eq('GOVERNMENT')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum.all_vars).to eq([
-
'SOLE_PROPRIETOR',
-
'PRIVATE_PROFIT',
-
'PUBLIC_PROFIT',
-
'NON_PROFIT',
-
'GOVERNMENT'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::BusinessEntityTypeEnum.build_from_hash('SOLE_PROPRIETOR')).to eq('SOLE_PROPRIETOR')
-
1
expect(Bandwidth::BusinessEntityTypeEnum.build_from_hash('PRIVATE_PROFIT')).to eq('PRIVATE_PROFIT')
-
1
expect(Bandwidth::BusinessEntityTypeEnum.build_from_hash('PUBLIC_PROFIT')).to eq('PUBLIC_PROFIT')
-
1
expect(Bandwidth::BusinessEntityTypeEnum.build_from_hash('NON_PROFIT')).to eq('NON_PROFIT')
-
1
expect(Bandwidth::BusinessEntityTypeEnum.build_from_hash('GOVERNMENT')).to eq('GOVERNMENT')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::BusinessEntityTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::BusinessRegistrationTypeEnum
-
1
describe Bandwidth::BusinessRegistrationTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines EIN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::EIN).to eq('EIN')
-
end
-
-
1
it 'defines CBN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::CBN).to eq('CBN')
-
end
-
-
1
it 'defines NEQ' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::NEQ).to eq('NEQ')
-
end
-
-
1
it 'defines PROVINCIAL_NUMBER' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::PROVINCIAL_NUMBER).to eq('PROVINCIAL_NUMBER')
-
end
-
-
1
it 'defines CRN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::CRN).to eq('CRN')
-
end
-
-
1
it 'defines VAT' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::VAT).to eq('VAT')
-
end
-
-
1
it 'defines ACN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::ACN).to eq('ACN')
-
end
-
-
1
it 'defines ABN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::ABN).to eq('ABN')
-
end
-
-
1
it 'defines BRN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::BRN).to eq('BRN')
-
end
-
-
1
it 'defines SIREN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::SIREN).to eq('SIREN')
-
end
-
-
1
it 'defines SIRET' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::SIRET).to eq('SIRET')
-
end
-
-
1
it 'defines NZBN' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::NZBN).to eq('NZBN')
-
end
-
-
1
it 'defines UST_IDNR' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::UST_IDNR).to eq('UST_IDNR')
-
end
-
-
1
it 'defines CIF' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::CIF).to eq('CIF')
-
end
-
-
1
it 'defines NIF' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::NIF).to eq('NIF')
-
end
-
-
1
it 'defines CNPJ' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::CNPJ).to eq('CNPJ')
-
end
-
-
1
it 'defines UID' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::UID).to eq('UID')
-
end
-
-
1
it 'defines OTHER' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum::OTHER).to eq('OTHER')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.all_vars).to eq([
-
'EIN',
-
'CBN',
-
'NEQ',
-
'PROVINCIAL_NUMBER',
-
'CRN',
-
'VAT',
-
'ACN',
-
'ABN',
-
'BRN',
-
'SIREN',
-
'SIRET',
-
'NZBN',
-
'UST_IDNR',
-
'CIF',
-
'NIF',
-
'CNPJ',
-
'UID',
-
'OTHER'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('EIN')).to eq('EIN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('CBN')).to eq('CBN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('NEQ')).to eq('NEQ')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('PROVINCIAL_NUMBER')).to eq('PROVINCIAL_NUMBER')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('CRN')).to eq('CRN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('VAT')).to eq('VAT')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('ACN')).to eq('ACN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('ABN')).to eq('ABN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('BRN')).to eq('BRN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('SIREN')).to eq('SIREN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('SIRET')).to eq('SIRET')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('NZBN')).to eq('NZBN')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('UST_IDNR')).to eq('UST_IDNR')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('CIF')).to eq('CIF')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('NIF')).to eq('NIF')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('CNPJ')).to eq('CNPJ')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('UID')).to eq('UID')
-
1
expect(Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('OTHER')).to eq('OTHER')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::BusinessRegistrationTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Bxml
-
1
describe 'Bandwidth::Bxml::Bxml' do
-
5
let(:instance) { Bandwidth::Bxml::Bxml.new }
-
5
let(:pause_recording) { Bandwidth::Bxml::PauseRecording.new }
-
-
1
describe 'test an instance of Bxml' do
-
1
it 'validates instance of Bxml' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Bxml)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Root)
-
end
-
-
1
it 'test initializing with a single nested verb' do
-
1
instance = Bandwidth::Bxml::Bxml.new(pause_recording)
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n</Bxml>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test initializing with multiple nested verbs' do
-
1
instance = Bandwidth::Bxml::Bxml.new([pause_recording, pause_recording])
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n <PauseRecording/>\n</Bxml>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test adding a single verb to the Bxml instance' do
-
1
instance.add_verbs(pause_recording)
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n</Bxml>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test adding multiple verbs to the Bxml instance' do
-
1
instance.add_verbs([pause_recording, pause_recording])
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n <PauseRecording/>\n</Bxml>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test the to_bxml method of the Bxml instance' do
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::NestableVerb
-
1
describe 'Bandwidth::Bxml::NestableVerb' do
-
2
let(:instance) { Bandwidth::Bxml::NestableVerb.new('Test') }
-
-
1
describe 'test an instance of NestableVerb' do
-
1
it 'validates instance of NestableVerb' do
-
1
expect(instance).to be_a(Bandwidth::Bxml::NestableVerb)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Response
-
1
describe 'Bandwidth::Bxml::Response' do
-
5
let(:instance) { Bandwidth::Bxml::Response.new }
-
5
let(:pause_recording) { Bandwidth::Bxml::PauseRecording.new }
-
-
1
describe 'test an instance of Response' do
-
1
it 'validates instance of Response' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Response)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Root)
-
end
-
-
1
it 'test initializing with a single nested verb' do
-
1
instance = Bandwidth::Bxml::Response.new(pause_recording)
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test initializing with multiple nested verbs' do
-
1
instance = Bandwidth::Bxml::Response.new([pause_recording, pause_recording])
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test adding a single verb to the Response instance' do
-
1
instance.add_verbs(pause_recording)
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test adding multiple verbs to the Response instance' do
-
1
instance.add_verbs([pause_recording, pause_recording])
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'test the to_bxml method of the Response instance' do
-
1
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Verb
-
1
describe 'Bandwidth::Bxml::Verb' do
-
3
let(:instance) { Bandwidth::Bxml::Verb.new('Test') }
-
-
1
describe 'test an instance of Verb' do
-
1
it 'validates instance of Verb' do
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Verb instance' do
-
1
expected = "\n<Test/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Bridge
-
1
describe 'Bandwidth::Bxml::Bridge' do
-
1
let(:initial_attributes) {
-
{
-
3
bridge_complete_url: 'https://initial.com',
-
bridge_complete_method: 'POST',
-
bridge_complete_fallback_url: 'https://initial.com',
-
bridge_complete_fallback_method: 'POST',
-
bridge_target_complete_url: 'https://initial.com',
-
bridge_target_complete_method: 'POST',
-
bridge_target_complete_fallback_url: 'https://initial.com',
-
bridge_target_complete_fallback_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
bridge_complete_url: 'https://new.com',
-
bridge_complete_method: 'GET',
-
bridge_complete_fallback_url: 'https://new.com',
-
bridge_complete_fallback_method: 'GET',
-
bridge_target_complete_url: 'https://new.com',
-
bridge_target_complete_method: 'GET',
-
bridge_target_complete_fallback_url: 'https://new.com',
-
bridge_target_complete_fallback_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Bridge.new('c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d', initial_attributes) }
-
-
1
describe 'test an instance of Bridge' do
-
1
it 'validates instance of Bridge' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Bridge)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Bridge instance' do
-
1
expected = "\n<Bridge bridgeCompleteUrl=\"https://initial.com\" bridgeCompleteMethod=\"POST\" bridgeCompleteFallbackUrl=\"https://initial.com\" bridgeCompleteFallbackMethod=\"POST\" bridgeTargetCompleteUrl=\"https://initial.com\" bridgeTargetCompleteMethod=\"POST\" bridgeTargetCompleteFallbackUrl=\"https://initial.com\" bridgeTargetCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\">c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d</Bridge>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Bridge instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Bridge bridgeCompleteUrl=\"https://new.com\" bridgeCompleteMethod=\"GET\" bridgeCompleteFallbackUrl=\"https://new.com\" bridgeCompleteFallbackMethod=\"GET\" bridgeTargetCompleteUrl=\"https://new.com\" bridgeTargetCompleteMethod=\"GET\" bridgeTargetCompleteFallbackUrl=\"https://new.com\" bridgeTargetCompleteFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\">c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d</Bridge>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Conference
-
1
describe 'Bandwidth::Bxml::Conference' do
-
1
let(:initial_attributes) {
-
{
-
3
mute: true,
-
hold: true,
-
call_ids_to_coach: 'initial',
-
conference_event_url: 'https://initial.com',
-
conference_event_method: 'POST',
-
conference_event_fallback_url: 'https://initial.com',
-
conference_event_fallback_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag',
-
callback_timeout: 5.0
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
mute: false,
-
hold: false,
-
call_ids_to_coach: 'new',
-
conference_event_url: 'https://new.com',
-
conference_event_method: 'GET',
-
conference_event_fallback_url: 'https://new.com',
-
conference_event_fallback_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag',
-
callback_timeout: 10.0
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Conference.new('conference_name', initial_attributes) }
-
-
1
describe 'test an instance of Conference' do
-
1
it 'validates instance of Conference' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Conference)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Conference instance' do
-
1
expected = "\n<Conference mute=\"true\" hold=\"true\" callIdsToCoach=\"initial\" conferenceEventUrl=\"https://initial.com\" conferenceEventMethod=\"POST\" conferenceEventFallbackUrl=\"https://initial.com\" conferenceEventFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" callbackTimeout=\"5.0\">conference_name</Conference>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Conference instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Conference mute=\"false\" hold=\"false\" callIdsToCoach=\"new\" conferenceEventUrl=\"https://new.com\" conferenceEventMethod=\"GET\" conferenceEventFallbackUrl=\"https://new.com\" conferenceEventFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" callbackTimeout=\"10.0\">conference_name</Conference>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::CustomParam
-
1
describe 'Bandwidth::Bxml::CustomParam' do
-
1
let(:initial_attributes) {
-
{
-
3
name: 'initial_name',
-
value: 'initial_value'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name',
-
value: 'new_value'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::CustomParam.new(initial_attributes) }
-
-
1
describe 'test an instance of CustomParam' do
-
1
it 'validates instance of CustomParam' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::CustomParam)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the CustomParam instance' do
-
1
expected = "\n<CustomParam name=\"initial_name\" value=\"initial_value\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the CustomParam instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<CustomParam name=\"new_name\" value=\"new_value\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Forward
-
1
describe 'Bandwidth::Bxml::Forward' do
-
1
let(:initial_attributes) {
-
{
-
3
to: '+19195551234',
-
from: '+19195554321',
-
call_timeout: 5,
-
diversion_treatment: 'propagate',
-
diversion_reason: 'user-busy',
-
uui: '93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
to: '+19195554321',
-
from: '+19195551234',
-
call_timeout: 10,
-
diversion_treatment: 'stack',
-
diversion_reason: 'no-answer',
-
uui: '4fa28015d8ede84bd1a493d6f3c0be5845960b74;encoding=base64,fdsa;encoding=jwt'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Forward.new(initial_attributes) }
-
-
1
describe 'test an instance of Forward' do
-
1
it 'validates instance of Forward' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Forward)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Forward instance' do
-
1
expected = "\n<Forward to=\"+19195551234\" from=\"+19195554321\" callTimeout=\"5\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\" uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Forward instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Forward to=\"+19195554321\" from=\"+19195551234\" callTimeout=\"10\" diversionTreatment=\"stack\" diversionReason=\"no-answer\" uui=\"4fa28015d8ede84bd1a493d6f3c0be5845960b74;encoding=base64,fdsa;encoding=jwt\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Gather
-
1
describe 'Bandwidth::Bxml::Gather' do
-
1
let(:initial_attributes) {
-
{
-
6
gather_url: 'https://initial.com',
-
gather_method: 'POST',
-
gather_fallback_url: 'https://initial.com',
-
gather_fallback_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag',
-
terminating_digits: '5',
-
max_digits: 5,
-
inter_digit_timeout: 5,
-
first_digit_timeout: 5,
-
repeat_count: 5
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
gather_url: 'https://new.com',
-
gather_method: 'POST',
-
gather_fallback_url: 'https://new.com',
-
gather_fallback_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag',
-
terminating_digits: '10',
-
max_digits: 10,
-
inter_digit_timeout: 10,
-
first_digit_timeout: 10,
-
repeat_count: 10
-
}
-
}
-
-
4
let (:play_audio) { Bandwidth::Bxml::PlayAudio.new('https://audio.url/audio1.wav') }
-
2
let (:speak_sentence) { Bandwidth::Bxml::SpeakSentence.new('<lang xml:lang="es-MX">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis>') }
-
-
4
let(:instance) { Bandwidth::Bxml::Gather.new([], initial_attributes) }
-
4
let(:instance_nested) { Bandwidth::Bxml::Gather.new(play_audio, initial_attributes) }
-
-
1
describe 'test an instance of Gather' do
-
1
it 'validates instance of Gather' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Gather)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Gather instance' do
-
1
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Gather instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Gather gatherUrl=\"https://new.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://new.com\" gatherFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"10\" maxDigits=\"10\" interDigitTimeout=\"10\" firstDigitTimeout=\"10\" repeatCount=\"10\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
-
1
describe 'test an instance of Gather with nested verbs' do
-
1
it 'validates instance of Gather' do
-
1
expect(instance_nested).to be_instance_of(Bandwidth::Bxml::Gather)
-
1
expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the nested Gather instance' do
-
1
expected = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
-
1
expect(instance_nested.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the add_verb method of the nested Gather instance' do
-
1
expected_single = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n</Gather>\n"
-
1
instance_nested.add_audio_verbs(speak_sentence)
-
1
expect(instance_nested.to_bxml).to eq(expected_single)
-
-
1
expected_multiple = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
-
1
instance_nested.add_audio_verbs([speak_sentence, play_audio])
-
1
expect(instance_nested.to_bxml).to eq(expected_multiple)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Hangup
-
1
describe 'Bandwidth::Bxml::Hangup' do
-
3
let(:instance) { Bandwidth::Bxml::Hangup.new }
-
-
1
describe 'test an instance of Hangup' do
-
1
it 'validates instance of Hangup' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Hangup)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Hangup instance' do
-
1
expected = "\n<Hangup/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::PauseRecording
-
1
describe 'Bandwidth::Bxml::PauseRecording' do
-
3
let(:instance) { Bandwidth::Bxml::PauseRecording.new }
-
-
1
describe 'test an instance of PauseRecording' do
-
1
it 'validates instance of PauseRecording' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::PauseRecording)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the PauseRecording instance' do
-
1
expected = "\n<PauseRecording/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Pause
-
1
describe 'Bandwidth::Bxml::Pause' do
-
1
let(:initial_attributes) {
-
3
{
-
duration: 5
-
}
-
}
-
-
1
let(:new_attributes) {
-
1
{
-
duration: 10
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Pause.new(initial_attributes) }
-
-
1
describe 'test an instance of Pause' do
-
1
it 'validates instance of Pause' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Pause)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Pause instance' do
-
1
expected = "\n<Pause duration=\"5\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Pause instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Pause duration=\"10\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::PhoneNumber
-
1
describe 'Bandwidth::Bxml::PhoneNumber' do
-
1
let(:initial_attributes) {
-
{
-
3
transfer_answer_url: 'https://initial.com',
-
transfer_answer_method: 'POST',
-
transfer_answer_fallback_url: 'https://initial.com',
-
transfer_answer_fallback_method: 'POST',
-
transfer_disconnect_url: 'https://initial.com',
-
transfer_disconnect_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag',
-
uui: 'initial_uui'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
transfer_answer_url: 'https://new.com',
-
transfer_answer_method: 'GET',
-
transfer_answer_fallback_url: 'https://new.com',
-
transfer_answer_fallback_method: 'GET',
-
transfer_disconnect_url: 'https://new.com',
-
transfer_disconnect_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag',
-
uui: 'new_uui'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::PhoneNumber.new('+19195551234', initial_attributes) }
-
-
1
describe 'test an instance of PhoneNumber' do
-
1
it 'validates instance of PhoneNumber' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::PhoneNumber)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the PhoneNumber instance' do
-
1
expected = "\n<PhoneNumber transferAnswerUrl=\"https://initial.com\" transferAnswerMethod=\"POST\" transferAnswerFallbackUrl=\"https://initial.com\" transferAnswerFallbackMethod=\"POST\" transferDisconnectUrl=\"https://initial.com\" transferDisconnectMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" uui=\"initial_uui\">+19195551234</PhoneNumber>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the PhoneNumber instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<PhoneNumber transferAnswerUrl=\"https://new.com\" transferAnswerMethod=\"GET\" transferAnswerFallbackUrl=\"https://new.com\" transferAnswerFallbackMethod=\"GET\" transferDisconnectUrl=\"https://new.com\" transferDisconnectMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" uui=\"new_uui\">+19195551234</PhoneNumber>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::PlayAudio
-
1
describe 'Bandwidth::Bxml::PlayAudio' do
-
1
let(:initial_attributes) {
-
{
-
3
username: 'initial_username',
-
password: 'initial_password'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
username: 'new_username',
-
password: 'new_password'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::PlayAudio.new('https://audio.url/audio1.wav', initial_attributes) }
-
-
1
describe 'test an instance of PlayAudio' do
-
1
it 'validates instance of PlayAudio' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::PlayAudio)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the PlayAudio instance' do
-
1
expected = "\n<PlayAudio username=\"initial_username\" password=\"initial_password\">https://audio.url/audio1.wav</PlayAudio>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the PlayAudio instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<PlayAudio username=\"new_username\" password=\"new_password\">https://audio.url/audio1.wav</PlayAudio>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Record
-
1
describe 'Bandwidth::Bxml::Record' do
-
1
let(:initial_attributes) {
-
{
-
3
record_complete_url: 'https://initial.com',
-
record_complete_method: 'POST',
-
record_complete_fallback_url: 'https://initial.com',
-
record_complete_fallback_method: 'POST',
-
recording_available_url: 'https://initial.com',
-
recording_available_method: 'POST',
-
transcribe: true,
-
transcription_available_url: 'https://initial.com',
-
transcription_available_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag',
-
terminating_digits: '5',
-
max_duration: 5,
-
silence_timeout: 5,
-
file_format: 'wav'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
record_complete_url: 'https://new.com',
-
record_complete_method: 'GET',
-
record_complete_fallback_url: 'https://new.com',
-
record_complete_fallback_method: 'GET',
-
recording_available_url: 'https://new.com',
-
recording_available_method: 'GET',
-
transcribe: true,
-
transcription_available_url: 'https://new.com',
-
transcription_available_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag',
-
terminating_digits: '0',
-
max_duration: 10,
-
silence_timeout: 10,
-
file_format: 'mp3'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Record.new(initial_attributes) }
-
-
1
describe 'test an instance of Record' do
-
1
it 'validates instance of Record' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Record)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Record instance' do
-
1
expected = "\n<Record recordCompleteUrl=\"https://initial.com\" recordCompleteMethod=\"POST\" recordCompleteFallbackUrl=\"https://initial.com\" recordCompleteFallbackMethod=\"POST\" recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDuration=\"5\" silenceTimeout=\"5\" fileFormat=\"wav\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Record instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Record recordCompleteUrl=\"https://new.com\" recordCompleteMethod=\"GET\" recordCompleteFallbackUrl=\"https://new.com\" recordCompleteFallbackMethod=\"GET\" recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"true\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" terminatingDigits=\"0\" maxDuration=\"10\" silenceTimeout=\"10\" fileFormat=\"mp3\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Redirect
-
1
describe 'Bandwidth::Bxml::Redirect' do
-
1
let(:initial_attributes) {
-
{
-
3
redirect_url: 'https://initial.com',
-
redirect_method: 'POST',
-
redirect_fallback_url: 'https://initial.com',
-
redirect_fallback_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
redirect_url: 'https://new.com',
-
redirect_method: 'GET',
-
redirect_fallback_url: 'https://new.com',
-
redirect_fallback_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Redirect.new(initial_attributes) }
-
-
1
describe 'test an instance of Redirect' do
-
1
it 'validates instance of Redirect' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Redirect)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Redirect instance' do
-
1
expected = "\n<Redirect redirectUrl=\"https://initial.com\" redirectMethod=\"POST\" redirectFallbackUrl=\"https://initial.com\" redirectFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Redirect instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Redirect redirectUrl=\"https://new.com\" redirectMethod=\"GET\" redirectFallbackUrl=\"https://new.com\" redirectFallbackMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::ResumeRecording
-
1
describe 'Bandwidth::Bxml::ResumeRecording' do
-
3
let(:instance) { Bandwidth::Bxml::ResumeRecording.new }
-
-
1
describe 'test an instance of ResumeRecording' do
-
1
it 'validates instance of ResumeRecording' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::ResumeRecording)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the ResumeRecording instance' do
-
1
expected = "\n<ResumeRecording/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Ring
-
1
describe 'Bandwidth::Bxml::Ring' do
-
1
let(:initial_attributes) {
-
3
{
-
duration: 5.0,
-
answer_call: true
-
}
-
}
-
-
1
let(:new_attributes) {
-
1
{
-
duration: 10.0,
-
answer_call: false
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::Ring.new(initial_attributes) }
-
-
1
describe 'test an instance of Ring' do
-
1
it 'validates instance of Ring' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Ring)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Ring instance' do
-
1
expected = "\n<Ring duration=\"5.0\" answerCall=\"true\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Ring instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Ring duration=\"10.0\" answerCall=\"false\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::SendDtmf
-
1
describe 'Bandwidth::Bxml::SendDtmf' do
-
1
let(:initial_attributes) {
-
3
{
-
tone_duration: 5,
-
tone_interval: 5
-
}
-
}
-
-
1
let(:new_attributes) {
-
1
{
-
tone_duration: 10,
-
tone_interval: 10
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::SendDtmf.new('1234', initial_attributes) }
-
-
1
describe 'test an instance of SendDtmf' do
-
1
it 'validates instance of SendDtmf' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::SendDtmf)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the SendDtmf instance' do
-
1
expected = "\n<SendDtmf toneDuration=\"5\" toneInterval=\"5\">1234</SendDtmf>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the SendDtmf instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<SendDtmf toneDuration=\"10\" toneInterval=\"10\">1234</SendDtmf>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::SipUri
-
1
describe 'Bandwidth::Bxml::SipUri' do
-
1
let(:initial_attributes) {
-
{
-
3
uui: 'abc123',
-
transfer_answer_url: 'https://initial.com',
-
transfer_answer_method: 'POST',
-
transfer_answer_fallback_url: 'https://initial.com',
-
transfer_answer_fallback_method: 'POST',
-
transfer_disconnect_url: 'https://initial.com',
-
transfer_disconnect_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
uui: '123abc',
-
transfer_answer_url: 'https://new.com',
-
transfer_answer_method: 'GET',
-
transfer_answer_fallback_url: 'https://new.com',
-
transfer_answer_fallback_method: 'GET',
-
transfer_disconnect_url: 'https://new.com',
-
transfer_disconnect_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::SipUri.new('sip:1-999-123-4567@voip-provider.example.net', initial_attributes) }
-
-
1
describe 'test an instance of SipUri' do
-
1
it 'validates instance of SipUri' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::SipUri)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the SipUri instance' do
-
1
expected = "\n<SipUri uui=\"abc123\" transferAnswerUrl=\"https://initial.com\" transferAnswerMethod=\"POST\" transferAnswerFallbackUrl=\"https://initial.com\" transferAnswerFallbackMethod=\"POST\" transferDisconnectUrl=\"https://initial.com\" transferDisconnectMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\">sip:1-999-123-4567@voip-provider.example.net</SipUri>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the SipUri instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<SipUri uui=\"123abc\" transferAnswerUrl=\"https://new.com\" transferAnswerMethod=\"GET\" transferAnswerFallbackUrl=\"https://new.com\" transferAnswerFallbackMethod=\"GET\" transferDisconnectUrl=\"https://new.com\" transferDisconnectMethod=\"GET\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\">sip:1-999-123-4567@voip-provider.example.net</SipUri>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::SpeakSentence
-
1
describe 'Bandwidth::Bxml::SpeakSentence' do
-
1
let(:initial_attributes) {
-
{
-
3
voice: 'julie',
-
gender: 'female',
-
locale: 'en_US'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
voice: 'simon',
-
gender: 'male',
-
locale: 'en_UK'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::SpeakSentence.new('<lang xml:lang="es-MX">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis>', initial_attributes) }
-
-
1
describe 'test an instance of SpeakSentence' do
-
1
it 'validates instance of SpeakSentence' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::SpeakSentence)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the SpeakSentence instance' do
-
1
expected = "\n<SpeakSentence voice=\"julie\" gender=\"female\" locale=\"en_US\"><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the SpeakSentence instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<SpeakSentence voice=\"simon\" gender=\"male\" locale=\"en_UK\"><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StartGather
-
1
describe 'Bandwidth::Bxml::StartGather' do
-
1
let(:initial_attributes) {
-
{
-
3
dtmf_url: 'https://initial.com',
-
dtmf_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
tag: 'initial_tag'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
dtmf_url: 'https://new.com',
-
dtmf_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
tag: 'new_tag'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::StartGather.new(initial_attributes) }
-
-
1
describe 'test an instance of StartGather' do
-
1
it 'validates instance of StartGather' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StartGather)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StartGather instance' do
-
1
expected = "\n<StartGather dtmfUrl=\"https://initial.com\" dtmfMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" tag=\"initial_tag\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StartGather instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StartGather dtmfUrl=\"https://new.com\" dtmfMethod=\"GET\" username=\"new_username\" password=\"new_password\" tag=\"new_tag\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StartRecording
-
1
describe 'Bandwidth::Bxml::StartRecording' do
-
1
let(:initial_attributes) {
-
{
-
3
recording_available_url: 'https://initial.com',
-
recording_available_method: 'POST',
-
transcribe: true,
-
transcription_available_url: 'https://initial.com',
-
transcription_available_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
tag: 'initial_tag',
-
file_format: 'wav',
-
multi_channel: true
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
recording_available_url: 'https://new.com',
-
recording_available_method: 'GET',
-
transcribe: false,
-
transcription_available_url: 'https://new.com',
-
transcription_available_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
tag: 'new_tag',
-
file_format: 'mp3',
-
multi_channel: false
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::StartRecording.new(initial_attributes) }
-
-
1
describe 'test an instance of StartRecording' do
-
1
it 'validates instance of StartRecording' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StartRecording)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StartRecording instance' do
-
1
expected = "\n<StartRecording recordingAvailableUrl=\"https://initial.com\" recordingAvailableMethod=\"POST\" transcribe=\"true\" transcriptionAvailableUrl=\"https://initial.com\" transcriptionAvailableMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" tag=\"initial_tag\" fileFormat=\"wav\" multiChannel=\"true\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StartRecording instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StartRecording recordingAvailableUrl=\"https://new.com\" recordingAvailableMethod=\"GET\" transcribe=\"false\" transcriptionAvailableUrl=\"https://new.com\" transcriptionAvailableMethod=\"GET\" username=\"new_username\" password=\"new_password\" tag=\"new_tag\" fileFormat=\"mp3\" multiChannel=\"false\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StartStream
-
1
describe 'Bandwidth::Bxml::StartStream' do
-
1
let(:initial_attributes) {
-
{
-
6
name: 'initial_name',
-
mode: 'unidirectional',
-
tracks: 'inbound',
-
destination: 'https://initial.com',
-
destination_username: 'initial_destination_username',
-
destination_password: 'initial_destination_password',
-
stream_event_url: 'https://initial.com',
-
stream_event_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name',
-
mode: 'bidirectional',
-
tracks: 'outbound',
-
destination: 'https://new.com',
-
destination_username: 'new_destination_username',
-
destination_password: 'new_destination_password',
-
stream_event_url: 'https://new.com',
-
stream_event_method: 'GET',
-
username: 'new_username',
-
password: 'new_password'
-
}
-
}
-
-
4
let (:stream_param_1) { Bandwidth::Bxml::StreamParam.new({ name: 'stream_param_name_1', value: 'stream_param_value_1' }) }
-
2
let (:stream_param_2) { Bandwidth::Bxml::StreamParam.new({ name: 'stream_param_name_2', value: 'stream_param_value_2' }) }
-
-
4
let(:instance) { Bandwidth::Bxml::StartStream.new([], initial_attributes) }
-
4
let(:instance_nested) { Bandwidth::Bxml::StartStream.new(stream_param_1, initial_attributes) }
-
-
1
describe 'test an instance of StartStream' do
-
1
it 'validates instance of StartStream' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StartStream)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StartStream instance' do
-
1
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destination_username=\"initial_destination_username\" destination_password=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StartStream instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StartStream name=\"new_name\" mode=\"bidirectional\" tracks=\"outbound\" destination=\"https://new.com\" destination_username=\"new_destination_username\" destination_password=\"new_destination_password\" streamEventUrl=\"https://new.com\" streamEventMethod=\"GET\" username=\"new_username\" password=\"new_password\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
-
1
describe 'test an instance of StartStream with nested verbs' do
-
1
it 'validates instance of StartStream' do
-
1
expect(instance_nested).to be_instance_of(Bandwidth::Bxml::StartStream)
-
1
expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the nested StartStream instance' do
-
1
expected = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destination_username=\"initial_destination_username\" destination_password=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n</StartStream>\n"
-
1
expect(instance_nested.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the add_stream_param method of the nested StartStream instance' do
-
1
expected_single = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destination_username=\"initial_destination_username\" destination_password=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
-
1
instance_nested.add_stream_params(stream_param_2)
-
1
expect(instance_nested.to_bxml).to eq(expected_single)
-
-
1
expected_multiple = "\n<StartStream name=\"initial_name\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"https://initial.com\" destination_username=\"initial_destination_username\" destination_password=\"initial_destination_password\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
-
1
instance_nested.add_stream_params([stream_param_2, stream_param_2])
-
1
expect(instance_nested.to_bxml).to eq(expected_multiple)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StartTranscription
-
1
describe 'Bandwidth::Bxml::StartTranscription' do
-
1
let(:initial_attributes) {
-
{
-
6
name: 'initial_name',
-
tracks: 'inbound',
-
transcription_event_url: 'https://initial.com',
-
transcription_event_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
destination: 'https://initial.com',
-
stabilized: true
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name',
-
tracks: 'outbound',
-
transcription_event_url: 'https://new.com',
-
transcription_event_method: 'GET',
-
username: 'new_username',
-
password: 'new_password',
-
destination: 'https://new.com',
-
stabilized: false
-
}
-
}
-
-
4
let (:custom_param_1) { Bandwidth::Bxml::CustomParam.new({ name: 'custom_param_name_1', value: 'custom_param_value_1' }) }
-
2
let (:custom_param_2) { Bandwidth::Bxml::CustomParam.new({ name: 'custom_param_name_2', value: 'custom_param_value_2' }) }
-
-
4
let(:instance) { Bandwidth::Bxml::StartTranscription.new([], initial_attributes) }
-
4
let(:instance_nested) { Bandwidth::Bxml::StartTranscription.new(custom_param_1, initial_attributes) }
-
-
1
describe 'test an instance of StartTranscription' do
-
1
it 'validates instance of StartTranscription' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StartTranscription)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StartTranscription instance' do
-
1
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StartTranscription instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StartTranscription name=\"new_name\" tracks=\"outbound\" transcriptionEventUrl=\"https://new.com\" transcriptionEventMethod=\"GET\" username=\"new_username\" password=\"new_password\" destination=\"https://new.com\" stabilized=\"false\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
-
1
describe 'test an instance of StartTranscription with nested verbs' do
-
1
it 'validates instance of StartTranscription' do
-
1
expect(instance_nested).to be_instance_of(Bandwidth::Bxml::StartTranscription)
-
1
expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the nested StartTranscription instance' do
-
1
expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n</StartTranscription>\n"
-
1
expect(instance_nested.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the add_custom_param method of the nested StartTranscription instance' do
-
1
expected_single = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
-
1
instance_nested.add_custom_params(custom_param_2)
-
1
expect(instance_nested.to_bxml).to eq(expected_single)
-
-
1
expected_multiple = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
-
1
instance_nested.add_custom_params([custom_param_2, custom_param_2])
-
1
expect(instance_nested.to_bxml).to eq(expected_multiple)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StopGather
-
1
describe 'Bandwidth::Bxml::StopGather' do
-
3
let(:instance) { Bandwidth::Bxml::StopGather.new }
-
-
1
describe 'test an instance of StopGather' do
-
1
it 'validates instance of StopGather' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StopGather)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StopGather instance' do
-
1
expected = "\n<StopGather/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StopRecording
-
1
describe 'Bandwidth::Bxml::StopRecording' do
-
3
let(:instance) { Bandwidth::Bxml::StopRecording.new }
-
-
1
describe 'test an instance of StopRecording' do
-
1
it 'validates instance of StopRecording' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StopRecording)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StopRecording instance' do
-
1
expected = "\n<StopRecording/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StopStream
-
1
describe 'Bandwidth::Bxml::StopStream' do
-
1
let(:initial_attributes) {
-
{
-
3
name: 'initial_name',
-
wait: true
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name',
-
wait: false
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::StopStream.new(initial_attributes) }
-
-
1
describe 'test an instance of StopStream' do
-
1
it 'validates instance of StopStream' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StopStream)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StopStream instance' do
-
1
expected = "\n<StopStream name=\"initial_name\" wait=\"true\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StopStream instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StopStream name=\"new_name\" wait=\"false\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StopTranscription
-
1
describe 'Bandwidth::Bxml::StopTranscription' do
-
1
let(:initial_attributes) {
-
{
-
3
name: 'initial_name'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::StopTranscription.new(initial_attributes) }
-
-
1
describe 'test an instance of StopTranscription' do
-
1
it 'validates instance of StopTranscription' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StopTranscription)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StopTranscription instance' do
-
1
expected = "\n<StopTranscription name=\"initial_name\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StopTranscription instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StopTranscription name=\"new_name\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::StreamParam
-
1
describe 'Bandwidth::Bxml::StreamParam' do
-
1
let(:initial_attributes) {
-
{
-
3
name: 'initial_name',
-
value: 'initial_value'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
name: 'new_name',
-
value: 'new_value'
-
}
-
}
-
-
4
let(:instance) { Bandwidth::Bxml::StreamParam.new(initial_attributes) }
-
-
1
describe 'test an instance of StreamParam' do
-
1
it 'validates instance of StreamParam' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::StreamParam)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the StreamParam instance' do
-
1
expected = "\n<StreamParam name=\"initial_name\" value=\"initial_value\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the StreamParam instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<StreamParam name=\"new_name\" value=\"new_value\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Tag
-
1
describe 'Bandwidth::Bxml::Tag' do
-
3
let(:instance) { Bandwidth::Bxml::Tag.new('test_tag') }
-
-
1
describe 'test an instance of Tag' do
-
1
it 'validates instance of Tag' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Tag)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Tag instance' do
-
1
expected = "\n<Tag>test_tag</Tag>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Bxml::Transfer
-
1
describe 'Bandwidth::Bxml::Transfer' do
-
1
let(:initial_attributes) {
-
{
-
6
transfer_caller_id: '+19195551234',
-
transfer_caller_display_name: 'initial_caller',
-
call_timeout: 5,
-
transfer_complete_url: 'https://initial.com',
-
transfer_complete_method: 'POST',
-
transfer_complete_fallback_url: 'https://initial.com',
-
transfer_complete_fallback_method: 'POST',
-
username: 'initial_username',
-
password: 'initial_password',
-
fallback_username: 'initial_fallback_username',
-
fallback_password: 'initial_fallback_password',
-
tag: 'initial_tag',
-
diversion_treatment: 'propagate',
-
diversion_reason: 'user-busy'
-
}
-
}
-
-
1
let(:new_attributes) {
-
{
-
1
transfer_caller_id: '+19195554321',
-
transfer_caller_display_name: 'new_caller',
-
call_timeout: 10,
-
transfer_complete_url: 'https://new.com',
-
transfer_complete_method: 'POST',
-
transfer_complete_fallback_url: 'https://new.com',
-
transfer_complete_fallback_method: 'POST',
-
username: 'new_username',
-
password: 'new_password',
-
fallback_username: 'new_fallback_username',
-
fallback_password: 'new_fallback_password',
-
tag: 'new_tag',
-
diversion_treatment: 'stack',
-
diversion_reason: 'no-answer'
-
}
-
}
-
-
4
let(:phone_number) { Bandwidth::Bxml::PhoneNumber.new('+19195551234') }
-
2
let(:sip_uri) { Bandwidth::Bxml::SipUri.new('sip:1-999-123-4567@voip-provider.example.net') }
-
-
4
let(:instance) { Bandwidth::Bxml::Transfer.new([], initial_attributes) }
-
4
let(:instance_nested) { Bandwidth::Bxml::Transfer.new(phone_number, initial_attributes) }
-
-
1
describe 'test an instance of Transfer' do
-
1
it 'validates instance of Transfer' do
-
1
expect(instance).to be_instance_of(Bandwidth::Bxml::Transfer)
-
1
expect(instance).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the Transfer instance' do
-
1
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the set_attributes method of the Transfer instance' do
-
1
instance.set_attributes(new_attributes)
-
1
expected = "\n<Transfer transferCallerId=\"+19195554321\" transferCallerDisplayName=\"new_caller\" callTimeout=\"10\" transferCompleteUrl=\"https://new.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://new.com\" transferCompleteFallbackMethod=\"POST\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" diversionTreatment=\"stack\" diversionReason=\"no-answer\"/>\n"
-
1
expect(instance.to_bxml).to eq(expected)
-
end
-
end
-
-
1
describe 'test an instance of Transfer with nested verbs' do
-
1
it 'validates instance of Transfer' do
-
1
expect(instance_nested).to be_instance_of(Bandwidth::Bxml::Transfer)
-
1
expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
-
end
-
-
1
it 'tests the to_bxml method of the nested Transfer instance' do
-
1
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
-
1
expect(instance_nested.to_bxml).to eq(expected)
-
end
-
-
1
it 'tests the add_verb method of the nested Transfer instance' do
-
1
expected_single = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n</Transfer>\n"
-
1
instance_nested.add_transfer_recipients(sip_uri)
-
1
expect(instance_nested.to_bxml).to eq(expected_single)
-
-
1
expected_multiple = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
-
1
instance_nested.add_transfer_recipients([sip_uri, phone_number])
-
1
expect(instance_nested.to_bxml).to eq(expected_multiple)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallDirectionEnum
-
1
describe Bandwidth::CallDirectionEnum do
-
1
describe 'constants' do
-
1
it 'defines INBOUND' do
-
1
expect(Bandwidth::CallDirectionEnum::INBOUND).to eq('inbound')
-
end
-
-
1
it 'defines OUTBOUND' do
-
1
expect(Bandwidth::CallDirectionEnum::OUTBOUND).to eq('outbound')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CallDirectionEnum.all_vars).to eq([
-
'inbound',
-
'outbound'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CallDirectionEnum.build_from_hash('inbound')).to eq('inbound')
-
1
expect(Bandwidth::CallDirectionEnum.build_from_hash('outbound')).to eq('outbound')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CallDirectionEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallRecordingMetadata
-
1
describe Bandwidth::CallRecordingMetadata do
-
2
let(:call_recording_metadata_default) { Bandwidth::CallRecordingMetadata.new }
-
4
let(:call_recording_metadata_values) { Bandwidth::CallRecordingMetadata.new({
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
account_id: '9900000',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recording_id: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
to: '+19195551234',
-
from: '+19195554321',
-
transfer_caller_id: '+19195555678',
-
transfer_to: '+19195558765',
-
duration: 'PT13.67S',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
channels: 1,
-
start_time: '2022-06-16T13:15:07.160Z',
-
end_time: '2022-06-16T13:15:20.830Z',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
status: 'complete',
-
media_url: 'https://example.com/recording.wav',
-
transcription: { id: 't-123', url: 'https://example.com/t-123', status: 'available', completed_time: '2022-06-16T13:15:31.000Z' },
-
recording_name: 'sample-recording'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallRecordingMetadata.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallRecordingMetadata.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CallRecordingMetadata.acceptable_attributes).to eq(Bandwidth::CallRecordingMetadata.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::CallRecordingMetadata.openapi_nullable).to eq(Set.new([
-
:'media_url',
-
:'transcription'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CallRecordingMetadata created by the build_from_hash method' do
-
1
call_recording_metadata_from_hash = Bandwidth::CallRecordingMetadata.build_from_hash({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
to: '+19195551234',
-
from: '+19195554321',
-
transferCallerId: '+19195555678',
-
transferTo: '+19195558765',
-
duration: 'PT13.67S',
-
direction: 'inbound',
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:15:20.830Z',
-
fileFormat: 'wav',
-
status: 'complete',
-
mediaUrl: 'https://example.com/recording.wav',
-
recordingName: 'sample-recording'
-
})
-
1
expect(call_recording_metadata_from_hash).to be_instance_of(Bandwidth::CallRecordingMetadata)
-
1
expect(call_recording_metadata_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(call_recording_metadata_from_hash.account_id).to eq('9900000')
-
1
expect(call_recording_metadata_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_recording_metadata_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(call_recording_metadata_from_hash.recording_id).to eq('r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4')
-
1
expect(call_recording_metadata_from_hash.to).to eq('+19195551234')
-
1
expect(call_recording_metadata_from_hash.from).to eq('+19195554321')
-
1
expect(call_recording_metadata_from_hash.transfer_caller_id).to eq('+19195555678')
-
1
expect(call_recording_metadata_from_hash.transfer_to).to eq('+19195558765')
-
1
expect(call_recording_metadata_from_hash.duration).to eq('PT13.67S')
-
1
expect(call_recording_metadata_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(call_recording_metadata_from_hash.channels).to eq(1)
-
1
expect(call_recording_metadata_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(call_recording_metadata_from_hash.end_time).to eq(Time.parse('2022-06-16T13:15:20.830Z'))
-
1
expect(call_recording_metadata_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(call_recording_metadata_from_hash.status).to eq('complete')
-
1
expect(call_recording_metadata_from_hash.media_url).to eq('https://example.com/recording.wav')
-
1
expect(call_recording_metadata_from_hash.recording_name).to eq('sample-recording')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(call_recording_metadata_values.to_s).to eq('{:applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :accountId=>"9900000", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :recordingId=>"r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4", :to=>"+19195551234", :from=>"+19195554321", :transferCallerId=>"+19195555678", :transferTo=>"+19195558765", :duration=>"PT13.67S", :direction=>"inbound", :channels=>1, :startTime=>"2022-06-16T13:15:07.160Z", :endTime=>"2022-06-16T13:15:20.830Z", :fileFormat=>"wav", :status=>"complete", :mediaUrl=>"https://example.com/recording.wav", :transcription=>{:id=>"t-123", :url=>"https://example.com/t-123", :status=>"available", :completed_time=>"2022-06-16T13:15:31.000Z"}, :recordingName=>"sample-recording"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(call_recording_metadata_default.eql?(Bandwidth::CallRecordingMetadata.new)).to be true
-
1
expect(call_recording_metadata_default.eql?(call_recording_metadata_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(call_recording_metadata_values.to_body).to eq({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
to: '+19195551234',
-
from: '+19195554321',
-
transferCallerId: '+19195555678',
-
transferTo: '+19195558765',
-
duration: 'PT13.67S',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:15:20.830Z',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
status: 'complete',
-
mediaUrl: 'https://example.com/recording.wav',
-
transcription: { id: 't-123', url: 'https://example.com/t-123', status: 'available', completed_time: '2022-06-16T13:15:31.000Z' },
-
recordingName: 'sample-recording'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallStateEnum
-
1
describe Bandwidth::CallStateEnum do
-
1
describe 'constants' do
-
1
it 'defines ACTIVE' do
-
1
expect(Bandwidth::CallStateEnum::ACTIVE).to eq('active')
-
end
-
-
1
it 'defines COMPLETED' do
-
1
expect(Bandwidth::CallStateEnum::COMPLETED).to eq('completed')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CallStateEnum.all_vars).to eq(['active', 'completed'])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CallStateEnum.build_from_hash('active')).to eq('active')
-
1
expect(Bandwidth::CallStateEnum.build_from_hash('completed')).to eq('completed')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CallStateEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallState
-
1
describe Bandwidth::CallState do
-
2
let(:call_state_default) { Bandwidth::CallState.new }
-
4
let(:call_state_values) { Bandwidth::CallState.new({
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
account_id: '9900000',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
direction: 'inbound',
-
state: 'disconnected',
-
stir_shaken: {
-
'verstat': 'TN-Verification-Passed',
-
'attestationIndicator': 'A',
-
'originatingId': 'abc123'
-
},
-
identity: 'eyJhbGciOiJFUzI1NiI',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
end_time: '2022-06-16T13:15:18.314Z',
-
disconnect_cause: 'hangup',
-
error_message: nil,
-
error_id: nil,
-
last_update: '2022-06-16T13:15:18.314Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallState.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallState.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CallState.acceptable_attributes).to eq(Bandwidth::CallState.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::CallState.openapi_nullable).to eq(Set.new([
-
:'parent_call_id',
-
:'stir_shaken',
-
:'identity',
-
:'enqueued_time',
-
:'start_time',
-
:'answer_time',
-
:'end_time',
-
:'disconnect_cause',
-
:'error_message',
-
:'error_id'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CallState created by the build_from_hash method' do
-
1
call_state_from_hash = Bandwidth::CallState.build_from_hash({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
direction: 'inbound',
-
state: 'disconnected',
-
stirShaken: {
-
'verstat': 'TN-Verification-Passed',
-
'attestationIndicator': 'A',
-
'originatingId': 'abc123'
-
},
-
identity: 'eyJhbGciOiJFUzI1NiI',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:15:18.314Z',
-
disconnectCause: 'hangup',
-
errorMessage: nil,
-
errorId: nil,
-
lastUpdate: '2022-06-16T13:15:18.314Z'
-
})
-
1
expect(call_state_from_hash).to be_instance_of(Bandwidth::CallState)
-
1
expect(call_state_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(call_state_from_hash.account_id).to eq('9900000')
-
1
expect(call_state_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_state_from_hash.parent_call_id).to eq('c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_state_from_hash.to).to eq('+19195551234')
-
1
expect(call_state_from_hash.from).to eq('+19195554321')
-
1
expect(call_state_from_hash.direction).to eq('inbound')
-
1
expect(call_state_from_hash.state).to eq('disconnected')
-
1
expect(call_state_from_hash.stir_shaken).to eq({
-
'verstat' => 'TN-Verification-Passed',
-
'attestationIndicator' => 'A',
-
'originatingId' => 'abc123'
-
})
-
1
expect(call_state_from_hash.identity).to eq('eyJhbGciOiJFUzI1NiI')
-
1
expect(call_state_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(call_state_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(call_state_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(call_state_from_hash.end_time).to eq(Time.parse('2022-06-16T13:15:18.314Z'))
-
1
expect(call_state_from_hash.disconnect_cause).to eq('hangup')
-
1
expect(call_state_from_hash.error_message).to eq(nil)
-
1
expect(call_state_from_hash.error_id).to eq(nil)
-
1
expect(call_state_from_hash.last_update).to eq(Time.parse('2022-06-16T13:15:18.314Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(call_state_values.to_s).to eq('{:applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :accountId=>"9900000", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :to=>"+19195551234", :from=>"+19195554321", :direction=>"inbound", :state=>"disconnected", :stirShaken=>{:verstat=>"TN-Verification-Passed", :attestationIndicator=>"A", :originatingId=>"abc123"}, :identity=>"eyJhbGciOiJFUzI1NiI", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:15:18.314Z", :disconnectCause=>"hangup", :errorMessage=>nil, :errorId=>nil, :lastUpdate=>"2022-06-16T13:15:18.314Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(call_state_default.eql?(Bandwidth::CallState.new)).to be true
-
1
expect(call_state_default.eql?(call_state_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(call_state_values.to_body).to eq({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
direction: 'inbound',
-
state: 'disconnected',
-
stirShaken: {
-
'verstat': 'TN-Verification-Passed',
-
'attestationIndicator': 'A',
-
'originatingId': 'abc123'
-
},
-
identity: 'eyJhbGciOiJFUzI1NiI',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:15:18.314Z',
-
disconnectCause: 'hangup',
-
errorMessage: nil,
-
errorId: nil,
-
lastUpdate: '2022-06-16T13:15:18.314Z'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallTranscriptionDetectedLanguageEnum
-
1
describe Bandwidth::CallTranscriptionDetectedLanguageEnum do
-
1
describe 'constants' do
-
1
it 'defines EN_US' do
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum::EN_US).to eq('en-US')
-
end
-
-
1
it 'defines ES_US' do
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum::ES_US).to eq('es-US')
-
end
-
-
1
it 'defines FR_FR' do
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum::FR_FR).to eq('fr-FR')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum.all_vars).to eq([
-
'en-US',
-
'es-US',
-
'fr-FR'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum.build_from_hash('en-US')).to eq('en-US')
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum.build_from_hash('es-US')).to eq('es-US')
-
1
expect(Bandwidth::CallTranscriptionDetectedLanguageEnum.build_from_hash('fr-FR')).to eq('fr-FR')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionDetectedLanguageEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallTranscriptionMetadata
-
1
describe Bandwidth::CallTranscriptionMetadata do
-
2
let(:call_transcription_metadata_default) { Bandwidth::CallTranscriptionMetadata.new }
-
4
let(:call_transcription_metadata_values) { Bandwidth::CallTranscriptionMetadata.new({
-
transcription_id: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcription_name: 'live-transcription',
-
transcription_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1/transcriptions/t-1'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionMetadata.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionMetadata.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CallTranscriptionMetadata.acceptable_attributes).to eq(Bandwidth::CallTranscriptionMetadata.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CallTranscriptionMetadata.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CallTranscriptionMetadata created by the build_from_hash method' do
-
1
call_transcription_metadata_from_hash = Bandwidth::CallTranscriptionMetadata.build_from_hash({
-
transcriptionId: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcriptionName: 'live-transcription',
-
transcriptionUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1/transcriptions/t-1'
-
})
-
1
expect(call_transcription_metadata_from_hash).to be_instance_of(Bandwidth::CallTranscriptionMetadata)
-
1
expect(call_transcription_metadata_from_hash.transcription_id).to eq('t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_transcription_metadata_from_hash.transcription_name).to eq('live-transcription')
-
1
expect(call_transcription_metadata_from_hash.transcription_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1/transcriptions/t-1')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(call_transcription_metadata_values.to_s).to eq('{:transcriptionId=>"t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :transcriptionName=>"live-transcription", :transcriptionUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1/transcriptions/t-1"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(call_transcription_metadata_default.eql?(Bandwidth::CallTranscriptionMetadata.new)).to be true
-
1
expect(call_transcription_metadata_default.eql?(call_transcription_metadata_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(call_transcription_metadata_values.to_body).to eq({
-
transcriptionId: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcriptionName: 'live-transcription',
-
transcriptionUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1/transcriptions/t-1'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallTranscriptionResponse
-
1
describe Bandwidth::CallTranscriptionResponse do
-
2
let(:call_transcription_response_default) { Bandwidth::CallTranscriptionResponse.new }
-
4
let(:call_transcription_response_values) { Bandwidth::CallTranscriptionResponse.new({
-
account_id: '9900000',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcription_id: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tracks: [Bandwidth::CallTranscription.new({ detected_language: 'en-US', track: 'inbound', transcript: 'Hello', confidence: 0.9 })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CallTranscriptionResponse.acceptable_attributes).to eq(Bandwidth::CallTranscriptionResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CallTranscriptionResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CallTranscriptionResponse created by the build_from_hash method' do
-
1
call_transcription_response_from_hash = Bandwidth::CallTranscriptionResponse.build_from_hash({
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcriptionId: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tracks: [{ detectedLanguage: 'en-US', track: 'inbound', transcript: 'Hello', confidence: 0.9 }]
-
})
-
1
expect(call_transcription_response_from_hash).to be_instance_of(Bandwidth::CallTranscriptionResponse)
-
1
expect(call_transcription_response_from_hash.account_id).to eq('9900000')
-
1
expect(call_transcription_response_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_transcription_response_from_hash.transcription_id).to eq('t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(call_transcription_response_from_hash.tracks.first).to be_instance_of(Bandwidth::CallTranscription)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(call_transcription_response_values.to_s).to eq('{:accountId=>"9900000", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :transcriptionId=>"t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :tracks=>[{:detectedLanguage=>"en-US", :track=>"inbound", :transcript=>"Hello", :confidence=>0.9}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(call_transcription_response_default.eql?(Bandwidth::CallTranscriptionResponse.new)).to be true
-
1
expect(call_transcription_response_default.eql?(call_transcription_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(call_transcription_response_values.to_body).to eq({
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
transcriptionId: 't-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tracks: [{ detectedLanguage: 'en-US', track: 'inbound', transcript: 'Hello', confidence: 0.9 }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallTranscription
-
1
describe Bandwidth::CallTranscription do
-
2
let(:call_transcription_default) { Bandwidth::CallTranscription.new }
-
4
let(:call_transcription_values) { Bandwidth::CallTranscription.new({
-
detected_language: Bandwidth::CallTranscriptionDetectedLanguageEnum::EN_US,
-
track: Bandwidth::CallTranscriptionTrackEnum::INBOUND,
-
transcript: 'Hello world',
-
confidence: 0.9
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscription.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CallTranscription.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CallTranscription.acceptable_attributes).to eq(Bandwidth::CallTranscription.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CallTranscription.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CallTranscription created by the build_from_hash method' do
-
1
call_transcription_from_hash = Bandwidth::CallTranscription.build_from_hash({
-
detectedLanguage: 'en-US',
-
track: 'inbound',
-
transcript: 'Hello world',
-
confidence: 0.9
-
})
-
1
expect(call_transcription_from_hash).to be_instance_of(Bandwidth::CallTranscription)
-
1
expect(call_transcription_from_hash.detected_language).to eq(Bandwidth::CallTranscriptionDetectedLanguageEnum::EN_US)
-
1
expect(call_transcription_from_hash.track).to eq(Bandwidth::CallTranscriptionTrackEnum::INBOUND)
-
1
expect(call_transcription_from_hash.transcript).to eq('Hello world')
-
1
expect(call_transcription_from_hash.confidence).to eq(0.9)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(call_transcription_values.to_s).to eq('{:detectedLanguage=>"en-US", :track=>"inbound", :transcript=>"Hello world", :confidence=>0.9}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(call_transcription_default.eql?(Bandwidth::CallTranscription.new)).to be true
-
1
expect(call_transcription_default.eql?(call_transcription_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(call_transcription_values.to_body).to eq({
-
detectedLanguage: Bandwidth::CallTranscriptionDetectedLanguageEnum::EN_US,
-
track: Bandwidth::CallTranscriptionTrackEnum::INBOUND,
-
transcript: 'Hello world',
-
confidence: 0.9
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#confidence=' do
-
1
expect {
-
1
Bandwidth::CallTranscription.new({ confidence: nil })
-
}.to raise_error(ArgumentError, 'confidence cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CallTranscription.new({ confidence: 1.5 })
-
}.to raise_error(ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.')
-
-
1
expect {
-
1
Bandwidth::CallTranscription.new({ confidence: -0.5 })
-
}.to raise_error(ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallTranscriptionTrackEnum
-
1
describe Bandwidth::CallTranscriptionTrackEnum do
-
1
describe 'constants' do
-
1
it 'defines INBOUND' do
-
1
expect(Bandwidth::CallTranscriptionTrackEnum::INBOUND).to eq('inbound')
-
end
-
-
1
it 'defines OUTBOUND' do
-
1
expect(Bandwidth::CallTranscriptionTrackEnum::OUTBOUND).to eq('outbound')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CallTranscriptionTrackEnum.all_vars).to eq([
-
'inbound',
-
'outbound'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CallTranscriptionTrackEnum.build_from_hash('inbound')).to eq('inbound')
-
1
expect(Bandwidth::CallTranscriptionTrackEnum.build_from_hash('outbound')).to eq('outbound')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CallTranscriptionTrackEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CallbackMethodEnum
-
1
describe Bandwidth::CallbackMethodEnum do
-
1
describe 'constants' do
-
1
it 'defines GET' do
-
1
expect(Bandwidth::CallbackMethodEnum::GET).to eq('GET')
-
end
-
-
1
it 'defines POST' do
-
1
expect(Bandwidth::CallbackMethodEnum::POST).to eq('POST')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CallbackMethodEnum.all_vars).to eq([
-
'GET',
-
'POST'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CallbackMethodEnum.build_from_hash('GET')).to eq('GET')
-
1
expect(Bandwidth::CallbackMethodEnum.build_from_hash('POST')).to eq('POST')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CallbackMethodEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Callback
-
1
describe Bandwidth::Callback do
-
1
describe '.openapi_one_of' do
-
1
it 'lists the classes defined in oneOf' do
-
1
expect(Bandwidth::Callback.openapi_one_of).to eq([
-
:'InboundCallback',
-
:'StatusCallback'
-
])
-
end
-
end
-
-
1
describe '.openapi_discriminator_name' do
-
1
it 'returns the discriminator property name' do
-
1
expect(Bandwidth::Callback.openapi_discriminator_name).to eq(:'type')
-
end
-
end
-
-
1
describe '.openapi_discriminator_mapping' do
-
1
it 'maps every discriminator value to a oneOf class' do
-
1
expect(Bandwidth::Callback.openapi_discriminator_mapping).to eq({
-
:'message-delivered' => :'StatusCallback',
-
:'message-failed' => :'StatusCallback',
-
:'message-read' => :'StatusCallback',
-
:'message-received' => :'InboundCallback',
-
:'message-sending' => :'StatusCallback',
-
:'message-sent' => :'StatusCallback',
-
:'request-location-response' => :'InboundCallback',
-
:'suggestion-response' => :'InboundCallback'
-
})
-
end
-
-
1
it 'maps only to classes listed in openapi_one_of' do
-
1
mapping_targets = Bandwidth::Callback.openapi_discriminator_mapping.values.uniq.sort
-
1
expect(mapping_targets).to eq(Bandwidth::Callback.openapi_one_of.sort)
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes inbound discriminator values to InboundCallback.build_from_hash' do
-
1
Bandwidth::Callback.openapi_discriminator_mapping.each do |discriminator, klass|
-
8
next unless klass == :'InboundCallback'
-
3
data = { type: discriminator.to_s }
-
3
expect(Bandwidth::InboundCallback).to receive(:build_from_hash).with(data).and_return(:inbound_result)
-
3
expect(Bandwidth::Callback.build(data)).to eq(:inbound_result)
-
end
-
end
-
-
1
it 'routes status discriminator values to StatusCallback.build_from_hash' do
-
1
Bandwidth::Callback.openapi_discriminator_mapping.each do |discriminator, klass|
-
8
next unless klass == :'StatusCallback'
-
5
data = { type: discriminator.to_s }
-
5
expect(Bandwidth::StatusCallback).to receive(:build_from_hash).with(data).and_return(:status_result)
-
5
expect(Bandwidth::Callback.build(data)).to eq(:status_result)
-
end
-
end
-
-
1
it 'returns nil when the discriminator value is missing' do
-
1
expect(Bandwidth::Callback.build({})).to be_nil
-
end
-
-
1
it 'returns nil when the discriminator value does not match any mapping' do
-
1
expect(Bandwidth::Callback.build({ type: 'unknown' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CardWidthEnum
-
1
describe Bandwidth::CardWidthEnum do
-
1
describe 'constants' do
-
1
it 'defines SMALL' do
-
1
expect(Bandwidth::CardWidthEnum::SMALL).to eq('SMALL')
-
end
-
-
1
it 'defines MEDIUM' do
-
1
expect(Bandwidth::CardWidthEnum::MEDIUM).to eq('MEDIUM')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CardWidthEnum.all_vars).to eq([
-
'SMALL',
-
'MEDIUM'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CardWidthEnum.build_from_hash('SMALL')).to eq('SMALL')
-
1
expect(Bandwidth::CardWidthEnum.build_from_hash('MEDIUM')).to eq('MEDIUM')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CardWidthEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CodeRequest
-
1
describe Bandwidth::CodeRequest do
-
2
let(:code_request_default) { Bandwidth::CodeRequest.new({
-
to: '+19195550100',
-
from: '+19195550101',
-
application_id: 'baseline-app',
-
message: 'Your code is {CODE}',
-
digits: 6
-
}) }
-
4
let(:code_request_values) { Bandwidth::CodeRequest.new({
-
to: '+19195551234',
-
from: '+19195554321',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
scope: '2FA',
-
message: 'Your verification code is {CODE}',
-
digits: 8
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CodeRequest.acceptable_attributes).to eq(Bandwidth::CodeRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CodeRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CodeRequest created by the build_from_hash method' do
-
1
code_request_from_hash = Bandwidth::CodeRequest.build_from_hash({
-
to: '+19195551234',
-
from: '+19195554321',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
scope: '2FA',
-
message: 'Your verification code is {CODE}',
-
digits: 8
-
})
-
1
expect(code_request_from_hash).to be_instance_of(Bandwidth::CodeRequest)
-
1
expect(code_request_from_hash.to).to eq('+19195551234')
-
1
expect(code_request_from_hash.from).to eq('+19195554321')
-
1
expect(code_request_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(code_request_from_hash.scope).to eq('2FA')
-
1
expect(code_request_from_hash.message).to eq('Your verification code is {CODE}')
-
1
expect(code_request_from_hash.digits).to eq(8)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(code_request_values.to_s).to eq('{:to=>"+19195551234", :from=>"+19195554321", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :scope=>"2FA", :message=>"Your verification code is {CODE}", :digits=>8}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
code_request_equal = Bandwidth::CodeRequest.new({
-
to: '+19195550100',
-
from: '+19195550101',
-
application_id: 'baseline-app',
-
message: 'Your code is {CODE}',
-
digits: 6
-
})
-
1
expect(code_request_default.eql?(code_request_equal)).to be true
-
1
expect(code_request_default.eql?(code_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(code_request_values.to_body).to eq({
-
to: '+19195551234',
-
from: '+19195554321',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
scope: '2FA',
-
message: 'Your verification code is {CODE}',
-
digits: 8
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: nil, from: '+19195554321', application_id: 'a', message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: 'invalid', from: '+19195554321', application_id: 'a', message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, /invalid value for "to", must conform to the pattern/)
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: nil, application_id: 'a', message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+1' + '9' * 32, application_id: 'a', message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'invalid value for "from", the character length must be smaller than or equal to 32.')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: 'invalid', application_id: 'a', message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, /invalid value for "from", must conform to the pattern/)
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: nil, message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a' * 51, message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'invalid value for "application_id", the character length must be smaller than or equal to 50.')
-
end
-
-
1
it '#scope=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', scope: nil, message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'scope cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', scope: 'a' * 26, message: 'm', digits: 6 })
-
}.to raise_error(ArgumentError, 'invalid value for "scope", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#message=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', message: nil, digits: 6 })
-
}.to raise_error(ArgumentError, 'message cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', message: 'a' * 2049, digits: 6 })
-
}.to raise_error(ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#digits=' do
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', message: 'm', digits: nil })
-
}.to raise_error(ArgumentError, 'digits cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', message: 'm', digits: 9 })
-
}.to raise_error(ArgumentError, 'invalid value for "digits", must be smaller than or equal to 8.')
-
-
1
expect {
-
1
Bandwidth::CodeRequest.new({ to: '+19195551234', from: '+19195554321', application_id: 'a', message: 'm', digits: 3 })
-
}.to raise_error(ArgumentError, 'invalid value for "digits", must be greater than or equal to 4.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CompletedLookupStatusEnum
-
1
describe Bandwidth::CompletedLookupStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines COMPLETE' do
-
1
expect(Bandwidth::CompletedLookupStatusEnum::COMPLETE).to eq('COMPLETE')
-
end
-
-
1
it 'defines PARTIAL_COMPLETE' do
-
1
expect(Bandwidth::CompletedLookupStatusEnum::PARTIAL_COMPLETE).to eq('PARTIAL_COMPLETE')
-
end
-
-
1
it 'defines FAILED' do
-
1
expect(Bandwidth::CompletedLookupStatusEnum::FAILED).to eq('FAILED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::CompletedLookupStatusEnum.all_vars).to eq([
-
'COMPLETE',
-
'PARTIAL_COMPLETE',
-
'FAILED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::CompletedLookupStatusEnum.build_from_hash('COMPLETE')).to eq('COMPLETE')
-
1
expect(Bandwidth::CompletedLookupStatusEnum.build_from_hash('PARTIAL_COMPLETE')).to eq('PARTIAL_COMPLETE')
-
1
expect(Bandwidth::CompletedLookupStatusEnum.build_from_hash('FAILED')).to eq('FAILED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::CompletedLookupStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceCompletedCallback
-
1
describe Bandwidth::ConferenceCompletedCallback do
-
2
let(:conference_completed_callback_default) { Bandwidth::ConferenceCompletedCallback.new }
-
4
let(:conference_completed_callback_values) { Bandwidth::ConferenceCompletedCallback.new({
-
event_type: 'conferenceCompleted',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceCompletedCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceCompletedCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceCompletedCallback.acceptable_attributes).to eq(Bandwidth::ConferenceCompletedCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceCompletedCallback.openapi_nullable).to eq(Set.new([
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceCompletedCallback created by the build_from_hash method' do
-
1
conference_completed_callback_from_hash = Bandwidth::ConferenceCompletedCallback.build_from_hash({
-
eventType: 'conferenceCompleted',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
1
expect(conference_completed_callback_from_hash).to be_instance_of(Bandwidth::ConferenceCompletedCallback)
-
1
expect(conference_completed_callback_from_hash.event_type).to eq('conferenceCompleted')
-
1
expect(conference_completed_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_completed_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_completed_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_completed_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_completed_callback_values.to_s).to eq('{:eventType=>"conferenceCompleted", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_completed_callback_default.eql?(Bandwidth::ConferenceCompletedCallback.new)).to be true
-
1
expect(conference_completed_callback_default.eql?(conference_completed_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_completed_callback_values.to_body).to eq({
-
eventType: 'conferenceCompleted',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceCreatedCallback
-
1
describe Bandwidth::ConferenceCreatedCallback do
-
2
let(:conference_created_callback_default) { Bandwidth::ConferenceCreatedCallback.new }
-
4
let(:conference_created_callback_values) { Bandwidth::ConferenceCreatedCallback.new({
-
event_type: 'conferenceCreated',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceCreatedCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceCreatedCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceCreatedCallback.acceptable_attributes).to eq(Bandwidth::ConferenceCreatedCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceCreatedCallback.openapi_nullable).to eq(Set.new([
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceCreatedCallback created by the build_from_hash method' do
-
1
conference_created_callback_from_hash = Bandwidth::ConferenceCreatedCallback.build_from_hash({
-
eventType: 'conferenceCreated',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
1
expect(conference_created_callback_from_hash).to be_instance_of(Bandwidth::ConferenceCreatedCallback)
-
1
expect(conference_created_callback_from_hash.event_type).to eq('conferenceCreated')
-
1
expect(conference_created_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_created_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_created_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_created_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_created_callback_values.to_s).to eq('{:eventType=>"conferenceCreated", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_created_callback_default.eql?(Bandwidth::ConferenceCreatedCallback.new)).to be true
-
1
expect(conference_created_callback_default.eql?(conference_created_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_created_callback_values.to_body).to eq({
-
eventType: 'conferenceCreated',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceMemberExitCallback
-
1
describe Bandwidth::ConferenceMemberExitCallback do
-
2
let(:conference_member_exit_callback_default) { Bandwidth::ConferenceMemberExitCallback.new }
-
4
let(:conference_member_exit_callback_values) { Bandwidth::ConferenceMemberExitCallback.new({
-
event_type: 'conferenceMemberExit',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMemberExitCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMemberExitCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceMemberExitCallback.acceptable_attributes).to eq(Bandwidth::ConferenceMemberExitCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceMemberExitCallback.openapi_nullable).to eq(Set.new([
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceMemberExitCallback created by the build_from_hash method' do
-
1
conference_member_exit_callback_from_hash = Bandwidth::ConferenceMemberExitCallback.build_from_hash({
-
eventType: 'conferenceMemberExit',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
})
-
1
expect(conference_member_exit_callback_from_hash).to be_instance_of(Bandwidth::ConferenceMemberExitCallback)
-
1
expect(conference_member_exit_callback_from_hash.event_type).to eq('conferenceMemberExit')
-
1
expect(conference_member_exit_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_member_exit_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_member_exit_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_member_exit_callback_from_hash.from).to eq('+19195554321')
-
1
expect(conference_member_exit_callback_from_hash.to).to eq('+19195551234')
-
1
expect(conference_member_exit_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_member_exit_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_member_exit_callback_values.to_s).to eq('{:eventType=>"conferenceMemberExit", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_member_exit_callback_default.eql?(Bandwidth::ConferenceMemberExitCallback.new)).to be true
-
1
expect(conference_member_exit_callback_default.eql?(conference_member_exit_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_member_exit_callback_values.to_body).to eq({
-
eventType: 'conferenceMemberExit',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceMemberJoinCallback
-
1
describe Bandwidth::ConferenceMemberJoinCallback do
-
2
let(:conference_member_join_callback_default) { Bandwidth::ConferenceMemberJoinCallback.new }
-
4
let(:conference_member_join_callback_values) { Bandwidth::ConferenceMemberJoinCallback.new({
-
event_type: 'conferenceMemberJoin',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMemberJoinCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMemberJoinCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceMemberJoinCallback.acceptable_attributes).to eq(Bandwidth::ConferenceMemberJoinCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceMemberJoinCallback.openapi_nullable).to eq(Set.new([
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceMemberJoinCallback created by the build_from_hash method' do
-
1
conference_member_join_callback_from_hash = Bandwidth::ConferenceMemberJoinCallback.build_from_hash({
-
eventType: 'conferenceMemberJoin',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
})
-
1
expect(conference_member_join_callback_from_hash).to be_instance_of(Bandwidth::ConferenceMemberJoinCallback)
-
1
expect(conference_member_join_callback_from_hash.event_type).to eq('conferenceMemberJoin')
-
1
expect(conference_member_join_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_member_join_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_member_join_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_member_join_callback_from_hash.from).to eq('+19195554321')
-
1
expect(conference_member_join_callback_from_hash.to).to eq('+19195551234')
-
1
expect(conference_member_join_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_member_join_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_member_join_callback_values.to_s).to eq('{:eventType=>"conferenceMemberJoin", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_member_join_callback_default.eql?(Bandwidth::ConferenceMemberJoinCallback.new)).to be true
-
1
expect(conference_member_join_callback_default.eql?(conference_member_join_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_member_join_callback_values.to_body).to eq({
-
eventType: 'conferenceMemberJoin',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceMember
-
1
describe Bandwidth::ConferenceMember do
-
2
let(:conference_member_default) { Bandwidth::ConferenceMember.new }
-
4
let(:conference_member_values) { Bandwidth::ConferenceMember.new({
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
conference_id: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
member_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-1/members/c-1',
-
mute: false,
-
hold: false,
-
call_ids_to_coach: ['c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d86']
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMember.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceMember.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceMember.acceptable_attributes).to eq(Bandwidth::ConferenceMember.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceMember.openapi_nullable).to eq(Set.new([:'call_ids_to_coach']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceMember created by the build_from_hash method' do
-
1
conference_member_from_hash = Bandwidth::ConferenceMember.build_from_hash({
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
conferenceId: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
memberUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-1/members/c-1',
-
mute: false,
-
hold: false,
-
callIdsToCoach: ['c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d86']
-
})
-
1
expect(conference_member_from_hash).to be_instance_of(Bandwidth::ConferenceMember)
-
1
expect(conference_member_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_member_from_hash.conference_id).to eq('conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c')
-
1
expect(conference_member_from_hash.member_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-1/members/c-1')
-
1
expect(conference_member_from_hash.mute).to eq(false)
-
1
expect(conference_member_from_hash.hold).to eq(false)
-
1
expect(conference_member_from_hash.call_ids_to_coach).to eq(['c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d86'])
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_member_values.to_s).to eq('{:callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :conferenceId=>"conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c", :memberUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-1/members/c-1", :mute=>false, :hold=>false, :callIdsToCoach=>["c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d86"]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_member_default.eql?(Bandwidth::ConferenceMember.new)).to be true
-
1
expect(conference_member_default.eql?(conference_member_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_member_values.to_body).to eq({
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
conferenceId: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
memberUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-1/members/c-1',
-
mute: false,
-
hold: false,
-
callIdsToCoach: ['c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d86']
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceRecordingAvailableCallback
-
1
describe Bandwidth::ConferenceRecordingAvailableCallback do
-
2
let(:conference_recording_available_callback_default) { Bandwidth::ConferenceRecordingAvailableCallback.new }
-
4
let(:conference_recording_available_callback_values) { Bandwidth::ConferenceRecordingAvailableCallback.new({
-
event_type: 'conferenceRecordingAvailable',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
account_id: '9900000',
-
recording_id: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
channels: 1,
-
start_time: '2022-06-16T13:15:07.160Z',
-
end_time: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
media_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
tag: 'custom tag',
-
status: 'complete'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRecordingAvailableCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRecordingAvailableCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceRecordingAvailableCallback.acceptable_attributes).to eq(Bandwidth::ConferenceRecordingAvailableCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceRecordingAvailableCallback.openapi_nullable).to eq(Set.new([
-
:'media_url',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceRecordingAvailableCallback created by the build_from_hash method' do
-
1
conference_recording_available_callback_from_hash = Bandwidth::ConferenceRecordingAvailableCallback.build_from_hash({
-
eventType: 'conferenceRecordingAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
accountId: '9900000',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
tag: 'custom tag',
-
status: 'complete'
-
})
-
1
expect(conference_recording_available_callback_from_hash).to be_instance_of(Bandwidth::ConferenceRecordingAvailableCallback)
-
1
expect(conference_recording_available_callback_from_hash.event_type).to eq('conferenceRecordingAvailable')
-
1
expect(conference_recording_available_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_recording_available_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_recording_available_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_recording_available_callback_from_hash.account_id).to eq('9900000')
-
1
expect(conference_recording_available_callback_from_hash.recording_id).to eq('r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_recording_available_callback_from_hash.channels).to eq(1)
-
1
expect(conference_recording_available_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_recording_available_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:17:07.160Z'))
-
1
expect(conference_recording_available_callback_from_hash.duration).to eq('PT2M')
-
1
expect(conference_recording_available_callback_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(conference_recording_available_callback_from_hash.media_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media')
-
1
expect(conference_recording_available_callback_from_hash.tag).to eq('custom tag')
-
1
expect(conference_recording_available_callback_from_hash.status).to eq('complete')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_recording_available_callback_values.to_s).to eq('{:eventType=>"conferenceRecordingAvailable", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :accountId=>"9900000", :recordingId=>"r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :channels=>1, :startTime=>"2022-06-16T13:15:07.160Z", :endTime=>"2022-06-16T13:17:07.160Z", :duration=>"PT2M", :fileFormat=>"wav", :mediaUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media", :tag=>"custom tag", :status=>"complete"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_recording_available_callback_default.eql?(Bandwidth::ConferenceRecordingAvailableCallback.new)).to be true
-
1
expect(conference_recording_available_callback_default.eql?(conference_recording_available_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_recording_available_callback_values.to_body).to eq({
-
eventType: 'conferenceRecordingAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
accountId: '9900000',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
tag: 'custom tag',
-
status: 'complete'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceRecordingMetadata
-
1
describe Bandwidth::ConferenceRecordingMetadata do
-
2
let(:conference_recording_metadata_default) { Bandwidth::ConferenceRecordingMetadata.new }
-
4
let(:conference_recording_metadata_values) { Bandwidth::ConferenceRecordingMetadata.new({
-
account_id: '9900000',
-
conference_id: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
recording_id: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
duration: 'PT13.67S',
-
channels: 1,
-
start_time: '2022-06-16T13:15:07.160Z',
-
end_time: '2022-06-16T13:15:20.830Z',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
status: 'complete',
-
media_url: 'https://example.com/recording.wav',
-
recording_name: 'sample-recording'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRecordingMetadata.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRecordingMetadata.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceRecordingMetadata.acceptable_attributes).to eq(Bandwidth::ConferenceRecordingMetadata.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceRecordingMetadata.openapi_nullable).to eq(Set.new([:'media_url']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceRecordingMetadata created by the build_from_hash method' do
-
1
conference_recording_metadata_from_hash = Bandwidth::ConferenceRecordingMetadata.build_from_hash({
-
accountId: '9900000',
-
conferenceId: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
recordingId: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
duration: 'PT13.67S',
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:15:20.830Z',
-
fileFormat: 'wav',
-
status: 'complete',
-
mediaUrl: 'https://example.com/recording.wav',
-
recordingName: 'sample-recording'
-
})
-
1
expect(conference_recording_metadata_from_hash).to be_instance_of(Bandwidth::ConferenceRecordingMetadata)
-
1
expect(conference_recording_metadata_from_hash.account_id).to eq('9900000')
-
1
expect(conference_recording_metadata_from_hash.conference_id).to eq('conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c')
-
1
expect(conference_recording_metadata_from_hash.name).to eq('weekly-stand-up')
-
1
expect(conference_recording_metadata_from_hash.recording_id).to eq('r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4')
-
1
expect(conference_recording_metadata_from_hash.duration).to eq('PT13.67S')
-
1
expect(conference_recording_metadata_from_hash.channels).to eq(1)
-
1
expect(conference_recording_metadata_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_recording_metadata_from_hash.end_time).to eq(Time.parse('2022-06-16T13:15:20.830Z'))
-
1
expect(conference_recording_metadata_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(conference_recording_metadata_from_hash.status).to eq('complete')
-
1
expect(conference_recording_metadata_from_hash.media_url).to eq('https://example.com/recording.wav')
-
1
expect(conference_recording_metadata_from_hash.recording_name).to eq('sample-recording')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_recording_metadata_values.to_s).to eq('{:accountId=>"9900000", :conferenceId=>"conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c", :name=>"weekly-stand-up", :recordingId=>"r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4", :duration=>"PT13.67S", :channels=>1, :startTime=>"2022-06-16T13:15:07.160Z", :endTime=>"2022-06-16T13:15:20.830Z", :fileFormat=>"wav", :status=>"complete", :mediaUrl=>"https://example.com/recording.wav", :recordingName=>"sample-recording"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_recording_metadata_default.eql?(Bandwidth::ConferenceRecordingMetadata.new)).to be true
-
1
expect(conference_recording_metadata_default.eql?(conference_recording_metadata_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_recording_metadata_values.to_body).to eq({
-
accountId: '9900000',
-
conferenceId: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
recordingId: 'r-fbe05094-9fd2b71d-a4e6-4f43-8c3e-5b04b1d8a4b4',
-
duration: 'PT13.67S',
-
channels: 1,
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:15:20.830Z',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
status: 'complete',
-
mediaUrl: 'https://example.com/recording.wav',
-
recordingName: 'sample-recording'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceRedirectCallback
-
1
describe Bandwidth::ConferenceRedirectCallback do
-
2
let(:conference_redirect_callback_default) { Bandwidth::ConferenceRedirectCallback.new }
-
4
let(:conference_redirect_callback_values) { Bandwidth::ConferenceRedirectCallback.new({
-
event_type: 'conferenceRedirect',
-
event_time: '2022-06-16T13:15:07.160Z',
-
conference_id: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRedirectCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ConferenceRedirectCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ConferenceRedirectCallback.acceptable_attributes).to eq(Bandwidth::ConferenceRedirectCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ConferenceRedirectCallback.openapi_nullable).to eq(Set.new([
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ConferenceRedirectCallback created by the build_from_hash method' do
-
1
conference_redirect_callback_from_hash = Bandwidth::ConferenceRedirectCallback.build_from_hash({
-
eventType: 'conferenceRedirect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
1
expect(conference_redirect_callback_from_hash).to be_instance_of(Bandwidth::ConferenceRedirectCallback)
-
1
expect(conference_redirect_callback_from_hash.event_type).to eq('conferenceRedirect')
-
1
expect(conference_redirect_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_redirect_callback_from_hash.conference_id).to eq('conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(conference_redirect_callback_from_hash.name).to eq('my-conference-name')
-
1
expect(conference_redirect_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_redirect_callback_values.to_s).to eq('{:eventType=>"conferenceRedirect", :eventTime=>"2022-06-16T13:15:07.160Z", :conferenceId=>"conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :name=>"my-conference-name", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_redirect_callback_default.eql?(Bandwidth::ConferenceRedirectCallback.new)).to be true
-
1
expect(conference_redirect_callback_default.eql?(conference_redirect_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_redirect_callback_values.to_body).to eq({
-
eventType: 'conferenceRedirect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
conferenceId: 'conf-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
name: 'my-conference-name',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Conference
-
1
describe Bandwidth::Conference do
-
2
let(:conference_default) { Bandwidth::Conference.new }
-
4
let(:conference_values) { Bandwidth::Conference.new({
-
id: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
created_time: '2022-06-16T13:15:07.160Z',
-
completed_time: '2022-06-16T13:45:07.160Z',
-
conference_event_url: 'https://example.com/conference-event',
-
conference_event_method: Bandwidth::CallbackMethodEnum::POST,
-
tag: 'custom tag',
-
active_members: [Bandwidth::ConferenceMember.new({ call_id: 'c-1', conference_id: 'conf-1' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Conference.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Conference.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Conference.acceptable_attributes).to eq(Bandwidth::Conference.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::Conference.openapi_nullable).to eq(Set.new([
-
:'completed_time',
-
:'conference_event_url',
-
:'conference_event_method',
-
:'tag',
-
:'active_members'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Conference created by the build_from_hash method' do
-
1
conference_from_hash = Bandwidth::Conference.build_from_hash({
-
id: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
createdTime: '2022-06-16T13:15:07.160Z',
-
completedTime: '2022-06-16T13:45:07.160Z',
-
conferenceEventUrl: 'https://example.com/conference-event',
-
conferenceEventMethod: 'POST',
-
tag: 'custom tag',
-
activeMembers: [{ callId: 'c-1', conferenceId: 'conf-1' }]
-
})
-
1
expect(conference_from_hash).to be_instance_of(Bandwidth::Conference)
-
1
expect(conference_from_hash.id).to eq('conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c')
-
1
expect(conference_from_hash.name).to eq('weekly-stand-up')
-
1
expect(conference_from_hash.created_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(conference_from_hash.completed_time).to eq(Time.parse('2022-06-16T13:45:07.160Z'))
-
1
expect(conference_from_hash.conference_event_url).to eq('https://example.com/conference-event')
-
1
expect(conference_from_hash.conference_event_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(conference_from_hash.tag).to eq('custom tag')
-
1
expect(conference_from_hash.active_members.first).to be_instance_of(Bandwidth::ConferenceMember)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(conference_values.to_s).to eq('{:id=>"conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c", :name=>"weekly-stand-up", :createdTime=>"2022-06-16T13:15:07.160Z", :completedTime=>"2022-06-16T13:45:07.160Z", :conferenceEventUrl=>"https://example.com/conference-event", :conferenceEventMethod=>"POST", :tag=>"custom tag", :activeMembers=>[{:callId=>"c-1", :conferenceId=>"conf-1"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(conference_default.eql?(Bandwidth::Conference.new)).to be true
-
1
expect(conference_default.eql?(conference_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(conference_values.to_body).to eq({
-
id: 'conf-fe23a767-a75a5b77-23e8-4b5b-a973-1eb967d7d75c',
-
name: 'weekly-stand-up',
-
createdTime: '2022-06-16T13:15:07.160Z',
-
completedTime: '2022-06-16T13:45:07.160Z',
-
conferenceEventUrl: 'https://example.com/conference-event',
-
conferenceEventMethod: Bandwidth::CallbackMethodEnum::POST,
-
tag: 'custom tag',
-
activeMembers: [{ callId: 'c-1', conferenceId: 'conf-1' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ConferenceStateEnum
-
1
describe Bandwidth::ConferenceStateEnum do
-
1
describe 'constants' do
-
1
it 'defines ACTIVE' do
-
1
expect(Bandwidth::ConferenceStateEnum::ACTIVE).to eq('active')
-
end
-
-
1
it 'defines COMPLETED' do
-
1
expect(Bandwidth::ConferenceStateEnum::COMPLETED).to eq('completed')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::ConferenceStateEnum.all_vars).to eq([
-
'active',
-
'completed'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::ConferenceStateEnum.build_from_hash('active')).to eq('active')
-
1
expect(Bandwidth::ConferenceStateEnum.build_from_hash('completed')).to eq('completed')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::ConferenceStateEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Contact
-
1
describe Bandwidth::Contact do
-
2
let(:contact_default) { Bandwidth::Contact.new({
-
first_name: 'Baseline',
-
last_name: 'User',
-
email: 'baseline@example.com',
-
phone_number: '+19195550100'
-
}) }
-
4
let(:contact_values) { Bandwidth::Contact.new({
-
first_name: 'John',
-
last_name: 'Doe',
-
email: 'john.doe@example.com',
-
phone_number: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Contact.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Contact.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Contact.acceptable_attributes).to eq(Bandwidth::Contact.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Contact.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Contact created by the build_from_hash method' do
-
1
contact_from_hash = Bandwidth::Contact.build_from_hash({
-
firstName: 'John',
-
lastName: 'Doe',
-
email: 'john.doe@example.com',
-
phoneNumber: '+19195551234'
-
})
-
1
expect(contact_from_hash).to be_instance_of(Bandwidth::Contact)
-
1
expect(contact_from_hash.first_name).to eq('John')
-
1
expect(contact_from_hash.last_name).to eq('Doe')
-
1
expect(contact_from_hash.email).to eq('john.doe@example.com')
-
1
expect(contact_from_hash.phone_number).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(contact_values.to_s).to eq('{:firstName=>"John", :lastName=>"Doe", :email=>"john.doe@example.com", :phoneNumber=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
contact_equal = Bandwidth::Contact.new({
-
first_name: 'Baseline',
-
last_name: 'User',
-
email: 'baseline@example.com',
-
phone_number: '+19195550100'
-
})
-
1
expect(contact_default.eql?(contact_equal)).to be true
-
1
expect(contact_default.eql?(contact_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(contact_values.to_body).to eq({
-
firstName: 'John',
-
lastName: 'Doe',
-
email: 'john.doe@example.com',
-
phoneNumber: '+19195551234'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#first_name=' do
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: nil, last_name: 'Doe', email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'first_name cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'a' * 501, last_name: 'Doe', email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: '', last_name: 'Doe', email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "first_name", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#last_name=' do
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: nil, email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'last_name cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'a' * 501, email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: '', email: 'a@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "last_name", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#email=' do
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: nil, phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'email cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: ('a' * 495) + '@b.com', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: 'not-an-email', phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, /invalid value for "email", must conform to the pattern/)
-
end
-
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: 'a@b.com', phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: 'a@b.com', phone_number: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::Contact.new({ first_name: 'John', last_name: 'Doe', email: 'a@b.com', phone_number: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 1.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateAsyncBulkLookupResponseData
-
1
describe Bandwidth::CreateAsyncBulkLookupResponseData do
-
2
let(:create_async_bulk_lookup_response_data_default) { Bandwidth::CreateAsyncBulkLookupResponseData.new }
-
4
let(:create_async_bulk_lookup_response_data_values) { Bandwidth::CreateAsyncBulkLookupResponseData.new({
-
request_id: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: 'IN_PROGRESS'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateAsyncBulkLookupResponseData.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateAsyncBulkLookupResponseData.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateAsyncBulkLookupResponseData.acceptable_attributes).to eq(Bandwidth::CreateAsyncBulkLookupResponseData.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateAsyncBulkLookupResponseData.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateAsyncBulkLookupResponseData created by the build_from_hash method' do
-
1
create_async_bulk_lookup_response_data_from_hash = Bandwidth::CreateAsyncBulkLookupResponseData.build_from_hash({
-
requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: 'IN_PROGRESS'
-
})
-
1
expect(create_async_bulk_lookup_response_data_from_hash).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData)
-
1
expect(create_async_bulk_lookup_response_data_from_hash.request_id).to eq('00b97c1b-d8b4-4a32-ad14-7d09ce04acb6')
-
1
expect(create_async_bulk_lookup_response_data_from_hash.status).to eq('IN_PROGRESS')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_async_bulk_lookup_response_data_values.to_s).to eq('{:requestId=>"00b97c1b-d8b4-4a32-ad14-7d09ce04acb6", :status=>"IN_PROGRESS"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(create_async_bulk_lookup_response_data_default.eql?(Bandwidth::CreateAsyncBulkLookupResponseData.new)).to be true
-
1
expect(create_async_bulk_lookup_response_data_default.eql?(create_async_bulk_lookup_response_data_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_async_bulk_lookup_response_data_values.to_body).to eq({
-
requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: 'IN_PROGRESS'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateAsyncBulkLookupResponse
-
1
describe Bandwidth::CreateAsyncBulkLookupResponse do
-
2
let(:create_async_bulk_lookup_response_default) { Bandwidth::CreateAsyncBulkLookupResponse.new }
-
4
let(:create_async_bulk_lookup_response_values) { Bandwidth::CreateAsyncBulkLookupResponse.new({
-
links: [Bandwidth::LinkSchema.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: Bandwidth::CreateAsyncBulkLookupResponseData.new({ request_id: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'IN_PROGRESS' }),
-
errors: [Bandwidth::LookupErrorSchema.new({ code: 'E1', description: 'bad', type: 'validation' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateAsyncBulkLookupResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateAsyncBulkLookupResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateAsyncBulkLookupResponse.acceptable_attributes).to eq(Bandwidth::CreateAsyncBulkLookupResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateAsyncBulkLookupResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateAsyncBulkLookupResponse created by the build_from_hash method' do
-
1
create_async_bulk_lookup_response_from_hash = Bandwidth::CreateAsyncBulkLookupResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'IN_PROGRESS' },
-
errors: [{ code: 'E1', description: 'bad', type: 'validation' }]
-
})
-
1
expect(create_async_bulk_lookup_response_from_hash).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponse)
-
1
expect(create_async_bulk_lookup_response_from_hash.links.first).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(create_async_bulk_lookup_response_from_hash.data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData)
-
1
expect(create_async_bulk_lookup_response_from_hash.errors.first).to be_instance_of(Bandwidth::LookupErrorSchema)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_async_bulk_lookup_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:requestId=>"00b97c1b-d8b4-4a32-ad14-7d09ce04acb6", :status=>"IN_PROGRESS"}, :errors=>[{:code=>"E1", :description=>"bad", :type=>"validation"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(create_async_bulk_lookup_response_default.eql?(Bandwidth::CreateAsyncBulkLookupResponse.new)).to be true
-
1
expect(create_async_bulk_lookup_response_default.eql?(create_async_bulk_lookup_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_async_bulk_lookup_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'IN_PROGRESS' },
-
errors: [{ code: 'E1', description: 'bad', type: 'validation' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateCallResponse
-
1
describe Bandwidth::CreateCallResponse do
-
2
let(:create_call_response_default) { Bandwidth::CreateCallResponse.new({
-
application_id: 'baseline-app',
-
account_id: '9900000',
-
call_id: 'baseline-call',
-
to: '+19195550100',
-
from: '+19195550101',
-
call_url: 'https://example.com/calls/baseline',
-
answer_url: 'https://example.com/answer/baseline'
-
}) }
-
4
let(:create_call_response_values) { Bandwidth::CreateCallResponse.new({
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
account_id: '9900000',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1',
-
call_timeout: 30.0,
-
callback_timeout: 15.0,
-
tag: 'custom tag',
-
answer_method: Bandwidth::CallbackMethodEnum::POST,
-
answer_url: 'https://example.com/answer',
-
answer_fallback_method: Bandwidth::CallbackMethodEnum::POST,
-
answer_fallback_url: 'https://example.com/answer-fallback',
-
disconnect_method: Bandwidth::CallbackMethodEnum::POST,
-
disconnect_url: 'https://example.com/disconnect',
-
username: 'user',
-
password: 'pass',
-
fallback_username: 'fallback_user',
-
fallback_password: 'fallback_pass',
-
priority: 5
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateCallResponse.acceptable_attributes).to eq(Bandwidth::CreateCallResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::CreateCallResponse.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'tag',
-
:'answer_method',
-
:'answer_fallback_method',
-
:'answer_fallback_url',
-
:'disconnect_method',
-
:'disconnect_url',
-
:'username',
-
:'password',
-
:'fallback_username',
-
:'fallback_password',
-
:'priority'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateCallResponse created by the build_from_hash method' do
-
1
create_call_response_from_hash = Bandwidth::CreateCallResponse.build_from_hash({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1',
-
callTimeout: 30.0,
-
callbackTimeout: 15.0,
-
tag: 'custom tag',
-
answerMethod: 'POST',
-
answerUrl: 'https://example.com/answer',
-
answerFallbackMethod: 'POST',
-
answerFallbackUrl: 'https://example.com/answer-fallback',
-
disconnectMethod: 'POST',
-
disconnectUrl: 'https://example.com/disconnect',
-
username: 'user',
-
password: 'pass',
-
fallbackUsername: 'fallback_user',
-
fallbackPassword: 'fallback_pass',
-
priority: 5
-
})
-
1
expect(create_call_response_from_hash).to be_instance_of(Bandwidth::CreateCallResponse)
-
1
expect(create_call_response_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(create_call_response_from_hash.account_id).to eq('9900000')
-
1
expect(create_call_response_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(create_call_response_from_hash.to).to eq('+19195551234')
-
1
expect(create_call_response_from_hash.from).to eq('+19195554321')
-
1
expect(create_call_response_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(create_call_response_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1')
-
1
expect(create_call_response_from_hash.call_timeout).to eq(30.0)
-
1
expect(create_call_response_from_hash.callback_timeout).to eq(15.0)
-
1
expect(create_call_response_from_hash.tag).to eq('custom tag')
-
1
expect(create_call_response_from_hash.answer_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_response_from_hash.answer_url).to eq('https://example.com/answer')
-
1
expect(create_call_response_from_hash.answer_fallback_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_response_from_hash.answer_fallback_url).to eq('https://example.com/answer-fallback')
-
1
expect(create_call_response_from_hash.disconnect_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_response_from_hash.disconnect_url).to eq('https://example.com/disconnect')
-
1
expect(create_call_response_from_hash.username).to eq('user')
-
1
expect(create_call_response_from_hash.password).to eq('pass')
-
1
expect(create_call_response_from_hash.fallback_username).to eq('fallback_user')
-
1
expect(create_call_response_from_hash.fallback_password).to eq('fallback_pass')
-
1
expect(create_call_response_from_hash.priority).to eq(5)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_call_response_values.to_s).to eq('{:applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :accountId=>"9900000", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :to=>"+19195551234", :from=>"+19195554321", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1", :callTimeout=>30.0, :callbackTimeout=>15.0, :tag=>"custom tag", :answerMethod=>"POST", :answerUrl=>"https://example.com/answer", :answerFallbackMethod=>"POST", :answerFallbackUrl=>"https://example.com/answer-fallback", :disconnectMethod=>"POST", :disconnectUrl=>"https://example.com/disconnect", :username=>"user", :password=>"pass", :fallbackUsername=>"fallback_user", :fallbackPassword=>"fallback_pass", :priority=>5}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_call_response_equal = Bandwidth::CreateCallResponse.new({
-
application_id: 'baseline-app',
-
account_id: '9900000',
-
call_id: 'baseline-call',
-
to: '+19195550100',
-
from: '+19195550101',
-
call_url: 'https://example.com/calls/baseline',
-
answer_url: 'https://example.com/answer/baseline'
-
})
-
1
expect(create_call_response_default.eql?(create_call_response_equal)).to be true
-
1
expect(create_call_response_default.eql?(create_call_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_call_response_values.to_body).to eq({
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
accountId: '9900000',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
to: '+19195551234',
-
from: '+19195554321',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-1',
-
callTimeout: 30.0,
-
callbackTimeout: 15.0,
-
tag: 'custom tag',
-
answerMethod: Bandwidth::CallbackMethodEnum::POST,
-
answerUrl: 'https://example.com/answer',
-
answerFallbackMethod: Bandwidth::CallbackMethodEnum::POST,
-
answerFallbackUrl: 'https://example.com/answer-fallback',
-
disconnectMethod: Bandwidth::CallbackMethodEnum::POST,
-
disconnectUrl: 'https://example.com/disconnect',
-
username: 'user',
-
password: 'pass',
-
fallbackUsername: 'fallback_user',
-
fallbackPassword: 'fallback_pass',
-
priority: 5
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: nil, account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#account_id=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: nil, call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'account_id cannot be nil')
-
end
-
-
1
it '#call_id=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: nil, to: 'a', from: 'a', call_url: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'call_id cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: nil, from: 'a', call_url: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: nil, call_url: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#call_url=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: nil, answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'call_url cannot be nil')
-
end
-
-
1
it '#answer_url=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: nil })
-
}.to raise_error(ArgumentError, 'answer_url cannot be nil')
-
end
-
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a', username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a', password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_username=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a', fallback_username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_password=' do
-
1
expect {
-
1
Bandwidth::CreateCallResponse.new({ application_id: 'a', account_id: 'a', call_id: 'a', to: 'a', from: 'a', call_url: 'a', answer_url: 'a', fallback_password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateCall
-
1
describe Bandwidth::CreateCall do
-
2
let(:create_call_default) { Bandwidth::CreateCall.new({
-
to: '+19195550100',
-
from: '+19195550101',
-
application_id: 'baseline-app',
-
answer_url: 'https://example.com/answer/baseline'
-
}) }
-
4
let(:create_call_values) { Bandwidth::CreateCall.new({
-
to: '+19195551234',
-
from: '+19195554321',
-
privacy: false,
-
display_name: 'Caller Name',
-
uui: 'eyJ0eXAiOiJKV1Q;encoding=jwt',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
answer_url: 'https://example.com/answer',
-
answer_method: Bandwidth::CallbackMethodEnum::POST,
-
username: 'user',
-
password: 'pass',
-
answer_fallback_url: 'https://example.com/answer-fallback',
-
answer_fallback_method: Bandwidth::CallbackMethodEnum::POST,
-
fallback_username: 'fallback_user',
-
fallback_password: 'fallback_pass',
-
disconnect_url: 'https://example.com/disconnect',
-
disconnect_method: Bandwidth::CallbackMethodEnum::POST,
-
call_timeout: 30,
-
callback_timeout: 15,
-
machine_detection: {},
-
priority: 5,
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateCall.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateCall.acceptable_attributes).to eq(Bandwidth::CreateCall.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::CreateCall.openapi_nullable).to eq(Set.new([
-
:'privacy',
-
:'display_name',
-
:'uui',
-
:'answer_method',
-
:'username',
-
:'password',
-
:'answer_fallback_url',
-
:'answer_fallback_method',
-
:'fallback_username',
-
:'fallback_password',
-
:'disconnect_url',
-
:'disconnect_method',
-
:'call_timeout',
-
:'callback_timeout',
-
:'priority',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateCall created by the build_from_hash method' do
-
1
create_call_from_hash = Bandwidth::CreateCall.build_from_hash({
-
to: '+19195551234',
-
from: '+19195554321',
-
privacy: false,
-
displayName: 'Caller Name',
-
uui: 'eyJ0eXAiOiJKV1Q;encoding=jwt',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
answerUrl: 'https://example.com/answer',
-
answerMethod: 'POST',
-
username: 'user',
-
password: 'pass',
-
answerFallbackUrl: 'https://example.com/answer-fallback',
-
answerFallbackMethod: 'POST',
-
fallbackUsername: 'fallback_user',
-
fallbackPassword: 'fallback_pass',
-
disconnectUrl: 'https://example.com/disconnect',
-
disconnectMethod: 'POST',
-
callTimeout: 30,
-
callbackTimeout: 15,
-
priority: 5,
-
tag: 'custom tag'
-
})
-
1
expect(create_call_from_hash).to be_instance_of(Bandwidth::CreateCall)
-
1
expect(create_call_from_hash.to).to eq('+19195551234')
-
1
expect(create_call_from_hash.from).to eq('+19195554321')
-
1
expect(create_call_from_hash.privacy).to eq(false)
-
1
expect(create_call_from_hash.display_name).to eq('Caller Name')
-
1
expect(create_call_from_hash.uui).to eq('eyJ0eXAiOiJKV1Q;encoding=jwt')
-
1
expect(create_call_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(create_call_from_hash.answer_url).to eq('https://example.com/answer')
-
1
expect(create_call_from_hash.answer_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_from_hash.username).to eq('user')
-
1
expect(create_call_from_hash.password).to eq('pass')
-
1
expect(create_call_from_hash.answer_fallback_url).to eq('https://example.com/answer-fallback')
-
1
expect(create_call_from_hash.answer_fallback_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_from_hash.fallback_username).to eq('fallback_user')
-
1
expect(create_call_from_hash.fallback_password).to eq('fallback_pass')
-
1
expect(create_call_from_hash.disconnect_url).to eq('https://example.com/disconnect')
-
1
expect(create_call_from_hash.disconnect_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(create_call_from_hash.call_timeout).to eq(30)
-
1
expect(create_call_from_hash.callback_timeout).to eq(15)
-
1
expect(create_call_from_hash.priority).to eq(5)
-
1
expect(create_call_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_call_values.to_s).to eq('{:to=>"+19195551234", :from=>"+19195554321", :privacy=>false, :displayName=>"Caller Name", :uui=>"eyJ0eXAiOiJKV1Q;encoding=jwt", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :answerUrl=>"https://example.com/answer", :answerMethod=>"POST", :username=>"user", :password=>"pass", :answerFallbackUrl=>"https://example.com/answer-fallback", :answerFallbackMethod=>"POST", :fallbackUsername=>"fallback_user", :fallbackPassword=>"fallback_pass", :disconnectUrl=>"https://example.com/disconnect", :disconnectMethod=>"POST", :callTimeout=>30, :callbackTimeout=>15, :machineDetection=>{}, :priority=>5, :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_call_equal = Bandwidth::CreateCall.new({
-
to: '+19195550100',
-
from: '+19195550101',
-
application_id: 'baseline-app',
-
answer_url: 'https://example.com/answer/baseline'
-
})
-
1
expect(create_call_default.eql?(create_call_equal)).to be true
-
1
expect(create_call_default.eql?(create_call_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_call_values.to_body).to eq({
-
to: '+19195551234',
-
from: '+19195554321',
-
privacy: false,
-
displayName: 'Caller Name',
-
uui: 'eyJ0eXAiOiJKV1Q;encoding=jwt',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
answerUrl: 'https://example.com/answer',
-
answerMethod: Bandwidth::CallbackMethodEnum::POST,
-
username: 'user',
-
password: 'pass',
-
answerFallbackUrl: 'https://example.com/answer-fallback',
-
answerFallbackMethod: Bandwidth::CallbackMethodEnum::POST,
-
fallbackUsername: 'fallback_user',
-
fallbackPassword: 'fallback_pass',
-
disconnectUrl: 'https://example.com/disconnect',
-
disconnectMethod: Bandwidth::CallbackMethodEnum::POST,
-
callTimeout: 30,
-
callbackTimeout: 15,
-
machineDetection: {},
-
priority: 5,
-
tag: 'custom tag'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: nil, from: 'a', application_id: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: nil, application_id: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#display_name=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', display_name: 'a' * 257, application_id: 'a', answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 256.')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: nil, answer_url: 'a' })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#answer_url=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: nil })
-
}.to raise_error(ArgumentError, 'answer_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "answer_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#answer_fallback_url=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', answer_fallback_url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "answer_fallback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#fallback_username=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', fallback_username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_password=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', fallback_password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#disconnect_url=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', disconnect_url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "disconnect_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#call_timeout=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', call_timeout: 301 })
-
}.to raise_error(ArgumentError, 'invalid value for "call_timeout", must be smaller than or equal to 300.')
-
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', call_timeout: 0 })
-
}.to raise_error(ArgumentError, 'invalid value for "call_timeout", must be greater than or equal to 1.')
-
end
-
-
1
it '#callback_timeout=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', callback_timeout: 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "callback_timeout", must be smaller than or equal to 25.')
-
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', callback_timeout: 0 })
-
}.to raise_error(ArgumentError, 'invalid value for "callback_timeout", must be greater than or equal to 1.')
-
end
-
-
1
it '#priority=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', priority: 6 })
-
}.to raise_error(ArgumentError, 'invalid value for "priority", must be smaller than or equal to 5.')
-
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', priority: 0 })
-
}.to raise_error(ArgumentError, 'invalid value for "priority", must be greater than or equal to 1.')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::CreateCall.new({ to: 'a', from: 'a', application_id: 'a', answer_url: 'a', tag: 'a' * 4097 })
-
}.to raise_error(ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 4096.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateEndpointRequestBase
-
1
describe Bandwidth::CreateEndpointRequestBase do
-
2
let(:create_endpoint_request_base_default) { Bandwidth::CreateEndpointRequestBase.new({
-
type: 'WEBRTC',
-
direction: 'INBOUND'
-
}) }
-
4
let(:create_endpoint_request_base_values) { Bandwidth::CreateEndpointRequestBase.new({
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL,
-
event_callback_url: 'https://example.com/event-callback',
-
event_fallback_url: 'https://example.com/event-fallback',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointRequestBase.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointRequestBase.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateEndpointRequestBase.acceptable_attributes).to eq(Bandwidth::CreateEndpointRequestBase.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateEndpointRequestBase.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateEndpointRequestBase created by the build_from_hash method' do
-
1
create_endpoint_request_base_from_hash = Bandwidth::CreateEndpointRequestBase.build_from_hash({
-
type: 'WEBRTC',
-
direction: 'BIDIRECTIONAL',
-
eventCallbackUrl: 'https://example.com/event-callback',
-
eventFallbackUrl: 'https://example.com/event-fallback',
-
tag: 'custom tag'
-
})
-
1
expect(create_endpoint_request_base_from_hash).to be_instance_of(Bandwidth::CreateEndpointRequestBase)
-
1
expect(create_endpoint_request_base_from_hash.type).to eq(Bandwidth::EndpointTypeEnum::WEBRTC)
-
1
expect(create_endpoint_request_base_from_hash.direction).to eq(Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL)
-
1
expect(create_endpoint_request_base_from_hash.event_callback_url).to eq('https://example.com/event-callback')
-
1
expect(create_endpoint_request_base_from_hash.event_fallback_url).to eq('https://example.com/event-fallback')
-
1
expect(create_endpoint_request_base_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_endpoint_request_base_values.to_s).to eq('{:type=>"WEBRTC", :direction=>"BIDIRECTIONAL", :eventCallbackUrl=>"https://example.com/event-callback", :eventFallbackUrl=>"https://example.com/event-fallback", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_endpoint_request_base_equal = Bandwidth::CreateEndpointRequestBase.new({
-
type: 'WEBRTC',
-
direction: 'INBOUND'
-
})
-
1
expect(create_endpoint_request_base_default.eql?(create_endpoint_request_base_equal)).to be true
-
1
expect(create_endpoint_request_base_default.eql?(create_endpoint_request_base_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_endpoint_request_base_values.to_body).to eq({
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL,
-
eventCallbackUrl: 'https://example.com/event-callback',
-
eventFallbackUrl: 'https://example.com/event-fallback',
-
tag: 'custom tag'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointRequestBase.new({ type: nil, direction: 'INBOUND' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#direction=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointRequestBase.new({ type: 'WEBRTC', direction: nil })
-
}.to raise_error(ArgumentError, 'direction cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointRequestBase.new({ type: 'WEBRTC', direction: 'INBOUND', tag: nil })
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateEndpointResponseData
-
1
describe Bandwidth::CreateEndpointResponseData do
-
2
let(:create_endpoint_response_data_default) { Bandwidth::CreateEndpointResponseData.new({
-
endpoint_id: 'baseline-endpoint',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
token: 'baseline-token'
-
}) }
-
4
let(:create_endpoint_response_data_values) { Bandwidth::CreateEndpointResponseData.new({
-
endpoint_id: 'ep-abc-123',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
devices: [Bandwidth::Device.new({ device_id: 'd-1', status: 'CONNECTED', creation_timestamp: '2022-06-16T13:15:08.000Z' })],
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateEndpointResponseData.acceptable_attributes).to eq(Bandwidth::CreateEndpointResponseData.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateEndpointResponseData.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateEndpointResponseData created by the build_from_hash method' do
-
1
create_endpoint_response_data_from_hash = Bandwidth::CreateEndpointResponseData.build_from_hash({
-
endpointId: 'ep-abc-123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
devices: [{ deviceId: 'd-1', status: 'CONNECTED', creationTimestamp: '2022-06-16T13:15:08.000Z' }],
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
})
-
1
expect(create_endpoint_response_data_from_hash).to be_instance_of(Bandwidth::CreateEndpointResponseData)
-
1
expect(create_endpoint_response_data_from_hash.endpoint_id).to eq('ep-abc-123')
-
1
expect(create_endpoint_response_data_from_hash.type).to eq(Bandwidth::EndpointTypeEnum::WEBRTC)
-
1
expect(create_endpoint_response_data_from_hash.status).to eq(Bandwidth::EndpointStatusEnum::CONNECTED)
-
1
expect(create_endpoint_response_data_from_hash.creation_timestamp).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(create_endpoint_response_data_from_hash.expiration_timestamp).to eq(Time.parse('2022-06-17T13:15:07.160Z'))
-
1
expect(create_endpoint_response_data_from_hash.tag).to eq('custom tag')
-
1
expect(create_endpoint_response_data_from_hash.devices.first).to be_instance_of(Bandwidth::Device)
-
1
expect(create_endpoint_response_data_from_hash.token).to eq('eyJhbGciOiJIUzI1NiJ9')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_endpoint_response_data_values.to_s).to eq('{:endpointId=>"ep-abc-123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:07.160Z", :expirationTimestamp=>"2022-06-17T13:15:07.160Z", :tag=>"custom tag", :devices=>[{:deviceId=>"d-1", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:08.000Z"}], :token=>"eyJhbGciOiJIUzI1NiJ9"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_endpoint_response_data_equal = Bandwidth::CreateEndpointResponseData.new({
-
endpoint_id: 'baseline-endpoint',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
token: 'baseline-token'
-
})
-
1
expect(create_endpoint_response_data_default.eql?(create_endpoint_response_data_equal)).to be true
-
1
expect(create_endpoint_response_data_default.eql?(create_endpoint_response_data_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_endpoint_response_data_values.to_body).to eq({
-
endpointId: 'ep-abc-123',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
devices: [{ deviceId: 'd-1', status: 'CONNECTED', creationTimestamp: '2022-06-16T13:15:08.000Z' }],
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#endpoint_id=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: nil, type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', token: 'a' })
-
}.to raise_error(ArgumentError, 'endpoint_id cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: nil, status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', token: 'a' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#status=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: 'WEBRTC', status: nil, creation_timestamp: 'a', expiration_timestamp: 'a', token: 'a' })
-
}.to raise_error(ArgumentError, 'status cannot be nil')
-
end
-
-
1
it '#creation_timestamp=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: nil, expiration_timestamp: 'a', token: 'a' })
-
}.to raise_error(ArgumentError, 'creation_timestamp cannot be nil')
-
end
-
-
1
it '#expiration_timestamp=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: nil, token: 'a' })
-
}.to raise_error(ArgumentError, 'expiration_timestamp cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', token: 'a', tag: nil })
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
-
1
it '#token=' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponseData.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', token: nil })
-
}.to raise_error(ArgumentError, 'token cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateEndpointResponse
-
1
describe Bandwidth::CreateEndpointResponse do
-
2
let(:create_endpoint_response_default) { Bandwidth::CreateEndpointResponse.new({
-
links: [],
-
data: {},
-
errors: []
-
}) }
-
7
let(:create_endpoint_response_values) { Bandwidth::CreateEndpointResponse.new({
-
links: [Bandwidth::BrtcLink.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: Bandwidth::CreateEndpointResponseData.new({
-
endpoint_id: 'ep-abc-123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
}),
-
errors: [Bandwidth::BrtcError.new({ type: 'validation', description: 'bad input' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateEndpointResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateEndpointResponse.acceptable_attributes).to eq(Bandwidth::CreateEndpointResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateEndpointResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateEndpointResponse created by the build_from_hash method' do
-
1
create_endpoint_response_from_hash = Bandwidth::CreateEndpointResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: {
-
endpointId: 'ep-abc-123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
},
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
1
expect(create_endpoint_response_from_hash).to be_instance_of(Bandwidth::CreateEndpointResponse)
-
1
expect(create_endpoint_response_from_hash.links.first).to be_instance_of(Bandwidth::BrtcLink)
-
1
expect(create_endpoint_response_from_hash.data).to be_instance_of(Bandwidth::CreateEndpointResponseData)
-
1
expect(create_endpoint_response_from_hash.errors.first).to be_instance_of(Bandwidth::BrtcError)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_endpoint_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:endpointId=>"ep-abc-123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:07.160Z", :expirationTimestamp=>"2022-06-17T13:15:07.160Z", :token=>"eyJhbGciOiJIUzI1NiJ9"}, :errors=>[{:type=>"validation", :description=>"bad input"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_endpoint_response_equal = Bandwidth::CreateEndpointResponse.new({
-
links: [],
-
data: {},
-
errors: []
-
})
-
1
expect(create_endpoint_response_default.eql?(create_endpoint_response_equal)).to be true
-
1
expect(create_endpoint_response_default.eql?(create_endpoint_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_endpoint_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: {
-
endpointId: 'ep-abc-123',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
token: 'eyJhbGciOiJIUzI1NiJ9'
-
},
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#links=' do
-
1
expect {
-
1
create_endpoint_response_values.links = nil
-
}.to raise_error(ArgumentError, 'links cannot be nil')
-
end
-
-
1
it '#data=' do
-
1
expect {
-
1
create_endpoint_response_values.data = nil
-
}.to raise_error(ArgumentError, 'data cannot be nil')
-
end
-
-
1
it '#errors=' do
-
1
expect {
-
1
create_endpoint_response_values.errors = nil
-
}.to raise_error(ArgumentError, 'errors cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateMessageRequestError
-
1
describe Bandwidth::CreateMessageRequestError do
-
2
let(:create_message_request_error_default) { Bandwidth::CreateMessageRequestError.new({
-
type: 'baseline-type',
-
description: 'baseline description'
-
}) }
-
4
let(:create_message_request_error_values) { Bandwidth::CreateMessageRequestError.new({
-
type: 'request-validation',
-
description: 'Your request could not be processed.',
-
field_errors: [Bandwidth::FieldError.new({ field_name: 'to', description: 'must be present' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateMessageRequestError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateMessageRequestError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateMessageRequestError.acceptable_attributes).to eq(Bandwidth::CreateMessageRequestError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateMessageRequestError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateMessageRequestError created by the build_from_hash method' do
-
1
create_message_request_error_from_hash = Bandwidth::CreateMessageRequestError.build_from_hash({
-
type: 'request-validation',
-
description: 'Your request could not be processed.',
-
fieldErrors: [{ fieldName: 'to', description: 'must be present' }]
-
})
-
1
expect(create_message_request_error_from_hash).to be_instance_of(Bandwidth::CreateMessageRequestError)
-
1
expect(create_message_request_error_from_hash.type).to eq('request-validation')
-
1
expect(create_message_request_error_from_hash.description).to eq('Your request could not be processed.')
-
1
expect(create_message_request_error_from_hash.field_errors.first).to be_instance_of(Bandwidth::FieldError)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_message_request_error_values.to_s).to eq('{:type=>"request-validation", :description=>"Your request could not be processed.", :fieldErrors=>[{:fieldName=>"to", :description=>"must be present"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_message_request_error_equal = Bandwidth::CreateMessageRequestError.new({
-
type: 'baseline-type',
-
description: 'baseline description'
-
})
-
1
expect(create_message_request_error_default.eql?(create_message_request_error_equal)).to be true
-
1
expect(create_message_request_error_default.eql?(create_message_request_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_message_request_error_values.to_body).to eq({
-
type: 'request-validation',
-
description: 'Your request could not be processed.',
-
fieldErrors: [{ fieldName: 'to', description: 'must be present' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::CreateMessageRequestError.new({ type: nil, description: 'a' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::CreateMessageRequestError.new({ type: 'a', description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateMultiChannelMessageResponse
-
1
describe Bandwidth::CreateMultiChannelMessageResponse do
-
2
let(:create_multi_channel_message_response_default) { Bandwidth::CreateMultiChannelMessageResponse.new }
-
4
let(:create_multi_channel_message_response_values) { Bandwidth::CreateMultiChannelMessageResponse.new({
-
links: [Bandwidth::Link.new({ rel: 'self', href: 'https://example.com' })],
-
errors: [Bandwidth::ErrorObject.new({ type: 'validation', description: 'bad input', source: Bandwidth::ErrorSource.new })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateMultiChannelMessageResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateMultiChannelMessageResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateMultiChannelMessageResponse.acceptable_attributes).to eq(Bandwidth::CreateMultiChannelMessageResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateMultiChannelMessageResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateMultiChannelMessageResponse created by the build_from_hash method' do
-
1
create_multi_channel_message_response_from_hash = Bandwidth::CreateMultiChannelMessageResponse.build_from_hash({
-
links: [{ rel: 'self', href: 'https://example.com' }],
-
errors: [{ type: 'validation', description: 'bad input', source: {} }]
-
})
-
1
expect(create_multi_channel_message_response_from_hash).to be_instance_of(Bandwidth::CreateMultiChannelMessageResponse)
-
1
expect(create_multi_channel_message_response_from_hash.links.first).to be_instance_of(Bandwidth::Link)
-
1
expect(create_multi_channel_message_response_from_hash.errors.first).to be_instance_of(Bandwidth::ErrorObject)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_multi_channel_message_response_values.to_s).to eq('{:links=>[{:rel=>"self", :href=>"https://example.com"}], :errors=>[{:type=>"validation", :description=>"bad input", :source=>{}}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(create_multi_channel_message_response_default.eql?(Bandwidth::CreateMultiChannelMessageResponse.new)).to be true
-
1
expect(create_multi_channel_message_response_default.eql?(create_multi_channel_message_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_multi_channel_message_response_values.to_body).to eq({
-
links: [{ rel: 'self', href: 'https://example.com' }],
-
errors: [{ type: 'validation', description: 'bad input', source: {} }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateSyncLookupResponseData
-
1
describe Bandwidth::CreateSyncLookupResponseData do
-
2
let(:create_sync_lookup_response_data_default) { Bandwidth::CreateSyncLookupResponseData.new }
-
4
let(:create_sync_lookup_response_data_values) { Bandwidth::CreateSyncLookupResponseData.new({
-
request_id: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: Bandwidth::CompletedLookupStatusEnum::COMPLETE,
-
results: [Bandwidth::LookupResult.new({ phone_number: '+19195551234' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateSyncLookupResponseData.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateSyncLookupResponseData.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateSyncLookupResponseData.acceptable_attributes).to eq(Bandwidth::CreateSyncLookupResponseData.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateSyncLookupResponseData.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateSyncLookupResponseData created by the build_from_hash method' do
-
1
create_sync_lookup_response_data_from_hash = Bandwidth::CreateSyncLookupResponseData.build_from_hash({
-
requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: 'COMPLETE',
-
results: [{ phoneNumber: '+19195551234' }]
-
})
-
1
expect(create_sync_lookup_response_data_from_hash).to be_instance_of(Bandwidth::CreateSyncLookupResponseData)
-
1
expect(create_sync_lookup_response_data_from_hash.request_id).to eq('00b97c1b-d8b4-4a32-ad14-7d09ce04acb6')
-
1
expect(create_sync_lookup_response_data_from_hash.status).to eq(Bandwidth::CompletedLookupStatusEnum::COMPLETE)
-
1
expect(create_sync_lookup_response_data_from_hash.results.first).to be_instance_of(Bandwidth::LookupResult)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_sync_lookup_response_data_values.to_s).to eq('{:requestId=>"00b97c1b-d8b4-4a32-ad14-7d09ce04acb6", :status=>"COMPLETE", :results=>[{:phoneNumber=>"+19195551234"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(create_sync_lookup_response_data_default.eql?(Bandwidth::CreateSyncLookupResponseData.new)).to be true
-
1
expect(create_sync_lookup_response_data_default.eql?(create_sync_lookup_response_data_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_sync_lookup_response_data_values.to_body).to eq({
-
requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6',
-
status: Bandwidth::CompletedLookupStatusEnum::COMPLETE,
-
results: [{ phoneNumber: '+19195551234' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateSyncLookupResponse
-
1
describe Bandwidth::CreateSyncLookupResponse do
-
2
let(:create_sync_lookup_response_default) { Bandwidth::CreateSyncLookupResponse.new }
-
4
let(:create_sync_lookup_response_values) { Bandwidth::CreateSyncLookupResponse.new({
-
links: [Bandwidth::LinkSchema.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: Bandwidth::CreateSyncLookupResponseData.new({ request_id: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'COMPLETE' }),
-
errors: [Bandwidth::LookupErrorSchema.new({ code: 'E1', description: 'bad', type: 'validation' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateSyncLookupResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateSyncLookupResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateSyncLookupResponse.acceptable_attributes).to eq(Bandwidth::CreateSyncLookupResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateSyncLookupResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateSyncLookupResponse created by the build_from_hash method' do
-
1
create_sync_lookup_response_from_hash = Bandwidth::CreateSyncLookupResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'COMPLETE' },
-
errors: [{ code: 'E1', description: 'bad', type: 'validation' }]
-
})
-
1
expect(create_sync_lookup_response_from_hash).to be_instance_of(Bandwidth::CreateSyncLookupResponse)
-
1
expect(create_sync_lookup_response_from_hash.links.first).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(create_sync_lookup_response_from_hash.data).to be_instance_of(Bandwidth::CreateSyncLookupResponseData)
-
1
expect(create_sync_lookup_response_from_hash.errors.first).to be_instance_of(Bandwidth::LookupErrorSchema)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_sync_lookup_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:requestId=>"00b97c1b-d8b4-4a32-ad14-7d09ce04acb6", :status=>"COMPLETE"}, :errors=>[{:code=>"E1", :description=>"bad", :type=>"validation"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(create_sync_lookup_response_default.eql?(Bandwidth::CreateSyncLookupResponse.new)).to be true
-
1
expect(create_sync_lookup_response_default.eql?(create_sync_lookup_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_sync_lookup_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: '00b97c1b-d8b4-4a32-ad14-7d09ce04acb6', status: 'COMPLETE' },
-
errors: [{ code: 'E1', description: 'bad', type: 'validation' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::CreateWebRtcConnectionRequest
-
1
describe Bandwidth::CreateWebRtcConnectionRequest do
-
2
let(:create_web_rtc_connection_request_default) { Bandwidth::CreateWebRtcConnectionRequest.new({
-
type: 'WEBRTC',
-
direction: 'INBOUND'
-
}) }
-
4
let(:create_web_rtc_connection_request_values) { Bandwidth::CreateWebRtcConnectionRequest.new({
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL,
-
event_callback_url: 'https://example.com/event-callback',
-
event_fallback_url: 'https://example.com/event-fallback',
-
tag: 'custom tag',
-
connection_metadata: { sessionId: 'session-1' }
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateWebRtcConnectionRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::CreateWebRtcConnectionRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::CreateWebRtcConnectionRequest.acceptable_attributes).to eq(Bandwidth::CreateWebRtcConnectionRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::CreateWebRtcConnectionRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of CreateWebRtcConnectionRequest created by the build_from_hash method' do
-
1
create_web_rtc_connection_request_from_hash = Bandwidth::CreateWebRtcConnectionRequest.build_from_hash({
-
type: 'WEBRTC',
-
direction: 'BIDIRECTIONAL',
-
eventCallbackUrl: 'https://example.com/event-callback',
-
eventFallbackUrl: 'https://example.com/event-fallback',
-
tag: 'custom tag',
-
connectionMetadata: { sessionId: 'session-1' }
-
})
-
1
expect(create_web_rtc_connection_request_from_hash).to be_instance_of(Bandwidth::CreateWebRtcConnectionRequest)
-
1
expect(create_web_rtc_connection_request_from_hash.type).to eq(Bandwidth::EndpointTypeEnum::WEBRTC)
-
1
expect(create_web_rtc_connection_request_from_hash.direction).to eq(Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL)
-
1
expect(create_web_rtc_connection_request_from_hash.event_callback_url).to eq('https://example.com/event-callback')
-
1
expect(create_web_rtc_connection_request_from_hash.event_fallback_url).to eq('https://example.com/event-fallback')
-
1
expect(create_web_rtc_connection_request_from_hash.tag).to eq('custom tag')
-
1
expect(create_web_rtc_connection_request_from_hash.connection_metadata).to eq({ sessionId: 'session-1' })
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(create_web_rtc_connection_request_values.to_s).to eq('{:type=>"WEBRTC", :direction=>"BIDIRECTIONAL", :eventCallbackUrl=>"https://example.com/event-callback", :eventFallbackUrl=>"https://example.com/event-fallback", :tag=>"custom tag", :connectionMetadata=>{:sessionId=>"session-1"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
create_web_rtc_connection_request_equal = Bandwidth::CreateWebRtcConnectionRequest.new({
-
type: 'WEBRTC',
-
direction: 'INBOUND'
-
})
-
1
expect(create_web_rtc_connection_request_default.eql?(create_web_rtc_connection_request_equal)).to be true
-
1
expect(create_web_rtc_connection_request_default.eql?(create_web_rtc_connection_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(create_web_rtc_connection_request_values.to_body).to eq({
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL,
-
eventCallbackUrl: 'https://example.com/event-callback',
-
eventFallbackUrl: 'https://example.com/event-fallback',
-
tag: 'custom tag',
-
connectionMetadata: { sessionId: 'session-1' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::CreateWebRtcConnectionRequest.new({ type: nil, direction: 'INBOUND' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#direction=' do
-
1
expect {
-
1
Bandwidth::CreateWebRtcConnectionRequest.new({ type: 'WEBRTC', direction: nil })
-
}.to raise_error(ArgumentError, 'direction cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::CreateWebRtcConnectionRequest.new({ type: 'WEBRTC', direction: 'INBOUND', tag: nil })
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::DeactivationEventEnum
-
1
describe Bandwidth::DeactivationEventEnum do
-
1
describe 'constants' do
-
1
it 'defines DEACTIVATED' do
-
1
expect(Bandwidth::DeactivationEventEnum::DEACTIVATED).to eq('DEACTIVATED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::DeactivationEventEnum.all_vars).to eq([
-
'DEACTIVATED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::DeactivationEventEnum.build_from_hash('DEACTIVATED')).to eq('DEACTIVATED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::DeactivationEventEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Device
-
1
describe Bandwidth::Device do
-
2
let(:device_default) { Bandwidth::Device.new({
-
device_id: 'baseline-device',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z'
-
}) }
-
4
let(:device_values) { Bandwidth::Device.new({
-
device_id: 'd-abc-123',
-
device_name: 'Chrome on macOS',
-
status: Bandwidth::DeviceStatusEnum::CONNECTED,
-
creation_timestamp: '2022-06-16T13:15:07.160Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Device.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Device.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Device.acceptable_attributes).to eq(Bandwidth::Device.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Device.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Device created by the build_from_hash method' do
-
1
device_from_hash = Bandwidth::Device.build_from_hash({
-
deviceId: 'd-abc-123',
-
deviceName: 'Chrome on macOS',
-
status: 'CONNECTED',
-
creationTimestamp: '2022-06-16T13:15:07.160Z'
-
})
-
1
expect(device_from_hash).to be_instance_of(Bandwidth::Device)
-
1
expect(device_from_hash.device_id).to eq('d-abc-123')
-
1
expect(device_from_hash.device_name).to eq('Chrome on macOS')
-
1
expect(device_from_hash.status).to eq(Bandwidth::DeviceStatusEnum::CONNECTED)
-
1
expect(device_from_hash.creation_timestamp).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(device_values.to_s).to eq('{:deviceId=>"d-abc-123", :deviceName=>"Chrome on macOS", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:07.160Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
device_equal = Bandwidth::Device.new({
-
device_id: 'baseline-device',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z'
-
})
-
1
expect(device_default.eql?(device_equal)).to be true
-
1
expect(device_default.eql?(device_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(device_values.to_body).to eq({
-
deviceId: 'd-abc-123',
-
deviceName: 'Chrome on macOS',
-
status: Bandwidth::DeviceStatusEnum::CONNECTED,
-
creationTimestamp: '2022-06-16T13:15:07.160Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#device_id=' do
-
1
expect {
-
1
Bandwidth::Device.new({ device_id: nil, status: 'CONNECTED', creation_timestamp: 'a' })
-
}.to raise_error(ArgumentError, 'device_id cannot be nil')
-
end
-
-
1
it '#device_name=' do
-
1
expect {
-
1
Bandwidth::Device.new({ device_id: 'a', device_name: nil, status: 'CONNECTED', creation_timestamp: 'a' })
-
}.to raise_error(ArgumentError, 'device_name cannot be nil')
-
end
-
-
1
it '#status=' do
-
1
expect {
-
1
Bandwidth::Device.new({ device_id: 'a', status: nil, creation_timestamp: 'a' })
-
}.to raise_error(ArgumentError, 'status cannot be nil')
-
end
-
-
1
it '#creation_timestamp=' do
-
1
expect {
-
1
Bandwidth::Device.new({ device_id: 'a', status: 'CONNECTED', creation_timestamp: nil })
-
}.to raise_error(ArgumentError, 'creation_timestamp cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::DeviceStatusEnum
-
1
describe Bandwidth::DeviceStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines CONNECTED' do
-
1
expect(Bandwidth::DeviceStatusEnum::CONNECTED).to eq('CONNECTED')
-
end
-
-
1
it 'defines DISCONNECTED' do
-
1
expect(Bandwidth::DeviceStatusEnum::DISCONNECTED).to eq('DISCONNECTED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::DeviceStatusEnum.all_vars).to eq([
-
'CONNECTED',
-
'DISCONNECTED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::DeviceStatusEnum.build_from_hash('CONNECTED')).to eq('CONNECTED')
-
1
expect(Bandwidth::DeviceStatusEnum.build_from_hash('DISCONNECTED')).to eq('DISCONNECTED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::DeviceStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::DisconnectCallback
-
1
describe Bandwidth::DisconnectCallback do
-
2
let(:disconnect_callback_default) { Bandwidth::DisconnectCallback.new }
-
4
let(:disconnect_callback_values) { Bandwidth::DisconnectCallback.new({
-
event_type: 'disconnect',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
end_time: '2022-06-16T13:16:18.126Z',
-
cause: 'hangup',
-
error_message: 'call rejected',
-
error_id: '4642074b-7b58-478b-96e4-3a60955c6765',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::DisconnectCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::DisconnectCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::DisconnectCallback.acceptable_attributes).to eq(Bandwidth::DisconnectCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::DisconnectCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'error_message',
-
:'error_id',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of DisconnectCallback created by the build_from_hash method' do
-
1
disconnect_callback_from_hash = Bandwidth::DisconnectCallback.build_from_hash({
-
eventType: 'disconnect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:16:18.126Z',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765',
-
tag: 'custom tag'
-
})
-
1
expect(disconnect_callback_from_hash).to be_instance_of(Bandwidth::DisconnectCallback)
-
1
expect(disconnect_callback_from_hash.event_type).to eq('disconnect')
-
1
expect(disconnect_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(disconnect_callback_from_hash.account_id).to eq('9900000')
-
1
expect(disconnect_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(disconnect_callback_from_hash.from).to eq('+19195554321')
-
1
expect(disconnect_callback_from_hash.to).to eq('+19195551234')
-
1
expect(disconnect_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(disconnect_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(disconnect_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(disconnect_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(disconnect_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(disconnect_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(disconnect_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:16:18.126Z'))
-
1
expect(disconnect_callback_from_hash.cause).to eq('hangup')
-
1
expect(disconnect_callback_from_hash.error_message).to eq('call rejected')
-
1
expect(disconnect_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765')
-
1
expect(disconnect_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(disconnect_callback_values.to_s).to eq('{:eventType=>"disconnect", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :direction=>"inbound", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:16:18.126Z", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(disconnect_callback_default.eql?(Bandwidth::DisconnectCallback.new)).to be true
-
1
expect(disconnect_callback_default.eql?(disconnect_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(disconnect_callback_values.to_body).to eq({
-
eventType: 'disconnect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:16:18.126Z',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Diversion
-
1
describe Bandwidth::Diversion do
-
2
let(:diversion_default) { Bandwidth::Diversion.new }
-
4
let(:diversion_values) { Bandwidth::Diversion.new({
-
reason: 'unconditional',
-
privacy: 'off',
-
screen: 'no',
-
counter: '2',
-
limit: '5',
-
unknown: 'some-value',
-
orig_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Diversion.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Diversion.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Diversion.acceptable_attributes).to eq(Bandwidth::Diversion.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Diversion.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Diversion created by the build_from_hash method' do
-
1
diversion_from_hash = Bandwidth::Diversion.build_from_hash({
-
reason: 'unconditional',
-
privacy: 'off',
-
screen: 'no',
-
counter: '2',
-
limit: '5',
-
unknown: 'some-value',
-
origTo: '+19195551234'
-
})
-
1
expect(diversion_from_hash).to be_instance_of(Bandwidth::Diversion)
-
1
expect(diversion_from_hash.reason).to eq('unconditional')
-
1
expect(diversion_from_hash.privacy).to eq('off')
-
1
expect(diversion_from_hash.screen).to eq('no')
-
1
expect(diversion_from_hash.counter).to eq('2')
-
1
expect(diversion_from_hash.limit).to eq('5')
-
1
expect(diversion_from_hash.unknown).to eq('some-value')
-
1
expect(diversion_from_hash.orig_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(diversion_values.to_s).to eq('{:reason=>"unconditional", :privacy=>"off", :screen=>"no", :counter=>"2", :limit=>"5", :unknown=>"some-value", :origTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(diversion_default.eql?(Bandwidth::Diversion.new)).to be true
-
1
expect(diversion_default.eql?(diversion_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(diversion_values.to_body).to eq({
-
reason: 'unconditional',
-
privacy: 'off',
-
screen: 'no',
-
counter: '2',
-
limit: '5',
-
unknown: 'some-value',
-
origTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::DtmfCallback
-
1
describe Bandwidth::DtmfCallback do
-
2
let(:dtmf_callback_default) { Bandwidth::DtmfCallback.new }
-
4
let(:dtmf_callback_values) { Bandwidth::DtmfCallback.new({
-
event_type: 'dtmf',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
digit: '1',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::DtmfCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::DtmfCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::DtmfCallback.acceptable_attributes).to eq(Bandwidth::DtmfCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::DtmfCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of DtmfCallback created by the build_from_hash method' do
-
1
dtmf_callback_from_hash = Bandwidth::DtmfCallback.build_from_hash({
-
eventType: 'dtmf',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
digit: '1',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
tag: 'custom tag'
-
})
-
1
expect(dtmf_callback_from_hash).to be_instance_of(Bandwidth::DtmfCallback)
-
1
expect(dtmf_callback_from_hash.event_type).to eq('dtmf')
-
1
expect(dtmf_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(dtmf_callback_from_hash.account_id).to eq('9900000')
-
1
expect(dtmf_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(dtmf_callback_from_hash.from).to eq('+19195554321')
-
1
expect(dtmf_callback_from_hash.to).to eq('+19195551234')
-
1
expect(dtmf_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(dtmf_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(dtmf_callback_from_hash.digit).to eq('1')
-
1
expect(dtmf_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(dtmf_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(dtmf_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(dtmf_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(dtmf_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(dtmf_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(dtmf_callback_from_hash.transfer_to).to eq('+19195551234')
-
1
expect(dtmf_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(dtmf_callback_values.to_s).to eq('{:eventType=>"dtmf", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :direction=>"inbound", :digit=>"1", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(dtmf_callback_default.eql?(Bandwidth::DtmfCallback.new)).to be true
-
1
expect(dtmf_callback_default.eql?(dtmf_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(dtmf_callback_values.to_body).to eq({
-
eventType: 'dtmf',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
digit: '1',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointDirectionEnum
-
1
describe Bandwidth::EndpointDirectionEnum do
-
1
describe 'constants' do
-
1
it 'defines INBOUND' do
-
1
expect(Bandwidth::EndpointDirectionEnum::INBOUND).to eq('INBOUND')
-
end
-
-
1
it 'defines OUTBOUND' do
-
1
expect(Bandwidth::EndpointDirectionEnum::OUTBOUND).to eq('OUTBOUND')
-
end
-
-
1
it 'defines BIDIRECTIONAL' do
-
1
expect(Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL).to eq('BIDIRECTIONAL')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::EndpointDirectionEnum.all_vars).to eq([
-
'INBOUND',
-
'OUTBOUND',
-
'BIDIRECTIONAL'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::EndpointDirectionEnum.build_from_hash('INBOUND')).to eq('INBOUND')
-
1
expect(Bandwidth::EndpointDirectionEnum.build_from_hash('OUTBOUND')).to eq('OUTBOUND')
-
1
expect(Bandwidth::EndpointDirectionEnum.build_from_hash('BIDIRECTIONAL')).to eq('BIDIRECTIONAL')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::EndpointDirectionEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointEvent
-
1
describe Bandwidth::EndpointEvent do
-
2
let(:endpoint_event_default) { Bandwidth::EndpointEvent.new({
-
endpoint_id: 'baseline-endpoint',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
event_time: '2022-06-16T13:15:08.000Z',
-
event_type: 'DEVICE_CONNECTED'
-
}) }
-
4
let(:endpoint_event_values) { Bandwidth::EndpointEvent.new({
-
endpoint_id: 'ep-abc-123',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
event_time: '2022-06-16T13:15:08.000Z',
-
event_type: Bandwidth::EndpointEventTypeEnum::DEVICE_CONNECTED,
-
device: Bandwidth::Device.new({ device_id: 'd-1', status: 'CONNECTED', creation_timestamp: '2022-06-16T13:15:08.000Z' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::EndpointEvent.acceptable_attributes).to eq(Bandwidth::EndpointEvent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::EndpointEvent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of EndpointEvent created by the build_from_hash method' do
-
1
endpoint_event_from_hash = Bandwidth::EndpointEvent.build_from_hash({
-
endpointId: 'ep-abc-123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
eventTime: '2022-06-16T13:15:08.000Z',
-
eventType: 'DEVICE_CONNECTED',
-
device: { deviceId: 'd-1', status: 'CONNECTED', creationTimestamp: '2022-06-16T13:15:08.000Z' }
-
})
-
1
expect(endpoint_event_from_hash).to be_instance_of(Bandwidth::EndpointEvent)
-
1
expect(endpoint_event_from_hash.endpoint_id).to eq('ep-abc-123')
-
1
expect(endpoint_event_from_hash.type).to eq(Bandwidth::EndpointTypeEnum::WEBRTC)
-
1
expect(endpoint_event_from_hash.status).to eq(Bandwidth::EndpointStatusEnum::CONNECTED)
-
1
expect(endpoint_event_from_hash.creation_timestamp).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(endpoint_event_from_hash.expiration_timestamp).to eq(Time.parse('2022-06-17T13:15:07.160Z'))
-
1
expect(endpoint_event_from_hash.tag).to eq('custom tag')
-
1
expect(endpoint_event_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:08.000Z'))
-
1
expect(endpoint_event_from_hash.event_type).to eq(Bandwidth::EndpointEventTypeEnum::DEVICE_CONNECTED)
-
1
expect(endpoint_event_from_hash.device).to be_instance_of(Bandwidth::Device)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(endpoint_event_values.to_s).to eq('{:endpointId=>"ep-abc-123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:07.160Z", :expirationTimestamp=>"2022-06-17T13:15:07.160Z", :tag=>"custom tag", :eventTime=>"2022-06-16T13:15:08.000Z", :eventType=>"DEVICE_CONNECTED", :device=>{:deviceId=>"d-1", :status=>"CONNECTED", :creationTimestamp=>"2022-06-16T13:15:08.000Z"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
endpoint_event_equal = Bandwidth::EndpointEvent.new({
-
endpoint_id: 'baseline-endpoint',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2022-06-16T13:15:07.160Z',
-
expiration_timestamp: '2022-06-17T13:15:07.160Z',
-
event_time: '2022-06-16T13:15:08.000Z',
-
event_type: 'DEVICE_CONNECTED'
-
})
-
1
expect(endpoint_event_default.eql?(endpoint_event_equal)).to be true
-
1
expect(endpoint_event_default.eql?(endpoint_event_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(endpoint_event_values.to_body).to eq({
-
endpointId: 'ep-abc-123',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creationTimestamp: '2022-06-16T13:15:07.160Z',
-
expirationTimestamp: '2022-06-17T13:15:07.160Z',
-
tag: 'custom tag',
-
eventTime: '2022-06-16T13:15:08.000Z',
-
eventType: Bandwidth::EndpointEventTypeEnum::DEVICE_CONNECTED,
-
device: { deviceId: 'd-1', status: 'CONNECTED', creationTimestamp: '2022-06-16T13:15:08.000Z' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#endpoint_id=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: nil, type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', event_time: 'a', event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'endpoint_id cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: nil, status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', event_time: 'a', event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#status=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: nil, creation_timestamp: 'a', expiration_timestamp: 'a', event_time: 'a', event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'status cannot be nil')
-
end
-
-
1
it '#creation_timestamp=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: nil, expiration_timestamp: 'a', event_time: 'a', event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'creation_timestamp cannot be nil')
-
end
-
-
1
it '#expiration_timestamp=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: nil, event_time: 'a', event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'expiration_timestamp cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', event_time: 'a', event_type: 'DEVICE_CONNECTED', tag: nil })
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
-
1
it '#event_time=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', event_time: nil, event_type: 'DEVICE_CONNECTED' })
-
}.to raise_error(ArgumentError, 'event_time cannot be nil')
-
end
-
-
1
it '#event_type=' do
-
1
expect {
-
1
Bandwidth::EndpointEvent.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: 'a', expiration_timestamp: 'a', event_time: 'a', event_type: nil })
-
}.to raise_error(ArgumentError, 'event_type cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointEventTypeEnum
-
1
describe Bandwidth::EndpointEventTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines DEVICE_CONNECTED' do
-
1
expect(Bandwidth::EndpointEventTypeEnum::DEVICE_CONNECTED).to eq('DEVICE_CONNECTED')
-
end
-
-
1
it 'defines DEVICE_DISCONNECTED' do
-
1
expect(Bandwidth::EndpointEventTypeEnum::DEVICE_DISCONNECTED).to eq('DEVICE_DISCONNECTED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::EndpointEventTypeEnum.all_vars).to eq([
-
'DEVICE_CONNECTED',
-
'DEVICE_DISCONNECTED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::EndpointEventTypeEnum.build_from_hash('DEVICE_CONNECTED')).to eq('DEVICE_CONNECTED')
-
1
expect(Bandwidth::EndpointEventTypeEnum.build_from_hash('DEVICE_DISCONNECTED')).to eq('DEVICE_DISCONNECTED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::EndpointEventTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointResponse
-
1
describe Bandwidth::EndpointResponse do
-
7
let(:endpoint_data) { Bandwidth::Endpoint.new({
-
endpoint_id: 'abc123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
}) }
-
2
let(:endpoint_response_default) { Bandwidth::EndpointResponse.new({
-
links: [],
-
data: endpoint_data,
-
errors: []
-
}) }
-
7
let(:endpoint_response_values) { Bandwidth::EndpointResponse.new({
-
links: [Bandwidth::BrtcLink.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: endpoint_data,
-
errors: [Bandwidth::BrtcError.new({ type: 'validation', description: 'bad input' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::EndpointResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::EndpointResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::EndpointResponse.acceptable_attributes).to eq(Bandwidth::EndpointResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::EndpointResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of EndpointResponse created by the build_from_hash method' do
-
1
endpoint_response_from_hash = Bandwidth::EndpointResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { endpointId: 'abc123', type: 'WEBRTC', status: 'CONNECTED', creationTimestamp: '2024-01-01T00:00:00Z', expirationTimestamp: '2024-01-02T00:00:00Z' },
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
1
expect(endpoint_response_from_hash).to be_instance_of(Bandwidth::EndpointResponse)
-
1
expect(endpoint_response_from_hash.links.first).to be_instance_of(Bandwidth::BrtcLink)
-
1
expect(endpoint_response_from_hash.data).to be_instance_of(Bandwidth::Endpoint)
-
1
expect(endpoint_response_from_hash.errors.first).to be_instance_of(Bandwidth::BrtcError)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(endpoint_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:endpointId=>"abc123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2024-01-01T00:00:00Z", :expirationTimestamp=>"2024-01-02T00:00:00Z"}, :errors=>[{:type=>"validation", :description=>"bad input"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
endpoint_response_equal = Bandwidth::EndpointResponse.new({
-
links: [],
-
data: endpoint_data,
-
errors: []
-
})
-
1
expect(endpoint_response_default.eql?(endpoint_response_equal)).to be true
-
1
expect(endpoint_response_default.eql?(endpoint_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(endpoint_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { endpointId: 'abc123', type: 'WEBRTC', status: 'CONNECTED', creationTimestamp: '2024-01-01T00:00:00Z', expirationTimestamp: '2024-01-02T00:00:00Z' },
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#links=' do
-
1
expect {
-
1
endpoint_response_values.links = nil
-
}.to raise_error(ArgumentError, 'links cannot be nil')
-
end
-
-
1
it '#data=' do
-
1
expect {
-
1
endpoint_response_values.data = nil
-
}.to raise_error(ArgumentError, 'data cannot be nil')
-
end
-
-
1
it '#errors=' do
-
1
expect {
-
1
endpoint_response_values.errors = nil
-
}.to raise_error(ArgumentError, 'errors cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Endpoint
-
1
describe Bandwidth::Endpoint do
-
2
let(:endpoint_default) { Bandwidth::Endpoint.new({
-
endpoint_id: 'endpoint-1',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
}) }
-
5
let(:endpoint_values) { Bandwidth::Endpoint.new({
-
endpoint_id: 'endpoint-2',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::DISCONNECTED,
-
creation_timestamp: '2024-02-01T00:00:00Z',
-
expiration_timestamp: '2024-02-02T00:00:00Z',
-
tag: 'custom tag',
-
devices: [{ device_id: 'device-1', device_name: 'Phone', status: 'CONNECTED', creation_timestamp: '2024-02-01T00:00:00Z' }]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Endpoint.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Endpoint.acceptable_attributes).to eq(Bandwidth::Endpoint.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Endpoint.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Endpoint created by the build_from_hash method' do
-
1
endpoint_from_hash = Bandwidth::Endpoint.build_from_hash({
-
endpointId: 'endpoint-2',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::DISCONNECTED,
-
creationTimestamp: '2024-02-01T00:00:00Z',
-
expirationTimestamp: '2024-02-02T00:00:00Z',
-
tag: 'custom tag',
-
devices: [{ deviceId: 'device-1', deviceName: 'Phone', status: 'CONNECTED', creationTimestamp: '2024-02-01T00:00:00Z' }]
-
})
-
1
expect(endpoint_from_hash).to be_instance_of(Bandwidth::Endpoint)
-
1
expect(endpoint_from_hash.endpoint_id).to eq('endpoint-2')
-
1
expect(endpoint_from_hash.type).to eq(Bandwidth::EndpointTypeEnum::WEBRTC)
-
1
expect(endpoint_from_hash.status).to eq(Bandwidth::EndpointStatusEnum::DISCONNECTED)
-
1
expect(endpoint_from_hash.creation_timestamp).to eq(Time.parse('2024-02-01T00:00:00Z'))
-
1
expect(endpoint_from_hash.expiration_timestamp).to eq(Time.parse('2024-02-02T00:00:00Z'))
-
1
expect(endpoint_from_hash.tag).to eq('custom tag')
-
1
expect(endpoint_from_hash.devices).to be_instance_of(Array)
-
1
expect(endpoint_from_hash.devices.first).to be_instance_of(Bandwidth::Device)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(endpoint_values.to_s).to eq('{:endpointId=>"endpoint-2", :type=>"WEBRTC", :status=>"DISCONNECTED", :creationTimestamp=>"2024-02-01T00:00:00Z", :expirationTimestamp=>"2024-02-02T00:00:00Z", :tag=>"custom tag", :devices=>[{:device_id=>"device-1", :device_name=>"Phone", :status=>"CONNECTED", :creation_timestamp=>"2024-02-01T00:00:00Z"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
endpoint_equal = Bandwidth::Endpoint.new({
-
endpoint_id: 'endpoint-1',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::CONNECTED,
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
})
-
1
expect(endpoint_default.eql?(endpoint_equal)).to be true
-
1
expect(endpoint_default.eql?(endpoint_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(endpoint_values.to_body).to eq({
-
endpointId: 'endpoint-2',
-
type: Bandwidth::EndpointTypeEnum::WEBRTC,
-
status: Bandwidth::EndpointStatusEnum::DISCONNECTED,
-
creationTimestamp: '2024-02-01T00:00:00Z',
-
expirationTimestamp: '2024-02-02T00:00:00Z',
-
tag: 'custom tag',
-
devices: [{ device_id: 'device-1', device_name: 'Phone', status: 'CONNECTED', creation_timestamp: '2024-02-01T00:00:00Z' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#endpoint_id=' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ endpoint_id: nil })
-
}.to raise_error(ArgumentError, 'endpoint_id cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ endpoint_id: 'endpoint-1', type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#status=' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ endpoint_id: 'endpoint-1', type: Bandwidth::EndpointTypeEnum::WEBRTC, status: nil })
-
}.to raise_error(ArgumentError, 'status cannot be nil')
-
end
-
-
1
it '#creation_timestamp=' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ endpoint_id: 'endpoint-1', type: Bandwidth::EndpointTypeEnum::WEBRTC, status: Bandwidth::EndpointStatusEnum::CONNECTED, creation_timestamp: nil })
-
}.to raise_error(ArgumentError, 'creation_timestamp cannot be nil')
-
end
-
-
1
it '#expiration_timestamp=' do
-
1
expect {
-
1
Bandwidth::Endpoint.new({ endpoint_id: 'endpoint-1', type: Bandwidth::EndpointTypeEnum::WEBRTC, status: Bandwidth::EndpointStatusEnum::CONNECTED, creation_timestamp: '2024-01-01T00:00:00Z', expiration_timestamp: nil })
-
}.to raise_error(ArgumentError, 'expiration_timestamp cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
endpoint_values.tag = nil
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointStatusEnum
-
1
describe Bandwidth::EndpointStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines CONNECTED' do
-
1
expect(Bandwidth::EndpointStatusEnum::CONNECTED).to eq('CONNECTED')
-
end
-
-
1
it 'defines DISCONNECTED' do
-
1
expect(Bandwidth::EndpointStatusEnum::DISCONNECTED).to eq('DISCONNECTED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::EndpointStatusEnum.all_vars).to eq([
-
'CONNECTED',
-
'DISCONNECTED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::EndpointStatusEnum.build_from_hash('CONNECTED')).to eq('CONNECTED')
-
1
expect(Bandwidth::EndpointStatusEnum.build_from_hash('DISCONNECTED')).to eq('DISCONNECTED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::EndpointStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::EndpointTypeEnum
-
1
describe Bandwidth::EndpointTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines WEBRTC' do
-
1
expect(Bandwidth::EndpointTypeEnum::WEBRTC).to eq('WEBRTC')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::EndpointTypeEnum.all_vars).to eq([
-
'WEBRTC'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::EndpointTypeEnum.build_from_hash('WEBRTC')).to eq('WEBRTC')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::EndpointTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Endpoints
-
1
describe Bandwidth::Endpoints do
-
2
let(:endpoints_default) { Bandwidth::Endpoints.new({
-
endpoint_id: 'baseline',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
}) }
-
5
let(:endpoints_values) { Bandwidth::Endpoints.new({
-
endpoint_id: 'abc123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Endpoints.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Endpoints.acceptable_attributes).to eq(Bandwidth::Endpoints.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Endpoints.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Endpoints created by the build_from_hash method' do
-
1
endpoints_from_hash = Bandwidth::Endpoints.build_from_hash({
-
endpointId: 'abc123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creationTimestamp: '2024-01-01T00:00:00Z',
-
expirationTimestamp: '2024-01-02T00:00:00Z',
-
tag: 'custom tag'
-
})
-
1
expect(endpoints_from_hash).to be_instance_of(Bandwidth::Endpoints)
-
1
expect(endpoints_from_hash.endpoint_id).to eq('abc123')
-
1
expect(endpoints_from_hash.type).to eq('WEBRTC')
-
1
expect(endpoints_from_hash.status).to eq('CONNECTED')
-
1
expect(endpoints_from_hash.creation_timestamp).to eq(Time.parse('2024-01-01T00:00:00Z'))
-
1
expect(endpoints_from_hash.expiration_timestamp).to eq(Time.parse('2024-01-02T00:00:00Z'))
-
1
expect(endpoints_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(endpoints_values.to_s).to eq('{:endpointId=>"abc123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2024-01-01T00:00:00Z", :expirationTimestamp=>"2024-01-02T00:00:00Z", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
endpoints_equal = Bandwidth::Endpoints.new({
-
endpoint_id: 'baseline',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
})
-
1
expect(endpoints_default.eql?(endpoints_equal)).to be true
-
1
expect(endpoints_default.eql?(endpoints_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(endpoints_values.to_body).to eq({
-
endpointId: 'abc123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creationTimestamp: '2024-01-01T00:00:00Z',
-
expirationTimestamp: '2024-01-02T00:00:00Z',
-
tag: 'custom tag'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#endpoint_id=' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ endpoint_id: nil })
-
}.to raise_error(ArgumentError, 'endpoint_id cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ endpoint_id: 'a', type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#status=' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ endpoint_id: 'a', type: 'WEBRTC', status: nil })
-
}.to raise_error(ArgumentError, 'status cannot be nil')
-
end
-
-
1
it '#creation_timestamp=' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: nil })
-
}.to raise_error(ArgumentError, 'creation_timestamp cannot be nil')
-
end
-
-
1
it '#expiration_timestamp=' do
-
1
expect {
-
1
Bandwidth::Endpoints.new({ endpoint_id: 'a', type: 'WEBRTC', status: 'CONNECTED', creation_timestamp: '2024-01-01T00:00:00Z', expiration_timestamp: nil })
-
}.to raise_error(ArgumentError, 'expiration_timestamp cannot be nil')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
endpoints_values.tag = nil
-
}.to raise_error(ArgumentError, 'tag cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ErrorObject
-
1
describe Bandwidth::ErrorObject do
-
4
let(:error_source) { Bandwidth::ErrorSource.new({ field: 'phoneNumber' }) }
-
2
let(:error_object_default) { Bandwidth::ErrorObject.new({
-
type: 'baseline',
-
description: 'baseline description',
-
source: error_source
-
}) }
-
4
let(:error_object_values) { Bandwidth::ErrorObject.new({
-
type: 'validation',
-
description: 'bad input',
-
source: error_source
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ErrorObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ErrorObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ErrorObject.acceptable_attributes).to eq(Bandwidth::ErrorObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::ErrorObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ErrorObject created by the build_from_hash method' do
-
1
error_object_from_hash = Bandwidth::ErrorObject.build_from_hash({
-
type: 'validation',
-
description: 'bad input',
-
source: { field: 'phoneNumber' }
-
})
-
1
expect(error_object_from_hash).to be_instance_of(Bandwidth::ErrorObject)
-
1
expect(error_object_from_hash.type).to eq('validation')
-
1
expect(error_object_from_hash.description).to eq('bad input')
-
1
expect(error_object_from_hash.source).to be_instance_of(Bandwidth::ErrorSource)
-
1
expect(error_object_from_hash.source.field).to eq('phoneNumber')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(error_object_values.to_s).to eq('{:type=>"validation", :description=>"bad input", :source=>{:field=>"phoneNumber"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
error_object_equal = Bandwidth::ErrorObject.new({
-
type: 'baseline',
-
description: 'baseline description',
-
source: error_source
-
})
-
1
expect(error_object_default.eql?(error_object_equal)).to be true
-
1
expect(error_object_default.eql?(error_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(error_object_values.to_body).to eq({
-
type: 'validation',
-
description: 'bad input',
-
source: { field: 'phoneNumber' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::ErrorObject.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::ErrorObject.new({ type: 'a', description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
-
1
it '#source=' do
-
1
expect {
-
1
Bandwidth::ErrorObject.new({ type: 'a', description: 'b', source: nil })
-
}.to raise_error(ArgumentError, 'source cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ErrorSource
-
1
describe Bandwidth::ErrorSource do
-
2
let(:error_source_default) { Bandwidth::ErrorSource.new }
-
4
let(:error_source_values) { Bandwidth::ErrorSource.new({
-
parameter: 'phoneNumber',
-
field: 'to',
-
header: 'X-Request-Id',
-
reference: '/messages/123'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ErrorSource.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ErrorSource.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ErrorSource.acceptable_attributes).to eq(Bandwidth::ErrorSource.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::ErrorSource.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ErrorSource created by the build_from_hash method' do
-
1
error_source_from_hash = Bandwidth::ErrorSource.build_from_hash({
-
parameter: 'phoneNumber',
-
field: 'to',
-
header: 'X-Request-Id',
-
reference: '/messages/123'
-
})
-
1
expect(error_source_from_hash).to be_instance_of(Bandwidth::ErrorSource)
-
1
expect(error_source_from_hash.parameter).to eq('phoneNumber')
-
1
expect(error_source_from_hash.field).to eq('to')
-
1
expect(error_source_from_hash.header).to eq('X-Request-Id')
-
1
expect(error_source_from_hash.reference).to eq('/messages/123')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(error_source_values.to_s).to eq('{:parameter=>"phoneNumber", :field=>"to", :header=>"X-Request-Id", :reference=>"/messages/123"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(error_source_default.eql?(Bandwidth::ErrorSource.new)).to be true
-
1
expect(error_source_default.eql?(error_source_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(error_source_values.to_body).to eq({
-
parameter: 'phoneNumber',
-
field: 'to',
-
header: 'X-Request-Id',
-
reference: '/messages/123'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::FailureWebhook
-
1
describe Bandwidth::FailureWebhook do
-
2
let(:failure_webhook_default) { Bandwidth::FailureWebhook.new }
-
4
let(:failure_webhook_values) { Bandwidth::FailureWebhook.new({
-
account_id: '9900000',
-
phone_number: '+18005551234',
-
error_code: '400',
-
error_message: 'bad request',
-
errors: ['missing field'],
-
internal_ticket_number: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::FailureWebhook.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::FailureWebhook.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::FailureWebhook.acceptable_attributes).to eq(Bandwidth::FailureWebhook.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::FailureWebhook.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of FailureWebhook created by the build_from_hash method' do
-
1
failure_webhook_from_hash = Bandwidth::FailureWebhook.build_from_hash({
-
accountId: '9900000',
-
phoneNumber: '+18005551234',
-
errorCode: '400',
-
errorMessage: 'bad request',
-
errors: ['missing field'],
-
internalTicketNumber: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'
-
})
-
1
expect(failure_webhook_from_hash).to be_instance_of(Bandwidth::FailureWebhook)
-
1
expect(failure_webhook_from_hash.account_id).to eq('9900000')
-
1
expect(failure_webhook_from_hash.phone_number).to eq('+18005551234')
-
1
expect(failure_webhook_from_hash.error_code).to eq('400')
-
1
expect(failure_webhook_from_hash.error_message).to eq('bad request')
-
1
expect(failure_webhook_from_hash.errors).to eq(['missing field'])
-
1
expect(failure_webhook_from_hash.internal_ticket_number).to eq('aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(failure_webhook_values.to_s).to eq('{:accountId=>"9900000", :phoneNumber=>"+18005551234", :errorCode=>"400", :errorMessage=>"bad request", :errors=>["missing field"], :internalTicketNumber=>"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(failure_webhook_default.eql?(Bandwidth::FailureWebhook.new)).to be true
-
1
expect(failure_webhook_default.eql?(failure_webhook_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(failure_webhook_values.to_body).to eq({
-
accountId: '9900000',
-
phoneNumber: '+18005551234',
-
errorCode: '400',
-
errorMessage: 'bad request',
-
errors: ['missing field'],
-
internalTicketNumber: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::FailureWebhook.new({ phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::FailureWebhook.new({ phone_number: '+1800555123456' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::FailureWebhook.new({ phone_number: '+1800555' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::FailureWebhook.new({ phone_number: '+19195551234' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", must conform to the pattern (?-mix:^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$).')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::FieldError
-
1
describe Bandwidth::FieldError do
-
2
let(:field_error_default) { Bandwidth::FieldError.new }
-
4
let(:field_error_values) { Bandwidth::FieldError.new({
-
field_name: 'to',
-
description: 'invalid phone number'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::FieldError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::FieldError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::FieldError.acceptable_attributes).to eq(Bandwidth::FieldError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::FieldError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of FieldError created by the build_from_hash method' do
-
1
field_error_from_hash = Bandwidth::FieldError.build_from_hash({
-
fieldName: 'to',
-
description: 'invalid phone number'
-
})
-
1
expect(field_error_from_hash).to be_instance_of(Bandwidth::FieldError)
-
1
expect(field_error_from_hash.field_name).to eq('to')
-
1
expect(field_error_from_hash.description).to eq('invalid phone number')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(field_error_values.to_s).to eq('{:fieldName=>"to", :description=>"invalid phone number"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(field_error_default.eql?(Bandwidth::FieldError.new)).to be true
-
1
expect(field_error_default.eql?(field_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(field_error_values.to_body).to eq({
-
fieldName: 'to',
-
description: 'invalid phone number'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::FileFormatEnum
-
1
describe Bandwidth::FileFormatEnum do
-
1
describe 'constants' do
-
1
it 'defines MP3' do
-
1
expect(Bandwidth::FileFormatEnum::MP3).to eq('mp3')
-
end
-
-
1
it 'defines WAV' do
-
1
expect(Bandwidth::FileFormatEnum::WAV).to eq('wav')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::FileFormatEnum.all_vars).to eq([
-
'mp3',
-
'wav'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::FileFormatEnum.build_from_hash('mp3')).to eq('mp3')
-
1
expect(Bandwidth::FileFormatEnum.build_from_hash('wav')).to eq('wav')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::FileFormatEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::GatherCallback
-
1
describe Bandwidth::GatherCallback do
-
2
let(:gather_callback_default) { Bandwidth::GatherCallback.new }
-
4
let(:gather_callback_values) { Bandwidth::GatherCallback.new({
-
event_type: 'gather',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
digits: '123',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
terminating_digit: '#',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::GatherCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::GatherCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::GatherCallback.acceptable_attributes).to eq(Bandwidth::GatherCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::GatherCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of GatherCallback created by the build_from_hash method' do
-
1
gather_callback_from_hash = Bandwidth::GatherCallback.build_from_hash({
-
eventType: 'gather',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
digits: '123',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
terminatingDigit: '#',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
tag: 'custom tag'
-
})
-
1
expect(gather_callback_from_hash).to be_instance_of(Bandwidth::GatherCallback)
-
1
expect(gather_callback_from_hash.event_type).to eq('gather')
-
1
expect(gather_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(gather_callback_from_hash.account_id).to eq('9900000')
-
1
expect(gather_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(gather_callback_from_hash.from).to eq('+19195554321')
-
1
expect(gather_callback_from_hash.to).to eq('+19195551234')
-
1
expect(gather_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(gather_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(gather_callback_from_hash.digits).to eq('123')
-
1
expect(gather_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(gather_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(gather_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(gather_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(gather_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(gather_callback_from_hash.terminating_digit).to eq('#')
-
1
expect(gather_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(gather_callback_from_hash.transfer_to).to eq('+19195551234')
-
1
expect(gather_callback_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(gather_callback_values.to_s).to eq('{:eventType=>"gather", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :digits=>"123", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :terminatingDigit=>"#", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(gather_callback_default.eql?(Bandwidth::GatherCallback.new)).to be true
-
1
expect(gather_callback_default.eql?(gather_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(gather_callback_values.to_body).to eq({
-
eventType: 'gather',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
digits: '123',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
terminatingDigit: '#',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
tag: 'custom tag'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::GetAsyncBulkLookupResponseData
-
1
describe Bandwidth::GetAsyncBulkLookupResponseData do
-
4
let(:lookup_result) { Bandwidth::LookupResult.new({ phone_number: '+19195551234' }) }
-
2
let(:get_async_bulk_lookup_response_data_default) { Bandwidth::GetAsyncBulkLookupResponseData.new }
-
4
let(:get_async_bulk_lookup_response_data_values) { Bandwidth::GetAsyncBulkLookupResponseData.new({
-
request_id: 'abc-123',
-
status: Bandwidth::InProgressLookupStatusEnum::COMPLETE,
-
results: [lookup_result]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::GetAsyncBulkLookupResponseData.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::GetAsyncBulkLookupResponseData.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::GetAsyncBulkLookupResponseData.acceptable_attributes).to eq(Bandwidth::GetAsyncBulkLookupResponseData.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::GetAsyncBulkLookupResponseData.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of GetAsyncBulkLookupResponseData created by the build_from_hash method' do
-
1
get_async_bulk_lookup_response_data_from_hash = Bandwidth::GetAsyncBulkLookupResponseData.build_from_hash({
-
requestId: 'abc-123',
-
status: 'COMPLETE',
-
results: [{ phoneNumber: '+19195551234' }]
-
})
-
1
expect(get_async_bulk_lookup_response_data_from_hash).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponseData)
-
1
expect(get_async_bulk_lookup_response_data_from_hash.request_id).to eq('abc-123')
-
1
expect(get_async_bulk_lookup_response_data_from_hash.status).to eq('COMPLETE')
-
1
expect(get_async_bulk_lookup_response_data_from_hash.results.first).to be_instance_of(Bandwidth::LookupResult)
-
1
expect(get_async_bulk_lookup_response_data_from_hash.results.first.phone_number).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(get_async_bulk_lookup_response_data_values.to_s).to eq('{:requestId=>"abc-123", :status=>"COMPLETE", :results=>[{:phoneNumber=>"+19195551234"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(get_async_bulk_lookup_response_data_default.eql?(Bandwidth::GetAsyncBulkLookupResponseData.new)).to be true
-
1
expect(get_async_bulk_lookup_response_data_default.eql?(get_async_bulk_lookup_response_data_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(get_async_bulk_lookup_response_data_values.to_body).to eq({
-
requestId: 'abc-123',
-
status: Bandwidth::InProgressLookupStatusEnum::COMPLETE,
-
results: [{ phoneNumber: '+19195551234' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::GetAsyncBulkLookupResponse
-
1
describe Bandwidth::GetAsyncBulkLookupResponse do
-
2
let(:get_async_bulk_lookup_response_default) { Bandwidth::GetAsyncBulkLookupResponse.new }
-
4
let(:get_async_bulk_lookup_response_values) { Bandwidth::GetAsyncBulkLookupResponse.new({
-
links: [Bandwidth::LinkSchema.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: Bandwidth::GetAsyncBulkLookupResponseData.new({ request_id: 'abc-123' }),
-
errors: [Bandwidth::LookupErrorSchema.new({ code: '400', description: 'bad request', type: 'validation' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::GetAsyncBulkLookupResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::GetAsyncBulkLookupResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::GetAsyncBulkLookupResponse.acceptable_attributes).to eq(Bandwidth::GetAsyncBulkLookupResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::GetAsyncBulkLookupResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of GetAsyncBulkLookupResponse created by the build_from_hash method' do
-
1
get_async_bulk_lookup_response_from_hash = Bandwidth::GetAsyncBulkLookupResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: 'abc-123' },
-
errors: [{ code: '400', description: 'bad request', type: 'validation' }]
-
})
-
1
expect(get_async_bulk_lookup_response_from_hash).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponse)
-
1
expect(get_async_bulk_lookup_response_from_hash.links.first).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(get_async_bulk_lookup_response_from_hash.data).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponseData)
-
1
expect(get_async_bulk_lookup_response_from_hash.errors.first).to be_instance_of(Bandwidth::LookupErrorSchema)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(get_async_bulk_lookup_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:requestId=>"abc-123"}, :errors=>[{:code=>"400", :description=>"bad request", :type=>"validation"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(get_async_bulk_lookup_response_default.eql?(Bandwidth::GetAsyncBulkLookupResponse.new)).to be true
-
1
expect(get_async_bulk_lookup_response_default.eql?(get_async_bulk_lookup_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(get_async_bulk_lookup_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { requestId: 'abc-123' },
-
errors: [{ code: '400', description: 'bad request', type: 'validation' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::InProgressLookupStatusEnum
-
1
describe Bandwidth::InProgressLookupStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines IN_PROGRESS' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum::IN_PROGRESS).to eq('IN_PROGRESS')
-
end
-
-
1
it 'defines COMPLETE' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum::COMPLETE).to eq('COMPLETE')
-
end
-
-
1
it 'defines PARTIAL_COMPLETE' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum::PARTIAL_COMPLETE).to eq('PARTIAL_COMPLETE')
-
end
-
-
1
it 'defines FAILED' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum::FAILED).to eq('FAILED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum.all_vars).to eq([
-
'IN_PROGRESS',
-
'COMPLETE',
-
'PARTIAL_COMPLETE',
-
'FAILED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::InProgressLookupStatusEnum.build_from_hash('IN_PROGRESS')).to eq('IN_PROGRESS')
-
1
expect(Bandwidth::InProgressLookupStatusEnum.build_from_hash('COMPLETE')).to eq('COMPLETE')
-
1
expect(Bandwidth::InProgressLookupStatusEnum.build_from_hash('PARTIAL_COMPLETE')).to eq('PARTIAL_COMPLETE')
-
1
expect(Bandwidth::InProgressLookupStatusEnum.build_from_hash('FAILED')).to eq('FAILED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::InProgressLookupStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::InboundCallbackMessage
-
1
describe Bandwidth::InboundCallbackMessage do
-
2
let(:inbound_callback_message_default) { Bandwidth::InboundCallbackMessage.new({
-
id: 'baseline-id',
-
owner: '+19195554321',
-
application_id: 'baseline-app',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 1,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321'
-
}) }
-
12
let(:inbound_callback_message_values) { Bandwidth::InboundCallbackMessage.new({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::InboundCallbackMessage.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::InboundCallbackMessage.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::InboundCallbackMessage.acceptable_attributes).to eq(Bandwidth::InboundCallbackMessage.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::InboundCallbackMessage.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of InboundCallbackMessage created by the build_from_hash method' do
-
1
inbound_callback_message_from_hash = Bandwidth::InboundCallbackMessage.build_from_hash({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
})
-
1
expect(inbound_callback_message_from_hash).to be_instance_of(Bandwidth::InboundCallbackMessage)
-
1
expect(inbound_callback_message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(inbound_callback_message_from_hash.owner).to eq('+19195554321')
-
1
expect(inbound_callback_message_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(inbound_callback_message_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(inbound_callback_message_from_hash.segment_count).to eq(2)
-
1
expect(inbound_callback_message_from_hash.direction).to eq(Bandwidth::MessageDirectionEnum::IN)
-
1
expect(inbound_callback_message_from_hash.to).to eq(['+19195551234'])
-
1
expect(inbound_callback_message_from_hash.from).to eq('+19195554321')
-
1
expect(inbound_callback_message_from_hash.text).to eq('Hello world')
-
1
expect(inbound_callback_message_from_hash.tag).to eq('custom tag')
-
1
expect(inbound_callback_message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png'])
-
1
expect(inbound_callback_message_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT)
-
1
expect(inbound_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(inbound_callback_message_values.to_s).to eq('{:id=>"1589228074636lm4k2je7j7jklbn2", :owner=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :time=>"2022-06-16T13:15:07.160Z", :segmentCount=>2, :direction=>"in", :to=>["+19195551234"], :from=>"+19195554321", :text=>"Hello world", :tag=>"custom tag", :media=>["https://dev.bandwidth.com/images/bandwidth-logo.png"], :priority=>"default", :channel=>"SMS"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
inbound_callback_message_equal = Bandwidth::InboundCallbackMessage.new({
-
id: 'baseline-id',
-
owner: '+19195554321',
-
application_id: 'baseline-app',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 1,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321'
-
})
-
1
expect(inbound_callback_message_default.eql?(inbound_callback_message_equal)).to be true
-
1
expect(inbound_callback_message_default.eql?(inbound_callback_message_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(inbound_callback_message_values.to_body).to eq({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#id=' do
-
1
expect {
-
1
inbound_callback_message_values.id = nil
-
}.to raise_error(ArgumentError, 'id cannot be nil')
-
end
-
-
1
it '#owner=' do
-
1
expect {
-
1
inbound_callback_message_values.owner = nil
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
inbound_callback_message_values.application_id = nil
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#time=' do
-
1
expect {
-
1
inbound_callback_message_values.time = nil
-
}.to raise_error(ArgumentError, 'time cannot be nil')
-
end
-
-
1
it '#segment_count=' do
-
1
expect {
-
1
inbound_callback_message_values.segment_count = nil
-
}.to raise_error(ArgumentError, 'segment_count cannot be nil')
-
end
-
-
1
it '#direction=' do
-
1
expect {
-
1
inbound_callback_message_values.direction = nil
-
}.to raise_error(ArgumentError, 'direction cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
inbound_callback_message_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
inbound_callback_message_values.from = nil
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::InboundCallback
-
1
describe Bandwidth::InboundCallback do
-
2
let(:inbound_callback_default) { Bandwidth::InboundCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED,
-
to: '+19195551234',
-
description: 'baseline description',
-
message: { id: 'baseline' }
-
}) }
-
9
let(:inbound_callback_values) { Bandwidth::InboundCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED,
-
to: '+19195551234',
-
description: 'Incoming message received',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: 'in',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
carrier_name: 'Verizon'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::InboundCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::InboundCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::InboundCallback.acceptable_attributes).to eq(Bandwidth::InboundCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::InboundCallback.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of InboundCallback created by the build_from_hash method' do
-
1
inbound_callback_from_hash = Bandwidth::InboundCallback.build_from_hash({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED,
-
to: '+19195551234',
-
description: 'Incoming message received',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
carrierName: 'Verizon'
-
})
-
1
expect(inbound_callback_from_hash).to be_instance_of(Bandwidth::InboundCallback)
-
1
expect(inbound_callback_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(inbound_callback_from_hash.type).to eq(Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED)
-
1
expect(inbound_callback_from_hash.to).to eq('+19195551234')
-
1
expect(inbound_callback_from_hash.description).to eq('Incoming message received')
-
1
expect(inbound_callback_from_hash.message).to be_instance_of(Bandwidth::InboundCallbackMessage)
-
1
expect(inbound_callback_from_hash.message.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(inbound_callback_from_hash.message.text).to eq('Hello world')
-
1
expect(inbound_callback_from_hash.carrier_name).to eq('Verizon')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(inbound_callback_values.to_s).to eq('{:time=>"2022-06-16T13:15:07.160Z", :type=>"message-received", :to=>"+19195551234", :description=>"Incoming message received", :message=>{:id=>"1589228074636lm4k2je7j7jklbn2", :owner=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :time=>"2022-06-16T13:15:07.160Z", :segmentCount=>1, :direction=>"in", :to=>["+19195551234"], :from=>"+19195554321", :text=>"Hello world"}, :carrierName=>"Verizon"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
inbound_callback_equal = Bandwidth::InboundCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED,
-
to: '+19195551234',
-
description: 'baseline description',
-
message: { id: 'baseline' }
-
})
-
1
expect(inbound_callback_default.eql?(inbound_callback_equal)).to be true
-
1
expect(inbound_callback_default.eql?(inbound_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(inbound_callback_values.to_body).to eq({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED,
-
to: '+19195551234',
-
description: 'Incoming message received',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: 'in',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
carrierName: 'Verizon'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#time=' do
-
1
expect {
-
1
inbound_callback_values.time = nil
-
}.to raise_error(ArgumentError, 'time cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
inbound_callback_values.type = nil
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
inbound_callback_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
inbound_callback_values.description = nil
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
-
1
it '#message=' do
-
1
expect {
-
1
inbound_callback_values.message = nil
-
}.to raise_error(ArgumentError, 'message cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::InboundCallbackTypeEnum
-
1
describe Bandwidth::InboundCallbackTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines MESSAGE_RECEIVED' do
-
1
expect(Bandwidth::InboundCallbackTypeEnum::MESSAGE_RECEIVED).to eq('message-received')
-
end
-
-
1
it 'defines REQUEST_LOCATION_RESPONSE' do
-
1
expect(Bandwidth::InboundCallbackTypeEnum::REQUEST_LOCATION_RESPONSE).to eq('request-location-response')
-
end
-
-
1
it 'defines SUGGESTION_RESPONSE' do
-
1
expect(Bandwidth::InboundCallbackTypeEnum::SUGGESTION_RESPONSE).to eq('suggestion-response')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::InboundCallbackTypeEnum.all_vars).to eq([
-
'message-received',
-
'request-location-response',
-
'suggestion-response'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::InboundCallbackTypeEnum.build_from_hash('message-received')).to eq('message-received')
-
1
expect(Bandwidth::InboundCallbackTypeEnum.build_from_hash('request-location-response')).to eq('request-location-response')
-
1
expect(Bandwidth::InboundCallbackTypeEnum.build_from_hash('suggestion-response')).to eq('suggestion-response')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::InboundCallbackTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::InitiateCallback
-
1
describe Bandwidth::InitiateCallback do
-
2
let(:initiate_callback_default) { Bandwidth::InitiateCallback.new }
-
4
let(:initiate_callback_values) { Bandwidth::InitiateCallback.new({
-
event_type: 'initiate',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
start_time: '2022-06-16T13:15:07.160Z',
-
diversion: { reason: 'unconditional', privacy: 'off' },
-
stir_shaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' },
-
uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::InitiateCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::InitiateCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::InitiateCallback.acceptable_attributes).to eq(Bandwidth::InitiateCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::InitiateCallback.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of InitiateCallback created by the build_from_hash method' do
-
1
initiate_callback_from_hash = Bandwidth::InitiateCallback.build_from_hash({
-
eventType: 'initiate',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
startTime: '2022-06-16T13:15:07.160Z',
-
diversion: { reason: 'unconditional', privacy: 'off' },
-
stirShaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' },
-
uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64'
-
})
-
1
expect(initiate_callback_from_hash).to be_instance_of(Bandwidth::InitiateCallback)
-
1
expect(initiate_callback_from_hash.event_type).to eq('initiate')
-
1
expect(initiate_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(initiate_callback_from_hash.account_id).to eq('9900000')
-
1
expect(initiate_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(initiate_callback_from_hash.from).to eq('+19195554321')
-
1
expect(initiate_callback_from_hash.to).to eq('+19195551234')
-
1
expect(initiate_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(initiate_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(initiate_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(initiate_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(initiate_callback_from_hash.diversion).to be_instance_of(Bandwidth::Diversion)
-
1
expect(initiate_callback_from_hash.diversion.reason).to eq('unconditional')
-
1
expect(initiate_callback_from_hash.stir_shaken).to be_instance_of(Bandwidth::StirShaken)
-
1
expect(initiate_callback_from_hash.stir_shaken.verstat).to eq('TN-Validation-Passed')
-
1
expect(initiate_callback_from_hash.uui).to eq('aGVsbG8sIHdvcmxkIQ==;encoding=base64')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(initiate_callback_values.to_s).to eq('{:eventType=>"initiate", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :startTime=>"2022-06-16T13:15:07.160Z", :diversion=>{:reason=>"unconditional", :privacy=>"off"}, :stirShaken=>{:verstat=>"TN-Validation-Passed", :attestationIndicator=>"A", :originatingId=>"527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb"}, :uui=>"aGVsbG8sIHdvcmxkIQ==;encoding=base64"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(initiate_callback_default.eql?(Bandwidth::InitiateCallback.new)).to be true
-
1
expect(initiate_callback_default.eql?(initiate_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(initiate_callback_values.to_body).to eq({
-
eventType: 'initiate',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
startTime: '2022-06-16T13:15:07.160Z',
-
diversion: { reason: 'unconditional', privacy: 'off' },
-
stirShaken: { verstat: 'TN-Validation-Passed', attestationIndicator: 'A', originatingId: '527c7d1f-22a4-4ec1-ad19-1a4ec9466cdb' },
-
uui: 'aGVsbG8sIHdvcmxkIQ==;encoding=base64'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LatestMessageDeliveryStatusEnum
-
1
describe Bandwidth::LatestMessageDeliveryStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines ACTIVE' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE).to eq('ACTIVE')
-
end
-
-
1
it 'defines DEACTIVATED' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum::DEACTIVATED).to eq('DEACTIVATED')
-
end
-
-
1
it 'defines UNKNOWN' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum::UNKNOWN).to eq('UNKNOWN')
-
end
-
-
1
it 'defines NOT_ENABLED' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum::NOT_ENABLED).to eq('NOT_ENABLED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum.all_vars).to eq([
-
'ACTIVE',
-
'DEACTIVATED',
-
'UNKNOWN',
-
'NOT_ENABLED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum.build_from_hash('ACTIVE')).to eq('ACTIVE')
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum.build_from_hash('DEACTIVATED')).to eq('DEACTIVATED')
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum.build_from_hash('UNKNOWN')).to eq('UNKNOWN')
-
1
expect(Bandwidth::LatestMessageDeliveryStatusEnum.build_from_hash('NOT_ENABLED')).to eq('NOT_ENABLED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::LatestMessageDeliveryStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LineTypeEnum
-
1
describe Bandwidth::LineTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines FIXED' do
-
1
expect(Bandwidth::LineTypeEnum::FIXED).to eq('FIXED')
-
end
-
-
1
it 'defines VOIP_FIXED' do
-
1
expect(Bandwidth::LineTypeEnum::VOIP_FIXED).to eq('VOIP-FIXED')
-
end
-
-
1
it 'defines MOBILE' do
-
1
expect(Bandwidth::LineTypeEnum::MOBILE).to eq('MOBILE')
-
end
-
-
1
it 'defines VOIP' do
-
1
expect(Bandwidth::LineTypeEnum::VOIP).to eq('VOIP')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::LineTypeEnum.all_vars).to eq([
-
'FIXED',
-
'VOIP-FIXED',
-
'MOBILE',
-
'VOIP'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::LineTypeEnum.build_from_hash('FIXED')).to eq('FIXED')
-
1
expect(Bandwidth::LineTypeEnum.build_from_hash('VOIP-FIXED')).to eq('VOIP-FIXED')
-
1
expect(Bandwidth::LineTypeEnum.build_from_hash('MOBILE')).to eq('MOBILE')
-
1
expect(Bandwidth::LineTypeEnum.build_from_hash('VOIP')).to eq('VOIP')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::LineTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LinkSchema
-
1
describe Bandwidth::LinkSchema do
-
2
let(:link_schema_default) { Bandwidth::LinkSchema.new }
-
4
let(:link_schema_values) { Bandwidth::LinkSchema.new({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LinkSchema.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LinkSchema.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LinkSchema.acceptable_attributes).to eq(Bandwidth::LinkSchema.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LinkSchema.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LinkSchema created by the build_from_hash method' do
-
1
link_schema_from_hash = Bandwidth::LinkSchema.build_from_hash({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
})
-
1
expect(link_schema_from_hash).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(link_schema_from_hash.href).to eq('https://example.com')
-
1
expect(link_schema_from_hash.rel).to eq('self')
-
1
expect(link_schema_from_hash.method).to eq('GET')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(link_schema_values.to_s).to eq('{:href=>"https://example.com", :rel=>"self", :method=>"GET"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(link_schema_default.eql?(Bandwidth::LinkSchema.new)).to be true
-
1
expect(link_schema_default.eql?(link_schema_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(link_schema_values.to_body).to eq({
-
href: 'https://example.com',
-
rel: 'self',
-
method: 'GET'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Link
-
1
describe Bandwidth::Link do
-
2
let(:link_default) { Bandwidth::Link.new }
-
4
let(:link_values) { Bandwidth::Link.new({
-
rel: 'next',
-
href: 'https://example.com/page/2'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Link.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Link.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Link.acceptable_attributes).to eq(Bandwidth::Link.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Link.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Link created by the build_from_hash method' do
-
1
link_from_hash = Bandwidth::Link.build_from_hash({
-
rel: 'next',
-
href: 'https://example.com/page/2'
-
})
-
1
expect(link_from_hash).to be_instance_of(Bandwidth::Link)
-
1
expect(link_from_hash.rel).to eq('next')
-
1
expect(link_from_hash.href).to eq('https://example.com/page/2')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(link_values.to_s).to eq('{:rel=>"next", :href=>"https://example.com/page/2"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(link_default.eql?(Bandwidth::Link.new)).to be true
-
1
expect(link_default.eql?(link_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(link_values.to_body).to eq({
-
rel: 'next',
-
href: 'https://example.com/page/2'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LinksObject
-
1
describe Bandwidth::LinksObject do
-
2
let(:links_object_default) { Bandwidth::LinksObject.new }
-
4
let(:links_object_values) { Bandwidth::LinksObject.new({
-
first: 'https://example.com/page/1',
-
_next: 'https://example.com/page/2',
-
previous: 'https://example.com/page/0',
-
last: 'https://example.com/page/9'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LinksObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LinksObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LinksObject.acceptable_attributes).to eq(Bandwidth::LinksObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LinksObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LinksObject created by the build_from_hash method' do
-
1
links_object_from_hash = Bandwidth::LinksObject.build_from_hash({
-
first: 'https://example.com/page/1',
-
next: 'https://example.com/page/2',
-
previous: 'https://example.com/page/0',
-
last: 'https://example.com/page/9'
-
})
-
1
expect(links_object_from_hash).to be_instance_of(Bandwidth::LinksObject)
-
1
expect(links_object_from_hash.first).to eq('https://example.com/page/1')
-
1
expect(links_object_from_hash._next).to eq('https://example.com/page/2')
-
1
expect(links_object_from_hash.previous).to eq('https://example.com/page/0')
-
1
expect(links_object_from_hash.last).to eq('https://example.com/page/9')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(links_object_values.to_s).to eq('{:first=>"https://example.com/page/1", :next=>"https://example.com/page/2", :previous=>"https://example.com/page/0", :last=>"https://example.com/page/9"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(links_object_default.eql?(Bandwidth::LinksObject.new)).to be true
-
1
expect(links_object_default.eql?(links_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(links_object_values.to_body).to eq({
-
first: 'https://example.com/page/1',
-
next: 'https://example.com/page/2',
-
previous: 'https://example.com/page/0',
-
last: 'https://example.com/page/9'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ListEndpointsResponse
-
1
describe Bandwidth::ListEndpointsResponse do
-
7
let(:page) { Bandwidth::Page.new({ page_size: 25, total_elements: 100, total_pages: 4, page_number: 1 }) }
-
7
let(:endpoint) { Bandwidth::Endpoints.new({
-
endpoint_id: 'abc123',
-
type: 'WEBRTC',
-
status: 'CONNECTED',
-
creation_timestamp: '2024-01-01T00:00:00Z',
-
expiration_timestamp: '2024-01-02T00:00:00Z'
-
}) }
-
2
let(:list_endpoints_response_default) { Bandwidth::ListEndpointsResponse.new({
-
links: [],
-
data: [],
-
errors: []
-
}) }
-
7
let(:list_endpoints_response_values) { Bandwidth::ListEndpointsResponse.new({
-
links: [Bandwidth::BrtcLink.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
page: page,
-
data: [endpoint],
-
errors: [Bandwidth::BrtcError.new({ type: 'validation', description: 'bad input' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ListEndpointsResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ListEndpointsResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ListEndpointsResponse.acceptable_attributes).to eq(Bandwidth::ListEndpointsResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::ListEndpointsResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ListEndpointsResponse created by the build_from_hash method' do
-
1
list_endpoints_response_from_hash = Bandwidth::ListEndpointsResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
page: { pageSize: 25, totalElements: 100, totalPages: 4, pageNumber: 1 },
-
data: [{ endpointId: 'abc123', type: 'WEBRTC', status: 'CONNECTED', creationTimestamp: '2024-01-01T00:00:00Z', expirationTimestamp: '2024-01-02T00:00:00Z' }],
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
1
expect(list_endpoints_response_from_hash).to be_instance_of(Bandwidth::ListEndpointsResponse)
-
1
expect(list_endpoints_response_from_hash.links.first).to be_instance_of(Bandwidth::BrtcLink)
-
1
expect(list_endpoints_response_from_hash.page).to be_instance_of(Bandwidth::Page)
-
1
expect(list_endpoints_response_from_hash.data.first).to be_instance_of(Bandwidth::Endpoints)
-
1
expect(list_endpoints_response_from_hash.errors.first).to be_instance_of(Bandwidth::BrtcError)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(list_endpoints_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :page=>{:pageSize=>25, :totalElements=>100, :totalPages=>4, :pageNumber=>1}, :data=>[{:endpointId=>"abc123", :type=>"WEBRTC", :status=>"CONNECTED", :creationTimestamp=>"2024-01-01T00:00:00Z", :expirationTimestamp=>"2024-01-02T00:00:00Z"}], :errors=>[{:type=>"validation", :description=>"bad input"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
list_endpoints_response_equal = Bandwidth::ListEndpointsResponse.new({
-
links: [],
-
data: [],
-
errors: []
-
})
-
1
expect(list_endpoints_response_default.eql?(list_endpoints_response_equal)).to be true
-
1
expect(list_endpoints_response_default.eql?(list_endpoints_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(list_endpoints_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
page: { pageSize: 25, totalElements: 100, totalPages: 4, pageNumber: 1 },
-
data: [{ endpointId: 'abc123', type: 'WEBRTC', status: 'CONNECTED', creationTimestamp: '2024-01-01T00:00:00Z', expirationTimestamp: '2024-01-02T00:00:00Z' }],
-
errors: [{ type: 'validation', description: 'bad input' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#links=' do
-
1
expect {
-
1
list_endpoints_response_values.links = nil
-
}.to raise_error(ArgumentError, 'links cannot be nil')
-
end
-
-
1
it '#data=' do
-
1
expect {
-
1
list_endpoints_response_values.data = nil
-
}.to raise_error(ArgumentError, 'data cannot be nil')
-
end
-
-
1
it '#errors=' do
-
1
expect {
-
1
list_endpoints_response_values.errors = nil
-
}.to raise_error(ArgumentError, 'errors cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ListMessageDirectionEnum
-
1
describe Bandwidth::ListMessageDirectionEnum do
-
1
describe 'constants' do
-
1
it 'defines INBOUND' do
-
1
expect(Bandwidth::ListMessageDirectionEnum::INBOUND).to eq('INBOUND')
-
end
-
-
1
it 'defines OUTBOUND' do
-
1
expect(Bandwidth::ListMessageDirectionEnum::OUTBOUND).to eq('OUTBOUND')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::ListMessageDirectionEnum.all_vars).to eq([
-
'INBOUND',
-
'OUTBOUND'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::ListMessageDirectionEnum.build_from_hash('INBOUND')).to eq('INBOUND')
-
1
expect(Bandwidth::ListMessageDirectionEnum.build_from_hash('OUTBOUND')).to eq('OUTBOUND')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::ListMessageDirectionEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ListMessageItem
-
1
describe Bandwidth::ListMessageItem do
-
2
let(:list_message_item_default) { Bandwidth::ListMessageItem.new }
-
4
let(:list_message_item_values) { Bandwidth::ListMessageItem.new({
-
message_id: '1589228074636lm4k2je7j7jklbn2',
-
account_id: '9900000',
-
source_tn: '+19195554321',
-
destination_tn: '+19195551234',
-
message_status: Bandwidth::MessageStatusEnum::DELIVERED,
-
message_direction: Bandwidth::ListMessageDirectionEnum::OUTBOUND,
-
message_type: Bandwidth::MessageTypeEnum::SMS,
-
segment_count: 1,
-
error_code: 0,
-
receive_time: '2022-06-16T13:15:07.160Z',
-
carrier_name: 'verizon',
-
message_size: 27,
-
message_length: 18,
-
attachment_count: 0,
-
recipient_count: 1,
-
campaign_class: 'T',
-
campaign_id: 'CABC123',
-
bw_latency: 1,
-
carrier_latency: 2,
-
calling_number_country_a3: 'USA',
-
called_number_country_a3: 'USA',
-
product: 'MESSAGING-V2',
-
location: 'loc-1'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::ListMessageItem.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::ListMessageItem.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::ListMessageItem.acceptable_attributes).to eq(Bandwidth::ListMessageItem.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::ListMessageItem.openapi_nullable).to eq(Set.new([
-
:'carrier_name',
-
:'message_size',
-
:'attachment_count',
-
:'recipient_count',
-
:'campaign_class',
-
:'campaign_id',
-
:'bw_latency',
-
:'carrier_latency',
-
:'calling_number_country_a3',
-
:'called_number_country_a3',
-
:'product',
-
:'location'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of ListMessageItem created by the build_from_hash method' do
-
1
list_message_item_from_hash = Bandwidth::ListMessageItem.build_from_hash({
-
messageId: '1589228074636lm4k2je7j7jklbn2',
-
accountId: '9900000',
-
sourceTn: '+19195554321',
-
destinationTn: '+19195551234',
-
messageStatus: 'DELIVERED',
-
messageDirection: 'OUTBOUND',
-
messageType: 'sms',
-
segmentCount: 1,
-
errorCode: 0,
-
receiveTime: '2022-06-16T13:15:07.160Z',
-
carrierName: 'verizon',
-
messageSize: 27,
-
messageLength: 18,
-
attachmentCount: 0,
-
recipientCount: 1,
-
campaignClass: 'T',
-
campaignId: 'CABC123',
-
bwLatency: 1,
-
carrierLatency: 2,
-
callingNumberCountryA3: 'USA',
-
calledNumberCountryA3: 'USA',
-
product: 'MESSAGING-V2',
-
location: 'loc-1'
-
})
-
1
expect(list_message_item_from_hash).to be_instance_of(Bandwidth::ListMessageItem)
-
1
expect(list_message_item_from_hash.message_id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(list_message_item_from_hash.account_id).to eq('9900000')
-
1
expect(list_message_item_from_hash.source_tn).to eq('+19195554321')
-
1
expect(list_message_item_from_hash.destination_tn).to eq('+19195551234')
-
1
expect(list_message_item_from_hash.message_status).to eq('DELIVERED')
-
1
expect(list_message_item_from_hash.message_direction).to eq('OUTBOUND')
-
1
expect(list_message_item_from_hash.message_type).to eq('sms')
-
1
expect(list_message_item_from_hash.segment_count).to eq(1)
-
1
expect(list_message_item_from_hash.error_code).to eq(0)
-
1
expect(list_message_item_from_hash.receive_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(list_message_item_from_hash.carrier_name).to eq('verizon')
-
1
expect(list_message_item_from_hash.message_size).to eq(27)
-
1
expect(list_message_item_from_hash.message_length).to eq(18)
-
1
expect(list_message_item_from_hash.attachment_count).to eq(0)
-
1
expect(list_message_item_from_hash.recipient_count).to eq(1)
-
1
expect(list_message_item_from_hash.campaign_class).to eq('T')
-
1
expect(list_message_item_from_hash.campaign_id).to eq('CABC123')
-
1
expect(list_message_item_from_hash.bw_latency).to eq(1)
-
1
expect(list_message_item_from_hash.carrier_latency).to eq(2)
-
1
expect(list_message_item_from_hash.calling_number_country_a3).to eq('USA')
-
1
expect(list_message_item_from_hash.called_number_country_a3).to eq('USA')
-
1
expect(list_message_item_from_hash.product).to eq('MESSAGING-V2')
-
1
expect(list_message_item_from_hash.location).to eq('loc-1')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(list_message_item_values.to_s).to eq('{:messageId=>"1589228074636lm4k2je7j7jklbn2", :accountId=>"9900000", :sourceTn=>"+19195554321", :destinationTn=>"+19195551234", :messageStatus=>"DELIVERED", :messageDirection=>"OUTBOUND", :messageType=>"sms", :segmentCount=>1, :errorCode=>0, :receiveTime=>"2022-06-16T13:15:07.160Z", :carrierName=>"verizon", :messageSize=>27, :messageLength=>18, :attachmentCount=>0, :recipientCount=>1, :campaignClass=>"T", :campaignId=>"CABC123", :bwLatency=>1, :carrierLatency=>2, :callingNumberCountryA3=>"USA", :calledNumberCountryA3=>"USA", :product=>"MESSAGING-V2", :location=>"loc-1"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(list_message_item_default.eql?(Bandwidth::ListMessageItem.new)).to be true
-
1
expect(list_message_item_default.eql?(list_message_item_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(list_message_item_values.to_body).to eq({
-
messageId: '1589228074636lm4k2je7j7jklbn2',
-
accountId: '9900000',
-
sourceTn: '+19195554321',
-
destinationTn: '+19195551234',
-
messageStatus: Bandwidth::MessageStatusEnum::DELIVERED,
-
messageDirection: Bandwidth::ListMessageDirectionEnum::OUTBOUND,
-
messageType: Bandwidth::MessageTypeEnum::SMS,
-
segmentCount: 1,
-
errorCode: 0,
-
receiveTime: '2022-06-16T13:15:07.160Z',
-
carrierName: 'verizon',
-
messageSize: 27,
-
messageLength: 18,
-
attachmentCount: 0,
-
recipientCount: 1,
-
campaignClass: 'T',
-
campaignId: 'CABC123',
-
bwLatency: 1,
-
carrierLatency: 2,
-
callingNumberCountryA3: 'USA',
-
calledNumberCountryA3: 'USA',
-
product: 'MESSAGING-V2',
-
location: 'loc-1'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LookupErrorResponse
-
1
describe Bandwidth::LookupErrorResponse do
-
2
let(:lookup_error_response_default) { Bandwidth::LookupErrorResponse.new }
-
4
let(:lookup_error_response_values) { Bandwidth::LookupErrorResponse.new({
-
links: [Bandwidth::LinkSchema.new({ href: 'https://example.com', rel: 'self', method: 'GET' })],
-
data: { foo: 'bar' },
-
errors: [Bandwidth::LookupErrorSchema.new({ code: '400', description: 'bad request', type: 'validation' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LookupErrorResponse.acceptable_attributes).to eq(Bandwidth::LookupErrorResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LookupErrorResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LookupErrorResponse created by the build_from_hash method' do
-
1
lookup_error_response_from_hash = Bandwidth::LookupErrorResponse.build_from_hash({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { foo: 'bar' },
-
errors: [{ code: '400', description: 'bad request', type: 'validation' }]
-
})
-
1
expect(lookup_error_response_from_hash).to be_instance_of(Bandwidth::LookupErrorResponse)
-
1
expect(lookup_error_response_from_hash.links.first).to be_instance_of(Bandwidth::LinkSchema)
-
1
expect(lookup_error_response_from_hash.data).to eq({ foo: 'bar' })
-
1
expect(lookup_error_response_from_hash.errors.first).to be_instance_of(Bandwidth::LookupErrorSchema)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(lookup_error_response_values.to_s).to eq('{:links=>[{:href=>"https://example.com", :rel=>"self", :method=>"GET"}], :data=>{:foo=>"bar"}, :errors=>[{:code=>"400", :description=>"bad request", :type=>"validation"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(lookup_error_response_default.eql?(Bandwidth::LookupErrorResponse.new)).to be true
-
1
expect(lookup_error_response_default.eql?(lookup_error_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(lookup_error_response_values.to_body).to eq({
-
links: [{ href: 'https://example.com', rel: 'self', method: 'GET' }],
-
data: { foo: 'bar' },
-
errors: [{ code: '400', description: 'bad request', type: 'validation' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LookupErrorSchemaMeta
-
1
describe Bandwidth::LookupErrorSchemaMeta do
-
2
let(:lookup_error_schema_meta_default) { Bandwidth::LookupErrorSchemaMeta.new }
-
4
let(:lookup_error_schema_meta_values) { Bandwidth::LookupErrorSchemaMeta.new({
-
phone_numbers: ['+19195551234'],
-
message: 'invalid phone number',
-
code: 400
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchemaMeta.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchemaMeta.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LookupErrorSchemaMeta.acceptable_attributes).to eq(Bandwidth::LookupErrorSchemaMeta.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LookupErrorSchemaMeta.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LookupErrorSchemaMeta created by the build_from_hash method' do
-
1
lookup_error_schema_meta_from_hash = Bandwidth::LookupErrorSchemaMeta.build_from_hash({
-
phoneNumbers: ['+19195551234'],
-
message: 'invalid phone number',
-
code: 400
-
})
-
1
expect(lookup_error_schema_meta_from_hash).to be_instance_of(Bandwidth::LookupErrorSchemaMeta)
-
1
expect(lookup_error_schema_meta_from_hash.phone_numbers).to eq(['+19195551234'])
-
1
expect(lookup_error_schema_meta_from_hash.message).to eq('invalid phone number')
-
1
expect(lookup_error_schema_meta_from_hash.code).to eq(400)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(lookup_error_schema_meta_values.to_s).to eq('{:phoneNumbers=>["+19195551234"], :message=>"invalid phone number", :code=>400}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(lookup_error_schema_meta_default.eql?(Bandwidth::LookupErrorSchemaMeta.new)).to be true
-
1
expect(lookup_error_schema_meta_default.eql?(lookup_error_schema_meta_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(lookup_error_schema_meta_values.to_body).to eq({
-
phoneNumbers: ['+19195551234'],
-
message: 'invalid phone number',
-
code: 400
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LookupErrorSchema
-
1
describe Bandwidth::LookupErrorSchema do
-
2
let(:lookup_error_schema_default) { Bandwidth::LookupErrorSchema.new({
-
code: '400',
-
description: 'baseline description',
-
type: 'baseline'
-
}) }
-
4
let(:lookup_error_schema_values) { Bandwidth::LookupErrorSchema.new({
-
code: '404',
-
description: 'not found',
-
type: 'validation',
-
meta: Bandwidth::LookupErrorSchemaMeta.new({ phone_numbers: ['+19195551234'], message: 'invalid', code: 404 })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchema.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchema.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LookupErrorSchema.acceptable_attributes).to eq(Bandwidth::LookupErrorSchema.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LookupErrorSchema.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LookupErrorSchema created by the build_from_hash method' do
-
1
lookup_error_schema_from_hash = Bandwidth::LookupErrorSchema.build_from_hash({
-
code: '404',
-
description: 'not found',
-
type: 'validation',
-
meta: { phoneNumbers: ['+19195551234'], message: 'invalid', code: 404 }
-
})
-
1
expect(lookup_error_schema_from_hash).to be_instance_of(Bandwidth::LookupErrorSchema)
-
1
expect(lookup_error_schema_from_hash.code).to eq('404')
-
1
expect(lookup_error_schema_from_hash.description).to eq('not found')
-
1
expect(lookup_error_schema_from_hash.type).to eq('validation')
-
1
expect(lookup_error_schema_from_hash.meta).to be_instance_of(Bandwidth::LookupErrorSchemaMeta)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(lookup_error_schema_values.to_s).to eq('{:code=>"404", :description=>"not found", :type=>"validation", :meta=>{:phoneNumbers=>["+19195551234"], :message=>"invalid", :code=>404}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
lookup_error_schema_equal = Bandwidth::LookupErrorSchema.new({
-
code: '400',
-
description: 'baseline description',
-
type: 'baseline'
-
})
-
1
expect(lookup_error_schema_default.eql?(lookup_error_schema_equal)).to be true
-
1
expect(lookup_error_schema_default.eql?(lookup_error_schema_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(lookup_error_schema_values.to_body).to eq({
-
code: '404',
-
description: 'not found',
-
type: 'validation',
-
meta: { phoneNumbers: ['+19195551234'], message: 'invalid', code: 404 }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#code=' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchema.new({ code: nil })
-
}.to raise_error(ArgumentError, 'code cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchema.new({ code: '400', description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::LookupErrorSchema.new({ code: '400', description: 'a', type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::LookupResult
-
1
describe Bandwidth::LookupResult do
-
2
let(:lookup_result_default) { Bandwidth::LookupResult.new }
-
4
let(:lookup_result_values) { Bandwidth::LookupResult.new({
-
phone_number: '+19195551234',
-
line_type: Bandwidth::LineTypeEnum::MOBILE,
-
messaging_provider: 'Bandwidth',
-
voice_provider: 'Bandwidth',
-
country_code_a3: 'USA',
-
deactivation_reporter: 'verizon',
-
deactivation_date: '2024-01-01',
-
deactivation_event: Bandwidth::DeactivationEventEnum::DEACTIVATED,
-
latest_message_delivery_status: Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE,
-
initial_message_delivery_status_date: '2024-01-01',
-
latest_message_delivery_status_date: '2024-01-02',
-
rcs_enabled: true
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupResult.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::LookupResult.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::LookupResult.acceptable_attributes).to eq(Bandwidth::LookupResult.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::LookupResult.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of LookupResult created by the build_from_hash method' do
-
1
lookup_result_from_hash = Bandwidth::LookupResult.build_from_hash({
-
phoneNumber: '+19195551234',
-
lineType: 'MOBILE',
-
messagingProvider: 'Bandwidth',
-
voiceProvider: 'Bandwidth',
-
countryCodeA3: 'USA',
-
deactivationReporter: 'verizon',
-
deactivationDate: '2024-01-01',
-
deactivationEvent: 'DEACTIVATED',
-
latestMessageDeliveryStatus: 'ACTIVE',
-
initialMessageDeliveryStatusDate: '2024-01-01',
-
latestMessageDeliveryStatusDate: '2024-01-02',
-
rcsEnabled: true
-
})
-
1
expect(lookup_result_from_hash).to be_instance_of(Bandwidth::LookupResult)
-
1
expect(lookup_result_from_hash.phone_number).to eq('+19195551234')
-
1
expect(lookup_result_from_hash.line_type).to eq('MOBILE')
-
1
expect(lookup_result_from_hash.messaging_provider).to eq('Bandwidth')
-
1
expect(lookup_result_from_hash.voice_provider).to eq('Bandwidth')
-
1
expect(lookup_result_from_hash.country_code_a3).to eq('USA')
-
1
expect(lookup_result_from_hash.deactivation_reporter).to eq('verizon')
-
1
expect(lookup_result_from_hash.deactivation_date).to eq('2024-01-01')
-
1
expect(lookup_result_from_hash.deactivation_event).to eq('DEACTIVATED')
-
1
expect(lookup_result_from_hash.latest_message_delivery_status).to eq('ACTIVE')
-
1
expect(lookup_result_from_hash.initial_message_delivery_status_date).to eq(Date.parse('2024-01-01'))
-
1
expect(lookup_result_from_hash.latest_message_delivery_status_date).to eq(Date.parse('2024-01-02'))
-
1
expect(lookup_result_from_hash.rcs_enabled).to eq(true)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(lookup_result_values.to_s).to eq('{:phoneNumber=>"+19195551234", :lineType=>"MOBILE", :messagingProvider=>"Bandwidth", :voiceProvider=>"Bandwidth", :countryCodeA3=>"USA", :deactivationReporter=>"verizon", :deactivationDate=>"2024-01-01", :deactivationEvent=>"DEACTIVATED", :latestMessageDeliveryStatus=>"ACTIVE", :initialMessageDeliveryStatusDate=>"2024-01-01", :latestMessageDeliveryStatusDate=>"2024-01-02", :rcsEnabled=>true}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(lookup_result_default.eql?(Bandwidth::LookupResult.new)).to be true
-
1
expect(lookup_result_default.eql?(lookup_result_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(lookup_result_values.to_body).to eq({
-
phoneNumber: '+19195551234',
-
lineType: Bandwidth::LineTypeEnum::MOBILE,
-
messagingProvider: 'Bandwidth',
-
voiceProvider: 'Bandwidth',
-
countryCodeA3: 'USA',
-
deactivationReporter: 'verizon',
-
deactivationDate: '2024-01-01',
-
deactivationEvent: Bandwidth::DeactivationEventEnum::DEACTIVATED,
-
latestMessageDeliveryStatus: Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE,
-
initialMessageDeliveryStatusDate: '2024-01-01',
-
latestMessageDeliveryStatusDate: '2024-01-02',
-
rcsEnabled: true
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MachineDetectionCompleteCallback
-
1
describe Bandwidth::MachineDetectionCompleteCallback do
-
2
let(:machine_detection_complete_callback_default) { Bandwidth::MachineDetectionCompleteCallback.new }
-
4
let(:machine_detection_complete_callback_values) { Bandwidth::MachineDetectionCompleteCallback.new({
-
event_type: 'machineDetectionComplete',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machine_detection_result: { value: 'human', duration: 'PT5S' }
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionCompleteCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionCompleteCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MachineDetectionCompleteCallback.acceptable_attributes).to eq(Bandwidth::MachineDetectionCompleteCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::MachineDetectionCompleteCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'machine_detection_result'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MachineDetectionCompleteCallback created by the build_from_hash method' do
-
1
machine_detection_complete_callback_from_hash = Bandwidth::MachineDetectionCompleteCallback.build_from_hash({
-
eventType: 'machineDetectionComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machineDetectionResult: { value: 'human', duration: 'PT5S' }
-
})
-
1
expect(machine_detection_complete_callback_from_hash).to be_instance_of(Bandwidth::MachineDetectionCompleteCallback)
-
1
expect(machine_detection_complete_callback_from_hash.event_type).to eq('machineDetectionComplete')
-
1
expect(machine_detection_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(machine_detection_complete_callback_from_hash.account_id).to eq('9900000')
-
1
expect(machine_detection_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(machine_detection_complete_callback_from_hash.from).to eq('+19195554321')
-
1
expect(machine_detection_complete_callback_from_hash.to).to eq('+19195551234')
-
1
expect(machine_detection_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(machine_detection_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(machine_detection_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(machine_detection_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(machine_detection_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(machine_detection_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(machine_detection_complete_callback_from_hash.tag).to eq('custom tag')
-
1
expect(machine_detection_complete_callback_from_hash.machine_detection_result).to be_instance_of(Bandwidth::MachineDetectionResult)
-
1
expect(machine_detection_complete_callback_from_hash.machine_detection_result.value).to eq('human')
-
1
expect(machine_detection_complete_callback_from_hash.machine_detection_result.duration).to eq('PT5S')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(machine_detection_complete_callback_values.to_s).to eq('{:eventType=>"machineDetectionComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :machineDetectionResult=>{:value=>"human", :duration=>"PT5S"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(machine_detection_complete_callback_default.eql?(Bandwidth::MachineDetectionCompleteCallback.new)).to be true
-
1
expect(machine_detection_complete_callback_default.eql?(machine_detection_complete_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(machine_detection_complete_callback_values.to_body).to eq({
-
eventType: 'machineDetectionComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
machineDetectionResult: { value: 'human', duration: 'PT5S' }
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MachineDetectionConfiguration
-
1
describe Bandwidth::MachineDetectionConfiguration do
-
2
let(:machine_detection_configuration_default) { Bandwidth::MachineDetectionConfiguration.new }
-
4
let(:machine_detection_configuration_values) { Bandwidth::MachineDetectionConfiguration.new({
-
mode: Bandwidth::MachineDetectionModeEnum::SYNC,
-
detection_timeout: 20,
-
silence_timeout: 12,
-
speech_threshold: 8,
-
speech_end_threshold: 4,
-
machine_speech_end_threshold: 7,
-
delay_result: true,
-
callback_url: 'https://example.com/callback',
-
callback_method: Bandwidth::CallbackMethodEnum::GET,
-
username: 'user',
-
password: 'pass',
-
fallback_url: 'https://example.com/fallback',
-
fallback_method: Bandwidth::CallbackMethodEnum::GET,
-
fallback_username: 'fallback-user',
-
fallback_password: 'fallback-pass'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MachineDetectionConfiguration.acceptable_attributes).to eq(Bandwidth::MachineDetectionConfiguration.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::MachineDetectionConfiguration.openapi_nullable).to eq(Set.new([
-
:'detection_timeout',
-
:'silence_timeout',
-
:'speech_threshold',
-
:'speech_end_threshold',
-
:'machine_speech_end_threshold',
-
:'delay_result',
-
:'callback_url',
-
:'callback_method',
-
:'username',
-
:'password',
-
:'fallback_url',
-
:'fallback_method',
-
:'fallback_username',
-
:'fallback_password'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MachineDetectionConfiguration created by the build_from_hash method' do
-
1
machine_detection_configuration_from_hash = Bandwidth::MachineDetectionConfiguration.build_from_hash({
-
mode: 'sync',
-
detectionTimeout: 20,
-
silenceTimeout: 12,
-
speechThreshold: 8,
-
speechEndThreshold: 4,
-
machineSpeechEndThreshold: 7,
-
delayResult: true,
-
callbackUrl: 'https://example.com/callback',
-
callbackMethod: 'GET',
-
username: 'user',
-
password: 'pass',
-
fallbackUrl: 'https://example.com/fallback',
-
fallbackMethod: 'GET',
-
fallbackUsername: 'fallback-user',
-
fallbackPassword: 'fallback-pass'
-
})
-
1
expect(machine_detection_configuration_from_hash).to be_instance_of(Bandwidth::MachineDetectionConfiguration)
-
1
expect(machine_detection_configuration_from_hash.mode).to eq('sync')
-
1
expect(machine_detection_configuration_from_hash.detection_timeout).to eq(20.0)
-
1
expect(machine_detection_configuration_from_hash.silence_timeout).to eq(12.0)
-
1
expect(machine_detection_configuration_from_hash.speech_threshold).to eq(8.0)
-
1
expect(machine_detection_configuration_from_hash.speech_end_threshold).to eq(4.0)
-
1
expect(machine_detection_configuration_from_hash.machine_speech_end_threshold).to eq(7.0)
-
1
expect(machine_detection_configuration_from_hash.delay_result).to eq(true)
-
1
expect(machine_detection_configuration_from_hash.callback_url).to eq('https://example.com/callback')
-
1
expect(machine_detection_configuration_from_hash.callback_method).to eq('GET')
-
1
expect(machine_detection_configuration_from_hash.username).to eq('user')
-
1
expect(machine_detection_configuration_from_hash.password).to eq('pass')
-
1
expect(machine_detection_configuration_from_hash.fallback_url).to eq('https://example.com/fallback')
-
1
expect(machine_detection_configuration_from_hash.fallback_method).to eq('GET')
-
1
expect(machine_detection_configuration_from_hash.fallback_username).to eq('fallback-user')
-
1
expect(machine_detection_configuration_from_hash.fallback_password).to eq('fallback-pass')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(machine_detection_configuration_values.to_s).to eq('{:mode=>"sync", :detectionTimeout=>20, :silenceTimeout=>12, :speechThreshold=>8, :speechEndThreshold=>4, :machineSpeechEndThreshold=>7, :delayResult=>true, :callbackUrl=>"https://example.com/callback", :callbackMethod=>"GET", :username=>"user", :password=>"pass", :fallbackUrl=>"https://example.com/fallback", :fallbackMethod=>"GET", :fallbackUsername=>"fallback-user", :fallbackPassword=>"fallback-pass"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(machine_detection_configuration_default.eql?(Bandwidth::MachineDetectionConfiguration.new)).to be true
-
1
expect(machine_detection_configuration_default.eql?(machine_detection_configuration_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(machine_detection_configuration_values.to_body).to eq({
-
mode: Bandwidth::MachineDetectionModeEnum::SYNC,
-
detectionTimeout: 20,
-
silenceTimeout: 12,
-
speechThreshold: 8,
-
speechEndThreshold: 4,
-
machineSpeechEndThreshold: 7,
-
delayResult: true,
-
callbackUrl: 'https://example.com/callback',
-
callbackMethod: Bandwidth::CallbackMethodEnum::GET,
-
username: 'user',
-
password: 'pass',
-
fallbackUrl: 'https://example.com/fallback',
-
fallbackMethod: Bandwidth::CallbackMethodEnum::GET,
-
fallbackUsername: 'fallback-user',
-
fallbackPassword: 'fallback-pass'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#callback_url=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ callback_url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_url=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ fallback_url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_url", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#fallback_username=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ fallback_username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_password=' do
-
1
expect {
-
1
Bandwidth::MachineDetectionConfiguration.new({ fallback_password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MachineDetectionModeEnum
-
1
describe Bandwidth::MachineDetectionModeEnum do
-
1
describe 'constants' do
-
1
it 'defines SYNC' do
-
1
expect(Bandwidth::MachineDetectionModeEnum::SYNC).to eq('sync')
-
end
-
-
1
it 'defines ASYNC' do
-
1
expect(Bandwidth::MachineDetectionModeEnum::ASYNC).to eq('async')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::MachineDetectionModeEnum.all_vars).to eq([
-
'sync',
-
'async'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::MachineDetectionModeEnum.build_from_hash('sync')).to eq('sync')
-
1
expect(Bandwidth::MachineDetectionModeEnum.build_from_hash('async')).to eq('async')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::MachineDetectionModeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MachineDetectionResult
-
1
describe Bandwidth::MachineDetectionResult do
-
2
let(:machine_detection_result_default) { Bandwidth::MachineDetectionResult.new }
-
4
let(:machine_detection_result_values) { Bandwidth::MachineDetectionResult.new({
-
value: 'human',
-
duration: 'PT5S'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionResult.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MachineDetectionResult.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MachineDetectionResult.acceptable_attributes).to eq(Bandwidth::MachineDetectionResult.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MachineDetectionResult.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MachineDetectionResult created by the build_from_hash method' do
-
1
machine_detection_result_from_hash = Bandwidth::MachineDetectionResult.build_from_hash({
-
value: 'human',
-
duration: 'PT5S'
-
})
-
1
expect(machine_detection_result_from_hash).to be_instance_of(Bandwidth::MachineDetectionResult)
-
1
expect(machine_detection_result_from_hash.value).to eq('human')
-
1
expect(machine_detection_result_from_hash.duration).to eq('PT5S')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(machine_detection_result_values.to_s).to eq('{:value=>"human", :duration=>"PT5S"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(machine_detection_result_default.eql?(Bandwidth::MachineDetectionResult.new)).to be true
-
1
expect(machine_detection_result_default.eql?(machine_detection_result_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(machine_detection_result_values.to_body).to eq({
-
value: 'human',
-
duration: 'PT5S'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Media
-
1
describe Bandwidth::Media do
-
2
let(:media_default) { Bandwidth::Media.new }
-
4
let(:media_values) { Bandwidth::Media.new({
-
content: 'https://example.com/media/1.jpg',
-
content_length: 12345,
-
media_name: 'image.jpg'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Media.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Media.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Media.acceptable_attributes).to eq(Bandwidth::Media.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Media.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Media created by the build_from_hash method' do
-
1
media_from_hash = Bandwidth::Media.build_from_hash({
-
content: 'https://example.com/media/1.jpg',
-
contentLength: 12345,
-
mediaName: 'image.jpg'
-
})
-
1
expect(media_from_hash).to be_instance_of(Bandwidth::Media)
-
1
expect(media_from_hash.content).to eq('https://example.com/media/1.jpg')
-
1
expect(media_from_hash.content_length).to eq(12345)
-
1
expect(media_from_hash.media_name).to eq('image.jpg')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(media_values.to_s).to eq('{:content=>"https://example.com/media/1.jpg", :contentLength=>12345, :mediaName=>"image.jpg"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(media_default.eql?(Bandwidth::Media.new)).to be true
-
1
expect(media_default.eql?(media_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(media_values.to_body).to eq({
-
content: 'https://example.com/media/1.jpg',
-
contentLength: 12345,
-
mediaName: 'image.jpg'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessageDirectionEnum
-
1
describe Bandwidth::MessageDirectionEnum do
-
1
describe 'constants' do
-
1
it 'defines IN' do
-
1
expect(Bandwidth::MessageDirectionEnum::IN).to eq('in')
-
end
-
-
1
it 'defines OUT' do
-
1
expect(Bandwidth::MessageDirectionEnum::OUT).to eq('out')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::MessageDirectionEnum.all_vars).to eq([
-
'in',
-
'out'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::MessageDirectionEnum.build_from_hash('in')).to eq('in')
-
1
expect(Bandwidth::MessageDirectionEnum.build_from_hash('out')).to eq('out')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::MessageDirectionEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessageRequest
-
1
describe Bandwidth::MessageRequest do
-
2
let(:message_request_default) { Bandwidth::MessageRequest.new({
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
to: ['+19195551234'],
-
from: '+19195554321'
-
}) }
-
6
let(:message_request_values) { Bandwidth::MessageRequest.new({
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2022-06-16T13:45:07.160Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessageRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessageRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MessageRequest.acceptable_attributes).to eq(Bandwidth::MessageRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MessageRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MessageRequest created by the build_from_hash method' do
-
1
message_request_from_hash = Bandwidth::MessageRequest.build_from_hash({
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
tag: 'custom tag',
-
priority: 'default',
-
expiration: '2022-06-16T13:45:07.160Z'
-
})
-
1
expect(message_request_from_hash).to be_instance_of(Bandwidth::MessageRequest)
-
1
expect(message_request_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(message_request_from_hash.to).to eq(['+19195551234'])
-
1
expect(message_request_from_hash.from).to eq('+19195554321')
-
1
expect(message_request_from_hash.text).to eq('Hello world')
-
1
expect(message_request_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png'])
-
1
expect(message_request_from_hash.tag).to eq('custom tag')
-
1
expect(message_request_from_hash.priority).to eq('default')
-
1
expect(message_request_from_hash.expiration).to eq(Time.parse('2022-06-16T13:45:07.160Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(message_request_values.to_s).to eq('{:applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :to=>["+19195551234"], :from=>"+19195554321", :text=>"Hello world", :media=>["https://dev.bandwidth.com/images/bandwidth-logo.png"], :tag=>"custom tag", :priority=>"default", :expiration=>"2022-06-16T13:45:07.160Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
message_request_equal = Bandwidth::MessageRequest.new({
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
to: ['+19195551234'],
-
from: '+19195554321'
-
})
-
1
expect(message_request_default.eql?(message_request_equal)).to be true
-
1
expect(message_request_default.eql?(message_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(message_request_values.to_body).to eq({
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2022-06-16T13:45:07.160Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MessageRequest.new({ application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
message_request_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MessageRequest.new({ application_id: 'a', to: ['+19195551234'], from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
message_request_values.text = nil
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
message_request_values.text = 'a' * 2049
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Message
-
1
describe Bandwidth::Message do
-
2
let(:message_default) { Bandwidth::Message.new }
-
6
let(:message_values) { Bandwidth::Message.new({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
text: 'Hello world',
-
tag: 'custom tag',
-
priority: 'default',
-
expiration: '2022-06-16T13:45:07.160Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Message.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Message.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Message.acceptable_attributes).to eq(Bandwidth::Message.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Message.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Message created by the build_from_hash method' do
-
1
message_from_hash = Bandwidth::Message.build_from_hash({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
text: 'Hello world',
-
tag: 'custom tag',
-
priority: 'default',
-
expiration: '2022-06-16T13:45:07.160Z'
-
})
-
1
expect(message_from_hash).to be_instance_of(Bandwidth::Message)
-
1
expect(message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(message_from_hash.owner).to eq('+19195554321')
-
1
expect(message_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(message_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(message_from_hash.segment_count).to eq(2)
-
1
expect(message_from_hash.direction).to eq(Bandwidth::MessageDirectionEnum::IN)
-
1
expect(message_from_hash.to).to eq(['+19195551234'])
-
1
expect(message_from_hash.from).to eq('+19195554321')
-
1
expect(message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png'])
-
1
expect(message_from_hash.text).to eq('Hello world')
-
1
expect(message_from_hash.tag).to eq('custom tag')
-
1
expect(message_from_hash.priority).to eq('default')
-
1
expect(message_from_hash.expiration).to eq(Time.parse('2022-06-16T13:45:07.160Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(message_values.to_s).to eq('{:id=>"1589228074636lm4k2je7j7jklbn2", :owner=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :time=>"2022-06-16T13:15:07.160Z", :segmentCount=>2, :direction=>"in", :to=>["+19195551234"], :from=>"+19195554321", :media=>["https://dev.bandwidth.com/images/bandwidth-logo.png"], :text=>"Hello world", :tag=>"custom tag", :priority=>"default", :expiration=>"2022-06-16T13:45:07.160Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(message_default.eql?(Bandwidth::Message.new)).to be true
-
1
expect(message_default.eql?(message_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(message_values.to_body).to eq({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::IN,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
text: 'Hello world',
-
tag: 'custom tag',
-
priority: 'default',
-
expiration: '2022-06-16T13:45:07.160Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#to=' do
-
1
expect {
-
1
message_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#media=' do
-
1
expect {
-
1
message_values.media = nil
-
}.to raise_error(ArgumentError, 'media cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessageStatusEnum
-
1
describe Bandwidth::MessageStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines RECEIVED' do
-
1
expect(Bandwidth::MessageStatusEnum::RECEIVED).to eq('RECEIVED')
-
end
-
-
1
it 'defines QUEUED' do
-
1
expect(Bandwidth::MessageStatusEnum::QUEUED).to eq('QUEUED')
-
end
-
-
1
it 'defines SENDING' do
-
1
expect(Bandwidth::MessageStatusEnum::SENDING).to eq('SENDING')
-
end
-
-
1
it 'defines SENT' do
-
1
expect(Bandwidth::MessageStatusEnum::SENT).to eq('SENT')
-
end
-
-
1
it 'defines FAILED' do
-
1
expect(Bandwidth::MessageStatusEnum::FAILED).to eq('FAILED')
-
end
-
-
1
it 'defines DELIVERED' do
-
1
expect(Bandwidth::MessageStatusEnum::DELIVERED).to eq('DELIVERED')
-
end
-
-
1
it 'defines ACCEPTED' do
-
1
expect(Bandwidth::MessageStatusEnum::ACCEPTED).to eq('ACCEPTED')
-
end
-
-
1
it 'defines UNDELIVERED' do
-
1
expect(Bandwidth::MessageStatusEnum::UNDELIVERED).to eq('UNDELIVERED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::MessageStatusEnum.all_vars).to eq([
-
'RECEIVED',
-
'QUEUED',
-
'SENDING',
-
'SENT',
-
'FAILED',
-
'DELIVERED',
-
'ACCEPTED',
-
'UNDELIVERED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('RECEIVED')).to eq('RECEIVED')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('QUEUED')).to eq('QUEUED')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('SENDING')).to eq('SENDING')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('SENT')).to eq('SENT')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('FAILED')).to eq('FAILED')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('DELIVERED')).to eq('DELIVERED')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('ACCEPTED')).to eq('ACCEPTED')
-
1
expect(Bandwidth::MessageStatusEnum.build_from_hash('UNDELIVERED')).to eq('UNDELIVERED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::MessageStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessageTypeEnum
-
1
describe Bandwidth::MessageTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines SMS' do
-
1
expect(Bandwidth::MessageTypeEnum::SMS).to eq('sms')
-
end
-
-
1
it 'defines MMS' do
-
1
expect(Bandwidth::MessageTypeEnum::MMS).to eq('mms')
-
end
-
-
1
it 'defines RCS' do
-
1
expect(Bandwidth::MessageTypeEnum::RCS).to eq('rcs')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::MessageTypeEnum.all_vars).to eq([
-
'sms',
-
'mms',
-
'rcs'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::MessageTypeEnum.build_from_hash('sms')).to eq('sms')
-
1
expect(Bandwidth::MessageTypeEnum.build_from_hash('mms')).to eq('mms')
-
1
expect(Bandwidth::MessageTypeEnum.build_from_hash('rcs')).to eq('rcs')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::MessageTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessagesList
-
1
describe Bandwidth::MessagesList do
-
4
let(:page_info) { Bandwidth::PageInfo.new({
-
prev_page: 'https://example.com/prev',
-
next_page: 'https://example.com/next',
-
prev_page_token: 'prev-token',
-
next_page_token: 'next-token'
-
}) }
-
4
let(:list_message_item) { Bandwidth::ListMessageItem.new({ message_id: 'abc-123', message_length: 10 }) }
-
2
let(:messages_list_default) { Bandwidth::MessagesList.new }
-
4
let(:messages_list_values) { Bandwidth::MessagesList.new({
-
total_count: 1,
-
page_info: page_info,
-
messages: [list_message_item]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagesList.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagesList.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MessagesList.acceptable_attributes).to eq(Bandwidth::MessagesList.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MessagesList.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MessagesList created by the build_from_hash method' do
-
1
messages_list_from_hash = Bandwidth::MessagesList.build_from_hash({
-
totalCount: 1,
-
pageInfo: { prevPage: 'https://example.com/prev', nextPage: 'https://example.com/next', prevPageToken: 'prev-token', nextPageToken: 'next-token' },
-
messages: [{ messageId: 'abc-123', messageLength: 10 }]
-
})
-
1
expect(messages_list_from_hash).to be_instance_of(Bandwidth::MessagesList)
-
1
expect(messages_list_from_hash.total_count).to eq(1)
-
1
expect(messages_list_from_hash.page_info).to be_instance_of(Bandwidth::PageInfo)
-
1
expect(messages_list_from_hash.messages.first).to be_instance_of(Bandwidth::ListMessageItem)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(messages_list_values.to_s).to eq('{:totalCount=>1, :pageInfo=>{:prevPage=>"https://example.com/prev", :nextPage=>"https://example.com/next", :prevPageToken=>"prev-token", :nextPageToken=>"next-token"}, :messages=>[{:messageId=>"abc-123", :messageLength=>10}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(messages_list_default.eql?(Bandwidth::MessagesList.new)).to be true
-
1
expect(messages_list_default.eql?(messages_list_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(messages_list_values.to_body).to eq({
-
totalCount: 1,
-
pageInfo: { prevPage: 'https://example.com/prev', nextPage: 'https://example.com/next', prevPageToken: 'prev-token', nextPageToken: 'next-token' },
-
messages: [{ messageId: 'abc-123', messageLength: 10 }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessagingCodeResponse
-
1
describe Bandwidth::MessagingCodeResponse do
-
2
let(:messaging_code_response_default) { Bandwidth::MessagingCodeResponse.new }
-
4
let(:messaging_code_response_values) { Bandwidth::MessagingCodeResponse.new({
-
message_id: '1589228074636lm4k2je7j7jklbn2'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagingCodeResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagingCodeResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MessagingCodeResponse.acceptable_attributes).to eq(Bandwidth::MessagingCodeResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MessagingCodeResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MessagingCodeResponse created by the build_from_hash method' do
-
1
messaging_code_response_from_hash = Bandwidth::MessagingCodeResponse.build_from_hash({
-
messageId: '1589228074636lm4k2je7j7jklbn2'
-
})
-
1
expect(messaging_code_response_from_hash).to be_instance_of(Bandwidth::MessagingCodeResponse)
-
1
expect(messaging_code_response_from_hash.message_id).to eq('1589228074636lm4k2je7j7jklbn2')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(messaging_code_response_values.to_s).to eq('{:messageId=>"1589228074636lm4k2je7j7jklbn2"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(messaging_code_response_default.eql?(Bandwidth::MessagingCodeResponse.new)).to be true
-
1
expect(messaging_code_response_default.eql?(messaging_code_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(messaging_code_response_values.to_body).to eq({
-
messageId: '1589228074636lm4k2je7j7jklbn2'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MessagingRequestError
-
1
describe Bandwidth::MessagingRequestError do
-
2
let(:messaging_request_error_default) { Bandwidth::MessagingRequestError.new({
-
type: 'baseline',
-
description: 'baseline description'
-
}) }
-
4
let(:messaging_request_error_values) { Bandwidth::MessagingRequestError.new({
-
type: 'validation',
-
description: 'bad input'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagingRequestError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MessagingRequestError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MessagingRequestError.acceptable_attributes).to eq(Bandwidth::MessagingRequestError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MessagingRequestError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MessagingRequestError created by the build_from_hash method' do
-
1
messaging_request_error_from_hash = Bandwidth::MessagingRequestError.build_from_hash({
-
type: 'validation',
-
description: 'bad input'
-
})
-
1
expect(messaging_request_error_from_hash).to be_instance_of(Bandwidth::MessagingRequestError)
-
1
expect(messaging_request_error_from_hash.type).to eq('validation')
-
1
expect(messaging_request_error_from_hash.description).to eq('bad input')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(messaging_request_error_values.to_s).to eq('{:type=>"validation", :description=>"bad input"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
messaging_request_error_equal = Bandwidth::MessagingRequestError.new({
-
type: 'baseline',
-
description: 'baseline description'
-
})
-
1
expect(messaging_request_error_default.eql?(messaging_request_error_equal)).to be true
-
1
expect(messaging_request_error_default.eql?(messaging_request_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(messaging_request_error_values.to_body).to eq({
-
type: 'validation',
-
description: 'bad input'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::MessagingRequestError.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::MessagingRequestError.new({ type: 'a', description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MfaForbiddenRequestError
-
1
describe Bandwidth::MfaForbiddenRequestError do
-
2
let(:mfa_forbidden_request_error_default) { Bandwidth::MfaForbiddenRequestError.new }
-
4
let(:mfa_forbidden_request_error_values) { Bandwidth::MfaForbiddenRequestError.new({
-
message: 'Forbidden request'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaForbiddenRequestError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaForbiddenRequestError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MfaForbiddenRequestError.acceptable_attributes).to eq(Bandwidth::MfaForbiddenRequestError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MfaForbiddenRequestError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MfaForbiddenRequestError created by the build_from_hash method' do
-
1
mfa_forbidden_request_error_from_hash = Bandwidth::MfaForbiddenRequestError.build_from_hash({
-
message: 'Forbidden request'
-
})
-
1
expect(mfa_forbidden_request_error_from_hash).to be_instance_of(Bandwidth::MfaForbiddenRequestError)
-
1
expect(mfa_forbidden_request_error_from_hash.message).to eq('Forbidden request')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(mfa_forbidden_request_error_values.to_s).to eq('{:message=>"Forbidden request"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(mfa_forbidden_request_error_default.eql?(Bandwidth::MfaForbiddenRequestError.new)).to be true
-
1
expect(mfa_forbidden_request_error_default.eql?(mfa_forbidden_request_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(mfa_forbidden_request_error_values.to_body).to eq({
-
message: 'Forbidden request'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MfaRequestError
-
1
describe Bandwidth::MfaRequestError do
-
2
let(:mfa_request_error_default) { Bandwidth::MfaRequestError.new }
-
4
let(:mfa_request_error_values) { Bandwidth::MfaRequestError.new({
-
error: 'Invalid request',
-
request_id: 'req-abc-123'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaRequestError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaRequestError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MfaRequestError.acceptable_attributes).to eq(Bandwidth::MfaRequestError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MfaRequestError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MfaRequestError created by the build_from_hash method' do
-
1
mfa_request_error_from_hash = Bandwidth::MfaRequestError.build_from_hash({
-
error: 'Invalid request',
-
requestId: 'req-abc-123'
-
})
-
1
expect(mfa_request_error_from_hash).to be_instance_of(Bandwidth::MfaRequestError)
-
1
expect(mfa_request_error_from_hash.error).to eq('Invalid request')
-
1
expect(mfa_request_error_from_hash.request_id).to eq('req-abc-123')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(mfa_request_error_values.to_s).to eq('{:error=>"Invalid request", :requestId=>"req-abc-123"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(mfa_request_error_default.eql?(Bandwidth::MfaRequestError.new)).to be true
-
1
expect(mfa_request_error_default.eql?(mfa_request_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(mfa_request_error_values.to_body).to eq({
-
error: 'Invalid request',
-
requestId: 'req-abc-123'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MfaUnauthorizedRequestError
-
1
describe Bandwidth::MfaUnauthorizedRequestError do
-
2
let(:mfa_unauthorized_request_error_default) { Bandwidth::MfaUnauthorizedRequestError.new }
-
4
let(:mfa_unauthorized_request_error_values) { Bandwidth::MfaUnauthorizedRequestError.new({
-
message: 'Unauthorized'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaUnauthorizedRequestError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MfaUnauthorizedRequestError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MfaUnauthorizedRequestError.acceptable_attributes).to eq(Bandwidth::MfaUnauthorizedRequestError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MfaUnauthorizedRequestError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MfaUnauthorizedRequestError created by the build_from_hash method' do
-
1
mfa_unauthorized_request_error_from_hash = Bandwidth::MfaUnauthorizedRequestError.build_from_hash({
-
message: 'Unauthorized'
-
})
-
1
expect(mfa_unauthorized_request_error_from_hash).to be_instance_of(Bandwidth::MfaUnauthorizedRequestError)
-
1
expect(mfa_unauthorized_request_error_from_hash.message).to eq('Unauthorized')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(mfa_unauthorized_request_error_values.to_s).to eq('{:message=>"Unauthorized"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(mfa_unauthorized_request_error_default.eql?(Bandwidth::MfaUnauthorizedRequestError.new)).to be true
-
1
expect(mfa_unauthorized_request_error_default.eql?(mfa_unauthorized_request_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(mfa_unauthorized_request_error_values.to_body).to eq({
-
message: 'Unauthorized'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MmsMessageContentFile
-
1
describe Bandwidth::MmsMessageContentFile do
-
2
let(:mms_message_content_file_default) { Bandwidth::MmsMessageContentFile.new({
-
file_url: 'https://example.com/baseline.jpg'
-
}) }
-
4
let(:mms_message_content_file_values) { Bandwidth::MmsMessageContentFile.new({
-
file_url: 'https://example.com/image.jpg'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MmsMessageContentFile.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MmsMessageContentFile.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MmsMessageContentFile.acceptable_attributes).to eq(Bandwidth::MmsMessageContentFile.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MmsMessageContentFile.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MmsMessageContentFile created by the build_from_hash method' do
-
1
mms_message_content_file_from_hash = Bandwidth::MmsMessageContentFile.build_from_hash({
-
fileUrl: 'https://example.com/image.jpg'
-
})
-
1
expect(mms_message_content_file_from_hash).to be_instance_of(Bandwidth::MmsMessageContentFile)
-
1
expect(mms_message_content_file_from_hash.file_url).to eq('https://example.com/image.jpg')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(mms_message_content_file_values.to_s).to eq('{:fileUrl=>"https://example.com/image.jpg"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
mms_message_content_file_equal = Bandwidth::MmsMessageContentFile.new({
-
file_url: 'https://example.com/baseline.jpg'
-
})
-
1
expect(mms_message_content_file_default.eql?(mms_message_content_file_equal)).to be true
-
1
expect(mms_message_content_file_default.eql?(mms_message_content_file_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(mms_message_content_file_values.to_body).to eq({
-
fileUrl: 'https://example.com/image.jpg'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#file_url=' do
-
1
expect {
-
1
Bandwidth::MmsMessageContentFile.new({ file_url: nil })
-
}.to raise_error(ArgumentError, 'file_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::MmsMessageContentFile.new({ file_url: 'a' * 1001 })
-
}.to raise_error(ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MmsMessageContent
-
1
describe Bandwidth::MmsMessageContent do
-
2
let(:mms_message_content_default) { Bandwidth::MmsMessageContent.new }
-
4
let(:mms_message_content_values) { Bandwidth::MmsMessageContent.new({
-
text: 'Hello world',
-
media: [Bandwidth::MmsMessageContentFile.new({ file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png' })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MmsMessageContent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MmsMessageContent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MmsMessageContent.acceptable_attributes).to eq(Bandwidth::MmsMessageContent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MmsMessageContent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MmsMessageContent created by the build_from_hash method' do
-
1
mms_message_content_from_hash = Bandwidth::MmsMessageContent.build_from_hash({
-
text: 'Hello world',
-
media: [{ fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }]
-
})
-
1
expect(mms_message_content_from_hash).to be_instance_of(Bandwidth::MmsMessageContent)
-
1
expect(mms_message_content_from_hash.text).to eq('Hello world')
-
1
expect(mms_message_content_from_hash.media).to be_instance_of(Array)
-
1
expect(mms_message_content_from_hash.media.first).to be_instance_of(Bandwidth::MmsMessageContentFile)
-
1
expect(mms_message_content_from_hash.media.first.file_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo.png')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(mms_message_content_values.to_s).to eq('{:text=>"Hello world", :media=>[{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(mms_message_content_default.eql?(Bandwidth::MmsMessageContent.new)).to be true
-
1
expect(mms_message_content_default.eql?(mms_message_content_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(mms_message_content_values.to_body).to eq({
-
text: 'Hello world',
-
media: [{ fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::MmsMessageContent.new({ text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::MmsMessageContent.new({ text: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelActionCalendarEvent
-
1
describe Bandwidth::MultiChannelActionCalendarEvent do
-
2
let(:multi_channel_action_calendar_event_default) { Bandwidth::MultiChannelActionCalendarEvent.new({
-
type: Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
title: 'Baseline Event',
-
start_time: '2024-01-01T00:00:00Z',
-
end_time: '2024-01-01T01:00:00Z'
-
}) }
-
5
let(:multi_channel_action_calendar_event_values) { Bandwidth::MultiChannelActionCalendarEvent.new({
-
type: Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT,
-
text: 'Add to calendar',
-
postback_data: 'calendar_postback',
-
title: 'Bandwidth Demo',
-
start_time: '2024-06-16T13:15:07.160Z',
-
end_time: '2024-06-16T14:15:07.160Z',
-
description: 'A demo of the Bandwidth API'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelActionCalendarEvent.acceptable_attributes).to eq(Bandwidth::MultiChannelActionCalendarEvent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelActionCalendarEvent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelActionCalendarEvent created by the build_from_hash method' do
-
1
multi_channel_action_calendar_event_from_hash = Bandwidth::MultiChannelActionCalendarEvent.build_from_hash({
-
type: Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT,
-
text: 'Add to calendar',
-
postbackData: 'calendar_postback',
-
title: 'Bandwidth Demo',
-
startTime: '2024-06-16T13:15:07.160Z',
-
endTime: '2024-06-16T14:15:07.160Z',
-
description: 'A demo of the Bandwidth API'
-
})
-
1
expect(multi_channel_action_calendar_event_from_hash).to be_instance_of(Bandwidth::MultiChannelActionCalendarEvent)
-
1
expect(multi_channel_action_calendar_event_from_hash.type).to eq(Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT)
-
1
expect(multi_channel_action_calendar_event_from_hash.text).to eq('Add to calendar')
-
1
expect(multi_channel_action_calendar_event_from_hash.postback_data).to eq('calendar_postback')
-
1
expect(multi_channel_action_calendar_event_from_hash.title).to eq('Bandwidth Demo')
-
1
expect(multi_channel_action_calendar_event_from_hash.start_time).to eq(Time.parse('2024-06-16T13:15:07.160Z'))
-
1
expect(multi_channel_action_calendar_event_from_hash.end_time).to eq(Time.parse('2024-06-16T14:15:07.160Z'))
-
1
expect(multi_channel_action_calendar_event_from_hash.description).to eq('A demo of the Bandwidth API')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_action_calendar_event_values.to_s).to eq('{:type=>"CREATE_CALENDAR_EVENT", :text=>"Add to calendar", :postbackData=>"calendar_postback", :title=>"Bandwidth Demo", :startTime=>"2024-06-16T13:15:07.160Z", :endTime=>"2024-06-16T14:15:07.160Z", :description=>"A demo of the Bandwidth API"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_action_calendar_event_equal = Bandwidth::MultiChannelActionCalendarEvent.new({
-
type: Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
title: 'Baseline Event',
-
start_time: '2024-01-01T00:00:00Z',
-
end_time: '2024-01-01T01:00:00Z'
-
})
-
1
expect(multi_channel_action_calendar_event_default.eql?(multi_channel_action_calendar_event_equal)).to be true
-
1
expect(multi_channel_action_calendar_event_default.eql?(multi_channel_action_calendar_event_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_action_calendar_event_values.to_body).to eq({
-
type: Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT,
-
text: 'Add to calendar',
-
postbackData: 'calendar_postback',
-
title: 'Bandwidth Demo',
-
startTime: '2024-06-16T13:15:07.160Z',
-
endTime: '2024-06-16T14:15:07.160Z',
-
description: 'A demo of the Bandwidth API'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a' * 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#postback_data=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: nil })
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#title=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: 'a', title: nil })
-
}.to raise_error(ArgumentError, 'title cannot be nil')
-
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: 'a', title: 'a' * 101 })
-
}.to raise_error(ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.')
-
end
-
-
1
it '#start_time=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: 'a', title: 'a', start_time: nil })
-
}.to raise_error(ArgumentError, 'start_time cannot be nil')
-
end
-
-
1
it '#end_time=' do
-
1
expect {
-
1
Bandwidth::MultiChannelActionCalendarEvent.new({ type: 'CREATE_CALENDAR_EVENT', text: 'a', postback_data: 'a', title: 'a', start_time: '2024-01-01T00:00:00Z', end_time: nil })
-
}.to raise_error(ArgumentError, 'end_time cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
multi_channel_action_calendar_event_values.description = nil
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
-
1
expect {
-
1
multi_channel_action_calendar_event_values.description = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelAction
-
1
describe Bandwidth::MultiChannelAction do
-
1
describe '.openapi_any_of' do
-
1
it 'lists the classes defined in anyOf' do
-
1
expect(Bandwidth::MultiChannelAction.openapi_any_of).to eq([
-
:'MultiChannelActionCalendarEvent',
-
:'RbmActionBase',
-
:'RbmActionDial',
-
:'RbmActionOpenUrl',
-
:'RbmActionViewLocation'
-
])
-
end
-
end
-
-
1
describe '.openapi_discriminator_name' do
-
1
it 'returns the discriminator property name' do
-
1
expect(Bandwidth::MultiChannelAction.openapi_discriminator_name).to eq(:'type')
-
end
-
end
-
-
1
describe '.openapi_discriminator_mapping' do
-
1
it 'maps every discriminator value to an anyOf class' do
-
1
expect(Bandwidth::MultiChannelAction.openapi_discriminator_mapping).to eq({
-
:'CREATE_CALENDAR_EVENT' => :'MultiChannelActionCalendarEvent',
-
:'DIAL_PHONE' => :'RbmActionDial',
-
:'OPEN_URL' => :'RbmActionOpenUrl',
-
:'REPLY' => :'RbmActionBase',
-
:'REQUEST_LOCATION' => :'RbmActionBase',
-
:'SHOW_LOCATION' => :'RbmActionViewLocation'
-
})
-
end
-
-
1
it 'maps only to classes listed in openapi_any_of' do
-
1
mapping_targets = Bandwidth::MultiChannelAction.openapi_discriminator_mapping.values.uniq.sort
-
1
expect(mapping_targets).to eq(Bandwidth::MultiChannelAction.openapi_any_of.sort)
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes MultiChannelActionCalendarEvent discriminator values to MultiChannelActionCalendarEvent.build_from_hash' do
-
1
Bandwidth::MultiChannelAction.openapi_discriminator_mapping.each do |discriminator, klass|
-
6
next unless klass == :'MultiChannelActionCalendarEvent'
-
1
data = { type: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelActionCalendarEvent).to receive(:build_from_hash).with(data).and_return(:calendar_event_result)
-
1
expect(Bandwidth::MultiChannelAction.build(data)).to eq(:calendar_event_result)
-
end
-
end
-
-
1
it 'routes RbmActionBase discriminator values to RbmActionBase.build_from_hash' do
-
1
Bandwidth::MultiChannelAction.openapi_discriminator_mapping.each do |discriminator, klass|
-
6
next unless klass == :'RbmActionBase'
-
2
data = { type: discriminator.to_s }
-
2
expect(Bandwidth::RbmActionBase).to receive(:build_from_hash).with(data).and_return(:base_result)
-
2
expect(Bandwidth::MultiChannelAction.build(data)).to eq(:base_result)
-
end
-
end
-
-
1
it 'routes RbmActionDial discriminator values to RbmActionDial.build_from_hash' do
-
1
Bandwidth::MultiChannelAction.openapi_discriminator_mapping.each do |discriminator, klass|
-
6
next unless klass == :'RbmActionDial'
-
1
data = { type: discriminator.to_s }
-
1
expect(Bandwidth::RbmActionDial).to receive(:build_from_hash).with(data).and_return(:dial_result)
-
1
expect(Bandwidth::MultiChannelAction.build(data)).to eq(:dial_result)
-
end
-
end
-
-
1
it 'routes RbmActionOpenUrl discriminator values to RbmActionOpenUrl.build_from_hash' do
-
1
Bandwidth::MultiChannelAction.openapi_discriminator_mapping.each do |discriminator, klass|
-
6
next unless klass == :'RbmActionOpenUrl'
-
1
data = { type: discriminator.to_s }
-
1
expect(Bandwidth::RbmActionOpenUrl).to receive(:build_from_hash).with(data).and_return(:open_url_result)
-
1
expect(Bandwidth::MultiChannelAction.build(data)).to eq(:open_url_result)
-
end
-
end
-
-
1
it 'routes RbmActionViewLocation discriminator values to RbmActionViewLocation.build_from_hash' do
-
1
Bandwidth::MultiChannelAction.openapi_discriminator_mapping.each do |discriminator, klass|
-
6
next unless klass == :'RbmActionViewLocation'
-
1
data = { type: discriminator.to_s }
-
1
expect(Bandwidth::RbmActionViewLocation).to receive(:build_from_hash).with(data).and_return(:view_location_result)
-
1
expect(Bandwidth::MultiChannelAction.build(data)).to eq(:view_location_result)
-
end
-
end
-
-
1
it 'returns nil when the discriminator value is missing' do
-
1
expect(Bandwidth::MultiChannelAction.build({})).to be_nil
-
end
-
-
1
it 'returns nil when the discriminator value does not match any mapping' do
-
1
expect(Bandwidth::MultiChannelAction.build({ type: 'unknown' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListMMSObject
-
1
describe Bandwidth::MultiChannelChannelListMMSObject do
-
2
let(:multi_channel_channel_list_mms_object_default) { Bandwidth::MultiChannelChannelListMMSObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'baseline' })
-
}) }
-
4
let(:multi_channel_channel_list_mms_object_values) { Bandwidth::MultiChannelChannelListMMSObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'Hello world' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListMMSObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListMMSObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListMMSObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListMMSObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_mms_object_from_hash = Bandwidth::MultiChannelChannelListMMSObject.build_from_hash({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: { text: 'Hello world' }
-
})
-
1
expect(multi_channel_channel_list_mms_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListMMSObject)
-
1
expect(multi_channel_channel_list_mms_object_from_hash.from).to eq('+19195554321')
-
1
expect(multi_channel_channel_list_mms_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_mms_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::MMS)
-
1
expect(multi_channel_channel_list_mms_object_from_hash.content).to be_instance_of(Bandwidth::MmsMessageContent)
-
1
expect(multi_channel_channel_list_mms_object_from_hash.content.text).to eq('Hello world')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_mms_object_values.to_s).to eq('{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"MMS", :content=>{:text=>"Hello world"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_mms_object_equal = Bandwidth::MultiChannelChannelListMMSObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'baseline' })
-
})
-
1
expect(multi_channel_channel_list_mms_object_default.eql?(multi_channel_channel_list_mms_object_equal)).to be true
-
1
expect(multi_channel_channel_list_mms_object_default.eql?(multi_channel_channel_list_mms_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_mms_object_values.to_body).to eq({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: { text: 'Hello world' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new({ from: '+15554443333', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new({ from: '+15554443333', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSObject.new({ from: '+15554443333', application_id: 'a', channel: 'MMS', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListMMSResponseObject
-
1
describe Bandwidth::MultiChannelChannelListMMSResponseObject do
-
2
let(:multi_channel_channel_list_mms_response_object_default) { Bandwidth::MultiChannelChannelListMMSResponseObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'baseline' }),
-
owner: '+15554443333'
-
}) }
-
4
let(:multi_channel_channel_list_mms_response_object_values) { Bandwidth::MultiChannelChannelListMMSResponseObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'Hello world' }),
-
owner: '+19195554321'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListMMSResponseObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListMMSResponseObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListMMSResponseObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListMMSResponseObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_mms_response_object_from_hash = Bandwidth::MultiChannelChannelListMMSResponseObject.build_from_hash({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
})
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListMMSResponseObject)
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.from).to eq('+19195554321')
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::MMS)
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.content).to be_instance_of(Bandwidth::MmsMessageContent)
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.content.text).to eq('Hello world')
-
1
expect(multi_channel_channel_list_mms_response_object_from_hash.owner).to eq('+19195554321')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_mms_response_object_values.to_s).to eq('{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"MMS", :content=>{:text=>"Hello world"}, :owner=>"+19195554321"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_mms_response_object_equal = Bandwidth::MultiChannelChannelListMMSResponseObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: Bandwidth::MmsMessageContent.new({ text: 'baseline' }),
-
owner: '+15554443333'
-
})
-
1
expect(multi_channel_channel_list_mms_response_object_default.eql?(multi_channel_channel_list_mms_response_object_equal)).to be true
-
1
expect(multi_channel_channel_list_mms_response_object_default.eql?(multi_channel_channel_list_mms_response_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_mms_response_object_values.to_body).to eq({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ from: '+15554443333', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: 'MMS', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
-
1
it '#owner=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListMMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: 'MMS', content: 'c', owner: nil })
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListObjectBase
-
1
describe Bandwidth::MultiChannelChannelListObjectBase do
-
2
let(:multi_channel_channel_list_object_base_default) { Bandwidth::MultiChannelChannelListObjectBase.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
}) }
-
4
let(:multi_channel_channel_list_object_base_values) { Bandwidth::MultiChannelChannelListObjectBase.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListObjectBase.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListObjectBase.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListObjectBase.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListObjectBase.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListObjectBase.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListObjectBase created by the build_from_hash method' do
-
1
multi_channel_channel_list_object_base_from_hash = Bandwidth::MultiChannelChannelListObjectBase.build_from_hash({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS
-
})
-
1
expect(multi_channel_channel_list_object_base_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListObjectBase)
-
1
expect(multi_channel_channel_list_object_base_from_hash.from).to eq('+19195554321')
-
1
expect(multi_channel_channel_list_object_base_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_object_base_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::MMS)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_object_base_values.to_s).to eq('{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"MMS"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_object_base_equal = Bandwidth::MultiChannelChannelListObjectBase.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
})
-
1
expect(multi_channel_channel_list_object_base_default.eql?(multi_channel_channel_list_object_base_equal)).to be true
-
1
expect(multi_channel_channel_list_object_base_default.eql?(multi_channel_channel_list_object_base_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_object_base_values.to_body).to eq({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListObjectBase.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListObjectBase.new({ from: '+15554443333', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListObjectBase.new({ from: '+15554443333', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListOwnerObject
-
1
describe Bandwidth::MultiChannelChannelListOwnerObject do
-
2
let(:multi_channel_channel_list_owner_object_default) { Bandwidth::MultiChannelChannelListOwnerObject.new({
-
owner: '+15554443333'
-
}) }
-
4
let(:multi_channel_channel_list_owner_object_values) { Bandwidth::MultiChannelChannelListOwnerObject.new({
-
owner: '+19195554321'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListOwnerObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListOwnerObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListOwnerObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListOwnerObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListOwnerObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListOwnerObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_owner_object_from_hash = Bandwidth::MultiChannelChannelListOwnerObject.build_from_hash({
-
owner: '+19195554321'
-
})
-
1
expect(multi_channel_channel_list_owner_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListOwnerObject)
-
1
expect(multi_channel_channel_list_owner_object_from_hash.owner).to eq('+19195554321')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_owner_object_values.to_s).to eq('{:owner=>"+19195554321"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_owner_object_equal = Bandwidth::MultiChannelChannelListOwnerObject.new({
-
owner: '+15554443333'
-
})
-
1
expect(multi_channel_channel_list_owner_object_default.eql?(multi_channel_channel_list_owner_object_equal)).to be true
-
1
expect(multi_channel_channel_list_owner_object_default.eql?(multi_channel_channel_list_owner_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_owner_object_values.to_body).to eq({
-
owner: '+19195554321'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#owner=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListOwnerObject.new({ owner: nil })
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListRBMObjectAllOfContent
-
1
describe Bandwidth::MultiChannelChannelListRBMObjectAllOfContent do
-
1
describe '.openapi_one_of' do
-
1
it 'lists the classes defined in oneOf' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMObjectAllOfContent.openapi_one_of).to eq([
-
:'RbmMessageContentRichCard',
-
:'RbmMessageContentText',
-
:'RbmMessageMedia'
-
])
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes payloads matching RbmMessageContentText attributes to RbmMessageContentText.build_from_hash' do
-
1
data = { text: 'Hello world' }
-
1
expect(Bandwidth::MultiChannelChannelListRBMObjectAllOfContent.build(data)).to be_instance_of(Bandwidth::RbmMessageContentText)
-
end
-
-
1
it 'routes payloads matching RbmMessageMedia attributes to RbmMessageMedia.build_from_hash' do
-
1
data = { media: [{ fileUrl: 'https://example.com/image.png' }] }
-
1
expect(Bandwidth::MultiChannelChannelListRBMObjectAllOfContent.build(data)).to be_instance_of(Bandwidth::RbmMessageMedia)
-
end
-
-
1
it 'returns nil when the payload does not match any oneOf schema' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMObjectAllOfContent.build({ unknown: 'value' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListRBMObject
-
1
describe Bandwidth::MultiChannelChannelListRBMObject do
-
2
let(:multi_channel_channel_list_rbm_object_default) { Bandwidth::MultiChannelChannelListRBMObject.new({
-
from: 'BANDWIDTH',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'baseline' })
-
}) }
-
4
let(:multi_channel_channel_list_rbm_object_values) { Bandwidth::MultiChannelChannelListRBMObject.new({
-
from: 'BANDWIDTH',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'Hello world' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListRBMObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListRBMObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_rbm_object_from_hash = Bandwidth::MultiChannelChannelListRBMObject.build_from_hash({
-
from: 'BANDWIDTH',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: { text: 'Hello world' }
-
})
-
1
expect(multi_channel_channel_list_rbm_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListRBMObject)
-
1
expect(multi_channel_channel_list_rbm_object_from_hash.from).to eq('BANDWIDTH')
-
1
expect(multi_channel_channel_list_rbm_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_rbm_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::RBM)
-
1
expect(multi_channel_channel_list_rbm_object_from_hash.content).to be_instance_of(Bandwidth::RbmMessageContentText)
-
1
expect(multi_channel_channel_list_rbm_object_from_hash.content.text).to eq('Hello world')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_rbm_object_values.to_s).to eq('{:from=>"BANDWIDTH", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"RBM", :content=>{:text=>"Hello world"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_rbm_object_equal = Bandwidth::MultiChannelChannelListRBMObject.new({
-
from: 'BANDWIDTH',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'baseline' })
-
})
-
1
expect(multi_channel_channel_list_rbm_object_default.eql?(multi_channel_channel_list_rbm_object_equal)).to be true
-
1
expect(multi_channel_channel_list_rbm_object_default.eql?(multi_channel_channel_list_rbm_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_rbm_object_values.to_body).to eq({
-
from: 'BANDWIDTH',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: { text: 'Hello world' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new({ from: 'BANDWIDTH', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new({ from: 'BANDWIDTH', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMObject.new({ from: 'BANDWIDTH', application_id: 'a', channel: 'RBM', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListRBMResponseObject
-
1
describe Bandwidth::MultiChannelChannelListRBMResponseObject do
-
2
let(:multi_channel_channel_list_rbm_response_object_default) { Bandwidth::MultiChannelChannelListRBMResponseObject.new({
-
from: 'BANDWIDTH',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'baseline' }),
-
owner: 'BANDWIDTH'
-
}) }
-
4
let(:multi_channel_channel_list_rbm_response_object_values) { Bandwidth::MultiChannelChannelListRBMResponseObject.new({
-
from: 'BANDWIDTH',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'Hello world' }),
-
owner: 'BANDWIDTH'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMResponseObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListRBMResponseObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListRBMResponseObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListRBMResponseObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_rbm_response_object_from_hash = Bandwidth::MultiChannelChannelListRBMResponseObject.build_from_hash({
-
from: 'BANDWIDTH',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: { text: 'Hello world' },
-
owner: 'BANDWIDTH'
-
})
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListRBMResponseObject)
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.from).to eq('BANDWIDTH')
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::RBM)
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.content).to be_instance_of(Bandwidth::RbmMessageContentText)
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.content.text).to eq('Hello world')
-
1
expect(multi_channel_channel_list_rbm_response_object_from_hash.owner).to eq('BANDWIDTH')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_rbm_response_object_values.to_s).to eq('{:from=>"BANDWIDTH", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"RBM", :content=>{:text=>"Hello world"}, :owner=>"BANDWIDTH"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_rbm_response_object_equal = Bandwidth::MultiChannelChannelListRBMResponseObject.new({
-
from: 'BANDWIDTH',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: Bandwidth::RbmMessageContentText.new({ text: 'baseline' }),
-
owner: 'BANDWIDTH'
-
})
-
1
expect(multi_channel_channel_list_rbm_response_object_default.eql?(multi_channel_channel_list_rbm_response_object_equal)).to be true
-
1
expect(multi_channel_channel_list_rbm_response_object_default.eql?(multi_channel_channel_list_rbm_response_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_rbm_response_object_values.to_body).to eq({
-
from: 'BANDWIDTH',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
-
content: { text: 'Hello world' },
-
owner: 'BANDWIDTH'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ from: 'BANDWIDTH', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ from: 'BANDWIDTH', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ from: 'BANDWIDTH', application_id: 'a', channel: 'RBM', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
-
1
it '#owner=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListRBMResponseObject.new({ from: 'BANDWIDTH', application_id: 'a', channel: 'RBM', content: 'c', owner: nil })
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListRequestObject
-
1
describe Bandwidth::MultiChannelChannelListRequestObject do
-
1
describe '.openapi_any_of' do
-
1
it 'lists the classes defined in anyOf' do
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.openapi_any_of).to eq([
-
:'MultiChannelChannelListMMSObject',
-
:'MultiChannelChannelListRBMObject',
-
:'MultiChannelChannelListSMSObject'
-
])
-
end
-
end
-
-
1
describe '.openapi_discriminator_name' do
-
1
it 'returns the discriminator property name' do
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_name).to eq(:'channel')
-
end
-
end
-
-
1
describe '.openapi_discriminator_mapping' do
-
1
it 'maps every discriminator value to an anyOf class' do
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_mapping).to eq({
-
:'MMS' => :'MultiChannelChannelListMMSObject',
-
:'RBM' => :'MultiChannelChannelListRBMObject',
-
:'SMS' => :'MultiChannelChannelListSMSObject'
-
})
-
end
-
-
1
it 'maps only to classes listed in openapi_any_of' do
-
1
mapping_targets = Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_mapping.values.uniq.sort
-
1
expect(mapping_targets).to eq(Bandwidth::MultiChannelChannelListRequestObject.openapi_any_of.sort)
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes MultiChannelChannelListMMSObject discriminator values to MultiChannelChannelListMMSObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListMMSObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListMMSObject).to receive(:build_from_hash).with(data).and_return(:mms_result)
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.build(data)).to eq(:mms_result)
-
end
-
end
-
-
1
it 'routes MultiChannelChannelListRBMObject discriminator values to MultiChannelChannelListRBMObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListRBMObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListRBMObject).to receive(:build_from_hash).with(data).and_return(:rbm_result)
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.build(data)).to eq(:rbm_result)
-
end
-
end
-
-
1
it 'routes MultiChannelChannelListSMSObject discriminator values to MultiChannelChannelListSMSObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListRequestObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListSMSObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListSMSObject).to receive(:build_from_hash).with(data).and_return(:sms_result)
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.build(data)).to eq(:sms_result)
-
end
-
end
-
-
1
it 'returns nil when the discriminator value is missing' do
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.build({})).to be_nil
-
end
-
-
1
it 'returns nil when the discriminator value does not match any mapping' do
-
1
expect(Bandwidth::MultiChannelChannelListRequestObject.build({ channel: 'unknown' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListResponseObject
-
1
describe Bandwidth::MultiChannelChannelListResponseObject do
-
1
describe '.openapi_any_of' do
-
1
it 'lists the classes defined in anyOf' do
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.openapi_any_of).to eq([
-
:'MultiChannelChannelListMMSResponseObject',
-
:'MultiChannelChannelListRBMResponseObject',
-
:'MultiChannelChannelListSMSResponseObject'
-
])
-
end
-
end
-
-
1
describe '.openapi_discriminator_name' do
-
1
it 'returns the discriminator property name' do
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_name).to eq(:'channel')
-
end
-
end
-
-
1
describe '.openapi_discriminator_mapping' do
-
1
it 'maps every discriminator value to an anyOf class' do
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_mapping).to eq({
-
:'MMS' => :'MultiChannelChannelListMMSResponseObject',
-
:'RBM' => :'MultiChannelChannelListRBMResponseObject',
-
:'SMS' => :'MultiChannelChannelListSMSResponseObject'
-
})
-
end
-
-
1
it 'maps only to classes listed in openapi_any_of' do
-
1
mapping_targets = Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_mapping.values.uniq.sort
-
1
expect(mapping_targets).to eq(Bandwidth::MultiChannelChannelListResponseObject.openapi_any_of.sort)
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes MultiChannelChannelListMMSResponseObject discriminator values to MultiChannelChannelListMMSResponseObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListMMSResponseObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListMMSResponseObject).to receive(:build_from_hash).with(data).and_return(:mms_result)
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.build(data)).to eq(:mms_result)
-
end
-
end
-
-
1
it 'routes MultiChannelChannelListRBMResponseObject discriminator values to MultiChannelChannelListRBMResponseObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListRBMResponseObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListRBMResponseObject).to receive(:build_from_hash).with(data).and_return(:rbm_result)
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.build(data)).to eq(:rbm_result)
-
end
-
end
-
-
1
it 'routes MultiChannelChannelListSMSResponseObject discriminator values to MultiChannelChannelListSMSResponseObject.build_from_hash' do
-
1
Bandwidth::MultiChannelChannelListResponseObject.openapi_discriminator_mapping.each do |discriminator, klass|
-
3
next unless klass == :'MultiChannelChannelListSMSResponseObject'
-
1
data = { channel: discriminator.to_s }
-
1
expect(Bandwidth::MultiChannelChannelListSMSResponseObject).to receive(:build_from_hash).with(data).and_return(:sms_result)
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.build(data)).to eq(:sms_result)
-
end
-
end
-
-
1
it 'returns nil when the discriminator value is missing' do
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.build({})).to be_nil
-
end
-
-
1
it 'returns nil when the discriminator value does not match any mapping' do
-
1
expect(Bandwidth::MultiChannelChannelListResponseObject.build({ channel: 'unknown' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListSMSObject
-
1
describe Bandwidth::MultiChannelChannelListSMSObject do
-
2
let(:multi_channel_channel_list_sms_object_default) { Bandwidth::MultiChannelChannelListSMSObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'baseline' })
-
}) }
-
4
let(:multi_channel_channel_list_sms_object_values) { Bandwidth::MultiChannelChannelListSMSObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'Hello world' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListSMSObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListSMSObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListSMSObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListSMSObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_sms_object_from_hash = Bandwidth::MultiChannelChannelListSMSObject.build_from_hash({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' }
-
})
-
1
expect(multi_channel_channel_list_sms_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListSMSObject)
-
1
expect(multi_channel_channel_list_sms_object_from_hash.from).to eq('+19195554321')
-
1
expect(multi_channel_channel_list_sms_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_sms_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS)
-
1
expect(multi_channel_channel_list_sms_object_from_hash.content).to be_instance_of(Bandwidth::SmsMessageContent)
-
1
expect(multi_channel_channel_list_sms_object_from_hash.content.text).to eq('Hello world')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_sms_object_values.to_s).to eq('{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"SMS", :content=>{:text=>"Hello world"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_sms_object_equal = Bandwidth::MultiChannelChannelListSMSObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'baseline' })
-
})
-
1
expect(multi_channel_channel_list_sms_object_default.eql?(multi_channel_channel_list_sms_object_equal)).to be true
-
1
expect(multi_channel_channel_list_sms_object_default.eql?(multi_channel_channel_list_sms_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_sms_object_values.to_body).to eq({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' }
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new({ from: '+15554443333', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new({ from: '+15554443333', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSObject.new({ from: '+15554443333', application_id: 'a', channel: 'SMS', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelChannelListSMSResponseObject
-
1
describe Bandwidth::MultiChannelChannelListSMSResponseObject do
-
2
let(:multi_channel_channel_list_sms_response_object_default) { Bandwidth::MultiChannelChannelListSMSResponseObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'baseline' }),
-
owner: '+15554443333'
-
}) }
-
4
let(:multi_channel_channel_list_sms_response_object_values) { Bandwidth::MultiChannelChannelListSMSResponseObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'Hello world' }),
-
owner: '+19195554321'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelChannelListSMSResponseObject.acceptable_attributes).to eq(Bandwidth::MultiChannelChannelListSMSResponseObject.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelChannelListSMSResponseObject.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelChannelListSMSResponseObject created by the build_from_hash method' do
-
1
multi_channel_channel_list_sms_response_object_from_hash = Bandwidth::MultiChannelChannelListSMSResponseObject.build_from_hash({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
})
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash).to be_instance_of(Bandwidth::MultiChannelChannelListSMSResponseObject)
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.from).to eq('+19195554321')
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS)
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.content).to be_instance_of(Bandwidth::SmsMessageContent)
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.content.text).to eq('Hello world')
-
1
expect(multi_channel_channel_list_sms_response_object_from_hash.owner).to eq('+19195554321')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_channel_list_sms_response_object_values.to_s).to eq('{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"SMS", :content=>{:text=>"Hello world"}, :owner=>"+19195554321"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_channel_list_sms_response_object_equal = Bandwidth::MultiChannelChannelListSMSResponseObject.new({
-
from: '+15554443333',
-
application_id: 'baseline-app-id',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'baseline' }),
-
owner: '+15554443333'
-
})
-
1
expect(multi_channel_channel_list_sms_response_object_default.eql?(multi_channel_channel_list_sms_response_object_equal)).to be true
-
1
expect(multi_channel_channel_list_sms_response_object_default.eql?(multi_channel_channel_list_sms_response_object_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_channel_list_sms_response_object_values.to_body).to eq({
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#from=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ from: nil })
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ from: '+15554443333', application_id: nil })
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#channel=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: nil })
-
}.to raise_error(ArgumentError, 'channel cannot be nil')
-
end
-
-
1
it '#content=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: 'SMS', content: nil })
-
}.to raise_error(ArgumentError, 'content cannot be nil')
-
end
-
-
1
it '#owner=' do
-
1
expect {
-
1
Bandwidth::MultiChannelChannelListSMSResponseObject.new({ from: '+15554443333', application_id: 'a', channel: 'SMS', content: 'c', owner: nil })
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelError
-
1
describe Bandwidth::MultiChannelError do
-
2
let(:multi_channel_error_default) { Bandwidth::MultiChannelError.new }
-
4
let(:multi_channel_error_values) { Bandwidth::MultiChannelError.new({
-
links: [Bandwidth::Link.new({ rel: 'next', href: 'https://example.com/next' })],
-
data: { someKey: 'someValue' },
-
errors: [Bandwidth::ErrorObject.new({ type: 'invalid', description: 'Something went wrong', source: { parameter: 'foo' } })]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelError.acceptable_attributes).to eq(Bandwidth::MultiChannelError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::MultiChannelError.openapi_nullable).to eq(Set.new([:'data']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelError created by the build_from_hash method' do
-
1
multi_channel_error_from_hash = Bandwidth::MultiChannelError.build_from_hash({
-
links: [{ rel: 'next', href: 'https://example.com/next' }],
-
data: { someKey: 'someValue' },
-
errors: [{ type: 'invalid', description: 'Something went wrong', source: { parameter: 'foo' } }]
-
})
-
1
expect(multi_channel_error_from_hash).to be_instance_of(Bandwidth::MultiChannelError)
-
1
expect(multi_channel_error_from_hash.links.first).to be_instance_of(Bandwidth::Link)
-
1
expect(multi_channel_error_from_hash.links.first.rel).to eq('next')
-
1
expect(multi_channel_error_from_hash.links.first.href).to eq('https://example.com/next')
-
1
expect(multi_channel_error_from_hash.data).to eq({ someKey: 'someValue' })
-
1
expect(multi_channel_error_from_hash.errors.first).to be_instance_of(Bandwidth::ErrorObject)
-
1
expect(multi_channel_error_from_hash.errors.first.type).to eq('invalid')
-
1
expect(multi_channel_error_from_hash.errors.first.description).to eq('Something went wrong')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_error_values.to_s).to eq('{:links=>[{:rel=>"next", :href=>"https://example.com/next"}], :data=>{:someKey=>"someValue"}, :errors=>[{:type=>"invalid", :description=>"Something went wrong", :source=>{:parameter=>"foo"}}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(multi_channel_error_default.eql?(Bandwidth::MultiChannelError.new)).to be true
-
1
expect(multi_channel_error_default.eql?(multi_channel_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_error_values.to_body).to eq({
-
links: [{ rel: 'next', href: 'https://example.com/next' }],
-
data: { someKey: 'someValue' },
-
errors: [{ type: 'invalid', description: 'Something went wrong', source: { parameter: 'foo' } }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelMessageChannelEnum
-
1
describe Bandwidth::MultiChannelMessageChannelEnum do
-
1
describe 'constants' do
-
1
it 'defines RBM' do
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum::RBM).to eq('RBM')
-
end
-
-
1
it 'defines SMS' do
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum::SMS).to eq('SMS')
-
end
-
-
1
it 'defines MMS' do
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum::MMS).to eq('MMS')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum.all_vars).to eq([
-
'RBM',
-
'SMS',
-
'MMS'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum.build_from_hash('RBM')).to eq('RBM')
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum.build_from_hash('SMS')).to eq('SMS')
-
1
expect(Bandwidth::MultiChannelMessageChannelEnum.build_from_hash('MMS')).to eq('MMS')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageChannelEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelMessageContent
-
1
describe Bandwidth::MultiChannelMessageContent do
-
2
let(:multi_channel_message_content_default) { Bandwidth::MultiChannelMessageContent.new }
-
4
let(:multi_channel_message_content_values) { Bandwidth::MultiChannelMessageContent.new({
-
text: 'Hello world',
-
media: Bandwidth::RbmMessageContentFile.new({ file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png' })
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageContent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageContent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelMessageContent.acceptable_attributes).to eq(Bandwidth::MultiChannelMessageContent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelMessageContent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelMessageContent created by the build_from_hash method' do
-
1
multi_channel_message_content_from_hash = Bandwidth::MultiChannelMessageContent.build_from_hash({
-
text: 'Hello world',
-
media: { fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }
-
})
-
1
expect(multi_channel_message_content_from_hash).to be_instance_of(Bandwidth::MultiChannelMessageContent)
-
1
expect(multi_channel_message_content_from_hash.text).to eq('Hello world')
-
1
expect(multi_channel_message_content_from_hash.media).to be_instance_of(Bandwidth::RbmMessageContentFile)
-
1
expect(multi_channel_message_content_from_hash.media.file_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo.png')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_message_content_values.to_s).to eq('{:text=>"Hello world", :media=>{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(multi_channel_message_content_default.eql?(Bandwidth::MultiChannelMessageContent.new)).to be true
-
1
expect(multi_channel_message_content_default.eql?(multi_channel_message_content_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_message_content_values.to_body).to eq({
-
text: 'Hello world',
-
media: { fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelMessageRequest
-
1
describe Bandwidth::MultiChannelMessageRequest do
-
5
let(:sms_channel_object) { Bandwidth::MultiChannelChannelListSMSObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'Hello world' })
-
}) }
-
2
let(:multi_channel_message_request_default) { Bandwidth::MultiChannelMessageRequest.new({
-
to: '+15554443333',
-
channel_list: [sms_channel_object]
-
}) }
-
5
let(:multi_channel_message_request_values) { Bandwidth::MultiChannelMessageRequest.new({
-
to: '+19195551234',
-
channel_list: [sms_channel_object],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelMessageRequest.acceptable_attributes).to eq(Bandwidth::MultiChannelMessageRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelMessageRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelMessageRequest created by the build_from_hash method' do
-
1
multi_channel_message_request_from_hash = Bandwidth::MultiChannelMessageRequest.build_from_hash({
-
to: '+19195551234',
-
channelList: [{
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' }
-
}],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
})
-
1
expect(multi_channel_message_request_from_hash).to be_instance_of(Bandwidth::MultiChannelMessageRequest)
-
1
expect(multi_channel_message_request_from_hash.to).to eq('+19195551234')
-
1
expect(multi_channel_message_request_from_hash.channel_list.first).to be_instance_of(Bandwidth::MultiChannelChannelListSMSObject)
-
1
expect(multi_channel_message_request_from_hash.tag).to eq('custom tag')
-
1
expect(multi_channel_message_request_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT)
-
1
expect(multi_channel_message_request_from_hash.expiration).to eq(Time.parse('2024-06-16T13:45:07.160Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_message_request_values.to_s).to eq('{:to=>"+19195551234", :channelList=>[{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"SMS", :content=>{:text=>"Hello world"}}], :tag=>"custom tag", :priority=>"default", :expiration=>"2024-06-16T13:45:07.160Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_message_request_equal = Bandwidth::MultiChannelMessageRequest.new({
-
to: '+15554443333',
-
channel_list: [sms_channel_object]
-
})
-
1
expect(multi_channel_message_request_default.eql?(multi_channel_message_request_equal)).to be true
-
1
expect(multi_channel_message_request_default.eql?(multi_channel_message_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_message_request_values.to_body).to eq({
-
to: '+19195551234',
-
channelList: [{
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' }
-
}],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageRequest.new({})
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#channel_list=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageRequest.new({ to: '+15554443333' })
-
}.to raise_error(ArgumentError, 'channel_list cannot be nil')
-
-
1
expect {
-
1
multi_channel_message_request_values.channel_list = nil
-
}.to raise_error(ArgumentError, 'channel_list cannot be nil')
-
-
1
expect {
-
1
multi_channel_message_request_values.channel_list = [sms_channel_object] * 5
-
}.to raise_error(ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::MultiChannelMessageResponseData
-
1
describe Bandwidth::MultiChannelMessageResponseData do
-
6
let(:sms_channel_response) { Bandwidth::MultiChannelChannelListSMSResponseObject.new({
-
from: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: Bandwidth::SmsMessageContent.new({ text: 'Hello world' }),
-
owner: '+19195554321'
-
}) }
-
2
let(:multi_channel_message_response_data_default) { Bandwidth::MultiChannelMessageResponseData.new({
-
id: 'baseline-id',
-
time: '2024-01-01T00:00:00Z',
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+15554443333'],
-
channel_list: [sms_channel_response]
-
}) }
-
6
let(:multi_channel_message_response_data_values) { Bandwidth::MultiChannelMessageResponseData.new({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
time: '2024-06-16T13:15:07.160Z',
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
channel_list: [sms_channel_response],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::MultiChannelMessageResponseData.acceptable_attributes).to eq(Bandwidth::MultiChannelMessageResponseData.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::MultiChannelMessageResponseData.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of MultiChannelMessageResponseData created by the build_from_hash method' do
-
1
multi_channel_message_response_data_from_hash = Bandwidth::MultiChannelMessageResponseData.build_from_hash({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
time: '2024-06-16T13:15:07.160Z',
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
channelList: [{
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
}],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
})
-
1
expect(multi_channel_message_response_data_from_hash).to be_instance_of(Bandwidth::MultiChannelMessageResponseData)
-
1
expect(multi_channel_message_response_data_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(multi_channel_message_response_data_from_hash.time).to eq(Time.parse('2024-06-16T13:15:07.160Z'))
-
1
expect(multi_channel_message_response_data_from_hash.direction).to eq(Bandwidth::MessageDirectionEnum::OUT)
-
1
expect(multi_channel_message_response_data_from_hash.to).to eq(['+19195551234'])
-
1
expect(multi_channel_message_response_data_from_hash.channel_list.first).to be_instance_of(Bandwidth::MultiChannelChannelListSMSResponseObject)
-
1
expect(multi_channel_message_response_data_from_hash.tag).to eq('custom tag')
-
1
expect(multi_channel_message_response_data_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT)
-
1
expect(multi_channel_message_response_data_from_hash.expiration).to eq(Time.parse('2024-06-16T13:45:07.160Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(multi_channel_message_response_data_values.to_s).to eq('{:id=>"1589228074636lm4k2je7j7jklbn2", :time=>"2024-06-16T13:15:07.160Z", :direction=>"out", :to=>["+19195551234"], :channelList=>[{:from=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :channel=>"SMS", :content=>{:text=>"Hello world"}, :owner=>"+19195554321"}], :tag=>"custom tag", :priority=>"default", :expiration=>"2024-06-16T13:45:07.160Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
multi_channel_message_response_data_equal = Bandwidth::MultiChannelMessageResponseData.new({
-
id: 'baseline-id',
-
time: '2024-01-01T00:00:00Z',
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+15554443333'],
-
channel_list: [sms_channel_response]
-
})
-
1
expect(multi_channel_message_response_data_default.eql?(multi_channel_message_response_data_equal)).to be true
-
1
expect(multi_channel_message_response_data_default.eql?(multi_channel_message_response_data_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(multi_channel_message_response_data_values.to_body).to eq({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
time: '2024-06-16T13:15:07.160Z',
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
channelList: [{
-
from: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
-
content: { text: 'Hello world' },
-
owner: '+19195554321'
-
}],
-
tag: 'custom tag',
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
expiration: '2024-06-16T13:45:07.160Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#id=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ id: nil })
-
}.to raise_error(ArgumentError, 'id cannot be nil')
-
end
-
-
1
it '#time=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ id: 'a', time: nil })
-
}.to raise_error(ArgumentError, 'time cannot be nil')
-
end
-
-
1
it '#direction=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ id: 'a', time: 't', direction: nil })
-
}.to raise_error(ArgumentError, 'direction cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ id: 'a', time: 't', direction: 'out' })
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
-
1
expect {
-
1
multi_channel_message_response_data_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#channel_list=' do
-
1
expect {
-
1
Bandwidth::MultiChannelMessageResponseData.new({ id: 'a', time: 't', direction: 'out', to: ['x'] })
-
}.to raise_error(ArgumentError, 'channel_list cannot be nil')
-
-
1
expect {
-
1
multi_channel_message_response_data_values.channel_list = nil
-
}.to raise_error(ArgumentError, 'channel_list cannot be nil')
-
-
1
expect {
-
1
multi_channel_message_response_data_values.channel_list = [sms_channel_response] * 5
-
}.to raise_error(ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::OptInWorkflow
-
1
describe Bandwidth::OptInWorkflow do
-
2
let(:opt_in_workflow_default) { Bandwidth::OptInWorkflow.new({
-
description: 'baseline description',
-
image_urls: ['https://example.com/baseline.png']
-
}) }
-
6
let(:opt_in_workflow_values) { Bandwidth::OptInWorkflow.new({
-
description: 'A description of the opt in workflow',
-
image_urls: ['https://example.com/image1.png', 'https://example.com/image2.png'],
-
confirmation_response: 'Thanks for opting in!'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::OptInWorkflow.acceptable_attributes).to eq(Bandwidth::OptInWorkflow.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::OptInWorkflow.openapi_nullable).to eq(Set.new([:'confirmation_response']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of OptInWorkflow created by the build_from_hash method' do
-
1
opt_in_workflow_from_hash = Bandwidth::OptInWorkflow.build_from_hash({
-
description: 'A description of the opt in workflow',
-
imageUrls: ['https://example.com/image1.png', 'https://example.com/image2.png'],
-
confirmationResponse: 'Thanks for opting in!'
-
})
-
1
expect(opt_in_workflow_from_hash).to be_instance_of(Bandwidth::OptInWorkflow)
-
1
expect(opt_in_workflow_from_hash.description).to eq('A description of the opt in workflow')
-
1
expect(opt_in_workflow_from_hash.image_urls).to eq(['https://example.com/image1.png', 'https://example.com/image2.png'])
-
1
expect(opt_in_workflow_from_hash.confirmation_response).to eq('Thanks for opting in!')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(opt_in_workflow_values.to_s).to eq('{:description=>"A description of the opt in workflow", :imageUrls=>["https://example.com/image1.png", "https://example.com/image2.png"], :confirmationResponse=>"Thanks for opting in!"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
opt_in_workflow_equal = Bandwidth::OptInWorkflow.new({
-
description: 'baseline description',
-
image_urls: ['https://example.com/baseline.png']
-
})
-
1
expect(opt_in_workflow_default.eql?(opt_in_workflow_equal)).to be true
-
1
expect(opt_in_workflow_default.eql?(opt_in_workflow_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(opt_in_workflow_values.to_body).to eq({
-
description: 'A description of the opt in workflow',
-
imageUrls: ['https://example.com/image1.png', 'https://example.com/image2.png'],
-
confirmationResponse: 'Thanks for opting in!'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new({ description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new({ description: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.')
-
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new({ description: '' })
-
}.to raise_error(ArgumentError, 'invalid value for "description", the character length must be greater than or equal to 1.')
-
end
-
-
1
it '#image_urls=' do
-
1
expect {
-
1
Bandwidth::OptInWorkflow.new({ description: 'a' })
-
}.to raise_error(ArgumentError, 'image_urls cannot be nil')
-
-
1
expect {
-
1
opt_in_workflow_values.image_urls = nil
-
}.to raise_error(ArgumentError, 'image_urls cannot be nil')
-
end
-
-
1
it '#confirmation_response=' do
-
1
expect {
-
1
opt_in_workflow_values.confirmation_response = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "confirmation_response", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::PageInfo
-
1
describe Bandwidth::PageInfo do
-
2
let(:page_info_default) { Bandwidth::PageInfo.new }
-
4
let(:page_info_values) { Bandwidth::PageInfo.new({
-
prev_page: 'https://example.com/prev',
-
next_page: 'https://example.com/next',
-
prev_page_token: 'prev-token',
-
next_page_token: 'next-token'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::PageInfo.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::PageInfo.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::PageInfo.acceptable_attributes).to eq(Bandwidth::PageInfo.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::PageInfo.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of PageInfo created by the build_from_hash method' do
-
1
page_info_from_hash = Bandwidth::PageInfo.build_from_hash({
-
prevPage: 'https://example.com/prev',
-
nextPage: 'https://example.com/next',
-
prevPageToken: 'prev-token',
-
nextPageToken: 'next-token'
-
})
-
1
expect(page_info_from_hash).to be_instance_of(Bandwidth::PageInfo)
-
1
expect(page_info_from_hash.prev_page).to eq('https://example.com/prev')
-
1
expect(page_info_from_hash.next_page).to eq('https://example.com/next')
-
1
expect(page_info_from_hash.prev_page_token).to eq('prev-token')
-
1
expect(page_info_from_hash.next_page_token).to eq('next-token')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(page_info_values.to_s).to eq('{:prevPage=>"https://example.com/prev", :nextPage=>"https://example.com/next", :prevPageToken=>"prev-token", :nextPageToken=>"next-token"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(page_info_default.eql?(Bandwidth::PageInfo.new)).to be true
-
1
expect(page_info_default.eql?(page_info_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(page_info_values.to_body).to eq({
-
prevPage: 'https://example.com/prev',
-
nextPage: 'https://example.com/next',
-
prevPageToken: 'prev-token',
-
nextPageToken: 'next-token'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Page
-
1
describe Bandwidth::Page do
-
2
let(:page_default) { Bandwidth::Page.new({
-
page_size: 25
-
}) }
-
7
let(:page_values) { Bandwidth::Page.new({
-
page_size: 100,
-
total_elements: 250,
-
total_pages: 3,
-
page_number: 1
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Page.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Page.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Page.acceptable_attributes).to eq(Bandwidth::Page.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Page.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Page created by the build_from_hash method' do
-
1
page_from_hash = Bandwidth::Page.build_from_hash({
-
pageSize: 100,
-
totalElements: 250,
-
totalPages: 3,
-
pageNumber: 1
-
})
-
1
expect(page_from_hash).to be_instance_of(Bandwidth::Page)
-
1
expect(page_from_hash.page_size).to eq(100)
-
1
expect(page_from_hash.total_elements).to eq(250)
-
1
expect(page_from_hash.total_pages).to eq(3)
-
1
expect(page_from_hash.page_number).to eq(1)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(page_values.to_s).to eq('{:pageSize=>100, :totalElements=>250, :totalPages=>3, :pageNumber=>1}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
page_equal = Bandwidth::Page.new({ page_size: 25 })
-
1
expect(page_default.eql?(page_equal)).to be true
-
1
expect(page_default.eql?(page_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(page_values.to_body).to eq({
-
pageSize: 100,
-
totalElements: 250,
-
totalPages: 3,
-
pageNumber: 1
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#page_size=' do
-
1
expect {
-
1
Bandwidth::Page.new({ page_size: nil })
-
}.to raise_error(ArgumentError, 'page_size cannot be nil')
-
-
1
expect {
-
1
Bandwidth::Page.new({ page_size: -1 })
-
}.to raise_error(ArgumentError, 'invalid value for "page_size", must be greater than or equal to 0.')
-
end
-
-
1
it '#total_elements=' do
-
1
expect {
-
1
page_values.total_elements = nil
-
}.to raise_error(ArgumentError, 'total_elements cannot be nil')
-
-
1
expect {
-
1
page_values.total_elements = -1
-
}.to raise_error(ArgumentError, 'invalid value for "total_elements", must be greater than or equal to 0.')
-
end
-
-
1
it '#total_pages=' do
-
1
expect {
-
1
page_values.total_pages = nil
-
}.to raise_error(ArgumentError, 'total_pages cannot be nil')
-
-
1
expect {
-
1
page_values.total_pages = -1
-
}.to raise_error(ArgumentError, 'invalid value for "total_pages", must be greater than or equal to 0.')
-
end
-
-
1
it '#page_number=' do
-
1
expect {
-
1
page_values.page_number = nil
-
}.to raise_error(ArgumentError, 'page_number cannot be nil')
-
-
1
expect {
-
1
page_values.page_number = -1
-
}.to raise_error(ArgumentError, 'invalid value for "page_number", must be greater than or equal to 0.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::PriorityEnum
-
1
describe Bandwidth::PriorityEnum do
-
1
describe 'constants' do
-
1
it 'defines DEFAULT' do
-
1
expect(Bandwidth::PriorityEnum::DEFAULT).to eq('default')
-
end
-
-
1
it 'defines HIGH' do
-
1
expect(Bandwidth::PriorityEnum::HIGH).to eq('high')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::PriorityEnum.all_vars).to eq([
-
'default',
-
'high'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::PriorityEnum.build_from_hash('default')).to eq('default')
-
1
expect(Bandwidth::PriorityEnum.build_from_hash('high')).to eq('high')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::PriorityEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ProductTypeEnum
-
1
describe Bandwidth::ProductTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines LOCAL_A2_P' do
-
1
expect(Bandwidth::ProductTypeEnum::LOCAL_A2_P).to eq('LOCAL_A2P')
-
end
-
-
1
it 'defines P2_P' do
-
1
expect(Bandwidth::ProductTypeEnum::P2_P).to eq('P2P')
-
end
-
-
1
it 'defines SHORT_CODE_REACH' do
-
1
expect(Bandwidth::ProductTypeEnum::SHORT_CODE_REACH).to eq('SHORT_CODE_REACH')
-
end
-
-
1
it 'defines TOLL_FREE' do
-
1
expect(Bandwidth::ProductTypeEnum::TOLL_FREE).to eq('TOLL_FREE')
-
end
-
-
1
it 'defines HOSTED_SHORT_CODE' do
-
1
expect(Bandwidth::ProductTypeEnum::HOSTED_SHORT_CODE).to eq('HOSTED_SHORT_CODE')
-
end
-
-
1
it 'defines ALPHA_NUMERIC' do
-
1
expect(Bandwidth::ProductTypeEnum::ALPHA_NUMERIC).to eq('ALPHA_NUMERIC')
-
end
-
-
1
it 'defines RBM_MEDIA' do
-
1
expect(Bandwidth::ProductTypeEnum::RBM_MEDIA).to eq('RBM_MEDIA')
-
end
-
-
1
it 'defines RBM_RICH' do
-
1
expect(Bandwidth::ProductTypeEnum::RBM_RICH).to eq('RBM_RICH')
-
end
-
-
1
it 'defines RBM_CONVERSATIONAL' do
-
1
expect(Bandwidth::ProductTypeEnum::RBM_CONVERSATIONAL).to eq('RBM_CONVERSATIONAL')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::ProductTypeEnum.all_vars).to eq([
-
'LOCAL_A2P',
-
'P2P',
-
'SHORT_CODE_REACH',
-
'TOLL_FREE',
-
'HOSTED_SHORT_CODE',
-
'ALPHA_NUMERIC',
-
'RBM_MEDIA',
-
'RBM_RICH',
-
'RBM_CONVERSATIONAL'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('LOCAL_A2P')).to eq('LOCAL_A2P')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('P2P')).to eq('P2P')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('SHORT_CODE_REACH')).to eq('SHORT_CODE_REACH')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('TOLL_FREE')).to eq('TOLL_FREE')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('HOSTED_SHORT_CODE')).to eq('HOSTED_SHORT_CODE')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('ALPHA_NUMERIC')).to eq('ALPHA_NUMERIC')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('RBM_MEDIA')).to eq('RBM_MEDIA')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('RBM_RICH')).to eq('RBM_RICH')
-
1
expect(Bandwidth::ProductTypeEnum.build_from_hash('RBM_CONVERSATIONAL')).to eq('RBM_CONVERSATIONAL')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::ProductTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmActionBase
-
1
describe Bandwidth::RbmActionBase do
-
2
let(:rbm_action_base_default) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'baseline',
-
postback_data: 'baseline_postback'
-
}) }
-
4
let(:rbm_action_base_values) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionBase.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmActionBase.acceptable_attributes).to eq(Bandwidth::RbmActionBase.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmActionBase.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmActionBase created by the build_from_hash method' do
-
1
rbm_action_base_from_hash = Bandwidth::RbmActionBase.build_from_hash({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postbackData: 'reply_yes'
-
})
-
1
expect(rbm_action_base_from_hash).to be_instance_of(Bandwidth::RbmActionBase)
-
1
expect(rbm_action_base_from_hash.type).to eq(Bandwidth::RbmActionTypeEnum::REPLY)
-
1
expect(rbm_action_base_from_hash.text).to eq('Yes')
-
1
expect(rbm_action_base_from_hash.postback_data).to eq('reply_yes')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_action_base_values.to_s).to eq('{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_action_base_equal = Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'baseline',
-
postback_data: 'baseline_postback'
-
})
-
1
expect(rbm_action_base_default.eql?(rbm_action_base_equal)).to be true
-
1
expect(rbm_action_base_default.eql?(rbm_action_base_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_action_base_values.to_body).to eq({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postbackData: 'reply_yes'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ type: 'REPLY', text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ type: 'REPLY', text: 'a' * 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#postback_data=' do
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ type: 'REPLY', text: 'a', postback_data: nil })
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionBase.new({ type: 'REPLY', text: 'a', postback_data: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmActionDial
-
1
describe Bandwidth::RbmActionDial do
-
2
let(:rbm_action_dial_default) { Bandwidth::RbmActionDial.new({
-
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
phone_number: '+15554443333'
-
}) }
-
4
let(:rbm_action_dial_values) { Bandwidth::RbmActionDial.new({
-
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
-
text: 'Call us',
-
postback_data: 'dial_postback',
-
phone_number: '+19195554321'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmActionDial.acceptable_attributes).to eq(Bandwidth::RbmActionDial.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmActionDial.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmActionDial created by the build_from_hash method' do
-
1
rbm_action_dial_from_hash = Bandwidth::RbmActionDial.build_from_hash({
-
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
-
text: 'Call us',
-
postbackData: 'dial_postback',
-
phoneNumber: '+19195554321'
-
})
-
1
expect(rbm_action_dial_from_hash).to be_instance_of(Bandwidth::RbmActionDial)
-
1
expect(rbm_action_dial_from_hash.type).to eq(Bandwidth::RbmActionTypeEnum::DIAL_PHONE)
-
1
expect(rbm_action_dial_from_hash.text).to eq('Call us')
-
1
expect(rbm_action_dial_from_hash.postback_data).to eq('dial_postback')
-
1
expect(rbm_action_dial_from_hash.phone_number).to eq('+19195554321')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_action_dial_values.to_s).to eq('{:type=>"DIAL_PHONE", :text=>"Call us", :postbackData=>"dial_postback", :phoneNumber=>"+19195554321"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_action_dial_equal = Bandwidth::RbmActionDial.new({
-
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
phone_number: '+15554443333'
-
})
-
1
expect(rbm_action_dial_default.eql?(rbm_action_dial_equal)).to be true
-
1
expect(rbm_action_dial_default.eql?(rbm_action_dial_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_action_dial_values.to_body).to eq({
-
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
-
text: 'Call us',
-
postbackData: 'dial_postback',
-
phoneNumber: '+19195554321'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: 'DIAL_PHONE', text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: 'DIAL_PHONE', text: 'a' * 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#postback_data=' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: 'DIAL_PHONE', text: 'a', postback_data: nil })
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: 'DIAL_PHONE', text: 'a', postback_data: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::RbmActionDial.new({ type: 'DIAL_PHONE', text: 'a', postback_data: 'a', phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmActionOpenUrl
-
1
describe Bandwidth::RbmActionOpenUrl do
-
2
let(:rbm_action_open_url_default) { Bandwidth::RbmActionOpenUrl.new({
-
type: Bandwidth::RbmActionTypeEnum::OPEN_URL,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
url: 'https://example.com/baseline'
-
}) }
-
4
let(:rbm_action_open_url_values) { Bandwidth::RbmActionOpenUrl.new({
-
type: Bandwidth::RbmActionTypeEnum::OPEN_URL,
-
text: 'Open URL',
-
postback_data: 'open_url_postback',
-
url: 'https://example.com',
-
application: Bandwidth::RbmOpenUrlEnum::BROWSER,
-
webview_view_mode: Bandwidth::RbmWebViewEnum::FULL
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmActionOpenUrl.acceptable_attributes).to eq(Bandwidth::RbmActionOpenUrl.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmActionOpenUrl.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmActionOpenUrl created by the build_from_hash method' do
-
1
rbm_action_open_url_from_hash = Bandwidth::RbmActionOpenUrl.build_from_hash({
-
type: Bandwidth::RbmActionTypeEnum::OPEN_URL,
-
text: 'Open URL',
-
postbackData: 'open_url_postback',
-
url: 'https://example.com',
-
application: Bandwidth::RbmOpenUrlEnum::BROWSER,
-
webviewViewMode: Bandwidth::RbmWebViewEnum::FULL
-
})
-
1
expect(rbm_action_open_url_from_hash).to be_instance_of(Bandwidth::RbmActionOpenUrl)
-
1
expect(rbm_action_open_url_from_hash.type).to eq(Bandwidth::RbmActionTypeEnum::OPEN_URL)
-
1
expect(rbm_action_open_url_from_hash.text).to eq('Open URL')
-
1
expect(rbm_action_open_url_from_hash.postback_data).to eq('open_url_postback')
-
1
expect(rbm_action_open_url_from_hash.url).to eq('https://example.com')
-
1
expect(rbm_action_open_url_from_hash.application).to eq(Bandwidth::RbmOpenUrlEnum::BROWSER)
-
1
expect(rbm_action_open_url_from_hash.webview_view_mode).to eq(Bandwidth::RbmWebViewEnum::FULL)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_action_open_url_values.to_s).to eq('{:type=>"OPEN_URL", :text=>"Open URL", :postbackData=>"open_url_postback", :url=>"https://example.com", :application=>"BROWSER", :webviewViewMode=>"FULL"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_action_open_url_equal = Bandwidth::RbmActionOpenUrl.new({
-
type: Bandwidth::RbmActionTypeEnum::OPEN_URL,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
url: 'https://example.com/baseline'
-
})
-
1
expect(rbm_action_open_url_default.eql?(rbm_action_open_url_equal)).to be true
-
1
expect(rbm_action_open_url_default.eql?(rbm_action_open_url_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_action_open_url_values.to_body).to eq({
-
type: Bandwidth::RbmActionTypeEnum::OPEN_URL,
-
text: 'Open URL',
-
postbackData: 'open_url_postback',
-
url: 'https://example.com',
-
application: Bandwidth::RbmOpenUrlEnum::BROWSER,
-
webviewViewMode: Bandwidth::RbmWebViewEnum::FULL
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: 'a' * 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#postback_data=' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: 'a', postback_data: nil })
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: 'a', postback_data: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#url=' do
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: 'a', postback_data: 'a', url: nil })
-
}.to raise_error(ArgumentError, 'url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionOpenUrl.new({ type: 'OPEN_URL', text: 'a', postback_data: 'a', url: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmActionTypeEnum
-
1
describe Bandwidth::RbmActionTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines REPLY' do
-
1
expect(Bandwidth::RbmActionTypeEnum::REPLY).to eq('REPLY')
-
end
-
-
1
it 'defines DIAL_PHONE' do
-
1
expect(Bandwidth::RbmActionTypeEnum::DIAL_PHONE).to eq('DIAL_PHONE')
-
end
-
-
1
it 'defines SHOW_LOCATION' do
-
1
expect(Bandwidth::RbmActionTypeEnum::SHOW_LOCATION).to eq('SHOW_LOCATION')
-
end
-
-
1
it 'defines CREATE_CALENDAR_EVENT' do
-
1
expect(Bandwidth::RbmActionTypeEnum::CREATE_CALENDAR_EVENT).to eq('CREATE_CALENDAR_EVENT')
-
end
-
-
1
it 'defines OPEN_URL' do
-
1
expect(Bandwidth::RbmActionTypeEnum::OPEN_URL).to eq('OPEN_URL')
-
end
-
-
1
it 'defines REQUEST_LOCATION' do
-
1
expect(Bandwidth::RbmActionTypeEnum::REQUEST_LOCATION).to eq('REQUEST_LOCATION')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RbmActionTypeEnum.all_vars).to eq([
-
'REPLY',
-
'DIAL_PHONE',
-
'SHOW_LOCATION',
-
'CREATE_CALENDAR_EVENT',
-
'OPEN_URL',
-
'REQUEST_LOCATION'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('REPLY')).to eq('REPLY')
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('DIAL_PHONE')).to eq('DIAL_PHONE')
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('SHOW_LOCATION')).to eq('SHOW_LOCATION')
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('CREATE_CALENDAR_EVENT')).to eq('CREATE_CALENDAR_EVENT')
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('OPEN_URL')).to eq('OPEN_URL')
-
1
expect(Bandwidth::RbmActionTypeEnum.build_from_hash('REQUEST_LOCATION')).to eq('REQUEST_LOCATION')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RbmActionTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmActionViewLocation
-
1
describe Bandwidth::RbmActionViewLocation do
-
2
let(:rbm_action_view_location_default) { Bandwidth::RbmActionViewLocation.new({
-
type: Bandwidth::RbmActionTypeEnum::SHOW_LOCATION,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
latitude: 0.0,
-
longitude: 0.0
-
}) }
-
5
let(:rbm_action_view_location_values) { Bandwidth::RbmActionViewLocation.new({
-
type: Bandwidth::RbmActionTypeEnum::SHOW_LOCATION,
-
text: 'View location',
-
postback_data: 'location_postback',
-
latitude: 35.7796,
-
longitude: -78.6382,
-
label: 'Bandwidth HQ'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmActionViewLocation.acceptable_attributes).to eq(Bandwidth::RbmActionViewLocation.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmActionViewLocation.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmActionViewLocation created by the build_from_hash method' do
-
1
rbm_action_view_location_from_hash = Bandwidth::RbmActionViewLocation.build_from_hash({
-
type: Bandwidth::RbmActionTypeEnum::SHOW_LOCATION,
-
text: 'View location',
-
postbackData: 'location_postback',
-
latitude: 35.7796,
-
longitude: -78.6382,
-
label: 'Bandwidth HQ'
-
})
-
1
expect(rbm_action_view_location_from_hash).to be_instance_of(Bandwidth::RbmActionViewLocation)
-
1
expect(rbm_action_view_location_from_hash.type).to eq(Bandwidth::RbmActionTypeEnum::SHOW_LOCATION)
-
1
expect(rbm_action_view_location_from_hash.text).to eq('View location')
-
1
expect(rbm_action_view_location_from_hash.postback_data).to eq('location_postback')
-
1
expect(rbm_action_view_location_from_hash.latitude).to eq(35.7796)
-
1
expect(rbm_action_view_location_from_hash.longitude).to eq(-78.6382)
-
1
expect(rbm_action_view_location_from_hash.label).to eq('Bandwidth HQ')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_action_view_location_values.to_s).to eq('{:type=>"SHOW_LOCATION", :text=>"View location", :postbackData=>"location_postback", :latitude=>35.7796, :longitude=>-78.6382, :label=>"Bandwidth HQ"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_action_view_location_equal = Bandwidth::RbmActionViewLocation.new({
-
type: Bandwidth::RbmActionTypeEnum::SHOW_LOCATION,
-
text: 'baseline',
-
postback_data: 'baseline_postback',
-
latitude: 0.0,
-
longitude: 0.0
-
})
-
1
expect(rbm_action_view_location_default.eql?(rbm_action_view_location_equal)).to be true
-
1
expect(rbm_action_view_location_default.eql?(rbm_action_view_location_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_action_view_location_values.to_body).to eq({
-
type: Bandwidth::RbmActionTypeEnum::SHOW_LOCATION,
-
text: 'View location',
-
postbackData: 'location_postback',
-
latitude: 35.7796,
-
longitude: -78.6382,
-
label: 'Bandwidth HQ'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#type=' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: nil })
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: 'a' * 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.')
-
end
-
-
1
it '#postback_data=' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: 'a', postback_data: nil })
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: 'a', postback_data: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
-
1
it '#latitude=' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: 'a', postback_data: 'a', latitude: nil })
-
}.to raise_error(ArgumentError, 'latitude cannot be nil')
-
end
-
-
1
it '#longitude=' do
-
1
expect {
-
1
Bandwidth::RbmActionViewLocation.new({ type: 'SHOW_LOCATION', text: 'a', postback_data: 'a', latitude: 0.0, longitude: nil })
-
}.to raise_error(ArgumentError, 'longitude cannot be nil')
-
end
-
-
1
it '#label=' do
-
1
expect {
-
1
rbm_action_view_location_values.label = nil
-
}.to raise_error(ArgumentError, 'label cannot be nil')
-
-
1
expect {
-
1
rbm_action_view_location_values.label = 'a' * 101
-
}.to raise_error(ArgumentError, 'invalid value for "label", the character length must be smaller than or equal to 100.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmCardContentMedia
-
1
describe Bandwidth::RbmCardContentMedia do
-
2
let(:rbm_card_content_media_default) { Bandwidth::RbmCardContentMedia.new({
-
file_url: 'https://example.com/baseline.png',
-
height: Bandwidth::RbmMediaHeightEnum::SHORT
-
}) }
-
5
let(:rbm_card_content_media_values) { Bandwidth::RbmCardContentMedia.new({
-
file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnail_url: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmCardContentMedia.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmCardContentMedia.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmCardContentMedia.acceptable_attributes).to eq(Bandwidth::RbmCardContentMedia.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmCardContentMedia.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmCardContentMedia created by the build_from_hash method' do
-
1
rbm_card_content_media_from_hash = Bandwidth::RbmCardContentMedia.build_from_hash({
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnailUrl: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
})
-
1
expect(rbm_card_content_media_from_hash).to be_instance_of(Bandwidth::RbmCardContentMedia)
-
1
expect(rbm_card_content_media_from_hash.file_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo.png')
-
1
expect(rbm_card_content_media_from_hash.thumbnail_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo-thumb.png')
-
1
expect(rbm_card_content_media_from_hash.height).to eq(Bandwidth::RbmMediaHeightEnum::MEDIUM)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_card_content_media_values.to_s).to eq('{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png", :thumbnailUrl=>"https://dev.bandwidth.com/images/bandwidth-logo-thumb.png", :height=>"MEDIUM"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_card_content_media_equal = Bandwidth::RbmCardContentMedia.new({
-
file_url: 'https://example.com/baseline.png',
-
height: Bandwidth::RbmMediaHeightEnum::SHORT
-
})
-
1
expect(rbm_card_content_media_default.eql?(rbm_card_content_media_equal)).to be true
-
1
expect(rbm_card_content_media_default.eql?(rbm_card_content_media_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_card_content_media_values.to_body).to eq({
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnailUrl: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#file_url=' do
-
1
expect {
-
1
Bandwidth::RbmCardContentMedia.new({ file_url: nil })
-
}.to raise_error(ArgumentError, 'file_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmCardContentMedia.new({ file_url: 'a' * 1001 })
-
}.to raise_error(ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
1
it '#thumbnail_url=' do
-
1
expect {
-
1
rbm_card_content_media_values.thumbnail_url = nil
-
}.to raise_error(ArgumentError, 'thumbnail_url cannot be nil')
-
-
1
expect {
-
1
rbm_card_content_media_values.thumbnail_url = 'a' * 1001
-
}.to raise_error(ArgumentError, 'invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
1
it '#height=' do
-
1
expect {
-
1
Bandwidth::RbmCardContentMedia.new({ file_url: 'a', height: nil })
-
}.to raise_error(ArgumentError, 'height cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmCardContent
-
1
describe Bandwidth::RbmCardContent do
-
5
let(:reply_action) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
2
let(:rbm_card_content_default) { Bandwidth::RbmCardContent.new }
-
5
let(:rbm_card_content_values) { Bandwidth::RbmCardContent.new({
-
title: 'Card Title',
-
description: 'Card Description',
-
media: Bandwidth::RbmCardContentMedia.new({
-
file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
}),
-
suggestions: [reply_action]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmCardContent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmCardContent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmCardContent.acceptable_attributes).to eq(Bandwidth::RbmCardContent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmCardContent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmCardContent created by the build_from_hash method' do
-
1
rbm_card_content_from_hash = Bandwidth::RbmCardContent.build_from_hash({
-
title: 'Card Title',
-
description: 'Card Description',
-
media: {
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
},
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
1
expect(rbm_card_content_from_hash).to be_instance_of(Bandwidth::RbmCardContent)
-
1
expect(rbm_card_content_from_hash.title).to eq('Card Title')
-
1
expect(rbm_card_content_from_hash.description).to eq('Card Description')
-
1
expect(rbm_card_content_from_hash.media).to be_instance_of(Bandwidth::RbmCardContentMedia)
-
1
expect(rbm_card_content_from_hash.suggestions.first).to be_instance_of(Bandwidth::RbmActionBase)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_card_content_values.to_s).to eq('{:title=>"Card Title", :description=>"Card Description", :media=>{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png", :height=>"MEDIUM"}, :suggestions=>[{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(rbm_card_content_default.eql?(Bandwidth::RbmCardContent.new)).to be true
-
1
expect(rbm_card_content_default.eql?(rbm_card_content_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_card_content_values.to_body).to eq({
-
title: 'Card Title',
-
description: 'Card Description',
-
media: {
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
height: Bandwidth::RbmMediaHeightEnum::MEDIUM
-
},
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#title=' do
-
1
expect {
-
1
Bandwidth::RbmCardContent.new({ title: nil })
-
}.to raise_error(ArgumentError, 'title cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmCardContent.new({ title: 'a' * 201 })
-
}.to raise_error(ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 200.')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
Bandwidth::RbmCardContent.new({ description: nil })
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmCardContent.new({ description: 'a' * 2001 })
-
}.to raise_error(ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.')
-
end
-
-
1
it '#suggestions=' do
-
1
expect {
-
1
rbm_card_content_values.suggestions = nil
-
}.to raise_error(ArgumentError, 'suggestions cannot be nil')
-
-
1
expect {
-
1
rbm_card_content_values.suggestions = [reply_action] * 5
-
}.to raise_error(ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 4.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmLocationResponse
-
1
describe Bandwidth::RbmLocationResponse do
-
2
let(:rbm_location_response_default) { Bandwidth::RbmLocationResponse.new }
-
4
let(:rbm_location_response_values) { Bandwidth::RbmLocationResponse.new({
-
latitude: 35.7796,
-
longitude: -78.6382
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmLocationResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmLocationResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmLocationResponse.acceptable_attributes).to eq(Bandwidth::RbmLocationResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmLocationResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmLocationResponse created by the build_from_hash method' do
-
1
rbm_location_response_from_hash = Bandwidth::RbmLocationResponse.build_from_hash({
-
latitude: 35.7796,
-
longitude: -78.6382
-
})
-
1
expect(rbm_location_response_from_hash).to be_instance_of(Bandwidth::RbmLocationResponse)
-
1
expect(rbm_location_response_from_hash.latitude).to eq(35.7796)
-
1
expect(rbm_location_response_from_hash.longitude).to eq(-78.6382)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_location_response_values.to_s).to eq('{:latitude=>35.7796, :longitude=>-78.6382}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(rbm_location_response_default.eql?(Bandwidth::RbmLocationResponse.new)).to be true
-
1
expect(rbm_location_response_default.eql?(rbm_location_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_location_response_values.to_body).to eq({
-
latitude: 35.7796,
-
longitude: -78.6382
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMediaHeightEnum
-
1
describe Bandwidth::RbmMediaHeightEnum do
-
1
describe 'constants' do
-
1
it 'defines SHORT' do
-
1
expect(Bandwidth::RbmMediaHeightEnum::SHORT).to eq('SHORT')
-
end
-
-
1
it 'defines MEDIUM' do
-
1
expect(Bandwidth::RbmMediaHeightEnum::MEDIUM).to eq('MEDIUM')
-
end
-
-
1
it 'defines TALL' do
-
1
expect(Bandwidth::RbmMediaHeightEnum::TALL).to eq('TALL')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RbmMediaHeightEnum.all_vars).to eq([
-
'SHORT',
-
'MEDIUM',
-
'TALL'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RbmMediaHeightEnum.build_from_hash('SHORT')).to eq('SHORT')
-
1
expect(Bandwidth::RbmMediaHeightEnum.build_from_hash('MEDIUM')).to eq('MEDIUM')
-
1
expect(Bandwidth::RbmMediaHeightEnum.build_from_hash('TALL')).to eq('TALL')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RbmMediaHeightEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMessageCarouselCard
-
1
describe Bandwidth::RbmMessageCarouselCard do
-
6
let(:card_content) { Bandwidth::RbmCardContent.new({
-
title: 'Card Title',
-
description: 'Card Description'
-
}) }
-
6
let(:reply_action) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
2
let(:rbm_message_carousel_card_default) { Bandwidth::RbmMessageCarouselCard.new({
-
card_width: Bandwidth::CardWidthEnum::SMALL,
-
card_contents: [card_content, card_content]
-
}) }
-
6
let(:rbm_message_carousel_card_values) { Bandwidth::RbmMessageCarouselCard.new({
-
card_width: Bandwidth::CardWidthEnum::MEDIUM,
-
card_contents: [card_content, card_content],
-
suggestions: [reply_action]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageCarouselCard.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageCarouselCard.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmMessageCarouselCard.acceptable_attributes).to eq(Bandwidth::RbmMessageCarouselCard.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmMessageCarouselCard.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmMessageCarouselCard created by the build_from_hash method' do
-
1
rbm_message_carousel_card_from_hash = Bandwidth::RbmMessageCarouselCard.build_from_hash({
-
cardWidth: Bandwidth::CardWidthEnum::MEDIUM,
-
cardContents: [{ title: 'Card Title', description: 'Card Description' }, { title: 'Card Title', description: 'Card Description' }],
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
1
expect(rbm_message_carousel_card_from_hash).to be_instance_of(Bandwidth::RbmMessageCarouselCard)
-
1
expect(rbm_message_carousel_card_from_hash.card_width).to eq(Bandwidth::CardWidthEnum::MEDIUM)
-
1
expect(rbm_message_carousel_card_from_hash.card_contents.first).to be_instance_of(Bandwidth::RbmCardContent)
-
1
expect(rbm_message_carousel_card_from_hash.suggestions.first).to be_instance_of(Bandwidth::RbmActionBase)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_message_carousel_card_values.to_s).to eq('{:cardWidth=>"MEDIUM", :cardContents=>[{:title=>"Card Title", :description=>"Card Description"}, {:title=>"Card Title", :description=>"Card Description"}], :suggestions=>[{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_message_carousel_card_equal = Bandwidth::RbmMessageCarouselCard.new({
-
card_width: Bandwidth::CardWidthEnum::SMALL,
-
card_contents: [card_content, card_content]
-
})
-
1
expect(rbm_message_carousel_card_default.eql?(rbm_message_carousel_card_equal)).to be true
-
1
expect(rbm_message_carousel_card_default.eql?(rbm_message_carousel_card_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_message_carousel_card_values.to_body).to eq({
-
cardWidth: Bandwidth::CardWidthEnum::MEDIUM,
-
cardContents: [
-
{ title: 'Card Title', description: 'Card Description' },
-
{ title: 'Card Title', description: 'Card Description' }
-
],
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#card_width=' do
-
1
expect {
-
1
Bandwidth::RbmMessageCarouselCard.new({ card_width: nil })
-
}.to raise_error(ArgumentError, 'card_width cannot be nil')
-
end
-
-
1
it '#card_contents=' do
-
1
expect {
-
1
Bandwidth::RbmMessageCarouselCard.new({ card_width: 'SMALL' })
-
}.to raise_error(ArgumentError, 'card_contents cannot be nil')
-
-
1
expect {
-
1
rbm_message_carousel_card_values.card_contents = nil
-
}.to raise_error(ArgumentError, 'card_contents cannot be nil')
-
-
1
expect {
-
1
rbm_message_carousel_card_values.card_contents = [card_content] * 11
-
}.to raise_error(ArgumentError, 'invalid value for "card_contents", number of items must be less than or equal to 10.')
-
end
-
-
1
it '#suggestions=' do
-
1
expect {
-
1
rbm_message_carousel_card_values.suggestions = nil
-
}.to raise_error(ArgumentError, 'suggestions cannot be nil')
-
-
1
expect {
-
1
rbm_message_carousel_card_values.suggestions = [reply_action] * 12
-
}.to raise_error(ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMessageContentFile
-
1
describe Bandwidth::RbmMessageContentFile do
-
2
let(:rbm_message_content_file_default) { Bandwidth::RbmMessageContentFile.new({
-
file_url: 'https://example.com/baseline.png'
-
}) }
-
5
let(:rbm_message_content_file_values) { Bandwidth::RbmMessageContentFile.new({
-
file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnail_url: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentFile.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentFile.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmMessageContentFile.acceptable_attributes).to eq(Bandwidth::RbmMessageContentFile.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmMessageContentFile.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmMessageContentFile created by the build_from_hash method' do
-
1
rbm_message_content_file_from_hash = Bandwidth::RbmMessageContentFile.build_from_hash({
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnailUrl: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png'
-
})
-
1
expect(rbm_message_content_file_from_hash).to be_instance_of(Bandwidth::RbmMessageContentFile)
-
1
expect(rbm_message_content_file_from_hash.file_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo.png')
-
1
expect(rbm_message_content_file_from_hash.thumbnail_url).to eq('https://dev.bandwidth.com/images/bandwidth-logo-thumb.png')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_message_content_file_values.to_s).to eq('{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png", :thumbnailUrl=>"https://dev.bandwidth.com/images/bandwidth-logo-thumb.png"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_message_content_file_equal = Bandwidth::RbmMessageContentFile.new({
-
file_url: 'https://example.com/baseline.png'
-
})
-
1
expect(rbm_message_content_file_default.eql?(rbm_message_content_file_equal)).to be true
-
1
expect(rbm_message_content_file_default.eql?(rbm_message_content_file_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_message_content_file_values.to_body).to eq({
-
fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png',
-
thumbnailUrl: 'https://dev.bandwidth.com/images/bandwidth-logo-thumb.png'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#file_url=' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentFile.new({ file_url: nil })
-
}.to raise_error(ArgumentError, 'file_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmMessageContentFile.new({ file_url: 'a' * 1001 })
-
}.to raise_error(ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.')
-
end
-
-
1
it '#thumbnail_url=' do
-
1
expect {
-
1
rbm_message_content_file_values.thumbnail_url = nil
-
}.to raise_error(ArgumentError, 'thumbnail_url cannot be nil')
-
-
1
expect {
-
1
rbm_message_content_file_values.thumbnail_url = 'a' * 1001
-
}.to raise_error(ArgumentError, 'invalid value for "thumbnail_url", the character length must be smaller than or equal to 1000.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMessageContentRichCard
-
1
describe Bandwidth::RbmMessageContentRichCard do
-
2
let(:card_content) { Bandwidth::RbmCardContent.new({
-
title: 'Card Title',
-
description: 'Card Description'
-
}) }
-
-
1
describe '.openapi_one_of' do
-
1
it 'lists the classes defined in oneOf' do
-
1
expect(Bandwidth::RbmMessageContentRichCard.openapi_one_of).to eq([
-
:'RbmMessageCarouselCard',
-
:'RbmStandaloneCard'
-
])
-
end
-
end
-
-
1
describe '.build' do
-
1
it 'routes payloads matching RbmMessageCarouselCard attributes to RbmMessageCarouselCard.build_from_hash' do
-
1
data = { cardWidth: 'SMALL', cardContents: [card_content, card_content] }
-
1
expect(Bandwidth::RbmMessageContentRichCard.build(data)).to be_instance_of(Bandwidth::RbmMessageCarouselCard)
-
end
-
-
1
it 'routes payloads matching RbmStandaloneCard attributes to RbmStandaloneCard.build_from_hash' do
-
1
data = { orientation: 'HORIZONTAL', thumbnailImageAlignment: 'LEFT', cardContent: { title: 'Card Title' } }
-
1
expect(Bandwidth::RbmMessageContentRichCard.build(data)).to be_instance_of(Bandwidth::RbmStandaloneCard)
-
end
-
-
1
it 'returns nil when the payload does not match any oneOf schema' do
-
1
expect(Bandwidth::RbmMessageContentRichCard.build({ unknown: 'value' })).to be_nil
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMessageContentText
-
1
describe Bandwidth::RbmMessageContentText do
-
5
let(:reply_action) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
2
let(:rbm_message_content_text_default) { Bandwidth::RbmMessageContentText.new({
-
text: 'baseline'
-
}) }
-
5
let(:rbm_message_content_text_values) { Bandwidth::RbmMessageContentText.new({
-
text: 'Hello world',
-
suggestions: [reply_action]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentText.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentText.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmMessageContentText.acceptable_attributes).to eq(Bandwidth::RbmMessageContentText.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmMessageContentText.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmMessageContentText created by the build_from_hash method' do
-
1
rbm_message_content_text_from_hash = Bandwidth::RbmMessageContentText.build_from_hash({
-
text: 'Hello world',
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
1
expect(rbm_message_content_text_from_hash).to be_instance_of(Bandwidth::RbmMessageContentText)
-
1
expect(rbm_message_content_text_from_hash.text).to eq('Hello world')
-
1
expect(rbm_message_content_text_from_hash.suggestions.first).to be_instance_of(Bandwidth::RbmActionBase)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_message_content_text_values.to_s).to eq('{:text=>"Hello world", :suggestions=>[{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_message_content_text_equal = Bandwidth::RbmMessageContentText.new({
-
text: 'baseline'
-
})
-
1
expect(rbm_message_content_text_default.eql?(rbm_message_content_text_equal)).to be true
-
1
expect(rbm_message_content_text_default.eql?(rbm_message_content_text_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_message_content_text_values.to_body).to eq({
-
text: 'Hello world',
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::RbmMessageContentText.new({ text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::RbmMessageContentText.new({ text: 'a' * 3271 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 3270.')
-
end
-
-
1
it '#suggestions=' do
-
1
expect {
-
1
rbm_message_content_text_values.suggestions = nil
-
}.to raise_error(ArgumentError, 'suggestions cannot be nil')
-
-
1
expect {
-
1
rbm_message_content_text_values.suggestions = [reply_action] * 12
-
}.to raise_error(ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmMessageMedia
-
1
describe Bandwidth::RbmMessageMedia do
-
6
let(:media_file) { Bandwidth::RbmMessageContentFile.new({
-
file_url: 'https://dev.bandwidth.com/images/bandwidth-logo.png'
-
}) }
-
6
let(:reply_action) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
2
let(:rbm_message_media_default) { Bandwidth::RbmMessageMedia.new({
-
media: [media_file]
-
}) }
-
6
let(:rbm_message_media_values) { Bandwidth::RbmMessageMedia.new({
-
media: [media_file],
-
suggestions: [reply_action]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageMedia.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmMessageMedia.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmMessageMedia.acceptable_attributes).to eq(Bandwidth::RbmMessageMedia.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmMessageMedia.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmMessageMedia created by the build_from_hash method' do
-
1
rbm_message_media_from_hash = Bandwidth::RbmMessageMedia.build_from_hash({
-
media: [{ fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }],
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
1
expect(rbm_message_media_from_hash).to be_instance_of(Bandwidth::RbmMessageMedia)
-
1
expect(rbm_message_media_from_hash.media.first).to be_instance_of(Bandwidth::RbmMessageContentFile)
-
1
expect(rbm_message_media_from_hash.suggestions.first).to be_instance_of(Bandwidth::RbmActionBase)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_message_media_values.to_s).to eq('{:media=>[{:fileUrl=>"https://dev.bandwidth.com/images/bandwidth-logo.png"}], :suggestions=>[{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_message_media_equal = Bandwidth::RbmMessageMedia.new({
-
media: [media_file]
-
})
-
1
expect(rbm_message_media_default.eql?(rbm_message_media_equal)).to be true
-
1
expect(rbm_message_media_default.eql?(rbm_message_media_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_message_media_values.to_body).to eq({
-
media: [{ fileUrl: 'https://dev.bandwidth.com/images/bandwidth-logo.png' }],
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#media=' do
-
1
expect {
-
1
Bandwidth::RbmMessageMedia.new({})
-
}.to raise_error(ArgumentError, 'media cannot be nil')
-
-
1
expect {
-
1
rbm_message_media_values.media = nil
-
}.to raise_error(ArgumentError, 'media cannot be nil')
-
end
-
-
1
it '#suggestions=' do
-
1
expect {
-
1
rbm_message_media_values.suggestions = nil
-
}.to raise_error(ArgumentError, 'suggestions cannot be nil')
-
-
1
expect {
-
1
rbm_message_media_values.suggestions = [reply_action] * 12
-
}.to raise_error(ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmOpenUrlEnum
-
1
describe Bandwidth::RbmOpenUrlEnum do
-
1
describe 'constants' do
-
1
it 'defines BROWSER' do
-
1
expect(Bandwidth::RbmOpenUrlEnum::BROWSER).to eq('BROWSER')
-
end
-
-
1
it 'defines WEBVIEW' do
-
1
expect(Bandwidth::RbmOpenUrlEnum::WEBVIEW).to eq('WEBVIEW')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RbmOpenUrlEnum.all_vars).to eq([
-
'BROWSER',
-
'WEBVIEW'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RbmOpenUrlEnum.build_from_hash('BROWSER')).to eq('BROWSER')
-
1
expect(Bandwidth::RbmOpenUrlEnum.build_from_hash('WEBVIEW')).to eq('WEBVIEW')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RbmOpenUrlEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmStandaloneCard
-
1
describe Bandwidth::RbmStandaloneCard do
-
5
let(:card_content) { Bandwidth::RbmCardContent.new({
-
title: 'Card Title',
-
description: 'Card Description'
-
}) }
-
5
let(:reply_action) { Bandwidth::RbmActionBase.new({
-
type: Bandwidth::RbmActionTypeEnum::REPLY,
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
2
let(:rbm_standalone_card_default) { Bandwidth::RbmStandaloneCard.new({
-
orientation: Bandwidth::StandaloneCardOrientationEnum::HORIZONTAL,
-
thumbnail_image_alignment: Bandwidth::ThumbnailAlignmentEnum::LEFT,
-
card_content: card_content
-
}) }
-
5
let(:rbm_standalone_card_values) { Bandwidth::RbmStandaloneCard.new({
-
orientation: Bandwidth::StandaloneCardOrientationEnum::VERTICAL,
-
thumbnail_image_alignment: Bandwidth::ThumbnailAlignmentEnum::RIGHT,
-
card_content: card_content,
-
suggestions: [reply_action]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmStandaloneCard.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmStandaloneCard.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmStandaloneCard.acceptable_attributes).to eq(Bandwidth::RbmStandaloneCard.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmStandaloneCard.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmStandaloneCard created by the build_from_hash method' do
-
1
rbm_standalone_card_from_hash = Bandwidth::RbmStandaloneCard.build_from_hash({
-
orientation: Bandwidth::StandaloneCardOrientationEnum::VERTICAL,
-
thumbnailImageAlignment: Bandwidth::ThumbnailAlignmentEnum::RIGHT,
-
cardContent: { title: 'Card Title', description: 'Card Description' },
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
1
expect(rbm_standalone_card_from_hash).to be_instance_of(Bandwidth::RbmStandaloneCard)
-
1
expect(rbm_standalone_card_from_hash.orientation).to eq(Bandwidth::StandaloneCardOrientationEnum::VERTICAL)
-
1
expect(rbm_standalone_card_from_hash.thumbnail_image_alignment).to eq(Bandwidth::ThumbnailAlignmentEnum::RIGHT)
-
1
expect(rbm_standalone_card_from_hash.card_content).to be_instance_of(Bandwidth::RbmCardContent)
-
1
expect(rbm_standalone_card_from_hash.suggestions.first).to be_instance_of(Bandwidth::RbmActionBase)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_standalone_card_values.to_s).to eq('{:orientation=>"VERTICAL", :thumbnailImageAlignment=>"RIGHT", :cardContent=>{:title=>"Card Title", :description=>"Card Description"}, :suggestions=>[{:type=>"REPLY", :text=>"Yes", :postbackData=>"reply_yes"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
rbm_standalone_card_equal = Bandwidth::RbmStandaloneCard.new({
-
orientation: Bandwidth::StandaloneCardOrientationEnum::HORIZONTAL,
-
thumbnail_image_alignment: Bandwidth::ThumbnailAlignmentEnum::LEFT,
-
card_content: card_content
-
})
-
1
expect(rbm_standalone_card_default.eql?(rbm_standalone_card_equal)).to be true
-
1
expect(rbm_standalone_card_default.eql?(rbm_standalone_card_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_standalone_card_values.to_body).to eq({
-
orientation: Bandwidth::StandaloneCardOrientationEnum::VERTICAL,
-
thumbnailImageAlignment: Bandwidth::ThumbnailAlignmentEnum::RIGHT,
-
cardContent: { title: 'Card Title', description: 'Card Description' },
-
suggestions: [{ type: Bandwidth::RbmActionTypeEnum::REPLY, text: 'Yes', postbackData: 'reply_yes' }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#orientation=' do
-
1
expect {
-
1
Bandwidth::RbmStandaloneCard.new({ orientation: nil })
-
}.to raise_error(ArgumentError, 'orientation cannot be nil')
-
end
-
-
1
it '#card_content=' do
-
1
expect {
-
1
Bandwidth::RbmStandaloneCard.new({ orientation: 'HORIZONTAL', thumbnail_image_alignment: 'LEFT', card_content: nil })
-
}.to raise_error(ArgumentError, 'card_content cannot be nil')
-
end
-
-
1
it '#suggestions=' do
-
1
expect {
-
1
rbm_standalone_card_values.suggestions = nil
-
}.to raise_error(ArgumentError, 'suggestions cannot be nil')
-
-
1
expect {
-
1
rbm_standalone_card_values.suggestions = [reply_action] * 12
-
}.to raise_error(ArgumentError, 'invalid value for "suggestions", number of items must be less than or equal to 11.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmSuggestionResponse
-
1
describe Bandwidth::RbmSuggestionResponse do
-
2
let(:rbm_suggestion_response_default) { Bandwidth::RbmSuggestionResponse.new }
-
5
let(:rbm_suggestion_response_values) { Bandwidth::RbmSuggestionResponse.new({
-
text: 'Yes',
-
postback_data: 'reply_yes'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmSuggestionResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RbmSuggestionResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RbmSuggestionResponse.acceptable_attributes).to eq(Bandwidth::RbmSuggestionResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RbmSuggestionResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RbmSuggestionResponse created by the build_from_hash method' do
-
1
rbm_suggestion_response_from_hash = Bandwidth::RbmSuggestionResponse.build_from_hash({
-
text: 'Yes',
-
postbackData: 'reply_yes'
-
})
-
1
expect(rbm_suggestion_response_from_hash).to be_instance_of(Bandwidth::RbmSuggestionResponse)
-
1
expect(rbm_suggestion_response_from_hash.text).to eq('Yes')
-
1
expect(rbm_suggestion_response_from_hash.postback_data).to eq('reply_yes')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(rbm_suggestion_response_values.to_s).to eq('{:text=>"Yes", :postbackData=>"reply_yes"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(rbm_suggestion_response_default.eql?(Bandwidth::RbmSuggestionResponse.new)).to be true
-
1
expect(rbm_suggestion_response_default.eql?(rbm_suggestion_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(rbm_suggestion_response_values.to_body).to eq({
-
text: 'Yes',
-
postbackData: 'reply_yes'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#postback_data=' do
-
1
expect {
-
1
rbm_suggestion_response_values.postback_data = nil
-
}.to raise_error(ArgumentError, 'postback_data cannot be nil')
-
-
1
expect {
-
1
rbm_suggestion_response_values.postback_data = 'a' * 2049
-
}.to raise_error(ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RbmWebViewEnum
-
1
describe Bandwidth::RbmWebViewEnum do
-
1
describe 'constants' do
-
1
it 'defines FULL' do
-
1
expect(Bandwidth::RbmWebViewEnum::FULL).to eq('FULL')
-
end
-
-
1
it 'defines HALF' do
-
1
expect(Bandwidth::RbmWebViewEnum::HALF).to eq('HALF')
-
end
-
-
1
it 'defines TALL' do
-
1
expect(Bandwidth::RbmWebViewEnum::TALL).to eq('TALL')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RbmWebViewEnum.all_vars).to eq([
-
'FULL',
-
'HALF',
-
'TALL'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RbmWebViewEnum.build_from_hash('FULL')).to eq('FULL')
-
1
expect(Bandwidth::RbmWebViewEnum.build_from_hash('HALF')).to eq('HALF')
-
1
expect(Bandwidth::RbmWebViewEnum.build_from_hash('TALL')).to eq('TALL')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RbmWebViewEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingAvailableCallback
-
1
describe Bandwidth::RecordingAvailableCallback do
-
2
let(:recording_available_callback_default) { Bandwidth::RecordingAvailableCallback.new }
-
4
let(:recording_available_callback_values) { Bandwidth::RecordingAvailableCallback.new({
-
event_type: 'recordingAvailable',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recording_id: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
media_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
end_time: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
status: 'complete',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingAvailableCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingAvailableCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RecordingAvailableCallback.acceptable_attributes).to eq(Bandwidth::RecordingAvailableCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::RecordingAvailableCallback.openapi_nullable).to eq(Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RecordingAvailableCallback created by the build_from_hash method' do
-
1
recording_available_callback_from_hash = Bandwidth::RecordingAvailableCallback.build_from_hash({
-
eventType: 'recordingAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
status: 'complete',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
1
expect(recording_available_callback_from_hash).to be_instance_of(Bandwidth::RecordingAvailableCallback)
-
1
expect(recording_available_callback_from_hash.event_type).to eq('recordingAvailable')
-
1
expect(recording_available_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_available_callback_from_hash.account_id).to eq('9900000')
-
1
expect(recording_available_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(recording_available_callback_from_hash.from).to eq('+19195554321')
-
1
expect(recording_available_callback_from_hash.to).to eq('+19195551234')
-
1
expect(recording_available_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(recording_available_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_available_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_available_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(recording_available_callback_from_hash.recording_id).to eq('r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_available_callback_from_hash.media_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media')
-
1
expect(recording_available_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_available_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_available_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:17:07.160Z'))
-
1
expect(recording_available_callback_from_hash.duration).to eq('PT2M')
-
1
expect(recording_available_callback_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(recording_available_callback_from_hash.channels).to eq(1)
-
1
expect(recording_available_callback_from_hash.tag).to eq('custom tag')
-
1
expect(recording_available_callback_from_hash.status).to eq('complete')
-
1
expect(recording_available_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(recording_available_callback_from_hash.transfer_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(recording_available_callback_values.to_s).to eq('{:eventType=>"recordingAvailable", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :recordingId=>"r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :mediaUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :endTime=>"2022-06-16T13:17:07.160Z", :duration=>"PT2M", :fileFormat=>"wav", :channels=>1, :tag=>"custom tag", :status=>"complete", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(recording_available_callback_default.eql?(Bandwidth::RecordingAvailableCallback.new)).to be true
-
1
expect(recording_available_callback_default.eql?(recording_available_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(recording_available_callback_values.to_body).to eq({
-
eventType: 'recordingAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
status: 'complete',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingCompleteCallback
-
1
describe Bandwidth::RecordingCompleteCallback do
-
2
let(:recording_complete_callback_default) { Bandwidth::RecordingCompleteCallback.new }
-
4
let(:recording_complete_callback_values) { Bandwidth::RecordingCompleteCallback.new({
-
event_type: 'recordingComplete',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recording_id: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
media_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
end_time: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingCompleteCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingCompleteCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RecordingCompleteCallback.acceptable_attributes).to eq(Bandwidth::RecordingCompleteCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::RecordingCompleteCallback.openapi_nullable).to eq(Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RecordingCompleteCallback created by the build_from_hash method' do
-
1
recording_complete_callback_from_hash = Bandwidth::RecordingCompleteCallback.build_from_hash({
-
eventType: 'recordingComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
1
expect(recording_complete_callback_from_hash).to be_instance_of(Bandwidth::RecordingCompleteCallback)
-
1
expect(recording_complete_callback_from_hash.event_type).to eq('recordingComplete')
-
1
expect(recording_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_complete_callback_from_hash.account_id).to eq('9900000')
-
1
expect(recording_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(recording_complete_callback_from_hash.from).to eq('+19195554321')
-
1
expect(recording_complete_callback_from_hash.to).to eq('+19195551234')
-
1
expect(recording_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(recording_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_complete_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(recording_complete_callback_from_hash.recording_id).to eq('r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(recording_complete_callback_from_hash.media_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media')
-
1
expect(recording_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(recording_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(recording_complete_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:17:07.160Z'))
-
1
expect(recording_complete_callback_from_hash.duration).to eq('PT2M')
-
1
expect(recording_complete_callback_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(recording_complete_callback_from_hash.channels).to eq(1)
-
1
expect(recording_complete_callback_from_hash.tag).to eq('custom tag')
-
1
expect(recording_complete_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(recording_complete_callback_from_hash.transfer_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(recording_complete_callback_values.to_s).to eq('{:eventType=>"recordingComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :recordingId=>"r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :mediaUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:17:07.160Z", :duration=>"PT2M", :fileFormat=>"wav", :channels=>1, :tag=>"custom tag", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(recording_complete_callback_default.eql?(Bandwidth::RecordingCompleteCallback.new)).to be true
-
1
expect(recording_complete_callback_default.eql?(recording_complete_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(recording_complete_callback_values.to_body).to eq({
-
eventType: 'recordingComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
channels: 1,
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingStateEnum
-
1
describe Bandwidth::RecordingStateEnum do
-
1
describe 'constants' do
-
1
it 'defines PAUSED' do
-
1
expect(Bandwidth::RecordingStateEnum::PAUSED).to eq('paused')
-
end
-
-
1
it 'defines RECORDING' do
-
1
expect(Bandwidth::RecordingStateEnum::RECORDING).to eq('recording')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RecordingStateEnum.all_vars).to eq([
-
'paused',
-
'recording'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RecordingStateEnum.build_from_hash('paused')).to eq('paused')
-
1
expect(Bandwidth::RecordingStateEnum.build_from_hash('recording')).to eq('recording')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RecordingStateEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingTranscriptionMetadata
-
1
describe Bandwidth::RecordingTranscriptionMetadata do
-
2
let(:recording_transcription_metadata_default) { Bandwidth::RecordingTranscriptionMetadata.new }
-
4
let(:recording_transcription_metadata_values) { Bandwidth::RecordingTranscriptionMetadata.new({
-
id: 't-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c',
-
status: 'available',
-
completed_time: '2022-06-17T22:21:30Z',
-
url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcriptions/t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingTranscriptionMetadata.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingTranscriptionMetadata.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RecordingTranscriptionMetadata.acceptable_attributes).to eq(Bandwidth::RecordingTranscriptionMetadata.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RecordingTranscriptionMetadata.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RecordingTranscriptionMetadata created by the build_from_hash method' do
-
1
recording_transcription_metadata_from_hash = Bandwidth::RecordingTranscriptionMetadata.build_from_hash({
-
id: 't-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c',
-
status: 'available',
-
completedTime: '2022-06-17T22:21:30Z',
-
url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcriptions/t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c'
-
})
-
1
expect(recording_transcription_metadata_from_hash).to be_instance_of(Bandwidth::RecordingTranscriptionMetadata)
-
1
expect(recording_transcription_metadata_from_hash.id).to eq('t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c')
-
1
expect(recording_transcription_metadata_from_hash.status).to eq('available')
-
1
expect(recording_transcription_metadata_from_hash.completed_time).to eq(Time.parse('2022-06-17T22:21:30Z'))
-
1
expect(recording_transcription_metadata_from_hash.url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcriptions/t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(recording_transcription_metadata_values.to_s).to eq('{:id=>"t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c", :status=>"available", :completedTime=>"2022-06-17T22:21:30Z", :url=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcriptions/t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(recording_transcription_metadata_default.eql?(Bandwidth::RecordingTranscriptionMetadata.new)).to be true
-
1
expect(recording_transcription_metadata_default.eql?(recording_transcription_metadata_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(recording_transcription_metadata_values.to_body).to eq({
-
id: 't-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c',
-
status: 'available',
-
completedTime: '2022-06-17T22:21:30Z',
-
url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcriptions/t-3f758f24-c7a2fdac-7c2e-4d83-bf28-c7c1ed29563c'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RecordingTranscriptions
-
1
describe Bandwidth::RecordingTranscriptions do
-
2
let(:recording_transcriptions_default) { Bandwidth::RecordingTranscriptions.new }
-
4
let(:recording_transcriptions_values) { Bandwidth::RecordingTranscriptions.new({
-
transcripts: [
-
Bandwidth::Transcription.new({ text: 'Hello World! Thank you for calling.', confidence: 0.9 })
-
]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingTranscriptions.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RecordingTranscriptions.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RecordingTranscriptions.acceptable_attributes).to eq(Bandwidth::RecordingTranscriptions.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::RecordingTranscriptions.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RecordingTranscriptions created by the build_from_hash method' do
-
1
recording_transcriptions_from_hash = Bandwidth::RecordingTranscriptions.build_from_hash({
-
transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }]
-
})
-
1
expect(recording_transcriptions_from_hash).to be_instance_of(Bandwidth::RecordingTranscriptions)
-
1
expect(recording_transcriptions_from_hash.transcripts).to be_instance_of(Array)
-
1
expect(recording_transcriptions_from_hash.transcripts.first).to be_instance_of(Bandwidth::Transcription)
-
1
expect(recording_transcriptions_from_hash.transcripts.first.text).to eq('Hello World! Thank you for calling.')
-
1
expect(recording_transcriptions_from_hash.transcripts.first.confidence).to eq(0.9)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(recording_transcriptions_values.to_s).to eq('{:transcripts=>[{:text=>"Hello World! Thank you for calling.", :confidence=>0.9}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(recording_transcriptions_default.eql?(Bandwidth::RecordingTranscriptions.new)).to be true
-
1
expect(recording_transcriptions_default.eql?(recording_transcriptions_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(recording_transcriptions_values.to_body).to eq({
-
transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RedirectCallback
-
1
describe Bandwidth::RedirectCallback do
-
2
let(:redirect_callback_default) { Bandwidth::RedirectCallback.new }
-
4
let(:redirect_callback_values) { Bandwidth::RedirectCallback.new({
-
event_type: 'redirect',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::RedirectCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::RedirectCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::RedirectCallback.acceptable_attributes).to eq(Bandwidth::RedirectCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::RedirectCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of RedirectCallback created by the build_from_hash method' do
-
1
redirect_callback_from_hash = Bandwidth::RedirectCallback.build_from_hash({
-
eventType: 'redirect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
1
expect(redirect_callback_from_hash).to be_instance_of(Bandwidth::RedirectCallback)
-
1
expect(redirect_callback_from_hash.event_type).to eq('redirect')
-
1
expect(redirect_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(redirect_callback_from_hash.account_id).to eq('9900000')
-
1
expect(redirect_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(redirect_callback_from_hash.from).to eq('+19195554321')
-
1
expect(redirect_callback_from_hash.to).to eq('+19195551234')
-
1
expect(redirect_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(redirect_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(redirect_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(redirect_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(redirect_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(redirect_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(redirect_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(redirect_callback_from_hash.tag).to eq('custom tag')
-
1
expect(redirect_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(redirect_callback_from_hash.transfer_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(redirect_callback_values.to_s).to eq('{:eventType=>"redirect", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(redirect_callback_default.eql?(Bandwidth::RedirectCallback.new)).to be true
-
1
expect(redirect_callback_default.eql?(redirect_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(redirect_callback_values.to_body).to eq({
-
eventType: 'redirect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::RedirectMethodEnum
-
1
describe Bandwidth::RedirectMethodEnum do
-
1
describe 'constants' do
-
1
it 'defines GET' do
-
1
expect(Bandwidth::RedirectMethodEnum::GET).to eq('GET')
-
end
-
-
1
it 'defines POST' do
-
1
expect(Bandwidth::RedirectMethodEnum::POST).to eq('POST')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::RedirectMethodEnum.all_vars).to eq([
-
'GET',
-
'POST'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::RedirectMethodEnum.build_from_hash('GET')).to eq('GET')
-
1
expect(Bandwidth::RedirectMethodEnum.build_from_hash('POST')).to eq('POST')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::RedirectMethodEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::SipConnectionMetadata
-
1
describe Bandwidth::SipConnectionMetadata do
-
2
let(:sip_connection_metadata_default) { Bandwidth::SipConnectionMetadata.new }
-
4
let(:sip_connection_metadata_values) { Bandwidth::SipConnectionMetadata.new({
-
ip_address: '192.168.1.1',
-
port: 5060,
-
credentials: Bandwidth::SipCredentials.new({ username: 'sipUser', password: 'sipPass' }),
-
uui_header: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::SipConnectionMetadata.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::SipConnectionMetadata.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::SipConnectionMetadata.acceptable_attributes).to eq(Bandwidth::SipConnectionMetadata.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::SipConnectionMetadata.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of SipConnectionMetadata created by the build_from_hash method' do
-
1
sip_connection_metadata_from_hash = Bandwidth::SipConnectionMetadata.build_from_hash({
-
ipAddress: '192.168.1.1',
-
port: 5060,
-
credentials: { username: 'sipUser', password: 'sipPass' },
-
uuiHeader: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
-
})
-
1
expect(sip_connection_metadata_from_hash).to be_instance_of(Bandwidth::SipConnectionMetadata)
-
1
expect(sip_connection_metadata_from_hash.ip_address).to eq('192.168.1.1')
-
1
expect(sip_connection_metadata_from_hash.port).to eq(5060)
-
1
expect(sip_connection_metadata_from_hash.credentials).to be_instance_of(Bandwidth::SipCredentials)
-
1
expect(sip_connection_metadata_from_hash.credentials.username).to eq('sipUser')
-
1
expect(sip_connection_metadata_from_hash.credentials.password).to eq('sipPass')
-
1
expect(sip_connection_metadata_from_hash.uui_header).to eq('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(sip_connection_metadata_values.to_s).to eq('{:ipAddress=>"192.168.1.1", :port=>5060, :credentials=>{:username=>"sipUser", :password=>"sipPass"}, :uuiHeader=>"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(sip_connection_metadata_default.eql?(Bandwidth::SipConnectionMetadata.new)).to be true
-
1
expect(sip_connection_metadata_default.eql?(sip_connection_metadata_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(sip_connection_metadata_values.to_body).to eq({
-
ipAddress: '192.168.1.1',
-
port: 5060,
-
credentials: { username: 'sipUser', password: 'sipPass' },
-
uuiHeader: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::SipCredentials
-
1
describe Bandwidth::SipCredentials do
-
2
let(:sip_credentials_default) { Bandwidth::SipCredentials.new }
-
4
let(:sip_credentials_values) { Bandwidth::SipCredentials.new({
-
username: 'sipUser',
-
password: 'sipPass'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::SipCredentials.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::SipCredentials.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::SipCredentials.acceptable_attributes).to eq(Bandwidth::SipCredentials.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::SipCredentials.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of SipCredentials created by the build_from_hash method' do
-
1
sip_credentials_from_hash = Bandwidth::SipCredentials.build_from_hash({
-
username: 'sipUser',
-
password: 'sipPass'
-
})
-
1
expect(sip_credentials_from_hash).to be_instance_of(Bandwidth::SipCredentials)
-
1
expect(sip_credentials_from_hash.username).to eq('sipUser')
-
1
expect(sip_credentials_from_hash.password).to eq('sipPass')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(sip_credentials_values.to_s).to eq('{:username=>"sipUser", :password=>"sipPass"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(sip_credentials_default.eql?(Bandwidth::SipCredentials.new)).to be true
-
1
expect(sip_credentials_default.eql?(sip_credentials_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(sip_credentials_values.to_body).to eq({
-
username: 'sipUser',
-
password: 'sipPass'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::SmsMessageContent
-
1
describe Bandwidth::SmsMessageContent do
-
2
let(:sms_message_content_default) { Bandwidth::SmsMessageContent.new({
-
text: 'baseline'
-
}) }
-
4
let(:sms_message_content_values) { Bandwidth::SmsMessageContent.new({
-
text: 'Hello world'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::SmsMessageContent.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::SmsMessageContent.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::SmsMessageContent.acceptable_attributes).to eq(Bandwidth::SmsMessageContent.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::SmsMessageContent.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of SmsMessageContent created by the build_from_hash method' do
-
1
sms_message_content_from_hash = Bandwidth::SmsMessageContent.build_from_hash({
-
text: 'Hello world'
-
})
-
1
expect(sms_message_content_from_hash).to be_instance_of(Bandwidth::SmsMessageContent)
-
1
expect(sms_message_content_from_hash.text).to eq('Hello world')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(sms_message_content_values.to_s).to eq('{:text=>"Hello world"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
sms_message_content_equal = Bandwidth::SmsMessageContent.new({
-
text: 'baseline'
-
})
-
1
expect(sms_message_content_default.eql?(sms_message_content_equal)).to be true
-
1
expect(sms_message_content_default.eql?(sms_message_content_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(sms_message_content_values.to_body).to eq({
-
text: 'Hello world'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#text=' do
-
1
expect {
-
1
Bandwidth::SmsMessageContent.new({ text: nil })
-
}.to raise_error(ArgumentError, 'text cannot be nil')
-
-
1
expect {
-
1
Bandwidth::SmsMessageContent.new({ text: 'a' * 2049 })
-
}.to raise_error(ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 2048.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StandaloneCardOrientationEnum
-
1
describe Bandwidth::StandaloneCardOrientationEnum do
-
1
describe 'constants' do
-
1
it 'defines HORIZONTAL' do
-
1
expect(Bandwidth::StandaloneCardOrientationEnum::HORIZONTAL).to eq('HORIZONTAL')
-
end
-
-
1
it 'defines VERTICAL' do
-
1
expect(Bandwidth::StandaloneCardOrientationEnum::VERTICAL).to eq('VERTICAL')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::StandaloneCardOrientationEnum.all_vars).to eq([
-
'HORIZONTAL',
-
'VERTICAL'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::StandaloneCardOrientationEnum.build_from_hash('HORIZONTAL')).to eq('HORIZONTAL')
-
1
expect(Bandwidth::StandaloneCardOrientationEnum.build_from_hash('VERTICAL')).to eq('VERTICAL')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::StandaloneCardOrientationEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StatusCallbackMessage
-
1
describe Bandwidth::StatusCallbackMessage do
-
2
let(:status_callback_message_default) { Bandwidth::StatusCallbackMessage.new({
-
id: 'baseline-id',
-
owner: '+19195554321',
-
application_id: 'baseline-app',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 1,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321'
-
}) }
-
12
let(:status_callback_message_values) { Bandwidth::StatusCallbackMessage.new({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 2,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::StatusCallbackMessage.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::StatusCallbackMessage.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::StatusCallbackMessage.acceptable_attributes).to eq(Bandwidth::StatusCallbackMessage.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::StatusCallbackMessage.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of StatusCallbackMessage created by the build_from_hash method' do
-
1
status_callback_message_from_hash = Bandwidth::StatusCallbackMessage.build_from_hash({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
})
-
1
expect(status_callback_message_from_hash).to be_instance_of(Bandwidth::StatusCallbackMessage)
-
1
expect(status_callback_message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(status_callback_message_from_hash.owner).to eq('+19195554321')
-
1
expect(status_callback_message_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
-
1
expect(status_callback_message_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(status_callback_message_from_hash.segment_count).to eq(2)
-
1
expect(status_callback_message_from_hash.direction).to eq(Bandwidth::MessageDirectionEnum::OUT)
-
1
expect(status_callback_message_from_hash.to).to eq(['+19195551234'])
-
1
expect(status_callback_message_from_hash.from).to eq('+19195554321')
-
1
expect(status_callback_message_from_hash.text).to eq('Hello world')
-
1
expect(status_callback_message_from_hash.tag).to eq('custom tag')
-
1
expect(status_callback_message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png'])
-
1
expect(status_callback_message_from_hash.priority).to eq(Bandwidth::PriorityEnum::DEFAULT)
-
1
expect(status_callback_message_from_hash.channel).to eq(Bandwidth::MultiChannelMessageChannelEnum::SMS)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(status_callback_message_values.to_s).to eq('{:id=>"1589228074636lm4k2je7j7jklbn2", :owner=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :time=>"2022-06-16T13:15:07.160Z", :segmentCount=>2, :direction=>"out", :to=>["+19195551234"], :from=>"+19195554321", :text=>"Hello world", :tag=>"custom tag", :media=>["https://dev.bandwidth.com/images/bandwidth-logo.png"], :priority=>"default", :channel=>"SMS"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
status_callback_message_equal = Bandwidth::StatusCallbackMessage.new({
-
id: 'baseline-id',
-
owner: '+19195554321',
-
application_id: 'baseline-app',
-
time: '2022-06-16T13:15:07.160Z',
-
segment_count: 1,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321'
-
})
-
1
expect(status_callback_message_default.eql?(status_callback_message_equal)).to be true
-
1
expect(status_callback_message_default.eql?(status_callback_message_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(status_callback_message_values.to_body).to eq({
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 2,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world',
-
tag: 'custom tag',
-
media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
-
priority: Bandwidth::PriorityEnum::DEFAULT,
-
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#id=' do
-
1
expect {
-
1
status_callback_message_values.id = nil
-
}.to raise_error(ArgumentError, 'id cannot be nil')
-
end
-
-
1
it '#owner=' do
-
1
expect {
-
1
status_callback_message_values.owner = nil
-
}.to raise_error(ArgumentError, 'owner cannot be nil')
-
end
-
-
1
it '#application_id=' do
-
1
expect {
-
1
status_callback_message_values.application_id = nil
-
}.to raise_error(ArgumentError, 'application_id cannot be nil')
-
end
-
-
1
it '#time=' do
-
1
expect {
-
1
status_callback_message_values.time = nil
-
}.to raise_error(ArgumentError, 'time cannot be nil')
-
end
-
-
1
it '#segment_count=' do
-
1
expect {
-
1
status_callback_message_values.segment_count = nil
-
}.to raise_error(ArgumentError, 'segment_count cannot be nil')
-
end
-
-
1
it '#direction=' do
-
1
expect {
-
1
status_callback_message_values.direction = nil
-
}.to raise_error(ArgumentError, 'direction cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
status_callback_message_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#from=' do
-
1
expect {
-
1
status_callback_message_values.from = nil
-
}.to raise_error(ArgumentError, 'from cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StatusCallback
-
1
describe Bandwidth::StatusCallback do
-
2
let(:status_callback_default) { Bandwidth::StatusCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED,
-
to: '+19195551234',
-
description: 'baseline description',
-
message: { id: 'baseline' }
-
}) }
-
9
let(:status_callback_values) { Bandwidth::StatusCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
event_time: '2022-06-16T13:16:07.160Z',
-
type: Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED,
-
to: '+19195551234',
-
description: 'Message delivered to carrier',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: 'out',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
error_code: 0,
-
carrier_name: 'Verizon'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::StatusCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::StatusCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::StatusCallback.acceptable_attributes).to eq(Bandwidth::StatusCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::StatusCallback.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of StatusCallback created by the build_from_hash method' do
-
1
status_callback_from_hash = Bandwidth::StatusCallback.build_from_hash({
-
time: '2022-06-16T13:15:07.160Z',
-
eventTime: '2022-06-16T13:16:07.160Z',
-
type: Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED,
-
to: '+19195551234',
-
description: 'Message delivered to carrier',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: Bandwidth::MessageDirectionEnum::OUT,
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
errorCode: 0,
-
carrierName: 'Verizon'
-
})
-
1
expect(status_callback_from_hash).to be_instance_of(Bandwidth::StatusCallback)
-
1
expect(status_callback_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(status_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:16:07.160Z'))
-
1
expect(status_callback_from_hash.type).to eq(Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED)
-
1
expect(status_callback_from_hash.to).to eq('+19195551234')
-
1
expect(status_callback_from_hash.description).to eq('Message delivered to carrier')
-
1
expect(status_callback_from_hash.message).to be_instance_of(Bandwidth::StatusCallbackMessage)
-
1
expect(status_callback_from_hash.message.id).to eq('1589228074636lm4k2je7j7jklbn2')
-
1
expect(status_callback_from_hash.message.text).to eq('Hello world')
-
1
expect(status_callback_from_hash.error_code).to eq(0)
-
1
expect(status_callback_from_hash.carrier_name).to eq('Verizon')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(status_callback_values.to_s).to eq('{:time=>"2022-06-16T13:15:07.160Z", :eventTime=>"2022-06-16T13:16:07.160Z", :type=>"message-delivered", :to=>"+19195551234", :description=>"Message delivered to carrier", :message=>{:id=>"1589228074636lm4k2je7j7jklbn2", :owner=>"+19195554321", :applicationId=>"93de2206-9669-4e07-948d-329f4b722ee2", :time=>"2022-06-16T13:15:07.160Z", :segmentCount=>1, :direction=>"out", :to=>["+19195551234"], :from=>"+19195554321", :text=>"Hello world"}, :errorCode=>0, :carrierName=>"Verizon"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
status_callback_equal = Bandwidth::StatusCallback.new({
-
time: '2022-06-16T13:15:07.160Z',
-
type: Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED,
-
to: '+19195551234',
-
description: 'baseline description',
-
message: { id: 'baseline' }
-
})
-
1
expect(status_callback_default.eql?(status_callback_equal)).to be true
-
1
expect(status_callback_default.eql?(status_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(status_callback_values.to_body).to eq({
-
time: '2022-06-16T13:15:07.160Z',
-
eventTime: '2022-06-16T13:16:07.160Z',
-
type: Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED,
-
to: '+19195551234',
-
description: 'Message delivered to carrier',
-
message: {
-
id: '1589228074636lm4k2je7j7jklbn2',
-
owner: '+19195554321',
-
applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
-
time: '2022-06-16T13:15:07.160Z',
-
segmentCount: 1,
-
direction: 'out',
-
to: ['+19195551234'],
-
from: '+19195554321',
-
text: 'Hello world'
-
},
-
errorCode: 0,
-
carrierName: 'Verizon'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#time=' do
-
1
expect {
-
1
status_callback_values.time = nil
-
}.to raise_error(ArgumentError, 'time cannot be nil')
-
end
-
-
1
it '#type=' do
-
1
expect {
-
1
status_callback_values.type = nil
-
}.to raise_error(ArgumentError, 'type cannot be nil')
-
end
-
-
1
it '#to=' do
-
1
expect {
-
1
status_callback_values.to = nil
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
end
-
-
1
it '#description=' do
-
1
expect {
-
1
status_callback_values.description = nil
-
}.to raise_error(ArgumentError, 'description cannot be nil')
-
end
-
-
1
it '#message=' do
-
1
expect {
-
1
status_callback_values.message = nil
-
}.to raise_error(ArgumentError, 'message cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StatusCallbackTypeEnum
-
1
describe Bandwidth::StatusCallbackTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines MESSAGE_SENDING' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum::MESSAGE_SENDING).to eq('message-sending')
-
end
-
-
1
it 'defines MESSAGE_DELIVERED' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum::MESSAGE_DELIVERED).to eq('message-delivered')
-
end
-
-
1
it 'defines MESSAGE_FAILED' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum::MESSAGE_FAILED).to eq('message-failed')
-
end
-
-
1
it 'defines MESSAGE_READ' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum::MESSAGE_READ).to eq('message-read')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum.all_vars).to eq([
-
'message-sending',
-
'message-delivered',
-
'message-failed',
-
'message-read'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-sending')).to eq('message-sending')
-
1
expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-delivered')).to eq('message-delivered')
-
1
expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-failed')).to eq('message-failed')
-
1
expect(Bandwidth::StatusCallbackTypeEnum.build_from_hash('message-read')).to eq('message-read')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::StatusCallbackTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::StirShaken
-
1
describe Bandwidth::StirShaken do
-
2
let(:stir_shaken_default) { Bandwidth::StirShaken.new }
-
4
let(:stir_shaken_values) { Bandwidth::StirShaken.new({
-
verstat: 'TN-Validation-Passed',
-
attestation_indicator: 'A',
-
originating_id: '99759086-1335-11ed-9bcf-5f7d464e91af'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::StirShaken.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::StirShaken.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::StirShaken.acceptable_attributes).to eq(Bandwidth::StirShaken.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::StirShaken.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of StirShaken created by the build_from_hash method' do
-
1
stir_shaken_from_hash = Bandwidth::StirShaken.build_from_hash({
-
verstat: 'TN-Validation-Passed',
-
attestationIndicator: 'A',
-
originatingId: '99759086-1335-11ed-9bcf-5f7d464e91af'
-
})
-
1
expect(stir_shaken_from_hash).to be_instance_of(Bandwidth::StirShaken)
-
1
expect(stir_shaken_from_hash.verstat).to eq('TN-Validation-Passed')
-
1
expect(stir_shaken_from_hash.attestation_indicator).to eq('A')
-
1
expect(stir_shaken_from_hash.originating_id).to eq('99759086-1335-11ed-9bcf-5f7d464e91af')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(stir_shaken_values.to_s).to eq('{:verstat=>"TN-Validation-Passed", :attestationIndicator=>"A", :originatingId=>"99759086-1335-11ed-9bcf-5f7d464e91af"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(stir_shaken_default.eql?(Bandwidth::StirShaken.new)).to be true
-
1
expect(stir_shaken_default.eql?(stir_shaken_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(stir_shaken_values.to_body).to eq({
-
verstat: 'TN-Validation-Passed',
-
attestationIndicator: 'A',
-
originatingId: '99759086-1335-11ed-9bcf-5f7d464e91af'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::SyncLookupRequest
-
1
describe Bandwidth::SyncLookupRequest do
-
2
let(:sync_lookup_request_default) { Bandwidth::SyncLookupRequest.new({
-
phone_numbers: ['+19195551234']
-
}) }
-
5
let(:sync_lookup_request_values) { Bandwidth::SyncLookupRequest.new({
-
phone_numbers: ['+19195551234', '+19195554321'],
-
rcs_agent: 'my_agent'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::SyncLookupRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::SyncLookupRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::SyncLookupRequest.acceptable_attributes).to eq(Bandwidth::SyncLookupRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::SyncLookupRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of SyncLookupRequest created by the build_from_hash method' do
-
1
sync_lookup_request_from_hash = Bandwidth::SyncLookupRequest.build_from_hash({
-
phoneNumbers: ['+19195551234', '+19195554321'],
-
rcsAgent: 'my_agent'
-
})
-
1
expect(sync_lookup_request_from_hash).to be_instance_of(Bandwidth::SyncLookupRequest)
-
1
expect(sync_lookup_request_from_hash.phone_numbers).to eq(['+19195551234', '+19195554321'])
-
1
expect(sync_lookup_request_from_hash.rcs_agent).to eq('my_agent')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(sync_lookup_request_values.to_s).to eq('{:phoneNumbers=>["+19195551234", "+19195554321"], :rcsAgent=>"my_agent"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
sync_lookup_request_equal = Bandwidth::SyncLookupRequest.new({
-
phone_numbers: ['+19195551234']
-
})
-
1
expect(sync_lookup_request_default.eql?(sync_lookup_request_equal)).to be true
-
1
expect(sync_lookup_request_default.eql?(sync_lookup_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(sync_lookup_request_values.to_body).to eq({
-
phoneNumbers: ['+19195551234', '+19195554321'],
-
rcsAgent: 'my_agent'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_numbers=' do
-
1
expect {
-
1
sync_lookup_request_values.phone_numbers = nil
-
}.to raise_error(ArgumentError, 'phone_numbers cannot be nil')
-
end
-
-
1
it '#rcs_agent=' do
-
1
expect {
-
1
Bandwidth::SyncLookupRequest.new({ phone_numbers: ['+19195551234'], rcs_agent: nil })
-
}.to raise_error(ArgumentError, 'rcs_agent cannot be nil')
-
-
1
expect {
-
1
Bandwidth::SyncLookupRequest.new({ phone_numbers: ['+19195551234'], rcs_agent: 'invalid agent!' })
-
}.to raise_error(ArgumentError, 'invalid value for "rcs_agent", must conform to the pattern (?-mix:^[A-Za-z0-9_-]{1,40}$).')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TelephoneNumber
-
1
describe Bandwidth::TelephoneNumber do
-
2
let(:telephone_number_default) { Bandwidth::TelephoneNumber.new }
-
4
let(:telephone_number_values) { Bandwidth::TelephoneNumber.new({
-
telephone_number: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TelephoneNumber.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TelephoneNumber.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TelephoneNumber.acceptable_attributes).to eq(Bandwidth::TelephoneNumber.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::TelephoneNumber.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TelephoneNumber created by the build_from_hash method' do
-
1
telephone_number_from_hash = Bandwidth::TelephoneNumber.build_from_hash({
-
telephoneNumber: '+19195551234'
-
})
-
1
expect(telephone_number_from_hash).to be_instance_of(Bandwidth::TelephoneNumber)
-
1
expect(telephone_number_from_hash.telephone_number).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(telephone_number_values.to_s).to eq('{:telephoneNumber=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(telephone_number_default.eql?(Bandwidth::TelephoneNumber.new)).to be true
-
1
expect(telephone_number_default.eql?(telephone_number_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(telephone_number_values.to_body).to eq({
-
telephoneNumber: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvBasicAuthentication
-
1
describe Bandwidth::TfvBasicAuthentication do
-
2
let(:tfv_basic_authentication_default) { Bandwidth::TfvBasicAuthentication.new({
-
username: 'baseline',
-
password: 'baselinePass'
-
}) }
-
4
let(:tfv_basic_authentication_values) { Bandwidth::TfvBasicAuthentication.new({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TfvBasicAuthentication.acceptable_attributes).to eq(Bandwidth::TfvBasicAuthentication.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::TfvBasicAuthentication.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TfvBasicAuthentication created by the build_from_hash method' do
-
1
tfv_basic_authentication_from_hash = Bandwidth::TfvBasicAuthentication.build_from_hash({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
})
-
1
expect(tfv_basic_authentication_from_hash).to be_instance_of(Bandwidth::TfvBasicAuthentication)
-
1
expect(tfv_basic_authentication_from_hash.username).to eq('mySecretUsername')
-
1
expect(tfv_basic_authentication_from_hash.password).to eq('mySecretPassword')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(tfv_basic_authentication_values.to_s).to eq('{:username=>"mySecretUsername", :password=>"mySecretPassword"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
tfv_basic_authentication_equal = Bandwidth::TfvBasicAuthentication.new({
-
username: 'baseline',
-
password: 'baselinePass'
-
})
-
1
expect(tfv_basic_authentication_default.eql?(tfv_basic_authentication_equal)).to be true
-
1
expect(tfv_basic_authentication_default.eql?(tfv_basic_authentication_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(tfv_basic_authentication_values.to_body).to eq({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new({ username: nil, password: 'pass' })
-
}.to raise_error(ArgumentError, 'username cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new({ username: 'a' * 101, password: 'pass' })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new({ username: 'user', password: nil })
-
}.to raise_error(ArgumentError, 'password cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvBasicAuthentication.new({ username: 'user', password: 'a' * 201 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvCallbackStatusEnum
-
1
describe Bandwidth::TfvCallbackStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines VERIFIED' do
-
1
expect(Bandwidth::TfvCallbackStatusEnum::VERIFIED).to eq('VERIFIED')
-
end
-
-
1
it 'defines UNVERIFIED' do
-
1
expect(Bandwidth::TfvCallbackStatusEnum::UNVERIFIED).to eq('UNVERIFIED')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::TfvCallbackStatusEnum.all_vars).to eq([
-
'VERIFIED',
-
'UNVERIFIED'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::TfvCallbackStatusEnum.build_from_hash('VERIFIED')).to eq('VERIFIED')
-
1
expect(Bandwidth::TfvCallbackStatusEnum.build_from_hash('UNVERIFIED')).to eq('UNVERIFIED')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::TfvCallbackStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvError
-
1
describe Bandwidth::TfvError do
-
2
let(:tfv_error_default) { Bandwidth::TfvError.new }
-
4
let(:tfv_error_values) { Bandwidth::TfvError.new({
-
type: 'type',
-
description: 'description',
-
errors: { key: 'value' }
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TfvError.acceptable_attributes).to eq(Bandwidth::TfvError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::TfvError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TfvError created by the build_from_hash method' do
-
1
tfv_error_from_hash = Bandwidth::TfvError.build_from_hash({
-
type: 'type',
-
description: 'description',
-
errors: { key: 'value' }
-
})
-
1
expect(tfv_error_from_hash).to be_instance_of(Bandwidth::TfvError)
-
1
expect(tfv_error_from_hash.type).to eq('type')
-
1
expect(tfv_error_from_hash.description).to eq('description')
-
1
expect(tfv_error_from_hash.errors).to eq({ key: 'value' })
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(tfv_error_values.to_s).to eq('{:type=>"type", :description=>"description", :errors=>{:key=>"value"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(tfv_error_default.eql?(Bandwidth::TfvError.new)).to be true
-
1
expect(tfv_error_default.eql?(tfv_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(tfv_error_values.to_body).to eq({
-
type: 'type',
-
description: 'description',
-
errors: { key: 'value' }
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvStatusEnum
-
1
describe Bandwidth::TfvStatusEnum do
-
1
describe 'constants' do
-
1
it 'defines VERIFIED' do
-
1
expect(Bandwidth::TfvStatusEnum::VERIFIED).to eq('VERIFIED')
-
end
-
-
1
it 'defines UNVERIFIED' do
-
1
expect(Bandwidth::TfvStatusEnum::UNVERIFIED).to eq('UNVERIFIED')
-
end
-
-
1
it 'defines PENDING' do
-
1
expect(Bandwidth::TfvStatusEnum::PENDING).to eq('PENDING')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::TfvStatusEnum.all_vars).to eq([
-
'VERIFIED',
-
'UNVERIFIED',
-
'PENDING'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::TfvStatusEnum.build_from_hash('VERIFIED')).to eq('VERIFIED')
-
1
expect(Bandwidth::TfvStatusEnum.build_from_hash('UNVERIFIED')).to eq('UNVERIFIED')
-
1
expect(Bandwidth::TfvStatusEnum.build_from_hash('PENDING')).to eq('PENDING')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::TfvStatusEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvStatus
-
1
describe Bandwidth::TfvStatus do
-
2
let(:tfv_status_default) { Bandwidth::TfvStatus.new }
-
4
let(:tfv_status_values) { Bandwidth::TfvStatus.new({
-
phone_number: '+18005554321',
-
status: Bandwidth::TfvStatusEnum::VERIFIED,
-
internal_ticket_number: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
decline_reason_description: 'The reason for declining',
-
resubmit_allowed: false,
-
created_date_time: '2024-01-01T00:00:00Z',
-
modified_date_time: '2024-01-02T00:00:00Z',
-
submission: { businessAddress: { name: 'Bandwidth' } },
-
blocked: false,
-
blocked_reason: 'The reason for blocking',
-
cv_token: 'cv_token_value'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvStatus.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TfvStatus.acceptable_attributes).to eq(Bandwidth::TfvStatus.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TfvStatus.openapi_nullable).to eq(Set.new([:'cv_token']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TfvStatus created by the build_from_hash method' do
-
1
tfv_status_from_hash = Bandwidth::TfvStatus.build_from_hash({
-
phoneNumber: '+18005554321',
-
status: Bandwidth::TfvStatusEnum::VERIFIED,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
declineReasonDescription: 'The reason for declining',
-
resubmitAllowed: false,
-
createdDateTime: '2024-01-01T00:00:00Z',
-
modifiedDateTime: '2024-01-02T00:00:00Z',
-
submission: { businessAddress: { name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' } },
-
blocked: false,
-
blockedReason: 'The reason for blocking',
-
cvToken: 'cv_token_value'
-
})
-
1
expect(tfv_status_from_hash).to be_instance_of(Bandwidth::TfvStatus)
-
1
expect(tfv_status_from_hash.phone_number).to eq('+18005554321')
-
1
expect(tfv_status_from_hash.status).to eq(Bandwidth::TfvStatusEnum::VERIFIED)
-
1
expect(tfv_status_from_hash.internal_ticket_number).to eq('8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3')
-
1
expect(tfv_status_from_hash.decline_reason_description).to eq('The reason for declining')
-
1
expect(tfv_status_from_hash.resubmit_allowed).to eq(false)
-
1
expect(tfv_status_from_hash.created_date_time).to eq(Time.parse('2024-01-01T00:00:00Z'))
-
1
expect(tfv_status_from_hash.modified_date_time).to eq(Time.parse('2024-01-02T00:00:00Z'))
-
1
expect(tfv_status_from_hash.submission).to be_instance_of(Bandwidth::TfvSubmissionInfo)
-
1
expect(tfv_status_from_hash.blocked).to eq(false)
-
1
expect(tfv_status_from_hash.blocked_reason).to eq('The reason for blocking')
-
1
expect(tfv_status_from_hash.cv_token).to eq('cv_token_value')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(tfv_status_values.to_s).to eq('{:phoneNumber=>"+18005554321", :status=>"VERIFIED", :internalTicketNumber=>"8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3", :declineReasonDescription=>"The reason for declining", :resubmitAllowed=>false, :createdDateTime=>"2024-01-01T00:00:00Z", :modifiedDateTime=>"2024-01-02T00:00:00Z", :submission=>{:businessAddress=>{:name=>"Bandwidth"}}, :blocked=>false, :blockedReason=>"The reason for blocking", :cvToken=>"cv_token_value"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(tfv_status_default.eql?(Bandwidth::TfvStatus.new)).to be true
-
1
expect(tfv_status_default.eql?(tfv_status_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(tfv_status_values.to_body).to eq({
-
phoneNumber: '+18005554321',
-
status: Bandwidth::TfvStatusEnum::VERIFIED,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
declineReasonDescription: 'The reason for declining',
-
resubmitAllowed: false,
-
createdDateTime: '2024-01-01T00:00:00Z',
-
modifiedDateTime: '2024-01-02T00:00:00Z',
-
submission: { businessAddress: { name: 'Bandwidth' } },
-
blocked: false,
-
blockedReason: 'The reason for blocking',
-
cvToken: 'cv_token_value'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ phone_number: '+1800555432' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ phone_number: '+180055543210' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ phone_number: '+12345678901' })
-
}.to raise_error(ArgumentError, /invalid value for "phone_number", must conform to the pattern/)
-
end
-
-
1
it '#cv_token=' do
-
1
expect {
-
1
Bandwidth::TfvStatus.new({ cv_token: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvSubmissionInfo
-
1
describe Bandwidth::TfvSubmissionInfo do
-
2
let(:tfv_submission_info_default) { Bandwidth::TfvSubmissionInfo.new }
-
4
let(:tfv_submission_info_values) { Bandwidth::TfvSubmissionInfo.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 1000,
-
use_case: 'Customer notifications',
-
use_case_summary: 'Send customers updates about their orders',
-
production_message_content: 'Your order has shipped',
-
opt_in_workflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additional_information: 'extra info',
-
isv_reseller: 'My ISV',
-
privacy_policy_url: 'https://example.com/privacy',
-
terms_and_conditions_url: 'https://example.com/terms',
-
business_dba: 'Bandwidth Inc',
-
business_registration_number: '12-3456789',
-
business_registration_type: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
business_registration_issuing_country: 'USA',
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TfvSubmissionInfo.acceptable_attributes).to eq(Bandwidth::TfvSubmissionInfo.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TfvSubmissionInfo.openapi_nullable).to eq(Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TfvSubmissionInfo created by the build_from_hash method' do
-
1
tfv_submission_info_from_hash = Bandwidth::TfvSubmissionInfo.build_from_hash({
-
businessAddress: { name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' },
-
businessContact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@bandwidth.com', phoneNumber: '+19195551234' },
-
messageVolume: 1000,
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessRegistrationIssuingCountry: 'USA',
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT
-
})
-
1
expect(tfv_submission_info_from_hash).to be_instance_of(Bandwidth::TfvSubmissionInfo)
-
1
expect(tfv_submission_info_from_hash.business_address).to be_instance_of(Bandwidth::Address)
-
1
expect(tfv_submission_info_from_hash.business_contact).to be_instance_of(Bandwidth::Contact)
-
1
expect(tfv_submission_info_from_hash.message_volume).to eq(1000)
-
1
expect(tfv_submission_info_from_hash.use_case).to eq('Customer notifications')
-
1
expect(tfv_submission_info_from_hash.use_case_summary).to eq('Send customers updates about their orders')
-
1
expect(tfv_submission_info_from_hash.production_message_content).to eq('Your order has shipped')
-
1
expect(tfv_submission_info_from_hash.opt_in_workflow).to be_instance_of(Bandwidth::OptInWorkflow)
-
1
expect(tfv_submission_info_from_hash.additional_information).to eq('extra info')
-
1
expect(tfv_submission_info_from_hash.isv_reseller).to eq('My ISV')
-
1
expect(tfv_submission_info_from_hash.privacy_policy_url).to eq('https://example.com/privacy')
-
1
expect(tfv_submission_info_from_hash.terms_and_conditions_url).to eq('https://example.com/terms')
-
1
expect(tfv_submission_info_from_hash.business_dba).to eq('Bandwidth Inc')
-
1
expect(tfv_submission_info_from_hash.business_registration_number).to eq('12-3456789')
-
1
expect(tfv_submission_info_from_hash.business_registration_type).to eq(Bandwidth::BusinessRegistrationTypeEnum::EIN)
-
1
expect(tfv_submission_info_from_hash.business_registration_issuing_country).to eq('USA')
-
1
expect(tfv_submission_info_from_hash.business_entity_type).to eq(Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(tfv_submission_info_values.to_s).to eq('{:businessAddress=>{:name=>"Bandwidth"}, :businessContact=>{:firstName=>"Jane"}, :messageVolume=>1000, :useCase=>"Customer notifications", :useCaseSummary=>"Send customers updates about their orders", :productionMessageContent=>"Your order has shipped", :optInWorkflow=>{:description=>"opt-in via website", :imageUrls=>["https://example.com/optin.png"]}, :additionalInformation=>"extra info", :isvReseller=>"My ISV", :privacyPolicyUrl=>"https://example.com/privacy", :termsAndConditionsUrl=>"https://example.com/terms", :businessDba=>"Bandwidth Inc", :businessRegistrationNumber=>"12-3456789", :businessRegistrationType=>"EIN", :businessRegistrationIssuingCountry=>"USA", :businessEntityType=>"PRIVATE_PROFIT"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(tfv_submission_info_default.eql?(Bandwidth::TfvSubmissionInfo.new)).to be true
-
1
expect(tfv_submission_info_default.eql?(tfv_submission_info_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(tfv_submission_info_values.to_body).to eq({
-
businessAddress: { name: 'Bandwidth' },
-
businessContact: { firstName: 'Jane' },
-
messageVolume: 1000,
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessRegistrationIssuingCountry: 'USA',
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#message_volume=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ message_volume: nil })
-
}.to raise_error(ArgumentError, 'message_volume cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ message_volume: 10000001 })
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ message_volume: 9 })
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
1
it '#use_case=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ use_case: nil })
-
}.to raise_error(ArgumentError, 'use_case cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ use_case: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#use_case_summary=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ use_case_summary: nil })
-
}.to raise_error(ArgumentError, 'use_case_summary cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ use_case_summary: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#production_message_content=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ production_message_content: nil })
-
}.to raise_error(ArgumentError, 'production_message_content cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ production_message_content: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#additional_information=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ additional_information: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#isv_reseller=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ isv_reseller: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#privacy_policy_url=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ privacy_policy_url: nil })
-
}.to raise_error(ArgumentError, 'privacy_policy_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ privacy_policy_url: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#terms_and_conditions_url=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ terms_and_conditions_url: nil })
-
}.to raise_error(ArgumentError, 'terms_and_conditions_url cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ terms_and_conditions_url: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_dba=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ business_dba: nil })
-
}.to raise_error(ArgumentError, 'business_dba cannot be nil')
-
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ business_dba: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_registration_number=' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionInfo.new({ business_registration_number: 'a' * 501 })
-
}.to raise_error(ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TfvSubmissionWrapper
-
1
describe Bandwidth::TfvSubmissionWrapper do
-
2
let(:tfv_submission_wrapper_default) { Bandwidth::TfvSubmissionWrapper.new }
-
4
let(:tfv_submission_wrapper_values) { Bandwidth::TfvSubmissionWrapper.new({
-
submission: { businessDba: 'Bandwidth Inc' }
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionWrapper.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TfvSubmissionWrapper.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TfvSubmissionWrapper.acceptable_attributes).to eq(Bandwidth::TfvSubmissionWrapper.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::TfvSubmissionWrapper.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TfvSubmissionWrapper created by the build_from_hash method' do
-
1
tfv_submission_wrapper_from_hash = Bandwidth::TfvSubmissionWrapper.build_from_hash({
-
submission: {
-
businessAddress: { name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' },
-
businessContact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@bandwidth.com', phoneNumber: '+19195551234' },
-
messageVolume: 1000,
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc'
-
}
-
})
-
1
expect(tfv_submission_wrapper_from_hash).to be_instance_of(Bandwidth::TfvSubmissionWrapper)
-
1
expect(tfv_submission_wrapper_from_hash.submission).to be_instance_of(Bandwidth::VerificationUpdateRequest)
-
1
expect(tfv_submission_wrapper_from_hash.submission.business_dba).to eq('Bandwidth Inc')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(tfv_submission_wrapper_values.to_s).to eq('{:submission=>{:businessDba=>"Bandwidth Inc"}}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(tfv_submission_wrapper_default.eql?(Bandwidth::TfvSubmissionWrapper.new)).to be true
-
1
expect(tfv_submission_wrapper_default.eql?(tfv_submission_wrapper_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(tfv_submission_wrapper_values.to_body).to eq({
-
submission: { businessDba: 'Bandwidth Inc' }
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::ThumbnailAlignmentEnum
-
1
describe Bandwidth::ThumbnailAlignmentEnum do
-
1
describe 'constants' do
-
1
it 'defines LEFT' do
-
1
expect(Bandwidth::ThumbnailAlignmentEnum::LEFT).to eq('LEFT')
-
end
-
-
1
it 'defines RIGHT' do
-
1
expect(Bandwidth::ThumbnailAlignmentEnum::RIGHT).to eq('RIGHT')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::ThumbnailAlignmentEnum.all_vars).to eq([
-
'LEFT',
-
'RIGHT'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::ThumbnailAlignmentEnum.build_from_hash('LEFT')).to eq('LEFT')
-
1
expect(Bandwidth::ThumbnailAlignmentEnum.build_from_hash('RIGHT')).to eq('RIGHT')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::ThumbnailAlignmentEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TranscribeRecording
-
1
describe Bandwidth::TranscribeRecording do
-
2
let(:transcribe_recording_default) { Bandwidth::TranscribeRecording.new }
-
4
let(:transcribe_recording_values) { Bandwidth::TranscribeRecording.new({
-
callback_url: 'https://example.com/callback',
-
callback_method: Bandwidth::CallbackMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
tag: 'arbitrary tag',
-
callback_timeout: 5.5,
-
detect_language: true
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TranscribeRecording.acceptable_attributes).to eq(Bandwidth::TranscribeRecording.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TranscribeRecording.openapi_nullable).to eq(Set.new([
-
:'callback_method',
-
:'username',
-
:'password',
-
:'tag',
-
:'callback_timeout',
-
:'detect_language'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TranscribeRecording created by the build_from_hash method' do
-
1
transcribe_recording_from_hash = Bandwidth::TranscribeRecording.build_from_hash({
-
callbackUrl: 'https://example.com/callback',
-
callbackMethod: Bandwidth::CallbackMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
tag: 'arbitrary tag',
-
callbackTimeout: 5.5,
-
detectLanguage: true
-
})
-
1
expect(transcribe_recording_from_hash).to be_instance_of(Bandwidth::TranscribeRecording)
-
1
expect(transcribe_recording_from_hash.callback_url).to eq('https://example.com/callback')
-
1
expect(transcribe_recording_from_hash.callback_method).to eq(Bandwidth::CallbackMethodEnum::POST)
-
1
expect(transcribe_recording_from_hash.username).to eq('mySecretUsername')
-
1
expect(transcribe_recording_from_hash.password).to eq('mySecretPassword')
-
1
expect(transcribe_recording_from_hash.tag).to eq('arbitrary tag')
-
1
expect(transcribe_recording_from_hash.callback_timeout).to eq(5.5)
-
1
expect(transcribe_recording_from_hash.detect_language).to eq(true)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transcribe_recording_values.to_s).to eq('{:callbackUrl=>"https://example.com/callback", :callbackMethod=>"POST", :username=>"mySecretUsername", :password=>"mySecretPassword", :tag=>"arbitrary tag", :callbackTimeout=>5.5, :detectLanguage=>true}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transcribe_recording_default.eql?(Bandwidth::TranscribeRecording.new)).to be true
-
1
expect(transcribe_recording_default.eql?(transcribe_recording_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transcribe_recording_values.to_body).to eq({
-
callbackUrl: 'https://example.com/callback',
-
callbackMethod: Bandwidth::CallbackMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
tag: 'arbitrary tag',
-
callbackTimeout: 5.5,
-
detectLanguage: true
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new({ username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new({ password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#callback_timeout=' do
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new({ callback_timeout: 26 })
-
}.to raise_error(ArgumentError, 'invalid value for "callback_timeout", must be smaller than or equal to 25.')
-
-
1
expect {
-
1
Bandwidth::TranscribeRecording.new({ callback_timeout: 0.5 })
-
}.to raise_error(ArgumentError, 'invalid value for "callback_timeout", must be greater than or equal to 1.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TranscriptionAvailableCallback
-
1
describe Bandwidth::TranscriptionAvailableCallback do
-
2
let(:transcription_available_callback_default) { Bandwidth::TranscriptionAvailableCallback.new }
-
4
let(:transcription_available_callback_values) { Bandwidth::TranscriptionAvailableCallback.new({
-
event_type: 'transcriptionAvailable',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
media_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recording_id: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
end_time: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
file_format: Bandwidth::FileFormatEnum::WAV,
-
tag: 'custom tag',
-
transcription: { text: 'Hello world.', confidence: 0.9 },
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TranscriptionAvailableCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TranscriptionAvailableCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TranscriptionAvailableCallback.acceptable_attributes).to eq(Bandwidth::TranscriptionAvailableCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TranscriptionAvailableCallback.openapi_nullable).to eq(Set.new([
-
:'media_url',
-
:'enqueued_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TranscriptionAvailableCallback created by the build_from_hash method' do
-
1
transcription_available_callback_from_hash = Bandwidth::TranscriptionAvailableCallback.build_from_hash({
-
eventType: 'transcriptionAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
tag: 'custom tag',
-
transcription: { text: 'Hello world.', confidence: 0.9 },
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
1
expect(transcription_available_callback_from_hash).to be_instance_of(Bandwidth::TranscriptionAvailableCallback)
-
1
expect(transcription_available_callback_from_hash.event_type).to eq('transcriptionAvailable')
-
1
expect(transcription_available_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transcription_available_callback_from_hash.account_id).to eq('9900000')
-
1
expect(transcription_available_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(transcription_available_callback_from_hash.from).to eq('+19195554321')
-
1
expect(transcription_available_callback_from_hash.to).to eq('+19195551234')
-
1
expect(transcription_available_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::INBOUND)
-
1
expect(transcription_available_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transcription_available_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transcription_available_callback_from_hash.media_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media')
-
1
expect(transcription_available_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(transcription_available_callback_from_hash.recording_id).to eq('r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transcription_available_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transcription_available_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transcription_available_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:17:07.160Z'))
-
1
expect(transcription_available_callback_from_hash.duration).to eq('PT2M')
-
1
expect(transcription_available_callback_from_hash.file_format).to eq(Bandwidth::FileFormatEnum::WAV)
-
1
expect(transcription_available_callback_from_hash.tag).to eq('custom tag')
-
1
expect(transcription_available_callback_from_hash.transcription).to be_instance_of(Bandwidth::Transcription)
-
1
expect(transcription_available_callback_from_hash.transcription.text).to eq('Hello world.')
-
1
expect(transcription_available_callback_from_hash.transcription.confidence).to eq(0.9)
-
1
expect(transcription_available_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(transcription_available_callback_from_hash.transfer_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transcription_available_callback_values.to_s).to eq('{:eventType=>"transcriptionAvailable", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"inbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :mediaUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :recordingId=>"r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :endTime=>"2022-06-16T13:17:07.160Z", :duration=>"PT2M", :fileFormat=>"wav", :tag=>"custom tag", :transcription=>{:text=>"Hello world.", :confidence=>0.9}, :transferCallerId=>"+19195554321", :transferTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transcription_available_callback_default.eql?(Bandwidth::TranscriptionAvailableCallback.new)).to be true
-
1
expect(transcription_available_callback_default.eql?(transcription_available_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transcription_available_callback_values.to_body).to eq({
-
eventType: 'transcriptionAvailable',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::INBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
mediaUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/media',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
recordingId: 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
endTime: '2022-06-16T13:17:07.160Z',
-
duration: 'PT2M',
-
fileFormat: Bandwidth::FileFormatEnum::WAV,
-
tag: 'custom tag',
-
transcription: { text: 'Hello world.', confidence: 0.9 },
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::Transcription
-
1
describe Bandwidth::Transcription do
-
2
let(:transcription_default) { Bandwidth::Transcription.new }
-
4
let(:transcription_values) { Bandwidth::Transcription.new({
-
text: 'Hello World! Thank you for calling.',
-
confidence: 0.9
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::Transcription.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::Transcription.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::Transcription.acceptable_attributes).to eq(Bandwidth::Transcription.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::Transcription.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of Transcription created by the build_from_hash method' do
-
1
transcription_from_hash = Bandwidth::Transcription.build_from_hash({
-
text: 'Hello World! Thank you for calling.',
-
confidence: 0.9
-
})
-
1
expect(transcription_from_hash).to be_instance_of(Bandwidth::Transcription)
-
1
expect(transcription_from_hash.text).to eq('Hello World! Thank you for calling.')
-
1
expect(transcription_from_hash.confidence).to eq(0.9)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transcription_values.to_s).to eq('{:text=>"Hello World! Thank you for calling.", :confidence=>0.9}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transcription_default.eql?(Bandwidth::Transcription.new)).to be true
-
1
expect(transcription_default.eql?(transcription_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transcription_values.to_body).to eq({
-
text: 'Hello World! Thank you for calling.',
-
confidence: 0.9
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TransferAnswerCallback
-
1
describe Bandwidth::TransferAnswerCallback do
-
2
let(:transfer_answer_callback_default) { Bandwidth::TransferAnswerCallback.new }
-
4
let(:transfer_answer_callback_values) { Bandwidth::TransferAnswerCallback.new({
-
event_type: 'transferAnswer',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferAnswerCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferAnswerCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TransferAnswerCallback.acceptable_attributes).to eq(Bandwidth::TransferAnswerCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TransferAnswerCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TransferAnswerCallback created by the build_from_hash method' do
-
1
transfer_answer_callback_from_hash = Bandwidth::TransferAnswerCallback.build_from_hash({
-
eventType: 'transferAnswer',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
1
expect(transfer_answer_callback_from_hash).to be_instance_of(Bandwidth::TransferAnswerCallback)
-
1
expect(transfer_answer_callback_from_hash.event_type).to eq('transferAnswer')
-
1
expect(transfer_answer_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_answer_callback_from_hash.account_id).to eq('9900000')
-
1
expect(transfer_answer_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(transfer_answer_callback_from_hash.from).to eq('+19195554321')
-
1
expect(transfer_answer_callback_from_hash.to).to eq('+19195551234')
-
1
expect(transfer_answer_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(transfer_answer_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_answer_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_answer_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_answer_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_answer_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(transfer_answer_callback_from_hash.tag).to eq('custom tag')
-
1
expect(transfer_answer_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(transfer_answer_callback_from_hash.transfer_to).to eq('+19195551234')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transfer_answer_callback_values.to_s).to eq('{:eventType=>"transferAnswer", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transfer_answer_callback_default.eql?(Bandwidth::TransferAnswerCallback.new)).to be true
-
1
expect(transfer_answer_callback_default.eql?(transfer_answer_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transfer_answer_callback_values.to_body).to eq({
-
eventType: 'transferAnswer',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TransferCompleteCallback
-
1
describe Bandwidth::TransferCompleteCallback do
-
2
let(:transfer_complete_callback_default) { Bandwidth::TransferCompleteCallback.new }
-
4
let(:transfer_complete_callback_values) { Bandwidth::TransferCompleteCallback.new({
-
event_type: 'transferComplete',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234',
-
cause: 'hangup',
-
error_message: 'call rejected',
-
error_id: '4642074b-7b58-478b-96e4-3a60955c6765'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferCompleteCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferCompleteCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TransferCompleteCallback.acceptable_attributes).to eq(Bandwidth::TransferCompleteCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TransferCompleteCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TransferCompleteCallback created by the build_from_hash method' do
-
1
transfer_complete_callback_from_hash = Bandwidth::TransferCompleteCallback.build_from_hash({
-
eventType: 'transferComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
1
expect(transfer_complete_callback_from_hash).to be_instance_of(Bandwidth::TransferCompleteCallback)
-
1
expect(transfer_complete_callback_from_hash.event_type).to eq('transferComplete')
-
1
expect(transfer_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_complete_callback_from_hash.account_id).to eq('9900000')
-
1
expect(transfer_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(transfer_complete_callback_from_hash.from).to eq('+19195554321')
-
1
expect(transfer_complete_callback_from_hash.to).to eq('+19195551234')
-
1
expect(transfer_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(transfer_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(transfer_complete_callback_from_hash.tag).to eq('custom tag')
-
1
expect(transfer_complete_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(transfer_complete_callback_from_hash.transfer_to).to eq('+19195551234')
-
1
expect(transfer_complete_callback_from_hash.cause).to eq('hangup')
-
1
expect(transfer_complete_callback_from_hash.error_message).to eq('call rejected')
-
1
expect(transfer_complete_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transfer_complete_callback_values.to_s).to eq('{:eventType=>"transferComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transfer_complete_callback_default.eql?(Bandwidth::TransferCompleteCallback.new)).to be true
-
1
expect(transfer_complete_callback_default.eql?(transfer_complete_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transfer_complete_callback_values.to_body).to eq({
-
eventType: 'transferComplete',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::TransferDisconnectCallback
-
1
describe Bandwidth::TransferDisconnectCallback do
-
2
let(:transfer_disconnect_callback_default) { Bandwidth::TransferDisconnectCallback.new }
-
4
let(:transfer_disconnect_callback_values) { Bandwidth::TransferDisconnectCallback.new({
-
event_type: 'transferDisconnect',
-
event_time: '2022-06-16T13:15:07.160Z',
-
account_id: '9900000',
-
application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parent_call_id: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueued_time: '2022-06-16T13:15:07.160Z',
-
start_time: '2022-06-16T13:15:07.160Z',
-
answer_time: '2022-06-16T13:15:18.126Z',
-
end_time: '2022-06-16T13:16:18.126Z',
-
tag: 'custom tag',
-
transfer_caller_id: '+19195554321',
-
transfer_to: '+19195551234',
-
cause: 'hangup',
-
error_message: 'call rejected',
-
error_id: '4642074b-7b58-478b-96e4-3a60955c6765'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferDisconnectCallback.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::TransferDisconnectCallback.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::TransferDisconnectCallback.acceptable_attributes).to eq(Bandwidth::TransferDisconnectCallback.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::TransferDisconnectCallback.openapi_nullable).to eq(Set.new([
-
:'enqueued_time',
-
:'answer_time',
-
:'tag',
-
:'error_message',
-
:'error_id'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of TransferDisconnectCallback created by the build_from_hash method' do
-
1
transfer_disconnect_callback_from_hash = Bandwidth::TransferDisconnectCallback.build_from_hash({
-
eventType: 'transferDisconnect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:16:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
1
expect(transfer_disconnect_callback_from_hash).to be_instance_of(Bandwidth::TransferDisconnectCallback)
-
1
expect(transfer_disconnect_callback_from_hash.event_type).to eq('transferDisconnect')
-
1
expect(transfer_disconnect_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_disconnect_callback_from_hash.account_id).to eq('9900000')
-
1
expect(transfer_disconnect_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
-
1
expect(transfer_disconnect_callback_from_hash.from).to eq('+19195554321')
-
1
expect(transfer_disconnect_callback_from_hash.to).to eq('+19195551234')
-
1
expect(transfer_disconnect_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND)
-
1
expect(transfer_disconnect_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_disconnect_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
1
expect(transfer_disconnect_callback_from_hash.parent_call_id).to eq('c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99')
-
1
expect(transfer_disconnect_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_disconnect_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
-
1
expect(transfer_disconnect_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
-
1
expect(transfer_disconnect_callback_from_hash.end_time).to eq(Time.parse('2022-06-16T13:16:18.126Z'))
-
1
expect(transfer_disconnect_callback_from_hash.tag).to eq('custom tag')
-
1
expect(transfer_disconnect_callback_from_hash.transfer_caller_id).to eq('+19195554321')
-
1
expect(transfer_disconnect_callback_from_hash.transfer_to).to eq('+19195551234')
-
1
expect(transfer_disconnect_callback_from_hash.cause).to eq('hangup')
-
1
expect(transfer_disconnect_callback_from_hash.error_message).to eq('call rejected')
-
1
expect(transfer_disconnect_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(transfer_disconnect_callback_values.to_s).to eq('{:eventType=>"transferDisconnect", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :parentCallId=>"c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :endTime=>"2022-06-16T13:16:18.126Z", :tag=>"custom tag", :transferCallerId=>"+19195554321", :transferTo=>"+19195551234", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(transfer_disconnect_callback_default.eql?(Bandwidth::TransferDisconnectCallback.new)).to be true
-
1
expect(transfer_disconnect_callback_default.eql?(transfer_disconnect_callback_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(transfer_disconnect_callback_values.to_body).to eq({
-
eventType: 'transferDisconnect',
-
eventTime: '2022-06-16T13:15:07.160Z',
-
accountId: '9900000',
-
applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
-
from: '+19195554321',
-
to: '+19195551234',
-
direction: Bandwidth::CallDirectionEnum::OUTBOUND,
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
-
parentCallId: 'c-95ac29a2-1331029c-2cb0-4a07-b215-b22865662d99',
-
enqueuedTime: '2022-06-16T13:15:07.160Z',
-
startTime: '2022-06-16T13:15:07.160Z',
-
answerTime: '2022-06-16T13:15:18.126Z',
-
endTime: '2022-06-16T13:16:18.126Z',
-
tag: 'custom tag',
-
transferCallerId: '+19195554321',
-
transferTo: '+19195551234',
-
cause: 'hangup',
-
errorMessage: 'call rejected',
-
errorId: '4642074b-7b58-478b-96e4-3a60955c6765'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::UpdateCallRecording
-
1
describe Bandwidth::UpdateCallRecording do
-
2
let(:update_call_recording_default) { Bandwidth::UpdateCallRecording.new({
-
state: Bandwidth::RecordingStateEnum::PAUSED
-
}) }
-
4
let(:update_call_recording_values) { Bandwidth::UpdateCallRecording.new({
-
state: Bandwidth::RecordingStateEnum::RECORDING
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateCallRecording.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateCallRecording.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::UpdateCallRecording.acceptable_attributes).to eq(Bandwidth::UpdateCallRecording.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::UpdateCallRecording.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of UpdateCallRecording created by the build_from_hash method' do
-
1
update_call_recording_from_hash = Bandwidth::UpdateCallRecording.build_from_hash({
-
state: Bandwidth::RecordingStateEnum::RECORDING
-
})
-
1
expect(update_call_recording_from_hash).to be_instance_of(Bandwidth::UpdateCallRecording)
-
1
expect(update_call_recording_from_hash.state).to eq(Bandwidth::RecordingStateEnum::RECORDING)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(update_call_recording_values.to_s).to eq('{:state=>"recording"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
update_call_recording_equal = Bandwidth::UpdateCallRecording.new({
-
state: Bandwidth::RecordingStateEnum::PAUSED
-
})
-
1
expect(update_call_recording_default.eql?(update_call_recording_equal)).to be true
-
1
expect(update_call_recording_default.eql?(update_call_recording_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(update_call_recording_values.to_body).to eq({
-
state: Bandwidth::RecordingStateEnum::RECORDING
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#state=' do
-
1
expect {
-
1
Bandwidth::UpdateCallRecording.new({ state: nil })
-
}.to raise_error(ArgumentError, 'state cannot be nil')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::UpdateCall
-
1
describe Bandwidth::UpdateCall do
-
2
let(:update_call_default) { Bandwidth::UpdateCall.new }
-
4
let(:update_call_values) { Bandwidth::UpdateCall.new({
-
state: Bandwidth::CallStateEnum::ACTIVE,
-
redirect_url: 'https://example.com/redirect',
-
redirect_method: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirect_fallback_url: 'https://example.com/fallback',
-
redirect_fallback_method: Bandwidth::RedirectMethodEnum::GET,
-
fallback_username: 'fallbackUser',
-
fallback_password: 'fallbackPass',
-
tag: 'custom tag'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::UpdateCall.acceptable_attributes).to eq(Bandwidth::UpdateCall.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::UpdateCall.openapi_nullable).to eq(Set.new([
-
:'state',
-
:'redirect_url',
-
:'redirect_method',
-
:'username',
-
:'password',
-
:'redirect_fallback_url',
-
:'redirect_fallback_method',
-
:'fallback_username',
-
:'fallback_password',
-
:'tag'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of UpdateCall created by the build_from_hash method' do
-
1
update_call_from_hash = Bandwidth::UpdateCall.build_from_hash({
-
state: Bandwidth::CallStateEnum::ACTIVE,
-
redirectUrl: 'https://example.com/redirect',
-
redirectMethod: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirectFallbackUrl: 'https://example.com/fallback',
-
redirectFallbackMethod: Bandwidth::RedirectMethodEnum::GET,
-
fallbackUsername: 'fallbackUser',
-
fallbackPassword: 'fallbackPass',
-
tag: 'custom tag'
-
})
-
1
expect(update_call_from_hash).to be_instance_of(Bandwidth::UpdateCall)
-
1
expect(update_call_from_hash.state).to eq(Bandwidth::CallStateEnum::ACTIVE)
-
1
expect(update_call_from_hash.redirect_url).to eq('https://example.com/redirect')
-
1
expect(update_call_from_hash.redirect_method).to eq(Bandwidth::RedirectMethodEnum::POST)
-
1
expect(update_call_from_hash.username).to eq('mySecretUsername')
-
1
expect(update_call_from_hash.password).to eq('mySecretPassword')
-
1
expect(update_call_from_hash.redirect_fallback_url).to eq('https://example.com/fallback')
-
1
expect(update_call_from_hash.redirect_fallback_method).to eq(Bandwidth::RedirectMethodEnum::GET)
-
1
expect(update_call_from_hash.fallback_username).to eq('fallbackUser')
-
1
expect(update_call_from_hash.fallback_password).to eq('fallbackPass')
-
1
expect(update_call_from_hash.tag).to eq('custom tag')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(update_call_values.to_s).to eq('{:state=>"active", :redirectUrl=>"https://example.com/redirect", :redirectMethod=>"POST", :username=>"mySecretUsername", :password=>"mySecretPassword", :redirectFallbackUrl=>"https://example.com/fallback", :redirectFallbackMethod=>"GET", :fallbackUsername=>"fallbackUser", :fallbackPassword=>"fallbackPass", :tag=>"custom tag"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(update_call_default.eql?(Bandwidth::UpdateCall.new)).to be true
-
1
expect(update_call_default.eql?(update_call_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(update_call_values.to_body).to eq({
-
state: Bandwidth::CallStateEnum::ACTIVE,
-
redirectUrl: 'https://example.com/redirect',
-
redirectMethod: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirectFallbackUrl: 'https://example.com/fallback',
-
redirectFallbackMethod: Bandwidth::RedirectMethodEnum::GET,
-
fallbackUsername: 'fallbackUser',
-
fallbackPassword: 'fallbackPass',
-
tag: 'custom tag'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_username=' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ fallback_username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_password=' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ fallback_password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#tag=' do
-
1
expect {
-
1
Bandwidth::UpdateCall.new({ tag: 'a' * 4097 })
-
}.to raise_error(ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 4096.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::UpdateConferenceMember
-
1
describe Bandwidth::UpdateConferenceMember do
-
2
let(:update_conference_member_default) { Bandwidth::UpdateConferenceMember.new }
-
4
let(:update_conference_member_values) { Bandwidth::UpdateConferenceMember.new({
-
mute: true,
-
hold: false,
-
call_ids_to_coach: ['c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85']
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateConferenceMember.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateConferenceMember.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::UpdateConferenceMember.acceptable_attributes).to eq(Bandwidth::UpdateConferenceMember.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::UpdateConferenceMember.openapi_nullable).to eq(Set.new([:'call_ids_to_coach']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of UpdateConferenceMember created by the build_from_hash method' do
-
1
update_conference_member_from_hash = Bandwidth::UpdateConferenceMember.build_from_hash({
-
mute: true,
-
hold: false,
-
callIdsToCoach: ['c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85']
-
})
-
1
expect(update_conference_member_from_hash).to be_instance_of(Bandwidth::UpdateConferenceMember)
-
1
expect(update_conference_member_from_hash.mute).to eq(true)
-
1
expect(update_conference_member_from_hash.hold).to eq(false)
-
1
expect(update_conference_member_from_hash.call_ids_to_coach).to eq(['c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'])
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(update_conference_member_values.to_s).to eq('{:mute=>true, :hold=>false, :callIdsToCoach=>["c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(update_conference_member_default.eql?(Bandwidth::UpdateConferenceMember.new)).to be true
-
1
expect(update_conference_member_default.eql?(update_conference_member_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(update_conference_member_values.to_body).to eq({
-
mute: true,
-
hold: false,
-
callIdsToCoach: ['c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85']
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::UpdateConference
-
1
describe Bandwidth::UpdateConference do
-
2
let(:update_conference_default) { Bandwidth::UpdateConference.new }
-
4
let(:update_conference_values) { Bandwidth::UpdateConference.new({
-
status: Bandwidth::ConferenceStateEnum::ACTIVE,
-
redirect_url: 'https://example.com/redirect',
-
redirect_method: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirect_fallback_url: 'https://example.com/fallback',
-
redirect_fallback_method: Bandwidth::RedirectMethodEnum::GET,
-
fallback_username: 'fallbackUser',
-
fallback_password: 'fallbackPass'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::UpdateConference.acceptable_attributes).to eq(Bandwidth::UpdateConference.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::UpdateConference.openapi_nullable).to eq(Set.new([
-
:'status',
-
:'redirect_url',
-
:'redirect_method',
-
:'username',
-
:'password',
-
:'redirect_fallback_url',
-
:'redirect_fallback_method',
-
:'fallback_username',
-
:'fallback_password'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of UpdateConference created by the build_from_hash method' do
-
1
update_conference_from_hash = Bandwidth::UpdateConference.build_from_hash({
-
status: Bandwidth::ConferenceStateEnum::ACTIVE,
-
redirectUrl: 'https://example.com/redirect',
-
redirectMethod: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirectFallbackUrl: 'https://example.com/fallback',
-
redirectFallbackMethod: Bandwidth::RedirectMethodEnum::GET,
-
fallbackUsername: 'fallbackUser',
-
fallbackPassword: 'fallbackPass'
-
})
-
1
expect(update_conference_from_hash).to be_instance_of(Bandwidth::UpdateConference)
-
1
expect(update_conference_from_hash.status).to eq(Bandwidth::ConferenceStateEnum::ACTIVE)
-
1
expect(update_conference_from_hash.redirect_url).to eq('https://example.com/redirect')
-
1
expect(update_conference_from_hash.redirect_method).to eq(Bandwidth::RedirectMethodEnum::POST)
-
1
expect(update_conference_from_hash.username).to eq('mySecretUsername')
-
1
expect(update_conference_from_hash.password).to eq('mySecretPassword')
-
1
expect(update_conference_from_hash.redirect_fallback_url).to eq('https://example.com/fallback')
-
1
expect(update_conference_from_hash.redirect_fallback_method).to eq(Bandwidth::RedirectMethodEnum::GET)
-
1
expect(update_conference_from_hash.fallback_username).to eq('fallbackUser')
-
1
expect(update_conference_from_hash.fallback_password).to eq('fallbackPass')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(update_conference_values.to_s).to eq('{:status=>"active", :redirectUrl=>"https://example.com/redirect", :redirectMethod=>"POST", :username=>"mySecretUsername", :password=>"mySecretPassword", :redirectFallbackUrl=>"https://example.com/fallback", :redirectFallbackMethod=>"GET", :fallbackUsername=>"fallbackUser", :fallbackPassword=>"fallbackPass"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(update_conference_default.eql?(Bandwidth::UpdateConference.new)).to be true
-
1
expect(update_conference_default.eql?(update_conference_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(update_conference_values.to_body).to eq({
-
status: Bandwidth::ConferenceStateEnum::ACTIVE,
-
redirectUrl: 'https://example.com/redirect',
-
redirectMethod: Bandwidth::RedirectMethodEnum::POST,
-
username: 'mySecretUsername',
-
password: 'mySecretPassword',
-
redirectFallbackUrl: 'https://example.com/fallback',
-
redirectFallbackMethod: Bandwidth::RedirectMethodEnum::GET,
-
fallbackUsername: 'fallbackUser',
-
fallbackPassword: 'fallbackPass'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new({ username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new({ password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_username=' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new({ fallback_username: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
-
end
-
-
1
it '#fallback_password=' do
-
1
expect {
-
1
Bandwidth::UpdateConference.new({ fallback_password: 'a' * 1025 })
-
}.to raise_error(ArgumentError, 'invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerificationDenialWebhook
-
1
describe Bandwidth::VerificationDenialWebhook do
-
2
let(:verification_denial_webhook_default) { Bandwidth::VerificationDenialWebhook.new }
-
4
let(:verification_denial_webhook_values) { Bandwidth::VerificationDenialWebhook.new({
-
account_id: '9900000',
-
additional_denial_reasons: [
-
Bandwidth::AdditionalDenialReason.new({ status_code: 100, reason: 'reason text', resubmit_allowed: true })
-
],
-
decline_reason_description: 'The reason for declining',
-
denial_status_code: 100,
-
internal_ticket_number: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
phone_number: '+18005554321',
-
resubmit_allowed: true,
-
status: 'UNVERIFIED',
-
blocked: false,
-
blocked_reason: 'The reason for blocking'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerificationDenialWebhook.acceptable_attributes).to eq(Bandwidth::VerificationDenialWebhook.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::VerificationDenialWebhook.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerificationDenialWebhook created by the build_from_hash method' do
-
1
verification_denial_webhook_from_hash = Bandwidth::VerificationDenialWebhook.build_from_hash({
-
accountId: '9900000',
-
additionalDenialReasons: [{ statusCode: 100, reason: 'reason text', resubmitAllowed: true }],
-
declineReasonDescription: 'The reason for declining',
-
denialStatusCode: 100,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
phoneNumber: '+18005554321',
-
resubmitAllowed: true,
-
status: 'UNVERIFIED',
-
blocked: false,
-
blockedReason: 'The reason for blocking'
-
})
-
1
expect(verification_denial_webhook_from_hash).to be_instance_of(Bandwidth::VerificationDenialWebhook)
-
1
expect(verification_denial_webhook_from_hash.account_id).to eq('9900000')
-
1
expect(verification_denial_webhook_from_hash.additional_denial_reasons).to be_instance_of(Array)
-
1
expect(verification_denial_webhook_from_hash.additional_denial_reasons.first).to be_instance_of(Bandwidth::AdditionalDenialReason)
-
1
expect(verification_denial_webhook_from_hash.decline_reason_description).to eq('The reason for declining')
-
1
expect(verification_denial_webhook_from_hash.denial_status_code).to eq(100)
-
1
expect(verification_denial_webhook_from_hash.internal_ticket_number).to eq('8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3')
-
1
expect(verification_denial_webhook_from_hash.phone_number).to eq('+18005554321')
-
1
expect(verification_denial_webhook_from_hash.resubmit_allowed).to eq(true)
-
1
expect(verification_denial_webhook_from_hash.status).to eq('UNVERIFIED')
-
1
expect(verification_denial_webhook_from_hash.blocked).to eq(false)
-
1
expect(verification_denial_webhook_from_hash.blocked_reason).to eq('The reason for blocking')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verification_denial_webhook_values.to_s).to eq('{:accountId=>"9900000", :additionalDenialReasons=>[{:statusCode=>100, :reason=>"reason text", :resubmitAllowed=>true}], :declineReasonDescription=>"The reason for declining", :denialStatusCode=>100, :internalTicketNumber=>"8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3", :phoneNumber=>"+18005554321", :resubmitAllowed=>true, :status=>"UNVERIFIED", :blocked=>false, :blockedReason=>"The reason for blocking"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(verification_denial_webhook_default.eql?(Bandwidth::VerificationDenialWebhook.new)).to be true
-
1
expect(verification_denial_webhook_default.eql?(verification_denial_webhook_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verification_denial_webhook_values.to_body).to eq({
-
accountId: '9900000',
-
additionalDenialReasons: [{ statusCode: 100, reason: 'reason text', resubmitAllowed: true }],
-
declineReasonDescription: 'The reason for declining',
-
denialStatusCode: 100,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3',
-
phoneNumber: '+18005554321',
-
resubmitAllowed: true,
-
status: 'UNVERIFIED',
-
blocked: false,
-
blockedReason: 'The reason for blocking'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new({ phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new({ phone_number: '+1800555432' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new({ phone_number: '+180055543210' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::VerificationDenialWebhook.new({ phone_number: '+12345678901' })
-
}.to raise_error(ArgumentError, /invalid value for "phone_number", must conform to the pattern/)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerificationRequest
-
1
describe Bandwidth::VerificationRequest do
-
2
let(:verification_request_default) { Bandwidth::VerificationRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 100,
-
phone_numbers: ['+18005550100'],
-
use_case: 'baseline use case',
-
use_case_summary: 'baseline summary',
-
production_message_content: 'baseline message',
-
opt_in_workflow: { description: 'baseline opt-in', imageUrls: [] },
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT
-
}) }
-
21
let(:verification_request_values) { Bandwidth::VerificationRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 1000,
-
phone_numbers: ['+18005554321'],
-
use_case: 'Customer notifications',
-
use_case_summary: 'Send customers updates about their orders',
-
production_message_content: 'Your order has shipped',
-
opt_in_workflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additional_information: 'extra info',
-
isv_reseller: 'My ISV',
-
privacy_policy_url: 'https://example.com/privacy',
-
terms_and_conditions_url: 'https://example.com/terms',
-
business_dba: 'Bandwidth Inc',
-
business_registration_number: '12-3456789',
-
business_registration_type: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
business_registration_issuing_country: 'USA',
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
help_message_response: 'For help reply with HELP',
-
age_gated_content: false,
-
cv_token: 'cv_token_value'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerificationRequest.acceptable_attributes).to eq(Bandwidth::VerificationRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::VerificationRequest.openapi_nullable).to eq(Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country',
-
:'help_message_response',
-
:'cv_token'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerificationRequest created by the build_from_hash method' do
-
1
verification_request_from_hash = Bandwidth::VerificationRequest.build_from_hash({
-
businessAddress: { name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' },
-
businessContact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@bandwidth.com', phoneNumber: '+19195551234' },
-
messageVolume: 1000,
-
phoneNumbers: ['+18005554321'],
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessRegistrationIssuingCountry: 'USA',
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
helpMessageResponse: 'For help reply with HELP',
-
ageGatedContent: false,
-
cvToken: 'cv_token_value'
-
})
-
1
expect(verification_request_from_hash).to be_instance_of(Bandwidth::VerificationRequest)
-
1
expect(verification_request_from_hash.business_address).to be_instance_of(Bandwidth::Address)
-
1
expect(verification_request_from_hash.business_contact).to be_instance_of(Bandwidth::Contact)
-
1
expect(verification_request_from_hash.message_volume).to eq(1000)
-
1
expect(verification_request_from_hash.phone_numbers).to eq(['+18005554321'])
-
1
expect(verification_request_from_hash.use_case).to eq('Customer notifications')
-
1
expect(verification_request_from_hash.use_case_summary).to eq('Send customers updates about their orders')
-
1
expect(verification_request_from_hash.production_message_content).to eq('Your order has shipped')
-
1
expect(verification_request_from_hash.opt_in_workflow).to be_instance_of(Bandwidth::OptInWorkflow)
-
1
expect(verification_request_from_hash.additional_information).to eq('extra info')
-
1
expect(verification_request_from_hash.isv_reseller).to eq('My ISV')
-
1
expect(verification_request_from_hash.privacy_policy_url).to eq('https://example.com/privacy')
-
1
expect(verification_request_from_hash.terms_and_conditions_url).to eq('https://example.com/terms')
-
1
expect(verification_request_from_hash.business_dba).to eq('Bandwidth Inc')
-
1
expect(verification_request_from_hash.business_registration_number).to eq('12-3456789')
-
1
expect(verification_request_from_hash.business_registration_type).to eq(Bandwidth::BusinessRegistrationTypeEnum::EIN)
-
1
expect(verification_request_from_hash.business_registration_issuing_country).to eq('USA')
-
1
expect(verification_request_from_hash.business_entity_type).to eq(Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT)
-
1
expect(verification_request_from_hash.help_message_response).to eq('For help reply with HELP')
-
1
expect(verification_request_from_hash.age_gated_content).to eq(false)
-
1
expect(verification_request_from_hash.cv_token).to eq('cv_token_value')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verification_request_values.to_s).to eq('{:businessAddress=>{:name=>"Bandwidth"}, :businessContact=>{:firstName=>"Jane"}, :messageVolume=>1000, :phoneNumbers=>["+18005554321"], :useCase=>"Customer notifications", :useCaseSummary=>"Send customers updates about their orders", :productionMessageContent=>"Your order has shipped", :optInWorkflow=>{:description=>"opt-in via website", :imageUrls=>["https://example.com/optin.png"]}, :additionalInformation=>"extra info", :isvReseller=>"My ISV", :privacyPolicyUrl=>"https://example.com/privacy", :termsAndConditionsUrl=>"https://example.com/terms", :businessDba=>"Bandwidth Inc", :businessRegistrationNumber=>"12-3456789", :businessRegistrationType=>"EIN", :businessRegistrationIssuingCountry=>"USA", :businessEntityType=>"PRIVATE_PROFIT", :helpMessageResponse=>"For help reply with HELP", :ageGatedContent=>false, :cvToken=>"cv_token_value"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
verification_request_equal = Bandwidth::VerificationRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 100,
-
phone_numbers: ['+18005550100'],
-
use_case: 'baseline use case',
-
use_case_summary: 'baseline summary',
-
production_message_content: 'baseline message',
-
opt_in_workflow: { description: 'baseline opt-in', imageUrls: [] },
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT
-
})
-
1
expect(verification_request_default.eql?(verification_request_equal)).to be true
-
1
expect(verification_request_default.eql?(verification_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verification_request_values.to_body).to eq({
-
businessAddress: { name: 'Bandwidth' },
-
businessContact: { firstName: 'Jane' },
-
messageVolume: 1000,
-
phoneNumbers: ['+18005554321'],
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessRegistrationIssuingCountry: 'USA',
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
helpMessageResponse: 'For help reply with HELP',
-
ageGatedContent: false,
-
cvToken: 'cv_token_value'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#business_address=' do
-
1
expect {
-
1
verification_request_values.business_address = nil
-
}.to raise_error(ArgumentError, 'business_address cannot be nil')
-
end
-
-
1
it '#business_contact=' do
-
1
expect {
-
1
verification_request_values.business_contact = nil
-
}.to raise_error(ArgumentError, 'business_contact cannot be nil')
-
end
-
-
1
it '#message_volume=' do
-
1
expect {
-
1
verification_request_values.message_volume = nil
-
}.to raise_error(ArgumentError, 'message_volume cannot be nil')
-
-
1
expect {
-
1
verification_request_values.message_volume = 10000001
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
-
1
expect {
-
1
verification_request_values.message_volume = 9
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
1
it '#phone_numbers=' do
-
1
expect {
-
1
verification_request_values.phone_numbers = nil
-
}.to raise_error(ArgumentError, 'phone_numbers cannot be nil')
-
-
1
expect {
-
12
verification_request_values.phone_numbers = Array.new(11) { '+18005551234' }
-
}.to raise_error(ArgumentError, 'invalid value for "phone_numbers", number of items must be less than or equal to 10.')
-
-
1
expect {
-
1
verification_request_values.phone_numbers = []
-
}.to raise_error(ArgumentError, 'invalid value for "phone_numbers", number of items must be greater than or equal to 1.')
-
end
-
-
1
it '#use_case=' do
-
1
expect {
-
1
verification_request_values.use_case = nil
-
}.to raise_error(ArgumentError, 'use_case cannot be nil')
-
-
1
expect {
-
1
verification_request_values.use_case = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#use_case_summary=' do
-
1
expect {
-
1
verification_request_values.use_case_summary = nil
-
}.to raise_error(ArgumentError, 'use_case_summary cannot be nil')
-
-
1
expect {
-
1
verification_request_values.use_case_summary = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#production_message_content=' do
-
1
expect {
-
1
verification_request_values.production_message_content = nil
-
}.to raise_error(ArgumentError, 'production_message_content cannot be nil')
-
-
1
expect {
-
1
verification_request_values.production_message_content = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#opt_in_workflow=' do
-
1
expect {
-
1
verification_request_values.opt_in_workflow = nil
-
}.to raise_error(ArgumentError, 'opt_in_workflow cannot be nil')
-
end
-
-
1
it '#additional_information=' do
-
1
expect {
-
1
verification_request_values.additional_information = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#isv_reseller=' do
-
1
expect {
-
1
verification_request_values.isv_reseller = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#privacy_policy_url=' do
-
1
expect {
-
1
verification_request_values.privacy_policy_url = nil
-
}.to raise_error(ArgumentError, 'privacy_policy_url cannot be nil')
-
-
1
expect {
-
1
verification_request_values.privacy_policy_url = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#terms_and_conditions_url=' do
-
1
expect {
-
1
verification_request_values.terms_and_conditions_url = nil
-
}.to raise_error(ArgumentError, 'terms_and_conditions_url cannot be nil')
-
-
1
expect {
-
1
verification_request_values.terms_and_conditions_url = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_dba=' do
-
1
expect {
-
1
verification_request_values.business_dba = nil
-
}.to raise_error(ArgumentError, 'business_dba cannot be nil')
-
-
1
expect {
-
1
verification_request_values.business_dba = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_registration_number=' do
-
1
expect {
-
1
verification_request_values.business_registration_number = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_entity_type=' do
-
1
expect {
-
1
verification_request_values.business_entity_type = nil
-
}.to raise_error(ArgumentError, 'business_entity_type cannot be nil')
-
end
-
-
1
it '#help_message_response=' do
-
1
expect {
-
1
verification_request_values.help_message_response = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "help_message_response", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#cv_token=' do
-
1
expect {
-
1
verification_request_values.cv_token = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerificationUpdateRequest
-
1
describe Bandwidth::VerificationUpdateRequest do
-
2
let(:verification_update_request_default) { Bandwidth::VerificationUpdateRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 100,
-
use_case: 'baseline use case',
-
use_case_summary: 'baseline summary',
-
production_message_content: 'baseline message',
-
opt_in_workflow: { description: 'baseline opt-in', imageUrls: [] }
-
}) }
-
19
let(:verification_update_request_values) { Bandwidth::VerificationUpdateRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 1000,
-
use_case: 'Customer notifications',
-
use_case_summary: 'Send customers updates about their orders',
-
production_message_content: 'Your order has shipped',
-
opt_in_workflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additional_information: 'extra info',
-
isv_reseller: 'My ISV',
-
privacy_policy_url: 'https://example.com/privacy',
-
terms_and_conditions_url: 'https://example.com/terms',
-
business_dba: 'Bandwidth Inc',
-
business_registration_number: '12-3456789',
-
business_registration_type: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
business_entity_type: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
business_registration_issuing_country: 'USA',
-
help_message_response: 'For help reply with HELP',
-
age_gated_content: false,
-
cv_token: 'cv_token_value'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationUpdateRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationUpdateRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerificationUpdateRequest.acceptable_attributes).to eq(Bandwidth::VerificationUpdateRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::VerificationUpdateRequest.openapi_nullable).to eq(Set.new([
-
:'additional_information',
-
:'isv_reseller',
-
:'business_registration_number',
-
:'business_registration_type',
-
:'business_registration_issuing_country',
-
:'help_message_response',
-
:'cv_token'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerificationUpdateRequest created by the build_from_hash method' do
-
1
verification_update_request_from_hash = Bandwidth::VerificationUpdateRequest.build_from_hash({
-
businessAddress: { name: 'Bandwidth', addr1: '900 Main Campus Dr', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.bandwidth.com' },
-
businessContact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@bandwidth.com', phoneNumber: '+19195551234' },
-
messageVolume: 1000,
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
businessRegistrationIssuingCountry: 'USA',
-
helpMessageResponse: 'For help reply with HELP',
-
ageGatedContent: false,
-
cvToken: 'cv_token_value'
-
})
-
1
expect(verification_update_request_from_hash).to be_instance_of(Bandwidth::VerificationUpdateRequest)
-
1
expect(verification_update_request_from_hash.business_address).to be_instance_of(Bandwidth::Address)
-
1
expect(verification_update_request_from_hash.business_contact).to be_instance_of(Bandwidth::Contact)
-
1
expect(verification_update_request_from_hash.message_volume).to eq(1000)
-
1
expect(verification_update_request_from_hash.use_case).to eq('Customer notifications')
-
1
expect(verification_update_request_from_hash.use_case_summary).to eq('Send customers updates about their orders')
-
1
expect(verification_update_request_from_hash.production_message_content).to eq('Your order has shipped')
-
1
expect(verification_update_request_from_hash.opt_in_workflow).to be_instance_of(Bandwidth::OptInWorkflow)
-
1
expect(verification_update_request_from_hash.additional_information).to eq('extra info')
-
1
expect(verification_update_request_from_hash.isv_reseller).to eq('My ISV')
-
1
expect(verification_update_request_from_hash.privacy_policy_url).to eq('https://example.com/privacy')
-
1
expect(verification_update_request_from_hash.terms_and_conditions_url).to eq('https://example.com/terms')
-
1
expect(verification_update_request_from_hash.business_dba).to eq('Bandwidth Inc')
-
1
expect(verification_update_request_from_hash.business_registration_number).to eq('12-3456789')
-
1
expect(verification_update_request_from_hash.business_registration_type).to eq(Bandwidth::BusinessRegistrationTypeEnum::EIN)
-
1
expect(verification_update_request_from_hash.business_entity_type).to eq(Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT)
-
1
expect(verification_update_request_from_hash.business_registration_issuing_country).to eq('USA')
-
1
expect(verification_update_request_from_hash.help_message_response).to eq('For help reply with HELP')
-
1
expect(verification_update_request_from_hash.age_gated_content).to eq(false)
-
1
expect(verification_update_request_from_hash.cv_token).to eq('cv_token_value')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verification_update_request_values.to_s).to eq('{:businessAddress=>{:name=>"Bandwidth"}, :businessContact=>{:firstName=>"Jane"}, :messageVolume=>1000, :useCase=>"Customer notifications", :useCaseSummary=>"Send customers updates about their orders", :productionMessageContent=>"Your order has shipped", :optInWorkflow=>{:description=>"opt-in via website", :imageUrls=>["https://example.com/optin.png"]}, :additionalInformation=>"extra info", :isvReseller=>"My ISV", :privacyPolicyUrl=>"https://example.com/privacy", :termsAndConditionsUrl=>"https://example.com/terms", :businessDba=>"Bandwidth Inc", :businessRegistrationNumber=>"12-3456789", :businessRegistrationType=>"EIN", :businessEntityType=>"PRIVATE_PROFIT", :businessRegistrationIssuingCountry=>"USA", :helpMessageResponse=>"For help reply with HELP", :ageGatedContent=>false, :cvToken=>"cv_token_value"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
verification_update_request_equal = Bandwidth::VerificationUpdateRequest.new({
-
business_address: { name: 'Bandwidth' },
-
business_contact: { firstName: 'Jane' },
-
message_volume: 100,
-
use_case: 'baseline use case',
-
use_case_summary: 'baseline summary',
-
production_message_content: 'baseline message',
-
opt_in_workflow: { description: 'baseline opt-in', imageUrls: [] }
-
})
-
1
expect(verification_update_request_default.eql?(verification_update_request_equal)).to be true
-
1
expect(verification_update_request_default.eql?(verification_update_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verification_update_request_values.to_body).to eq({
-
businessAddress: { name: 'Bandwidth' },
-
businessContact: { firstName: 'Jane' },
-
messageVolume: 1000,
-
useCase: 'Customer notifications',
-
useCaseSummary: 'Send customers updates about their orders',
-
productionMessageContent: 'Your order has shipped',
-
optInWorkflow: { description: 'opt-in via website', imageUrls: ['https://example.com/optin.png'] },
-
additionalInformation: 'extra info',
-
isvReseller: 'My ISV',
-
privacyPolicyUrl: 'https://example.com/privacy',
-
termsAndConditionsUrl: 'https://example.com/terms',
-
businessDba: 'Bandwidth Inc',
-
businessRegistrationNumber: '12-3456789',
-
businessRegistrationType: Bandwidth::BusinessRegistrationTypeEnum::EIN,
-
businessEntityType: Bandwidth::BusinessEntityTypeEnum::PRIVATE_PROFIT,
-
businessRegistrationIssuingCountry: 'USA',
-
helpMessageResponse: 'For help reply with HELP',
-
ageGatedContent: false,
-
cvToken: 'cv_token_value'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#business_address=' do
-
1
expect {
-
1
verification_update_request_values.business_address = nil
-
}.to raise_error(ArgumentError, 'business_address cannot be nil')
-
end
-
-
1
it '#business_contact=' do
-
1
expect {
-
1
verification_update_request_values.business_contact = nil
-
}.to raise_error(ArgumentError, 'business_contact cannot be nil')
-
end
-
-
1
it '#message_volume=' do
-
1
expect {
-
1
verification_update_request_values.message_volume = nil
-
}.to raise_error(ArgumentError, 'message_volume cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.message_volume = 10000001
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.')
-
-
1
expect {
-
1
verification_update_request_values.message_volume = 9
-
}.to raise_error(ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.')
-
end
-
-
1
it '#use_case=' do
-
1
expect {
-
1
verification_update_request_values.use_case = nil
-
}.to raise_error(ArgumentError, 'use_case cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.use_case = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#use_case_summary=' do
-
1
expect {
-
1
verification_update_request_values.use_case_summary = nil
-
}.to raise_error(ArgumentError, 'use_case_summary cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.use_case_summary = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#production_message_content=' do
-
1
expect {
-
1
verification_update_request_values.production_message_content = nil
-
}.to raise_error(ArgumentError, 'production_message_content cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.production_message_content = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#opt_in_workflow=' do
-
1
expect {
-
1
verification_update_request_values.opt_in_workflow = nil
-
}.to raise_error(ArgumentError, 'opt_in_workflow cannot be nil')
-
end
-
-
1
it '#additional_information=' do
-
1
expect {
-
1
verification_update_request_values.additional_information = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#isv_reseller=' do
-
1
expect {
-
1
verification_update_request_values.isv_reseller = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#privacy_policy_url=' do
-
1
expect {
-
1
verification_update_request_values.privacy_policy_url = nil
-
}.to raise_error(ArgumentError, 'privacy_policy_url cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.privacy_policy_url = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "privacy_policy_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#terms_and_conditions_url=' do
-
1
expect {
-
1
verification_update_request_values.terms_and_conditions_url = nil
-
}.to raise_error(ArgumentError, 'terms_and_conditions_url cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.terms_and_conditions_url = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "terms_and_conditions_url", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_dba=' do
-
1
expect {
-
1
verification_update_request_values.business_dba = nil
-
}.to raise_error(ArgumentError, 'business_dba cannot be nil')
-
-
1
expect {
-
1
verification_update_request_values.business_dba = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "business_dba", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#business_registration_number=' do
-
1
expect {
-
1
verification_update_request_values.business_registration_number = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "business_registration_number", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#help_message_response=' do
-
1
expect {
-
1
verification_update_request_values.help_message_response = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "help_message_response", the character length must be smaller than or equal to 500.')
-
end
-
-
1
it '#cv_token=' do
-
1
expect {
-
1
verification_update_request_values.cv_token = 'a' * 501
-
}.to raise_error(ArgumentError, 'invalid value for "cv_token", the character length must be smaller than or equal to 500.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerificationWebhook
-
1
describe Bandwidth::VerificationWebhook do
-
2
let(:verification_webhook_default) { Bandwidth::VerificationWebhook.new }
-
4
let(:verification_webhook_values) { Bandwidth::VerificationWebhook.new({
-
account_id: '9900000',
-
phone_number: '+18005554321',
-
status: Bandwidth::TfvCallbackStatusEnum::VERIFIED,
-
internal_ticket_number: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerificationWebhook.acceptable_attributes).to eq(Bandwidth::VerificationWebhook.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::VerificationWebhook.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerificationWebhook created by the build_from_hash method' do
-
1
verification_webhook_from_hash = Bandwidth::VerificationWebhook.build_from_hash({
-
accountId: '9900000',
-
phoneNumber: '+18005554321',
-
status: Bandwidth::TfvCallbackStatusEnum::VERIFIED,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3'
-
})
-
1
expect(verification_webhook_from_hash).to be_instance_of(Bandwidth::VerificationWebhook)
-
1
expect(verification_webhook_from_hash.account_id).to eq('9900000')
-
1
expect(verification_webhook_from_hash.phone_number).to eq('+18005554321')
-
1
expect(verification_webhook_from_hash.status).to eq(Bandwidth::TfvCallbackStatusEnum::VERIFIED)
-
1
expect(verification_webhook_from_hash.internal_ticket_number).to eq('8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verification_webhook_values.to_s).to eq('{:accountId=>"9900000", :phoneNumber=>"+18005554321", :status=>"VERIFIED", :internalTicketNumber=>"8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(verification_webhook_default.eql?(Bandwidth::VerificationWebhook.new)).to be true
-
1
expect(verification_webhook_default.eql?(verification_webhook_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verification_webhook_values.to_body).to eq({
-
accountId: '9900000',
-
phoneNumber: '+18005554321',
-
status: Bandwidth::TfvCallbackStatusEnum::VERIFIED,
-
internalTicketNumber: '8c8f33f8-0d72-43c8-8b6c-1da8f0a9e6b3'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#phone_number=' do
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new({ phone_number: nil })
-
}.to raise_error(ArgumentError, 'phone_number cannot be nil')
-
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new({ phone_number: '+1800555432' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new({ phone_number: '+180055543210' })
-
}.to raise_error(ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.')
-
-
1
expect {
-
1
Bandwidth::VerificationWebhook.new({ phone_number: '+12345678901' })
-
}.to raise_error(ArgumentError, /invalid value for "phone_number", must conform to the pattern/)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerifyCodeRequest
-
1
describe Bandwidth::VerifyCodeRequest do
-
2
let(:verify_code_request_default) { Bandwidth::VerifyCodeRequest.new({
-
to: '+19195551234',
-
expiration_time_in_minutes: 1.0,
-
code: '123456'
-
}) }
-
4
let(:verify_code_request_values) { Bandwidth::VerifyCodeRequest.new({
-
to: '+19195551234',
-
scope: '2FA',
-
expiration_time_in_minutes: 1.0,
-
code: '123456'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerifyCodeRequest.acceptable_attributes).to eq(Bandwidth::VerifyCodeRequest.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::VerifyCodeRequest.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerifyCodeRequest created by the build_from_hash method' do
-
1
verify_code_request_from_hash = Bandwidth::VerifyCodeRequest.build_from_hash({
-
to: '+19195551234',
-
scope: '2FA',
-
expirationTimeInMinutes: 1.0,
-
code: '123456'
-
})
-
1
expect(verify_code_request_from_hash).to be_instance_of(Bandwidth::VerifyCodeRequest)
-
1
expect(verify_code_request_from_hash.to).to eq('+19195551234')
-
1
expect(verify_code_request_from_hash.scope).to eq('2FA')
-
1
expect(verify_code_request_from_hash.expiration_time_in_minutes).to eq(1.0)
-
1
expect(verify_code_request_from_hash.code).to eq('123456')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verify_code_request_values.to_s).to eq('{:to=>"+19195551234", :scope=>"2FA", :expirationTimeInMinutes=>1.0, :code=>"123456"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
verify_code_request_equal = Bandwidth::VerifyCodeRequest.new({
-
to: '+19195551234',
-
expiration_time_in_minutes: 1.0,
-
code: '123456'
-
})
-
1
expect(verify_code_request_default.eql?(verify_code_request_equal)).to be true
-
1
expect(verify_code_request_default.eql?(verify_code_request_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verify_code_request_values.to_body).to eq({
-
to: '+19195551234',
-
scope: '2FA',
-
expirationTimeInMinutes: 1.0,
-
code: '123456'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#to=' do
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: nil })
-
}.to raise_error(ArgumentError, 'to cannot be nil')
-
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: 'invalid' })
-
}.to raise_error(ArgumentError, 'invalid value for "to", must conform to the pattern (?-mix:^\+[1-9]\d{1,14}$).')
-
end
-
-
1
it '#expiration_time_in_minutes=' do
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: nil })
-
}.to raise_error(ArgumentError, 'expiration_time_in_minutes cannot be nil')
-
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 16 })
-
}.to raise_error(ArgumentError, 'invalid value for "expiration_time_in_minutes", must be smaller than or equal to 15.')
-
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 0 })
-
}.to raise_error(ArgumentError, 'invalid value for "expiration_time_in_minutes", must be greater than or equal to 1.')
-
end
-
-
1
it '#code=' do
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 1, code: nil })
-
}.to raise_error(ArgumentError, 'code cannot be nil')
-
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 1, code: '123456789' })
-
}.to raise_error(ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 8.')
-
-
1
expect {
-
1
Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 1, code: '123' })
-
}.to raise_error(ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 4.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VerifyCodeResponse
-
1
describe Bandwidth::VerifyCodeResponse do
-
2
let(:verify_code_response_default) { Bandwidth::VerifyCodeResponse.new }
-
4
let(:verify_code_response_values) { Bandwidth::VerifyCodeResponse.new({
-
valid: true
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerifyCodeResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VerifyCodeResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VerifyCodeResponse.acceptable_attributes).to eq(Bandwidth::VerifyCodeResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::VerifyCodeResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VerifyCodeResponse created by the build_from_hash method' do
-
1
verify_code_response_from_hash = Bandwidth::VerifyCodeResponse.build_from_hash({
-
valid: true
-
})
-
1
expect(verify_code_response_from_hash).to be_instance_of(Bandwidth::VerifyCodeResponse)
-
1
expect(verify_code_response_from_hash.valid).to be true
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(verify_code_response_values.to_s).to eq('{:valid=>true}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(verify_code_response_default.eql?(Bandwidth::VerifyCodeResponse.new)).to be true
-
1
expect(verify_code_response_default.eql?(verify_code_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(verify_code_response_values.to_body).to eq({
-
valid: true
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VoiceApiError
-
1
describe Bandwidth::VoiceApiError do
-
2
let(:voice_api_error_default) { Bandwidth::VoiceApiError.new }
-
4
let(:voice_api_error_values) { Bandwidth::VoiceApiError.new({
-
type: 'validation',
-
description: 'request body is invalid',
-
id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VoiceApiError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VoiceApiError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VoiceApiError.acceptable_attributes).to eq(Bandwidth::VoiceApiError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::VoiceApiError.openapi_nullable).to eq(Set.new([:'id']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VoiceApiError created by the build_from_hash method' do
-
1
voice_api_error_from_hash = Bandwidth::VoiceApiError.build_from_hash({
-
type: 'validation',
-
description: 'request body is invalid',
-
id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
})
-
1
expect(voice_api_error_from_hash).to be_instance_of(Bandwidth::VoiceApiError)
-
1
expect(voice_api_error_from_hash.type).to eq('validation')
-
1
expect(voice_api_error_from_hash.description).to eq('request body is invalid')
-
1
expect(voice_api_error_from_hash.id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(voice_api_error_values.to_s).to eq('{:type=>"validation", :description=>"request body is invalid", :id=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(voice_api_error_default.eql?(Bandwidth::VoiceApiError.new)).to be true
-
1
expect(voice_api_error_default.eql?(voice_api_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(voice_api_error_values.to_body).to eq({
-
type: 'validation',
-
description: 'request body is invalid',
-
id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::VoiceCodeResponse
-
1
describe Bandwidth::VoiceCodeResponse do
-
2
let(:voice_code_response_default) { Bandwidth::VoiceCodeResponse.new }
-
4
let(:voice_code_response_values) { Bandwidth::VoiceCodeResponse.new({
-
call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::VoiceCodeResponse.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::VoiceCodeResponse.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::VoiceCodeResponse.acceptable_attributes).to eq(Bandwidth::VoiceCodeResponse.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::VoiceCodeResponse.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of VoiceCodeResponse created by the build_from_hash method' do
-
1
voice_code_response_from_hash = Bandwidth::VoiceCodeResponse.build_from_hash({
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
})
-
1
expect(voice_code_response_from_hash).to be_instance_of(Bandwidth::VoiceCodeResponse)
-
1
expect(voice_code_response_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(voice_code_response_values.to_s).to eq('{:callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(voice_code_response_default.eql?(Bandwidth::VoiceCodeResponse.new)).to be true
-
1
expect(voice_code_response_default.eql?(voice_code_response_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(voice_code_response_values.to_body).to eq({
-
callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscriptionBasicAuthentication
-
1
describe Bandwidth::WebhookSubscriptionBasicAuthentication do
-
2
let(:webhook_subscription_basic_authentication_default) { Bandwidth::WebhookSubscriptionBasicAuthentication.new({
-
username: 'baseline',
-
password: 'baselinePass'
-
}) }
-
4
let(:webhook_subscription_basic_authentication_values) { Bandwidth::WebhookSubscriptionBasicAuthentication.new({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::WebhookSubscriptionBasicAuthentication.acceptable_attributes).to eq(Bandwidth::WebhookSubscriptionBasicAuthentication.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::WebhookSubscriptionBasicAuthentication.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of WebhookSubscriptionBasicAuthentication created by the build_from_hash method' do
-
1
webhook_subscription_basic_authentication_from_hash = Bandwidth::WebhookSubscriptionBasicAuthentication.build_from_hash({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
})
-
1
expect(webhook_subscription_basic_authentication_from_hash).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication)
-
1
expect(webhook_subscription_basic_authentication_from_hash.username).to eq('mySecretUsername')
-
1
expect(webhook_subscription_basic_authentication_from_hash.password).to eq('mySecretPassword')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(webhook_subscription_basic_authentication_values.to_s).to eq('{:username=>"mySecretUsername", :password=>"mySecretPassword"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
webhook_subscription_basic_authentication_equal = Bandwidth::WebhookSubscriptionBasicAuthentication.new({
-
username: 'baseline',
-
password: 'baselinePass'
-
})
-
1
expect(webhook_subscription_basic_authentication_default.eql?(webhook_subscription_basic_authentication_equal)).to be true
-
1
expect(webhook_subscription_basic_authentication_default.eql?(webhook_subscription_basic_authentication_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(webhook_subscription_basic_authentication_values.to_body).to eq({
-
username: 'mySecretUsername',
-
password: 'mySecretPassword'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#username=' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new({ username: nil, password: 'pass' })
-
}.to raise_error(ArgumentError, 'username cannot be nil')
-
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new({ username: 'a' * 101, password: 'pass' })
-
}.to raise_error(ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.')
-
end
-
-
1
it '#password=' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new({ username: 'user', password: nil })
-
}.to raise_error(ArgumentError, 'password cannot be nil')
-
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionBasicAuthentication.new({ username: 'user', password: 'a' * 201 })
-
}.to raise_error(ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscriptionError
-
1
describe Bandwidth::WebhookSubscriptionError do
-
2
let(:webhook_subscription_error_default) { Bandwidth::WebhookSubscriptionError.new }
-
4
let(:webhook_subscription_error_values) { Bandwidth::WebhookSubscriptionError.new({
-
code: 400,
-
description: 'Invalid request',
-
telephone_numbers: [
-
Bandwidth::TelephoneNumber.new({ telephone_number: '+18005554321' })
-
]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionError.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionError.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::WebhookSubscriptionError.acceptable_attributes).to eq(Bandwidth::WebhookSubscriptionError.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::WebhookSubscriptionError.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of WebhookSubscriptionError created by the build_from_hash method' do
-
1
webhook_subscription_error_from_hash = Bandwidth::WebhookSubscriptionError.build_from_hash({
-
code: 400,
-
description: 'Invalid request',
-
telephoneNumbers: [{ telephoneNumber: '+18005554321' }]
-
})
-
1
expect(webhook_subscription_error_from_hash).to be_instance_of(Bandwidth::WebhookSubscriptionError)
-
1
expect(webhook_subscription_error_from_hash.code).to eq(400)
-
1
expect(webhook_subscription_error_from_hash.description).to eq('Invalid request')
-
1
expect(webhook_subscription_error_from_hash.telephone_numbers).to be_instance_of(Array)
-
1
expect(webhook_subscription_error_from_hash.telephone_numbers.first).to be_instance_of(Bandwidth::TelephoneNumber)
-
1
expect(webhook_subscription_error_from_hash.telephone_numbers.first.telephone_number).to eq('+18005554321')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(webhook_subscription_error_values.to_s).to eq('{:code=>400, :description=>"Invalid request", :telephoneNumbers=>[{:telephoneNumber=>"+18005554321"}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(webhook_subscription_error_default.eql?(Bandwidth::WebhookSubscriptionError.new)).to be true
-
1
expect(webhook_subscription_error_default.eql?(webhook_subscription_error_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(webhook_subscription_error_values.to_body).to eq({
-
code: 400,
-
description: 'Invalid request',
-
telephoneNumbers: [{ telephoneNumber: '+18005554321' }]
-
})
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscriptionRequestSchema
-
1
describe Bandwidth::WebhookSubscriptionRequestSchema do
-
2
let(:webhook_subscription_request_schema_default) { Bandwidth::WebhookSubscriptionRequestSchema.new }
-
6
let(:webhook_subscription_request_schema_values) { Bandwidth::WebhookSubscriptionRequestSchema.new({
-
basic_authentication: Bandwidth::TfvBasicAuthentication.new({ username: 'user', password: 'pass' }),
-
callback_url: 'https://example.com/callback',
-
shared_secret_key: 'abc123abc123abc1'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionRequestSchema.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionRequestSchema.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::WebhookSubscriptionRequestSchema.acceptable_attributes).to eq(Bandwidth::WebhookSubscriptionRequestSchema.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::WebhookSubscriptionRequestSchema.openapi_nullable).to eq(Set.new([
-
:'callback_url',
-
:'shared_secret_key'
-
]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of WebhookSubscriptionRequestSchema created by the build_from_hash method' do
-
1
webhook_subscription_request_schema_from_hash = Bandwidth::WebhookSubscriptionRequestSchema.build_from_hash({
-
basicAuthentication: { username: 'user', password: 'pass' },
-
callbackUrl: 'https://example.com/callback',
-
sharedSecretKey: 'abc123abc123abc1'
-
})
-
1
expect(webhook_subscription_request_schema_from_hash).to be_instance_of(Bandwidth::WebhookSubscriptionRequestSchema)
-
1
expect(webhook_subscription_request_schema_from_hash.basic_authentication).to be_instance_of(Bandwidth::TfvBasicAuthentication)
-
1
expect(webhook_subscription_request_schema_from_hash.basic_authentication.username).to eq('user')
-
1
expect(webhook_subscription_request_schema_from_hash.basic_authentication.password).to eq('pass')
-
1
expect(webhook_subscription_request_schema_from_hash.callback_url).to eq('https://example.com/callback')
-
1
expect(webhook_subscription_request_schema_from_hash.shared_secret_key).to eq('abc123abc123abc1')
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(webhook_subscription_request_schema_values.to_s).to eq('{:basicAuthentication=>{:username=>"user", :password=>"pass"}, :callbackUrl=>"https://example.com/callback", :sharedSecretKey=>"abc123abc123abc1"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(webhook_subscription_request_schema_default.eql?(Bandwidth::WebhookSubscriptionRequestSchema.new)).to be true
-
1
expect(webhook_subscription_request_schema_default.eql?(webhook_subscription_request_schema_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(webhook_subscription_request_schema_values.to_body).to eq({
-
basicAuthentication: { username: 'user', password: 'pass' },
-
callbackUrl: 'https://example.com/callback',
-
sharedSecretKey: 'abc123abc123abc1'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#callback_url=' do
-
1
expect {
-
1
webhook_subscription_request_schema_values.callback_url = 'a' * 2001
-
}.to raise_error(ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.')
-
-
1
expect {
-
1
webhook_subscription_request_schema_values.callback_url = 'not a url'
-
}.to raise_error(ArgumentError, /invalid value for "callback_url", must conform to the pattern/)
-
end
-
-
1
it '#shared_secret_key=' do
-
1
expect {
-
1
webhook_subscription_request_schema_values.shared_secret_key = 'a' * 65
-
}.to raise_error(ArgumentError, 'invalid value for "shared_secret_key", the character length must be smaller than or equal to 64.')
-
-
1
expect {
-
1
webhook_subscription_request_schema_values.shared_secret_key = 'a' * 15
-
}.to raise_error(ArgumentError, 'invalid value for "shared_secret_key", the character length must be greater than or equal to 16.')
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscription
-
1
describe Bandwidth::WebhookSubscription do
-
2
let(:webhook_subscription_default) { Bandwidth::WebhookSubscription.new }
-
5
let(:webhook_subscription_values) { Bandwidth::WebhookSubscription.new({
-
id: '6cf73464-0c9f-431f-bd16-3711df296b9a',
-
account_id: '9900000',
-
callback_url: 'https://example.com/callback',
-
type: Bandwidth::WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS,
-
basic_authentication: Bandwidth::WebhookSubscriptionBasicAuthentication.new({ username: 'user', password: 'pass' }),
-
created_date: '2024-01-01T00:00:00Z',
-
modified_date: '2024-01-02T00:00:00Z'
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscription.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscription.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::WebhookSubscription.acceptable_attributes).to eq(Bandwidth::WebhookSubscription.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be the set of nullable fields' do
-
1
expect(Bandwidth::WebhookSubscription.openapi_nullable).to eq(Set.new([:'callback_url']))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of WebhookSubscription created by the build_from_hash method' do
-
1
webhook_subscription_from_hash = Bandwidth::WebhookSubscription.build_from_hash({
-
id: '6cf73464-0c9f-431f-bd16-3711df296b9a',
-
accountId: '9900000',
-
callbackUrl: 'https://example.com/callback',
-
type: Bandwidth::WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS,
-
basicAuthentication: { username: 'user', password: 'pass' },
-
createdDate: '2024-01-01T00:00:00Z',
-
modifiedDate: '2024-01-02T00:00:00Z'
-
})
-
1
expect(webhook_subscription_from_hash).to be_instance_of(Bandwidth::WebhookSubscription)
-
1
expect(webhook_subscription_from_hash.id).to eq('6cf73464-0c9f-431f-bd16-3711df296b9a')
-
1
expect(webhook_subscription_from_hash.account_id).to eq('9900000')
-
1
expect(webhook_subscription_from_hash.callback_url).to eq('https://example.com/callback')
-
1
expect(webhook_subscription_from_hash.type).to eq(Bandwidth::WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS)
-
1
expect(webhook_subscription_from_hash.basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication)
-
1
expect(webhook_subscription_from_hash.created_date).to eq(Time.parse('2024-01-01T00:00:00Z'))
-
1
expect(webhook_subscription_from_hash.modified_date).to eq(Time.parse('2024-01-02T00:00:00Z'))
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(webhook_subscription_values.to_s).to eq('{:id=>"6cf73464-0c9f-431f-bd16-3711df296b9a", :accountId=>"9900000", :callbackUrl=>"https://example.com/callback", :type=>"TOLLFREE_VERIFICATION_STATUS", :basicAuthentication=>{:username=>"user", :password=>"pass"}, :createdDate=>"2024-01-01T00:00:00Z", :modifiedDate=>"2024-01-02T00:00:00Z"}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
expect(webhook_subscription_default.eql?(Bandwidth::WebhookSubscription.new)).to be true
-
1
expect(webhook_subscription_default.eql?(webhook_subscription_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(webhook_subscription_values.to_body).to eq({
-
id: '6cf73464-0c9f-431f-bd16-3711df296b9a',
-
accountId: '9900000',
-
callbackUrl: 'https://example.com/callback',
-
type: Bandwidth::WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS,
-
basicAuthentication: { username: 'user', password: 'pass' },
-
createdDate: '2024-01-01T00:00:00Z',
-
modifiedDate: '2024-01-02T00:00:00Z'
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#callback_url=' do
-
1
expect {
-
1
webhook_subscription_values.callback_url = 'a' * 2001
-
}.to raise_error(ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.')
-
-
1
expect {
-
1
webhook_subscription_values.callback_url = 'not a url'
-
}.to raise_error(ArgumentError, /invalid value for "callback_url", must conform to the pattern/)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscriptionTypeEnum
-
1
describe Bandwidth::WebhookSubscriptionTypeEnum do
-
1
describe 'constants' do
-
1
it 'defines TOLLFREE_VERIFICATION_STATUS' do
-
1
expect(Bandwidth::WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS).to eq('TOLLFREE_VERIFICATION_STATUS')
-
end
-
-
1
it 'defines MESSAGING_PORTOUT_APPROVAL_STATUS' do
-
1
expect(Bandwidth::WebhookSubscriptionTypeEnum::MESSAGING_PORTOUT_APPROVAL_STATUS).to eq('MESSAGING_PORTOUT_APPROVAL_STATUS')
-
end
-
end
-
-
1
describe '.all_vars' do
-
1
it 'returns every valid enum value' do
-
1
expect(Bandwidth::WebhookSubscriptionTypeEnum.all_vars).to eq([
-
'TOLLFREE_VERIFICATION_STATUS',
-
'MESSAGING_PORTOUT_APPROVAL_STATUS'
-
])
-
end
-
end
-
-
1
describe '.build_from_hash' do
-
1
it 'returns the value when it matches a valid enum value' do
-
1
expect(Bandwidth::WebhookSubscriptionTypeEnum.build_from_hash('TOLLFREE_VERIFICATION_STATUS')).to eq('TOLLFREE_VERIFICATION_STATUS')
-
1
expect(Bandwidth::WebhookSubscriptionTypeEnum.build_from_hash('MESSAGING_PORTOUT_APPROVAL_STATUS')).to eq('MESSAGING_PORTOUT_APPROVAL_STATUS')
-
end
-
-
1
it 'raises an error for an invalid enum value' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionTypeEnum.build_from_hash('invalid')
-
}.to raise_error(RuntimeError)
-
end
-
end
-
end
-
# Unit tests for Bandwidth::WebhookSubscriptionsListBody
-
1
describe Bandwidth::WebhookSubscriptionsListBody do
-
2
let(:webhook_subscriptions_list_body_default) { Bandwidth::WebhookSubscriptionsListBody.new({
-
data: []
-
}) }
-
5
let(:webhook_subscriptions_list_body_values) { Bandwidth::WebhookSubscriptionsListBody.new({
-
links: { self: 'https://example.com/self' },
-
errors: [
-
Bandwidth::WebhookSubscriptionError.new({ code: 400, description: 'Invalid request' })
-
],
-
data: [
-
Bandwidth::WebhookSubscription.new({ id: '6cf73464-0c9f-431f-bd16-3711df296b9a', account_id: '9900000' })
-
]
-
}) }
-
-
1
describe '#initialize' do
-
1
it 'causes an ArgumentError by passing an Array to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionsListBody.new([])
-
}.to raise_error(ArgumentError)
-
end
-
-
1
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
-
1
expect {
-
1
Bandwidth::WebhookSubscriptionsListBody.new({ invalid: true })
-
}.to raise_error(ArgumentError)
-
end
-
end
-
-
1
describe '#acceptable_attributes' do
-
1
it 'expects acceptable JSON attributes to be those in the attribute map' do
-
1
expect(Bandwidth::WebhookSubscriptionsListBody.acceptable_attributes).to eq(Bandwidth::WebhookSubscriptionsListBody.attribute_map.values)
-
end
-
end
-
-
1
describe '#openapi_nullable' do
-
1
it 'expects nullable attributes to be an empty set' do
-
1
expect(Bandwidth::WebhookSubscriptionsListBody.openapi_nullable).to eq(Set.new([]))
-
end
-
end
-
-
1
describe '#build_from_hash' do
-
1
it 'validates instance of WebhookSubscriptionsListBody created by the build_from_hash method' do
-
1
webhook_subscriptions_list_body_from_hash = Bandwidth::WebhookSubscriptionsListBody.build_from_hash({
-
links: { self: 'https://example.com/self' },
-
errors: [{ code: 400, description: 'Invalid request' }],
-
data: [{ id: '6cf73464-0c9f-431f-bd16-3711df296b9a', accountId: '9900000' }]
-
})
-
1
expect(webhook_subscriptions_list_body_from_hash).to be_instance_of(Bandwidth::WebhookSubscriptionsListBody)
-
1
expect(webhook_subscriptions_list_body_from_hash.links).to be_instance_of(Bandwidth::LinksObject)
-
1
expect(webhook_subscriptions_list_body_from_hash.errors).to be_instance_of(Array)
-
1
expect(webhook_subscriptions_list_body_from_hash.errors.first).to be_instance_of(Bandwidth::WebhookSubscriptionError)
-
1
expect(webhook_subscriptions_list_body_from_hash.data).to be_instance_of(Array)
-
1
expect(webhook_subscriptions_list_body_from_hash.data.first).to be_instance_of(Bandwidth::WebhookSubscription)
-
end
-
end
-
-
1
describe '#to_s' do
-
1
it 'returns a string representation of the object' do
-
1
expect(webhook_subscriptions_list_body_values.to_s).to eq('{:links=>{:self=>"https://example.com/self"}, :errors=>[{:code=>400, :description=>"Invalid request"}], :data=>[{:id=>"6cf73464-0c9f-431f-bd16-3711df296b9a", :accountId=>"9900000", :callbackUrl=>nil}]}')
-
end
-
end
-
-
1
describe '#eq? #==' do
-
1
it 'returns true/false when comparing objects' do
-
1
webhook_subscriptions_list_body_equal = Bandwidth::WebhookSubscriptionsListBody.new({
-
data: []
-
})
-
1
expect(webhook_subscriptions_list_body_default.eql?(webhook_subscriptions_list_body_equal)).to be true
-
1
expect(webhook_subscriptions_list_body_default.eql?(webhook_subscriptions_list_body_values)).to be false
-
end
-
end
-
-
1
describe '#to_body #to_hash' do
-
1
it 'returns a hash representation of the object' do
-
1
expect(webhook_subscriptions_list_body_values.to_body).to eq({
-
links: { self: 'https://example.com/self' },
-
errors: [{ code: 400, description: 'Invalid request' }],
-
data: [{ id: '6cf73464-0c9f-431f-bd16-3711df296b9a', accountId: '9900000', callbackUrl: nil }]
-
})
-
end
-
end
-
-
1
describe 'custom attribute writers' do
-
1
it '#data=' do
-
1
expect {
-
1
webhook_subscriptions_list_body_values.data = nil
-
}.to raise_error(ArgumentError, 'data cannot be nil')
-
end
-
end
-
end