Class: Verizon::BaseModel
- Inherits:
-
CoreLibrary::BaseModel
- Object
- CoreLibrary::BaseModel
- Verizon::BaseModel
- Defined in:
- lib/verizon/models/base_model.rb
Overview
Base model.
Direct Known Subclasses
Acceleration, Account, AccountDeviceList, AccountDeviceListFilter, AccountDeviceListRequest, AccountDeviceListResult, AccountIdentifier, AccountLabels, AccountLead, AccountLeadsResult, AccountLicenseDeviceListItem, AccountLicenseInfo, AccountService, AccountStatesAndServices, Activate, ActivateDeviceProfileRequest, ActiveAnomalyIndicator, ActiveTriggerIndicator, AddDevicesRequest, AddDevicesResult, Address, AddressItem, Addressquery, AggregateSessionReport, AggregateSessionReportRequest, AggregateUsageError, AggregateUsageItem, AggregatedReportCallbackResult, AnomalyDetectionRequest, AnomalyDetectionSettings, AnomalyDetectionTrigger, AnomalyTriggerRequest, AnomalyTriggerResult, AnomalyTriggerValue, ApiResponseCode, AssignLicenseRequest, AssociateLabelRequest, AsynchronousLocationRequestResult, AsynchronousRequestResult, AttributeSetting, BillUsageRequest, BillableUsageReport, BilledusageListRequest, BillingCycle, BullseyeServiceRequest, BullseyeServiceResult, CallbackActionResult, CallbackCreated, CallbackRegistered, CallbackRegistrationRequest, CallbackRegistrationResult, CallbackSummary, Campaign, CampaignFirmwareUpgrade, CampaignSoftware, CampaignSoftwareUpgrade, CarrierActionsRequest, CarrierActivateRequest, CarrierDeactivateRequest, CarrierInformation, ChangeConfigurationRequest, ChangeConfigurationResponse, ChangeDeviceIdRequest, ChangeMecDeviceIPAddressResponse, ChangeMecDeviceProfileResponse, ChangeMecDeviceStateResponse, ChangePmecDeviceIPaddressBulkRequest, ChangePmecDeviceIPaddressRequest, ChangePmecDeviceProfileBulkRequest, ChangePmecDeviceProfileRequest, ChangePmecDeviceStateActivateRequest, ChangePmecDeviceStateBulkActivateRequest, ChangePmecDeviceStateBulkDeactivateRequest, ChangePmecDeviceStateDeactivateRequest, CheckInHistoryItem, CheckOrderStatusRequest, ComputeResourcesType, Condition, Configuration, ConnectionEvent, ConnectionHistoryResult, ConnectivityManagementCallback, ConnectivityManagementSuccessResult, ConsentDeleteRequest, ConsentRequest, ContactInfoUpdateRequest, Coordinates, CreateDeviceGroupRequest, CreateIoTApplicationRequest, CreateIoTApplicationResponse, CreateServiceProfileResult, CreateSubscriptionRequest, CreateTargetRequest, CreateTargetRequestFields, CreateTriggerRequest, CreateTriggerRequestOptions, CustomFields, CustomFieldsUpdateRequest, CustomerName, Customernamequery, DailyUsageItem, DataPercentage100TriggerAttribute, DataPercentage50TriggerAttribute, DataPercentage75TriggerAttribute, DataPercentage90TriggerAttribute, DataTriggerRequest, DateFilter, DeactivateDeviceList, DeactivateDeviceProfileRequest, DeleteDevicesRequest, DeleteDevicesResult, DeleteServiceProfileResult, DeleteSubscriptionRequest, DeleteTargetRequest, DeregisterServiceEndpointResult, Device, DeviceActivationRequest, DeviceAggregateUsageListRequest, DeviceConnectionListRequest, DeviceCostCenterRequest, DeviceDiagnosticsCallback, DeviceExtendedDiagnosticsRequest, DeviceExtendedDiagnosticsResult, DeviceFilter, DeviceFilterWithoutAccount, DeviceFirmwareList, DeviceFirmwareUpgrade, DeviceFirmwareVersion, DeviceFirmwareVersionUpdateResult, DeviceGroup, DeviceGroupDevicesData, DeviceGroupUpdateRequest, DeviceIMEI, DeviceId, DeviceId2, DeviceIdSearch, DeviceIdentifier, DeviceInfo, DeviceLabels, DeviceList, DeviceList1, DeviceList2, DeviceList7, DeviceListQueryItem, DeviceListQueryResult, DeviceListResult, DeviceLocationCallback, DeviceLocationSubscription, DeviceLocationSuccessResult, DeviceLog, DeviceLoggingRequest, DeviceLoggingStatus, DeviceManagementResult, DeviceMismatchListRequest, DeviceMismatchListResult, DevicePrlListRequest, DeviceProfileRequest, DevicePropertylocation, DeviceProvisioningHistoryListRequest, DeviceProvisioningHistoryListResult, DeviceResetRequest, DeviceServiceInformation, DeviceServiceRequest, DeviceSoftwareUpgrade, DeviceSuspensionStatusRequest, DeviceUpgradeHistory, DeviceUploadRequest, DeviceUsageListRequest, DeviceUsageListResult, DevicesConsentResult, DiagnosticObservationSetting, DiagnosticsCategory, DiagnosticsObservationResult, DiagnosticsSubscription, DownloadTimeWindow, ESIMDeviceId, ESIMDeviceList, ESIMProfileRequest, ESIMProvhistoryRequest, ESIMRequestResponse, ESIMStatusResponse, ESIMsubrequest, EdgeDiscoveryResultData, EnablePromoExp, EnablePromoExp1, Engagement, ExtendedAttributes, Fields, Fields1, Fields2, FieldsHttpHeaders, Filtercriteria, Filtercriteria2, FindDeviceByPropertyResponse, FindDeviceByPropertyResponseList, Firmware, FirmwareCampaign, FirmwareIMEI, FirmwarePackage, FirmwareUpgrade, FirmwareUpgradeChangeRequest, FirmwareUpgradeChangeResult, FirmwareUpgradeDeviceListItem, FirmwareUpgradeRequest, FlowInfo, FotaV1CallbackRegistrationRequest, FotaV1CallbackRegistrationResult, FotaV1SuccessResult, FotaV2CallbackRegistrationRequest, FotaV2CallbackRegistrationResult, FotaV2Subscription, FotaV2SuccessResult, FotaV3CallbackRegistrationRequest, FotaV3CallbackRegistrationResult, FotaV3CallbackSummary, FotaV3Subscription, FotaV3SuccessResult, GIODeactivateDeviceProfileRequest, GIODeviceId, GIODeviceList, GIOProfileRequest, GIORequestResponse, GIOSMSSendRequest, GIOSmsMessage, GPU, GenerateExternalIDRequest, GenerateExternalIDResult, GetDeviceExperienceScoreBulkRequest, GetDeviceExperienceScoreHistoryRequest, GetDeviceListWithProfilesRequest, GetMECPerformanceConsentResponse, GetNetworkConditionsRequest, GetTriggerResponse, GetTriggerResponseList, GetWirelessCoverageRequest, GetWirelessCoverageRequestFWA, GoToStateRequest, History, HistoryAttributeValue, HistorySearchFilter, HistorySearchFilterAttributes, HistorySearchLimitTime, HistorySearchRequest, HyperPreciseLocationCallback, HyperPreciseLocationFault, IErrorMessage, IPPool, Id, IntelligenceSuccessResult, KPIInfo, KPIInfoList, KeyDataPercentage50, KeyServicePlan, Keyschunk2, KeysmsPercentage50, KvPair, Label, LabelsList, LicenseDeviceId, LicenseDeviceList, ListAllServiceEndpointsResult, ListMECPlatformsResult, ListOptimalServiceEndpointsResult, ListRegionsResult, ListServiceProfilesResult, Location, LocationReport, LocationReportStatus, LocationRequest, Locations, Locationscoord, LogInRequest, LogInResult, LogOutRequest, M201success, MECDeviceId, MECDeviceList, MECPerformanceMetrics, MECPerformanceQueryResult, MECPlatformResource, MECPlatformsAdditionalSupportInfo, MECPlatformsAdditionalSupportInfoData, MECProfile, MECProfileList, ManagedAccAddedList, ManagedAccProvisionedList, ManagedAccountCancelRequest, ManagedAccountCancelResponse, ManagedAccountsAddRequest, ManagedAccountsAddResponse, ManagedAccountsGetAllResponse, ManagedAccountsProvisionRequest, ManagedAccountsProvisionResponse, MismatchedDevice, MoveDeviceRequest, NetworkResourcesType, NetworkType, NoOfDaysB4PromoExp, Notification, NotificationGroupNameTriggerAttribute, NotificationReportRequest, NotificationReportStatusRequest, NumericalData, OauthToken, ObservationRequest, ObservationRequestAttribute, PlaceOfUse, PositionData, PositionError, PrimaryPlaceOfUse, ProfileChangeStateRequest, ProfileRequest, ProfileRequest2, PromoAlert, PromoAlert1, PromoAlertTriggerRequest, PropertyDeviceId, ProvhistoryRequest, ProvisioningHistory, QosDeviceId, QosDeviceInfo, QueryMECPerformanceMetricsRequest, QuerySubscriptionRequest, QueryTargetRequest, ReadySimDeviceId, ReadySimServicePlan, Region, RegisterCallbackRequest, RegisterServiceEndpointResult, RegisteredCallbacks, RemoveDeviceRequest, RequestBodyForUsage, RequestBodyForUsage1, RequestResponse, RequestTrigger, ResourceIdentifier, ResourcesEdgeHostedService, ResourcesEdgeHostedServiceWithProfileId, ResourcesServiceEndpoint, ResourcesServiceProfile, ResourcesServiceProfileWithId, ResponseToUsageQuery, RetrieveMonitorsRequest, RetrievesAvailableFilesResponse, RetrievesAvailableFilesResponseList, SMSEventHistoryRequest, SMSMessage, SMSMessagesQueryResult, SMSNumber, SMSOptionsSendRequest, SMSSendRequest, SMSTriggerRequest, SchedulesSoftwareUpgradeRequest, SearchDeviceByPropertyFields, SearchDeviceByPropertyResponse, SearchDeviceByPropertyResponseList, SearchDeviceEventHistoryRequest, SearchDeviceEventHistoryResponseList, SearchDeviceResponse, SearchSensorHistoryRequest, SearchSensorHistoryResponseList, SecuritySubscription, SecuritySubscriptionRequest, SecuritySubscriptionResult, SecuritySuccessResult, SensitivityParameters, ServicePlan, ServicePlanTriggerAttribute, ServicePlanUpdateRequest, ServiceUsage, SessionReport, SessionReportRequest, SessionResetPasswordRequest, SessionResetPasswordResult, SessionTriggerRequest, SetFallbackAttributeRequest, SmsMessagesResponse, SoftwarePackage, State, Status, StatusList, StatusResponse, StopMonitorRequest, Subrequest, SubscribeRequest, Subscription, Success, SuccessResponse, SynchronousLocationRequestResult, Target, TargetAuthentication, TargetAuthenticationBody, TargetAuthenticationBodyHeaders, TargetAuthenticationBodyHost, ThingspaceDevice, TransactionID, TriggerAttributesOptions, TriggerType1, TriggerType2, TriggerType3, TriggerValueResponse, TriggerValueResponse2, TriggersListOptions, Triggervalues, Triggervalues2, UpdateServiceEndpointResult, UpdateServiceProfileResult, UpdateTriggerRequest, UpdateTriggerRequestOptions, UpgradeListQueryResult, UploadAndScheduleFileRequest, UploadAndScheduleFileResponse, UploadConfigurationFilesResponse, UploadsActivatesDeviceRequest, Usage, UsageAnomalyAttributes, UsageHistory, UsageRequestResponse, UsageTriggerAddRequest, UsageTriggerResponse, UsageTriggerUpdateRequest, V1AccountSubscription, V1DeviceListItem, V1LicensesAssignedRemovedRequest, V1LicensesAssignedRemovedResult, V1ListOfLicensesToRemove, V1ListOfLicensesToRemoveRequest, V1ListOfLicensesToRemoveResult, V2AccountDevice, V2AccountDeviceList, V2AddOrRemoveDeviceRequest, V2AddOrRemoveDeviceResult, V2CampaignDevice, V2CampaignHistory, V2CampaignMetaInfo, V2ChangeCampaignDatesRequest, V2DeviceStatus, V2LicenseDevice, V2LicenseIMEI, V2LicenseSummary, V2LicensesAssignedRemovedResult, V2ListOfLicensesToRemove, V2ListOfLicensesToRemoveRequest, V2ListOfLicensesToRemoveResult, V2SoftwareInfo, V2TimeWindow, V3AccountDevice, V3AccountDeviceList, V3AddOrRemoveDeviceRequest, V3AddOrRemoveDeviceResult, V3CampaignDevice, V3CampaignHistory, V3CampaignMetaInfo, V3ChangeCampaignDatesRequest, V3Device, V3DeviceListItem, V3DeviceStatus, V3LicenseAssignedRemovedResult, V3LicenseDevice, V3LicenseIMEI, V3LicenseSummary, V3SoftwareInfo, V3TimeWindow, WNPRequestResponse
Instance Method Summary collapse
-
#to_hash ⇒ Object
Returns a Hash representation of the current object.
-
#to_json(options = {}) ⇒ Object
Returns a JSON representation of the curent object.
Instance Method Details
#to_hash ⇒ Object
Returns a Hash representation of the current object.
10 11 12 13 14 15 16 17 18 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 |
# File 'lib/verizon/models/base_model.rb', line 10 def to_hash # validating the model being serialized self.class.validate(self) if self.class.respond_to?(:validate) hash = {} instance_variables.each do |name| value = instance_variable_get(name) name = name[1..] key = self.class.names.key?(name) ? self.class.names[name] : name optional_fields = self.class.optionals nullable_fields = self.class.nullables if value.nil? next unless nullable_fields.include?(name) if !optional_fields.include?(name) && !nullable_fields.include?(name) raise ArgumentError, "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value." end end hash[key] = nil unless value.nil? if respond_to?("to_custom_#{name}") if (value.instance_of? Array) || (value.instance_of? Hash) params = [hash, key] hash[key] = send("to_custom_#{name}", *params) else hash[key] = send("to_custom_#{name}") end elsif respond_to?("to_union_type_#{name}") hash[key] = send("to_union_type_#{name}") elsif value.instance_of? Array hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v } elsif value.instance_of? Hash hash[key] = {} value.each do |k, v| hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v end else hash[key] = value.is_a?(BaseModel) ? value.to_hash : value end end end hash end |
#to_json(options = {}) ⇒ Object
Returns a JSON representation of the curent object.
57 58 59 60 |
# File 'lib/verizon/models/base_model.rb', line 57 def to_json( = {}) hash = to_hash hash.to_json() end |