Class: Verizon::AccountLevelFilter

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

Overview

AccountLevelFilter 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(separate_or_combined: SKIP, account_names: SKIP, additional_properties: nil) ⇒ AccountLevelFilter

Returns a new instance of AccountLevelFilter.



45
46
47
48
49
50
51
52
53
# File 'lib/verizon/models/account_level_filter.rb', line 45

def initialize(separate_or_combined: SKIP, account_names: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @separate_or_combined = separate_or_combined unless separate_or_combined == SKIP
  @account_names =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_namesAccountnames

Determines whether or not to aggregate usage of multiple accounts together, or separate by account. If this is null or not present, then the trigger will be for an individual line.

Returns:



22
23
24
# File 'lib/verizon/models/account_level_filter.rb', line 22

def 
  @account_names
end

#separate_or_combinedString

Determines whether or not to aggregate usage of multiple accounts together, or separate by account. If this is null or not present, then the trigger will be for an individual line.

Returns:

  • (String)


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

def separate_or_combined
  @separate_or_combined
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/verizon/models/account_level_filter.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  separate_or_combined =
    hash.key?('separateOrCombined') ? hash['separateOrCombined'] : SKIP
   = Accountnames.from_hash(hash['accountNames']) if hash['accountNames']

  # 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.
  AccountLevelFilter.new(separate_or_combined: separate_or_combined,
                         account_names: ,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/verizon/models/account_level_filter.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['separate_or_combined'] = 'separateOrCombined'
  @_hash['account_names'] = 'accountNames'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/verizon/models/account_level_filter.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/verizon/models/account_level_filter.rb', line 33

def self.optionals
  %w[
    separate_or_combined
    account_names
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



79
80
81
82
83
84
85
# File 'lib/verizon/models/account_level_filter.rb', line 79

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



95
96
97
98
99
# File 'lib/verizon/models/account_level_filter.rb', line 95

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} separate_or_combined: #{@separate_or_combined.inspect}, account_names:"\
  " #{@account_names.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
92
# File 'lib/verizon/models/account_level_filter.rb', line 88

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} separate_or_combined: #{@separate_or_combined}, account_names:"\
  " #{@account_names}, additional_properties: #{@additional_properties}>"
end