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
ARequestBodyForUsage, Acceleration, Account, AccountConsentCreate, AccountConsentUpdate, AccountDetails, AccountDeviceList, AccountDeviceListFilter, AccountDeviceListRequest, AccountDeviceListResult, AccountGroupShare, AccountGroupShareIndividual, AccountIdentifier, AccountLabels, AccountLead, AccountLeadsResult, AccountLicenseDeviceListItem, AccountLicenseInfo, AccountService, AccountStatesAndServices, ActionAccountGroupShare, Activate, ActivateDeviceProfileRequest, ActiveAnomalyIndicator, ActiveTriggerIndicator, AddDevicesRequest, AddDevicesResult, Address, AddressItem, Addressquery, AggregateSessionReport, AggregateSessionReportRequest, AggregateUsage, 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, Carrier, CarrierActionsRequest, CarrierActivateRequest, CarrierDeactivateRequest, CarrierInformation, CarrierServicePlan, ChangeConfigurationRequest, ChangeConfigurationResponse, ChangeDeviceIdRequest, ChangePWNDeviceIpaddressRequest, ChangePWNDeviceIpaddressResponse, ChangePWNDeviceProfileRequest, ChangePWNDeviceProfileResponse, ChangePWNDeviceStateActivateRequest, ChangePWNDeviceStateDeactivateRequest, ChangePWNDeviceStateResponse, ChangePlan, CheckInHistoryItem, CheckOrderStatusRequest, ComputeResourcesType, Condition, ConditionAccountGroupShare, Configuration, ConnectionEvent, ConnectionHistoryResult, ConnectivityManagementCallback, ConnectivityManagementSuccessResult, ConsentDeleteRequest, ConsentRequest, ConsentTransactionID, ContactInfoUpdateRequest, Coordinates, CreateDeviceGroupRequest, CreateIoTApplicationRequest, CreateIoTApplicationResponse, CreateServiceProfileResult, CreateSubscriptionRequest, CreateTargetRequest, CreateTargetRequestFields, CreateTriggerRequest, CreateTriggerRequestOptions, CreateTriggerV2Request, CustomFields, CustomFieldsUpdateRequest, CustomerName, Customernamequery, DailyUsage, DailyUsageHistory, DailyUsageItem, DailyUsageResponse, 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, DeviceIdarray, DeviceIdentifier, DeviceInfo, DeviceLabels, DeviceList, DeviceList2, DeviceListIP, DeviceListQueryItem, DeviceListQueryResult, DeviceListResult, DeviceListWithServiceAddress, DeviceListWithServiceAddress1, 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, ESIMGlobalDeviceList, ESIMProfileRequest, ESIMProfileRequest2, ESIMProvhistoryRequest, ESIMRequestResponse, EdgeDiscoveryResultData, EnablePromoExp, EnablePromoExp1, Engagement, ExtendedAttribute, ExtendedAttributes, FallBack, Feature, Fields, Fields1, Fields2, FieldsHttpHeaders, FilterCriteriaAccountGroupShare, 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, GetAccountDeviceConsent, GetDeviceExperienceScoreBulkRequest, GetDeviceExperienceScoreHistoryRequest, GetDeviceListWithProfilesRequest, GetNetworkConditionsRequest, GetPWNPerformanceConsentResponse, GetTriggerResponse, GetTriggerResponseList, GetWirelessCoverageRequest, GetWirelessCoverageRequestFWA, GoToStateRequest, GroupName, 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, M5gBiAddress, M5gBiCarrierInformation, M5gBiCustomerName, M5gBiRequestResponse, M5gBiaccountNameobject, M5gBiactivateRequest, M5gBiaddressAndcustomerinfo, M5gBiaddressAndcustomerinfo2, M5gBiattribute1, M5gBiattribute2, M5gBichangeRequest, M5gBideviceDetailsresponse, M5gBideviceId, M5gBideviceId1, M5gBideviceIdarray, M5gBikeyValue1, M5gBiprimaryPlaceofuse, MECPerformanceMetrics, MECPerformanceQueryResult, MECPlatformResource, MECPlatformsAdditionalSupportInfo, MECPlatformsAdditionalSupportInfoData, ManagedAccAddedList, ManagedAccProvisionedList, ManagedAccountCancelRequest, ManagedAccountCancelResponse, ManagedAccountsAddRequest, ManagedAccountsAddResponse, ManagedAccountsGetAllResponse, ManagedAccountsProvisionRequest, ManagedAccountsProvisionResponse, MismatchedDevice, MoveDeviceRequest, NetworkResourcesType, NetworkType, NoOfDaysB4PromoExp, Notification, NotificationGroupNameTriggerAttribute, NotificationReportRequest, NotificationReportStatusRequest, NumericalData, OauthToken, ObservationRequest, ObservationRequestAttribute, PWNDeviceId, PWNDeviceList, PWNProfile, PWNProfileList, PlaceOfUse, PositionData, PositionError, PricePlanTrigger, PrimaryPlaceOfUse, ProfileChangeStateRequest, ProfileRequest, ProfileRequest2, PromoAlert, PromoAlert1, PromoAlertTriggerRequest, PropertyDeviceId, ProvhistoryRequest, ProvisioningHistory, QosDeviceId, QosDeviceInfo, QueryMECPerformanceMetricsRequest, QuerySubscriptionRequest, QueryTargetRequest, ReadySimDeviceId, ReadySimServicePlan, Region, RegisterCallbackRequest, RegisterServiceEndpointResult, RegisteredCallbacks, RemoveDeviceRequest, RequestBodyForUsage, 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, SharePlan, SmsMessagesResponse, SmsNumbers, SoftwarePackage, State, StatusList, StatusResponse, StopMonitorRequest, Subrequest, SubscribeRequest, Subscription, Success, SuccessResponse, SynchronousLocationRequestResult, Target, TargetAuthentication, TargetAuthenticationBody, TargetAuthenticationBodyHeaders, TargetAuthenticationBodyHost, ThingspaceDevice, TransactionID, TriggerAttributesOptions, TriggerNotification, TriggerType1, TriggerType2, TriggerType3, TriggerV2Response, TriggerValueResponse, TriggerValueResponse2, TriggersListOptions, Triggervalues, Triggervalues2, UpdateServiceEndpointResult, UpdateServiceProfileResult, UpdateTriggerRequest, UpdateTriggerRequestOptions, UpdateTriggerV2Request, 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 |