Class: Bandwidth::ApiModelBase
- Inherits:
-
Object
- Object
- Bandwidth::ApiModelBase
- Defined in:
- lib/bandwidth-sdk/api_model_base.rb
Direct Known Subclasses
AccountStatistics, AdditionalDenialReason, Address, AnswerCallback, AsyncLookupRequest, BlockedWebhook, BridgeCompleteCallback, BridgeTargetCompleteCallback, CallRecordingMetadata, CallState, CallTranscription, CallTranscriptionMetadata, CallTranscriptionResponse, CodeRequest, Conference, ConferenceCompletedCallback, ConferenceCreatedCallback, ConferenceMember, ConferenceMemberExitCallback, ConferenceMemberJoinCallback, ConferenceRecordingAvailableCallback, ConferenceRecordingMetadata, ConferenceRedirectCallback, Contact, CreateAsyncBulkLookupResponse, CreateAsyncBulkLookupResponseData, CreateCall, CreateCallResponse, CreateMessageRequestError, CreateMultiChannelMessageResponse, CreateSyncLookupResponse, CreateSyncLookupResponseData, DisconnectCallback, Diversion, DtmfCallback, Error, ErrorObject, ErrorSource, FailureWebhook, FieldError, GatherCallback, GetAsyncBulkLookupResponse, GetAsyncBulkLookupResponseData, InboundCallback, InboundCallbackMessage, InitiateCallback, Link, LinkSchema, LinksObject, ListMessageItem, LookupErrorResponse, LookupErrorSchema, LookupErrorSchemaMeta, LookupResult, MachineDetectionCompleteCallback, MachineDetectionConfiguration, MachineDetectionResult, Media, Message, MessageRequest, MessagesList, MessagingCodeResponse, MessagingRequestError, MfaForbiddenRequestError, MfaRequestError, MfaUnauthorizedRequestError, MmsMessageContent, MmsMessageContentFile, MultiChannelActionCalendarEvent, MultiChannelChannelListMMSObject, MultiChannelChannelListMMSResponseObject, MultiChannelChannelListObjectBase, MultiChannelChannelListOwnerObject, MultiChannelChannelListRBMObject, MultiChannelChannelListRBMResponseObject, MultiChannelChannelListSMSObject, MultiChannelChannelListSMSResponseObject, MultiChannelError, MultiChannelMessageContent, MultiChannelMessageRequest, MultiChannelMessageResponseData, OptInWorkflow, PageInfo, RbmActionBase, RbmActionDial, RbmActionOpenUrl, RbmActionViewLocation, RbmCardContent, RbmCardContentMedia, RbmLocationResponse, RbmMessageCarouselCard, RbmMessageContentFile, RbmMessageContentText, RbmMessageMedia, RbmStandaloneCard, RbmSuggestionResponse, RecordingAvailableCallback, RecordingCompleteCallback, RecordingTranscriptionMetadata, RecordingTranscriptions, RedirectCallback, SmsMessageContent, StatusCallback, StatusCallbackMessage, StirShaken, SyncLookupRequest, TelephoneNumber, TfvBasicAuthentication, TfvError, TfvStatus, TfvSubmissionInfo, TfvSubmissionWrapper, TranscribeRecording, Transcription, TranscriptionAvailableCallback, TransferAnswerCallback, TransferCompleteCallback, TransferDisconnectCallback, UpdateCall, UpdateCallRecording, UpdateConference, UpdateConferenceMember, VerificationDenialWebhook, VerificationRequest, VerificationUpdateRequest, VerificationWebhook, VerifyCodeRequest, VerifyCodeResponse, VoiceApiError, VoiceCodeResponse, WebhookSubscription, WebhookSubscriptionBasicAuthentication, WebhookSubscriptionRequestSchema, WebhookSubscriptionsListBody
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
Instance Method Summary collapse
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_s ⇒ String
Returns the string representation of the object.
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bandwidth-sdk/api_model_base.rb', line 19 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly 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/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Bandwidth.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
Instance Method Details
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/bandwidth-sdk/api_model_base.rb', line 74 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
66 67 68 |
# File 'lib/bandwidth-sdk/api_model_base.rb', line 66 def to_body to_hash end |
#to_s ⇒ String
Returns the string representation of the object
60 61 62 |
# File 'lib/bandwidth-sdk/api_model_base.rb', line 60 def to_s to_hash.to_s end |