Class: Verizon::DiagnosticsSubscription

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/diagnostics_subscription.rb

Overview

Status of the diagnostic services subscription.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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( = nil, created_on = nil, last_updated = nil,
               total_allowed = nil, total_used = nil, sku_name = nil)
  @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_nameString

Account identifier in “##########-#####”. An account name is usually numeric, and must include any leading zeros.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/models/diagnostics_subscription.rb', line 16

def 
  @account_name
end

#created_onDateTime

The date and time of when the subscription was created.

Returns:

  • (DateTime)


20
21
22
# File 'lib/verizon/models/diagnostics_subscription.rb', line 20

def created_on
  @created_on
end

#last_updatedDateTime

The date and time of when the subscription was last updated.

Returns:

  • (DateTime)


24
25
26
# File 'lib/verizon/models/diagnostics_subscription.rb', line 24

def last_updated
  @last_updated
end

#sku_nameString

Name of the SKU for the account.

Returns:

  • (String)


36
37
38
# File 'lib/verizon/models/diagnostics_subscription.rb', line 36

def sku_name
  @sku_name
end

#total_allowedInteger

Number of licenses currently assigned to devices.

Returns:

  • (Integer)


28
29
30
# File 'lib/verizon/models/diagnostics_subscription.rb', line 28

def total_allowed
  @total_allowed
end

#total_usedInteger

Number of licenses currently used by the devices.

Returns:

  • (Integer)


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.
   = 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(,
                              created_on,
                              last_updated,
                              total_allowed,
                              total_used,
                              sku_name)
end

.namesObject

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/verizon/models/diagnostics_subscription.rb', line 56

def self.nullables
  []
end

.optionalsObject

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_onObject



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_updatedObject



99
100
101
# File 'lib/verizon/models/diagnostics_subscription.rb', line 99

def to_custom_last_updated
  DateTimeHelper.to_rfc3339(last_updated)
end