Class: Verizon::DtoFilter

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

Overview

DtoFilter 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(expand = SKIP, limitnumber = SKIP, nopagination = SKIP, page = SKIP, pagenumber = SKIP, projection = SKIP, selection = SKIP) ⇒ DtoFilter

Returns a new instance of DtoFilter.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/verizon/models/dto_filter.rb', line 72

def initialize(expand = SKIP, limitnumber = SKIP, nopagination = SKIP,
               page = SKIP, pagenumber = SKIP, projection = SKIP,
               selection = SKIP)
  @expand = expand unless expand == SKIP
  @limitnumber = limitnumber unless limitnumber == SKIP
  @nopagination = nopagination unless nopagination == SKIP
  @page = page unless page == SKIP
  @pagenumber = pagenumber unless pagenumber == SKIP
  @projection = projection unless projection == SKIP
  @selection = selection unless selection == SKIP
end

Instance Attribute Details

#expandString

Use to provide device details for alerts specific to a device

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/dto_filter.rb', line 14

def expand
  @expand
end

#limitnumberInteger

Limit the number of results returned

Returns:

  • (Integer)


18
19
20
# File 'lib/verizon/models/dto_filter.rb', line 18

def limitnumber
  @limitnumber
end

#nopaginationTrueClass | FalseClass

A flag set to show if pagination requested (false) or not (true)

Returns:

  • (TrueClass | FalseClass)


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

def nopagination
  @nopagination
end

#pageString

A flag set to show if pagination requested (false) or not (true)

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/dto_filter.rb', line 26

def page
  @page
end

#pagenumberInteger

A flag set to show if pagination requested (false) or not (true)

Returns:

  • (Integer)


30
31
32
# File 'lib/verizon/models/dto_filter.rb', line 30

def pagenumber
  @pagenumber
end

#projectionArray[String]

Limits the fields of the device that the user is interested in rather than all of the fields

Returns:

  • (Array[String])


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

def projection
  @projection
end

#selectionHash[String, Object]

Filters results based on user defined criteria

Returns:

  • (Hash[String, Object])


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

def selection
  @selection
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/dto_filter.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  expand = hash.key?('$expand') ? hash['$expand'] : SKIP
  limitnumber = hash.key?('$limitnumber') ? hash['$limitnumber'] : SKIP
  nopagination = hash.key?('$nopagination') ? hash['$nopagination'] : SKIP
  page = hash.key?('$page') ? hash['$page'] : SKIP
  pagenumber = hash.key?('$pagenumber') ? hash['$pagenumber'] : SKIP
  projection = hash.key?('$projection') ? hash['$projection'] : SKIP
  selection = hash.key?('$selection') ? hash['$selection'] : SKIP

  # Create object from extracted values.
  DtoFilter.new(expand,
                limitnumber,
                nopagination,
                page,
                pagenumber,
                projection,
                selection)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/verizon/models/dto_filter.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['expand'] = '$expand'
  @_hash['limitnumber'] = '$limitnumber'
  @_hash['nopagination'] = '$nopagination'
  @_hash['page'] = '$page'
  @_hash['pagenumber'] = '$pagenumber'
  @_hash['projection'] = '$projection'
  @_hash['selection'] = '$selection'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/verizon/models/dto_filter.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/verizon/models/dto_filter.rb', line 55

def self.optionals
  %w[
    expand
    limitnumber
    nopagination
    page
    pagenumber
    projection
    selection
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
# File 'lib/verizon/models/dto_filter.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} expand: #{@expand.inspect}, limitnumber: #{@limitnumber.inspect},"\
  " nopagination: #{@nopagination.inspect}, page: #{@page.inspect}, pagenumber:"\
  " #{@pagenumber.inspect}, projection: #{@projection.inspect}, selection:"\
  " #{@selection.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
# File 'lib/verizon/models/dto_filter.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} expand: #{@expand}, limitnumber: #{@limitnumber}, nopagination:"\
  " #{@nopagination}, page: #{@page}, pagenumber: #{@pagenumber}, projection: #{@projection},"\
  " selection: #{@selection}>"
end