Class: Verizon::DiagnosticsSubscription
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::DiagnosticsSubscription
- Defined in:
- lib/verizon/models/diagnostics_subscription.rb
Overview
Status of the diagnostic services subscription.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier in “##########-#####”.
-
#created_on ⇒ DateTime
The date and time of when the subscription was created.
-
#last_updated ⇒ DateTime
The date and time of when the subscription was last updated.
-
#sku_name ⇒ String
Name of the SKU for the account.
-
#total_allowed ⇒ Integer
Number of licenses currently assigned to devices.
-
#total_used ⇒ Integer
Number of licenses currently used by the devices.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_name:, created_on:, last_updated:, total_allowed:, total_used:, sku_name:, additional_properties: nil) ⇒ DiagnosticsSubscription
constructor
A new instance of DiagnosticsSubscription.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_last_updated ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(account_name:, created_on:, last_updated:, total_allowed:, total_used:, sku_name:, additional_properties: nil) ⇒ DiagnosticsSubscription
Returns a new instance of DiagnosticsSubscription.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 60 def initialize(account_name:, created_on:, last_updated:, total_allowed:, total_used:, sku_name:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_name = account_name @created_on = created_on @last_updated = last_updated @total_allowed = total_allowed @total_used = total_used @sku_name = sku_name @additional_properties = additional_properties end |
Instance Attribute Details
#account_name ⇒ String
Account identifier in “##########-#####”. An account name is usually numeric, and must include any leading zeros.
16 17 18 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 16 def account_name @account_name end |
#created_on ⇒ DateTime
The date and time of when the subscription was created.
20 21 22 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 20 def created_on @created_on end |
#last_updated ⇒ DateTime
The date and time of when the subscription was last updated.
24 25 26 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 24 def last_updated @last_updated end |
#sku_name ⇒ String
Name of the SKU for the account.
36 37 38 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 36 def sku_name @sku_name end |
#total_allowed ⇒ Integer
Number of licenses currently assigned to devices.
28 29 30 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 28 def total_allowed @total_allowed end |
#total_used ⇒ Integer
Number of licenses currently used by the devices.
32 33 34 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 32 def total_used @total_used end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : nil created_on = if hash.key?('createdOn') (DateTimeHelper.from_rfc3339(hash['createdOn']) if hash['createdOn']) end last_updated = if hash.key?('lastUpdated') (DateTimeHelper.from_rfc3339(hash['lastUpdated']) if hash['lastUpdated']) end total_allowed = hash.key?('totalAllowed') ? hash['totalAllowed'] : nil total_used = hash.key?('totalUsed') ? hash['totalUsed'] : nil sku_name = hash.key?('skuName') ? hash['skuName'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. DiagnosticsSubscription.new(account_name: account_name, created_on: created_on, last_updated: last_updated, total_allowed: total_allowed, total_used: total_used, sku_name: sku_name, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['created_on'] = 'createdOn' @_hash['last_updated'] = 'lastUpdated' @_hash['total_allowed'] = 'totalAllowed' @_hash['total_used'] = 'totalUsed' @_hash['sku_name'] = 'skuName' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 51 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
124 125 126 127 128 129 130 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 124 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name.inspect}, created_on: #{@created_on.inspect},"\ " last_updated: #{@last_updated.inspect}, total_allowed: #{@total_allowed.inspect},"\ " total_used: #{@total_used.inspect}, sku_name: #{@sku_name.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
107 108 109 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 107 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_last_updated ⇒ Object
111 112 113 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 111 def to_custom_last_updated DateTimeHelper.to_rfc3339(last_updated) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
116 117 118 119 120 121 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 116 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name}, created_on: #{@created_on}, last_updated:"\ " #{@last_updated}, total_allowed: #{@total_allowed}, total_used: #{@total_used}, sku_name:"\ " #{@sku_name}, additional_properties: #{@additional_properties}>" end |