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 = nil, created_on = nil, last_updated = nil, total_allowed = nil, total_used = nil, sku_name = nil) ⇒ DiagnosticsSubscription
constructor
A new instance of DiagnosticsSubscription.
- #to_custom_created_on ⇒ Object
- #to_custom_last_updated ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = nil, created_on = nil, last_updated = nil, total_allowed = nil, total_used = nil, sku_name = nil) ⇒ DiagnosticsSubscription
Returns a new instance of DiagnosticsSubscription.
60 61 62 63 64 65 66 67 68 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 60 def initialize(account_name = nil, created_on = nil, last_updated = nil, total_allowed = nil, total_used = nil, sku_name = 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 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.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 71 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 object from extracted values. DiagnosticsSubscription.new(account_name, created_on, last_updated, total_allowed, total_used, sku_name) 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
#to_custom_created_on ⇒ Object
95 96 97 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 95 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_last_updated ⇒ Object
99 100 101 |
# File 'lib/verizon/models/diagnostics_subscription.rb', line 99 def to_custom_last_updated DateTimeHelper.to_rfc3339(last_updated) end |