Class: Verizon::ResourceRule

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

Overview

ResourceRule Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(createdon:, foreignid:, lastupdated:, rulechain:, versionid:, accountclientid: SKIP, billingaccountid: SKIP, description: SKIP, deviceid: SKIP, disabled: SKIP, id: SKIP, name: SKIP, rulesyntax: SKIP, version: SKIP) ⇒ ResourceRule

Returns a new instance of ResourceRule.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/verizon/models/resource_rule.rb', line 109

def initialize(createdon:, foreignid:, lastupdated:, rulechain:, versionid:,
               accountclientid: SKIP, billingaccountid: SKIP,
               description: SKIP, deviceid: SKIP, disabled: SKIP, id: SKIP,
               name: SKIP, rulesyntax: SKIP, version: SKIP)
  @accountclientid = accountclientid unless accountclientid == SKIP
  @billingaccountid = billingaccountid unless billingaccountid == SKIP
  @createdon = createdon
  @description = description unless description == SKIP
  @deviceid = deviceid unless deviceid == SKIP
  @disabled = disabled unless disabled == SKIP
  @foreignid = foreignid
  @id = id unless id == SKIP
  @lastupdated = lastupdated
  @name = name unless name == SKIP
  @rulechain = rulechain
  @rulesyntax = rulesyntax unless rulesyntax == SKIP
  @version = version unless version == SKIP
  @versionid = versionid
end

Instance Attribute Details

#accountclientidString

Not used in this release, future functionality

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/resource_rule.rb', line 15

def accountclientid
  @accountclientid
end

#billingaccountidString

The billing account ID. This is the same value as the Account ID

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/resource_rule.rb', line 19

def billingaccountid
  @billingaccountid
end

#createdonDateTime

Timestamp of the record

Returns:

  • (DateTime)


23
24
25
# File 'lib/verizon/models/resource_rule.rb', line 23

def createdon
  @createdon
end

#descriptionString

a short description

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/resource_rule.rb', line 27

def description
  @description
end

#deviceidString

This is a UUID value of the device created when the device is onboarded

Returns:

  • (String)


31
32
33
# File 'lib/verizon/models/resource_rule.rb', line 31

def deviceid
  @deviceid
end

#disabledTrueClass | FalseClass

This is a UUID value of the device created when the device is onboarded

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/verizon/models/resource_rule.rb', line 35

def disabled
  @disabled
end

#foreignidString

UUID of the ECPD account the user belongs to

Returns:

  • (String)


39
40
41
# File 'lib/verizon/models/resource_rule.rb', line 39

def foreignid
  @foreignid
end

#idString

UUID of the user record, assigned at creation

Returns:

  • (String)


43
44
45
# File 'lib/verizon/models/resource_rule.rb', line 43

def id
  @id
end

#lastupdatedDateTime

Timestamp of the record

Returns:

  • (DateTime)


47
48
49
# File 'lib/verizon/models/resource_rule.rb', line 47

def lastupdated
  @lastupdated
end

#nameString

User defined name of the record

Returns:

  • (String)


51
52
53
# File 'lib/verizon/models/resource_rule.rb', line 51

def name
  @name
end

#rulechainObject

User defined name of the record

Returns:

  • (Object)


55
56
57
# File 'lib/verizon/models/resource_rule.rb', line 55

def rulechain
  @rulechain
end

#rulesyntaxString

The syntax of the rule and supports camel and json style syntaxes

Returns:

  • (String)


59
60
61
# File 'lib/verizon/models/resource_rule.rb', line 59

def rulesyntax
  @rulesyntax
end

#versionString

The resource version

Returns:

  • (String)


63
64
65
# File 'lib/verizon/models/resource_rule.rb', line 63

def version
  @version
end

#versionidString

The UUID of the resource version

Returns:

  • (String)


67
68
69
# File 'lib/verizon/models/resource_rule.rb', line 67

def versionid
  @versionid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/verizon/models/resource_rule.rb', line 130

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  createdon = if hash.key?('createdon')
                (DateTimeHelper.from_rfc3339(hash['createdon']) if hash['createdon'])
              end
  foreignid = hash.key?('foreignid') ? hash['foreignid'] : nil
  lastupdated = if hash.key?('lastupdated')
                  (DateTimeHelper.from_rfc3339(hash['lastupdated']) if hash['lastupdated'])
                end
  rulechain = hash.key?('rulechain') ? hash['rulechain'] : nil
  versionid = hash.key?('versionid') ? hash['versionid'] : nil
  accountclientid =
    hash.key?('accountclientid') ? hash['accountclientid'] : SKIP
  billingaccountid =
    hash.key?('billingaccountid') ? hash['billingaccountid'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  deviceid = hash.key?('deviceid') ? hash['deviceid'] : SKIP
  disabled = hash.key?('disabled') ? hash['disabled'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  rulesyntax = hash.key?('rulesyntax') ? hash['rulesyntax'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  ResourceRule.new(createdon: createdon,
                   foreignid: foreignid,
                   lastupdated: lastupdated,
                   rulechain: rulechain,
                   versionid: versionid,
                   accountclientid: accountclientid,
                   billingaccountid: billingaccountid,
                   description: description,
                   deviceid: deviceid,
                   disabled: disabled,
                   id: id,
                   name: name,
                   rulesyntax: rulesyntax,
                   version: version)
end

.namesObject

A mapping from model property names to API property names.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/verizon/models/resource_rule.rb', line 70

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accountclientid'] = 'accountclientid'
  @_hash['billingaccountid'] = 'billingaccountid'
  @_hash['createdon'] = 'createdon'
  @_hash['description'] = 'description'
  @_hash['deviceid'] = 'deviceid'
  @_hash['disabled'] = 'disabled'
  @_hash['foreignid'] = 'foreignid'
  @_hash['id'] = 'id'
  @_hash['lastupdated'] = 'lastupdated'
  @_hash['name'] = 'name'
  @_hash['rulechain'] = 'rulechain'
  @_hash['rulesyntax'] = 'rulesyntax'
  @_hash['version'] = 'version'
  @_hash['versionid'] = 'versionid'
  @_hash
end

.nullablesObject

An array for nullable fields



105
106
107
# File 'lib/verizon/models/resource_rule.rb', line 105

def self.nullables
  []
end

.optionalsObject

An array for optional fields



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/verizon/models/resource_rule.rb', line 90

def self.optionals
  %w[
    accountclientid
    billingaccountid
    description
    deviceid
    disabled
    id
    name
    rulesyntax
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



191
192
193
194
195
196
197
198
199
200
# File 'lib/verizon/models/resource_rule.rb', line 191

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid.inspect}, billingaccountid:"\
  " #{@billingaccountid.inspect}, createdon: #{@createdon.inspect}, description:"\
  " #{@description.inspect}, deviceid: #{@deviceid.inspect}, disabled: #{@disabled.inspect},"\
  " foreignid: #{@foreignid.inspect}, id: #{@id.inspect}, lastupdated:"\
  " #{@lastupdated.inspect}, name: #{@name.inspect}, rulechain: #{@rulechain.inspect},"\
  " rulesyntax: #{@rulesyntax.inspect}, version: #{@version.inspect}, versionid:"\
  " #{@versionid.inspect}>"
end

#to_custom_createdonObject



172
173
174
# File 'lib/verizon/models/resource_rule.rb', line 172

def to_custom_createdon
  DateTimeHelper.to_rfc3339(createdon)
end

#to_custom_lastupdatedObject



176
177
178
# File 'lib/verizon/models/resource_rule.rb', line 176

def to_custom_lastupdated
  DateTimeHelper.to_rfc3339(lastupdated)
end

#to_sObject

Provides a human-readable string representation of the object.



181
182
183
184
185
186
187
188
# File 'lib/verizon/models/resource_rule.rb', line 181

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accountclientid: #{@accountclientid}, billingaccountid:"\
  " #{@billingaccountid}, createdon: #{@createdon}, description: #{@description}, deviceid:"\
  " #{@deviceid}, disabled: #{@disabled}, foreignid: #{@foreignid}, id: #{@id}, lastupdated:"\
  " #{@lastupdated}, name: #{@name}, rulechain: #{@rulechain}, rulesyntax: #{@rulesyntax},"\
  " version: #{@version}, versionid: #{@versionid}>"
end