Class: Verizon::BaseModel
- Inherits:
-
CoreLibrary::BaseModel
- Object
- CoreLibrary::BaseModel
- Verizon::BaseModel
- Defined in:
- lib/verizon/models/base_model.rb
Overview
Base model. rubocop:disable all
Direct Known Subclasses
ARequestBodyForUsage, Acceleration, Account, AccountConsentCreate, AccountConsentUpdate, AccountDetails, AccountDeviceList, AccountDeviceListFilter, AccountDeviceListRequest, AccountDeviceListResult, AccountGroupShareAction, AccountGroupShareCondition, AccountGroupShareCreateTrigger, AccountGroupShareCreateTriggerRequest, AccountGroupShareFilter, AccountGroupShareFilterCriteria, AccountGroupShareIndividual1, AccountGroupShareObject, AccountGroupShareUpdateTrigger, AccountGroupShareUpdateTriggerRequest, AccountIdentifier, AccountLabels, AccountLead, AccountLeadsResult, AccountLevelCreateTrigger, AccountLevelCreateTriggerRequest, AccountLevelFilter, AccountLevelObject, AccountLevelUpdateTrigger, AccountLevelUpdateTriggerRequest, AccountLicenseDeviceListItem, AccountLicenseInfo, AccountService, AccountShareCreateTriggerRequest, AccountShareFilterCriteria, AccountShareFilterCriteria1, AccountSharePricePlanTrigger, AccountShareUpdateTriggerRequest, AccountStatesAndServices, Accountid, Accountnames, ActionId, ActionObjectCall, ActionResultwithDeviceConfig, Actionobject, Activate, ActivateDeviceProfileRequest, ActiveAnomalyIndicator, ActiveTriggerIndicator, Activeindicator, AddDevicesRequest, AddDevicesResult, Address, AddressItem, Addressquery, AdvisoryItem, AdvisoryItem1, AggregateSessionReport, AggregateSessionReportRequest, AggregateUsage, AggregateUsageError, AggregateUsageItem, AggregatedReportCallbackResult, AllowanceThreshold, Altitude, AnomalyDetectionRequest, AnomalyDetectionSettings, AnomalyDetectionTrigger, AnomalyTriggerRequest, AnomalyTriggerResult, AnomalyTriggerValue, ApiResponseCode, AsphaltOrTar, AssignLicenseRequest, AssociateLabelRequest, AsynchronousLocationRequestResult, AsynchronousRequestResult, AsynchronousRequestResultforplanner, AttributeSetting, AuthSubRestErrorResponseforplanner, BillUsageRequest, BillableUsageReport, BilledusageListRequest, BillingCycle, BulkUpdateSmartalert, BullseyeServiceRequest, BullseyeServiceResult, CallbackActionResult, CallbackCreated, CallbackRegistered, CallbackRegistrationRequest, CallbackRegistrationResult, CallbackSummary, Campaign, CampaignFirmwareUpgrade, CampaignSoftware, CampaignSoftwareUpgrade, Carrier, CarrierActionsRequest, CarrierActivateRequest, CarrierDeactivateRequest, CarrierInformation, CarrierServicePlan, Carriercode1, CauseCodeChoice, CauseCodeChoice1, CauseCodeChoice2, CauseCodeChoice3, CauseCodeChoice4, CauseCodeChoice5, Cellphonenumber, Certificate, ChangeConfigurationRequest, ChangeConfigurationResponse, ChangeDeviceIdRequest, ChangePWNDeviceIpaddressRequest, ChangePWNDeviceIpaddressResponse, ChangePWNDeviceProfileRequest, ChangePWNDeviceProfileResponse, ChangePWNDeviceStateActivateRequest, ChangePWNDeviceStateDeactivateRequest, ChangePWNDeviceStateResponse, ChangePlanDetails, CheckInHistoryItem, CheckOrderStatusRequest, Cinders, ClientPersistenceResponse, ClientRegistrationPendingResponse, ClientRegistrationRequestV2, ClientRegistrationResponse, Condition, ConditionObjectCall, Configuration, ConfigurationListItem, ConnectionEvent, ConnectionHistoryResult, ConnectionRequest, ConnectionResponse, ConnectionResponseV3, ConnectivityManagementCallback, ConnectivityManagementSuccessResult, ConsentDeleteRequest, ConsentRequest, ConsentTransactionID, ContactInfoUpdateRequest, Content, Content1, Content2, Content3, Content4, ContentFrictionInfo, Coordinates, CreateDeviceGroupRequest, CreateIoTApplicationRequest, CreateIoTApplicationResponse, CreateSubscriptionRequest, CreateTargetRequest, CreateTargetRequestFields, CreateTriggerRequest, CreateTriggerRequestOptions, Createtriggerchunk, CredentialsRequest, CustomFields, CustomFieldsUpdateRequest, CustomerName, Customernamequery, DailyUsage, DailyUsageHistory, DailyUsageItem, DailyUsageResponse, DataFrame, DataPercentage100TriggerAttribute, DataPercentage50TriggerAttribute, DataPercentage75TriggerAttribute, DataPercentage90TriggerAttribute, DataTrigger, DataTrigger1, DataTrigger2, DataTrigger4, DataTrigger5, DataTriggerRequest, DateFilter, DeactivateDeviceList, DeactivateDeviceProfileRequest, DeleteDevicesRequest, DeleteDevicesResult, DeleteSubscriptionRequest, DeleteTargetRequest, DenmPayload, DescriptionOfRoadSurfaceAsphaltOrTar, DescriptionOfRoadSurfaceCinders, DescriptionOfRoadSurfaceGrass, DescriptionOfRoadSurfaceGravel, DescriptionOfRoadSurfaceIce, DescriptionOfRoadSurfacePortlandCement, DescriptionOfRoadSurfaceRock, DescriptionOfRoadSurfaceSnow, Device, DeviceActivationRequest, DeviceAggregateUsageListRequest, DeviceConnectionListRequest, DeviceCostCenterRequest, DeviceCredentialRequestItem, DeviceDiagnosticsCallback, DeviceExtendedDiagnosticsRequest, DeviceExtendedDiagnosticsResult, DeviceFilter, DeviceFilterWithoutAccount, DeviceFirmwareList, DeviceFirmwareUpgrade, DeviceFirmwareVersion, DeviceFirmwareVersionUpdateResult, DeviceGroup, DeviceGroupDevicesData, DeviceGroupFilter, DeviceGroupFilterCriteria, DeviceGroupObject, DeviceGroupUpdateRequest, DeviceIMEI, DeviceId, DeviceId2, DeviceIdSearch, DeviceIdarray, DeviceIdentifier, DeviceIdforplanner, DeviceInfo, DeviceLabels, DeviceLevelCreateTrigger, DeviceLevelCreateTriggerRequest, DeviceLevelUpdateTrigger, DeviceLevelUpdateTriggerRequest, DeviceList, DeviceList2, DeviceListIP, DeviceListQueryItem, DeviceListQueryResult, DeviceListResult, DeviceListWithServiceAddress, DeviceListWithServiceAddress1, DeviceListforplanner, DeviceLocationCallback, DeviceLocationSubscription, DeviceLocationSuccessResult, DeviceLog, DeviceLoggingRequest, DeviceLoggingStatus, DeviceManagementResult, DeviceMismatchListRequest, DeviceMismatchListResult, DevicePrlListRequest, DeviceProfileRequest, DevicePropertylocation, DeviceProvisioningHistoryListRequest, DeviceProvisioningHistoryListResult, DeviceResetRequest, DeviceRole, DeviceServiceInformation, DeviceServiceRequest, DeviceSoftwareUpgrade, DeviceStatusItemforplanner, DeviceSuspensionStatusRequest, DeviceUpgradeHistory, DeviceUploadRequest, DeviceUsageListRequest, DeviceUsageListResult, Devicepropertyfilter, Devicepropertyselection, DevicesConsentResult, DiagnosticObservationSetting, DiagnosticsCategory, DiagnosticsObservationResult, DiagnosticsSubscription, DistributionSchedule, DmV1DevicesActionsSetRequest, DownloadTimeWindow, DropResponse, DropResponseItem, DtoAddUsersToNotificationGroupRequest, DtoBulkUpdate, DtoConfigurationProfile, DtoConfigurationProfileDelete, DtoConfigurationProfilePath, DtoCreateNotificationGroupRequest, DtoCreateUserRequest, DtoDeleteNotificationGroupRequest, DtoDeleteUserRequest, DtoDeviceActionSetConfiguration, DtoDeviceActionSetConfiguration1, DtoDeviceActionSetRequest, DtoDeviceActionSetResponse, DtoDeviceCommand, DtoDeviceConfig, DtoDeviceResourceIdentifier, DtoDeviceResourceIdentifier1, DtoExpandedDeviceResponse, DtoFields, DtoFilter, DtoGetNetworkHealthScoreResponse, DtoHealthScoreMetric, DtoHealthScoreSummary, DtoLastReportedTimeRequest, DtoLastReportedTimeResponse, DtoListDeviceExperienceHistoryRequest, DtoListDevicesRequest, DtoListNetworkExperienceHistoryRequest, DtoListNotificationGroupRequest, DtoListRulesRequest, DtoListSensorDevicesRequest, DtoListSmartAlertsRequest, DtoListUserRequest, DtoNotificationGroupRequestEntity, DtoNotificationGroupResponseEntity, DtoOffBoardSensor, DtoOffBoardSensorRequest, DtoOnBoardSensorRequest, DtoOverwriteRuleRequest, DtoPatchDeviceRequest, DtoPatchSmartAlertRequest, DtoProfile, DtoProfileResponse, DtoQueryMetrics, DtoQueryMetricsResponse, DtoRemoveUsersFromNotificationGroupRequest, DtoResourceidentifier, DtoSensorBoardingEvent, DtoSensorOffBoardStatusRequest, DtoSensorOffBoardingStatusResponse, DtoSensorOnBoardStatusRequest, DtoSensorOnBoardingStatusResponse, DtoUpdateNotificationGroupRequest, DtoUpdateUserRequest, DtoUserDTO, ESIMDeviceId, ESIMDeviceList, ESIMGlobalDeviceList, ESIMProfileRequest, ESIMProfileRequest2, ESIMProvhistoryRequest, ESIMRequestResponse, EnablePromoExp, EnablePromoExp1, Engagement, EtsiAlert, EtxFeature, EtxGeoFence, EtxID, EventPosition, EventType, ExtendedAttribute, ExtendedAttributes, FallBack, Feature, Fields, Fields1, Fields2, FieldsHttpHeaders, FilterCriteria1, Filtercriteria, Filtercriteria2, FiltercriteriaObjectCall, FindDeviceByPropertyResponse, FindDeviceByPropertyResponseList, Firmware, FirmwareCampaign, FirmwareIMEI, FirmwarePackage, FirmwareUpgrade, FirmwareUpgradeChangeRequest, FirmwareUpgradeChangeResult, FirmwareUpgradeDeviceListItem, FirmwareUpgradeRequest, FlowInfo, FotaV1CallbackRegistrationRequest, FotaV1CallbackRegistrationResult, FotaV1SuccessResult, FotaV2CallbackRegistrationRequest, FotaV2CallbackRegistrationResult, FotaV2Subscription, FotaV2SuccessResult, FotaV3CallbackRegistrationRequest, FotaV3CallbackRegistrationResult, FotaV3CallbackSummary, FotaV3Subscription, FotaV3SuccessResult, FrictionInformation, GIODeactivateDeviceProfileRequest, GIODeviceId, GIODeviceList, GIOProfileRequest, GIORequestResponse, GIOSMSSendRequest, GIOSmsMessage, Gatewayidentifier, GenerateExternalIDRequest, GenerateExternalIDResult, GenerateResponse, GenerateResponseItem, GenerateResponseItemCredential, Generic, GeoFenceConfigurationRequest, GeoFenceConfigurationResponse, GeoFenceConfigurationUpdateRequest, Geofence, GeographicalPath, GeographicalPathDescription, Geolocation, GetAccountDeviceConsent, GetAccountInformationResponseforplanner, GetDeviceExperienceScoreBulkRequest, GetDeviceExperienceScoreHistoryRequest, GetDeviceListWithProfilesRequest, GetDeviceStatusesRequestforplanner, GetDeviceStatusesResponseforplanner, GetDevicesWindowsRequestforplanner, GetNetworkConditionsRequest, GetPWNPerformanceConsentResponse, GetTriggerResponse, GetTriggerResponseList, GetWirelessCoverageRequest, GetWirelessCoverageRequestFWA, GoToStateRequest, Grass, Gravel, GroupName, Header, Heading, HeadingItem, History, HistoryAttributeValue, HistorySearchFilter, HistorySearchFilterAttributes, HistorySearchLimitTime, HistorySearchRequest, HplAccountDeviceList, HplAddDevicesRequest, HplBullseyeEnable, HplCustomFields, HplDeviceId, HyperPreciseLocationCallback, HyperPreciseLocationFault, IErrorMessage, IPPool, IPPoolforplanner, Ice, Id, IntelligenceSuccessResult, Item, Item1, Item3, KPIInfo, KPIInfoList, KeyDataPercentage50, KeyServicePlan, Keyschunk2, KeysmsPercentage50, KvPair, KvPairforplanner, Label, LabelsList, LicenseDeviceId, LicenseDeviceList, LineString, Location, LocationReport, LocationReportStatus, LocationRequest, Locations, Locations1, Locationscoord, LogInRequest, LogInResult, LogOutRequest, M201success, M2mV1IntelligenceWirelessCoverageRequest, M5gBiAddress, M5gBiCarrierInformation, M5gBiCustomerName, M5gBiRequestResponse, M5gBiaccountNameobject, M5gBiactivateRequest, M5gBiaddressAndcustomerinfo, M5gBiaddressAndcustomerinfo2, M5gBiattribute1, M5gBiattribute2, M5gBichangeRequest, M5gBideviceDetailsresponse, M5gBideviceId, M5gBideviceId1, M5gBideviceIdarray, M5gBideviceIdarray2, M5gBikeyValue1, M5gBiprimaryPlaceofuse, ManagedAccAddedList, ManagedAccProvisionedList, ManagedAccountCancelRequest, ManagedAccountCancelResponse, ManagedAccountsAddRequest, ManagedAccountsAddResponse, ManagedAccountsGetAllResponse, ManagedAccountsProvisionRequest, ManagedAccountsProvisionResponse, Management, Message, Message1, Message2, Message3, MessageBase, MismatchedDevice, MoveDeviceRequest, MsgId, MsgId1, MultiLineString, MultiPolygon, NetworkTypeObject, NoOfDaysB4PromoExp, NodeLL, NodeLLmD64b, NodeListLL, NodeOffsetPointLL, NotificationGroupNameTriggerAttribute, NotificationReportRequest, NotificationReportStatusRequest, Notificationarray, Notify, NumericalData, OauthToken, ObservationRequest, ObservationRequestAttribute, Offboarding, Offset, OffsetSystem, Onboarding, PWNDeviceId, PWNDeviceList, PWNProfile, PWNProfileList, PayAsYouGoCreateTriggerRequest, PayAsYouGoFilterCriteria, PayAsYouGoFilterCriteria1, PayAsYouGoPricePlanTrigger, PayAsYouGoUpdateTriggerRequest, Payload, PeriodicReporting, PlaceOfUse, Polygon, PortlandCement, PosConfidenceEllipse, Position, PositionData, PositionError, PricePlanTrigger, PricePlanTrigger1, PricePlanTrigger2, PrimaryPlaceOfUse, PrivateNetworkApns, ProfileChangeStateRequest, ProfileRequest, ProfileRequest2, PromoAlert, PromoAlert1, PromoAlertTriggerRequest, PropertyDeviceId, ProvhistoryRequest, ProvisioningHistory, QosDeviceId, QosDeviceInfo, QuerySubscriptionRequest, QueryTargetRequest, RatePlanGroup, Rateplan, Rateplantype2, Rateplantype2Condition, RateplantypeObject, RbsHighPrecisionTiltConfig, Rbstiltconfig, ReadySimDeviceId, ReadySimServicePlan, RegisterCallbackRequest, RegisteredCallbacks, RemoveDeviceRequest, RequestBodyForUsage, RequestResponse, RequestTrigger, ResourceDevice, ResourceEvent, ResourceIdentifier, ResourceOnBoardSensor, ResourceResourceQuery, ResourceRule, ResourceUser, ResponseToUsageQuery, RetrieveMonitorsRequest, RetrieveResponse, RetrieveResponseItem, RetrievesAvailableFilesResponse, RetrievesAvailableFilesResponseList, RoadSignID, Rock, SMSEventHistoryRequest, SMSMessage, SMSMessagesQueryResult, SMSNumber, SMSOptionsSendRequest, SMSSendRequest, SMSTriggerRequest, SaeAlert, SaeInfo, SchedulesSoftwareUpgradeRequest, SearchDeviceByPropertyFields, SearchDeviceByPropertyResponse, SearchDeviceByPropertyResponseList, SearchDeviceEventHistoryRequest, SearchDeviceEventHistoryResponseList, SearchDeviceResponse, SearchSensorHistoryRequest, SearchSensorHistoryResponseList, SecuritySubscription, SecuritySubscriptionRequest, SecuritySubscriptionResult, SecuritySuccessResult, SensitivityParameters, SensorInsightsBLE, Sensorinsightsconfig, ServicePlan, ServicePlanResponseforplanner, ServicePlanTriggerAttribute, ServicePlanUpdateRequest, ServiceUsage, SessionReport, SessionReportRequest, SessionResetPasswordRequest, SessionResetPasswordResult, SessionTriggerRequest, SetFallbackAttributeRequest, Situation, SmsMessagesResponse, Snow, SoftwarePackage, Speed, SpeedItem, State, StatusList, StatusResponse, StopMonitorRequest, Subrequest, SubscribeRequest, Subscription, Success, SuccessResponse, Suspenddetailsobject, SynchronousLocationRequestResult, Target, TargetAuthentication, TargetAuthenticationBody, TargetAuthenticationBodyHeaders, TargetAuthenticationBodyHost, TextPhraseOrITIS, TextPhraseOrITIS1, TheIDresourceandDeviceID, ThingspaceDevice, TransactionID, TriggerAttributesOptions, TriggerNotification, TriggerResponse, TriggerType1, TriggerType2, TriggerType3, TriggerValueResponse, TriggerValueResponse2, TriggersListOptions, Triggervalues, Triggervalues2, Tscore, UpdateTriggerRequest, UpdateTriggerRequestOptions, Updatetriggerchunk, UpgradeListQueryResult, UploadAndScheduleFileRequest, UploadAndScheduleFileResponse, UploadConfigurationFilesResponse, UploadsActivatesDeviceRequest, Usage, UsageAnomalyAttributes, UsageHistory, UsageRequestResponse, UsageTriggerAddRequest, UsageTriggerResponse, UsageTriggerUpdateRequest, UserDeviceExperienceHistory, UserNetworkExperienceHistory, UserSmartAlert, 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, V2TriggersRequest, V2TriggersRequest1, V3AccountDevice, V3AccountDeviceList, V3AddOrRemoveDeviceRequest, V3AddOrRemoveDeviceResult, V3CampaignDevice, V3CampaignHistory, V3CampaignMetaInfo, V3ChangeCampaignDatesRequest, V3Device, V3DeviceListItem, V3DeviceStatus, V3LicenseAssignedRemovedResult, V3LicenseDevice, V3LicenseIMEI, V3LicenseSummary, V3SoftwareInfo, V3TimeWindow, WNPRequestResponse
Instance Method Summary collapse
-
#check_for_conflict(name, existing_prop_names) ⇒ Object
Checks if an additional property conflicts with a model’s existing property.
-
#process_additional_properties(additional_properties, existing_prop_names) ⇒ Object
Processes additional properties, ensuring no conflicts with existing properties.
-
#process_array(value) ⇒ Object
Processes an array of values, recursively calling ‘to_hash` on BaseModel objects.
-
#process_basic_value(value) ⇒ Object
Processes a basic value (non-array, non-hash).
-
#process_hash(value) ⇒ Object
Processes a hash of values, recursively calling ‘to_hash` on BaseModel objects.
-
#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
#check_for_conflict(name, existing_prop_names) ⇒ Object
Checks if an additional property conflicts with a model’s existing property.
80 81 82 83 84 |
# File 'lib/verizon/models/base_model.rb', line 80 def check_for_conflict(name, existing_prop_names) return unless existing_prop_names.key?(name) raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties" end |
#process_additional_properties(additional_properties, existing_prop_names) ⇒ Object
Processes additional properties, ensuring no conflicts with existing properties.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/verizon/models/base_model.rb', line 63 def process_additional_properties(additional_properties, existing_prop_names) hash = {} additional_properties.each do |name, value| check_for_conflict(name, existing_prop_names) hash[name] = if value.is_a?(Array) process_array(value) elsif value.is_a?(Hash) process_hash(value) else process_basic_value(value) end end hash end |
#process_array(value) ⇒ Object
Processes an array of values, recursively calling ‘to_hash` on BaseModel objects.
87 88 89 |
# File 'lib/verizon/models/base_model.rb', line 87 def process_array(value) value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v } end |
#process_basic_value(value) ⇒ Object
Processes a basic value (non-array, non-hash).
99 100 101 |
# File 'lib/verizon/models/base_model.rb', line 99 def process_basic_value(value) value.is_a?(BaseModel) ? value.to_hash : value end |
#process_hash(value) ⇒ Object
Processes a hash of values, recursively calling ‘to_hash` on BaseModel objects.
92 93 94 95 96 |
# File 'lib/verizon/models/base_model.rb', line 92 def process_hash(value) value.transform_values do |v| v.is_a?(BaseModel) ? v.to_hash : v end end |
#to_hash ⇒ Object
Returns a Hash representation of the current object.
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 55 56 57 58 59 60 |
# File 'lib/verizon/models/base_model.rb', line 11 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..] if name == 'additional_properties' additional_properties = process_additional_properties(value, self.class.names) hash.merge!(additional_properties) else 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 end hash end |
#to_json(options = {}) ⇒ Object
Returns a JSON representation of the curent object.
104 105 106 107 |
# File 'lib/verizon/models/base_model.rb', line 104 def to_json( = {}) hash = to_hash hash.to_json() end |