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(m_expand: SKIP, m_limitnumber: SKIP, m_nopagination: SKIP, m_page: SKIP, m_pagenumber: SKIP, m_projection: SKIP, m_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(m_expand: SKIP, m_limitnumber: SKIP, m_nopagination: SKIP,
               m_page: SKIP, m_pagenumber: SKIP, m_projection: SKIP,
               m_selection: SKIP)
  @m_expand = m_expand unless m_expand == SKIP
  @m_limitnumber = m_limitnumber unless m_limitnumber == SKIP
  @m_nopagination = m_nopagination unless m_nopagination == SKIP
  @m_page = m_page unless m_page == SKIP
  @m_pagenumber = m_pagenumber unless m_pagenumber == SKIP
  @m_projection = m_projection unless m_projection == SKIP
  @m_selection = m_selection unless m_selection == SKIP
end

Instance Attribute Details

#m_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 m_expand
  @m_expand
end

#m_limitnumberInteger

Limit the number of results returned

Returns:

  • (Integer)


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

def m_limitnumber
  @m_limitnumber
end

#m_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 m_nopagination
  @m_nopagination
end

#m_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 m_page
  @m_page
end

#m_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 m_pagenumber
  @m_pagenumber
end

#m_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 m_projection
  @m_projection
end

#m_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 m_selection
  @m_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.
  m_expand = hash.key?('$expand') ? hash['$expand'] : SKIP
  m_limitnumber = hash.key?('$limitnumber') ? hash['$limitnumber'] : SKIP
  m_nopagination = hash.key?('$nopagination') ? hash['$nopagination'] : SKIP
  m_page = hash.key?('$page') ? hash['$page'] : SKIP
  m_pagenumber = hash.key?('$pagenumber') ? hash['$pagenumber'] : SKIP
  m_projection = hash.key?('$projection') ? hash['$projection'] : SKIP
  m_selection = hash.key?('$selection') ? hash['$selection'] : SKIP

  # Create object from extracted values.
  DtoFilter.new(m_expand: m_expand,
                m_limitnumber: m_limitnumber,
                m_nopagination: m_nopagination,
                m_page: m_page,
                m_pagenumber: m_pagenumber,
                m_projection: m_projection,
                m_selection: m_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['m_expand'] = '$expand'
  @_hash['m_limitnumber'] = '$limitnumber'
  @_hash['m_nopagination'] = '$nopagination'
  @_hash['m_page'] = '$page'
  @_hash['m_pagenumber'] = '$pagenumber'
  @_hash['m_projection'] = '$projection'
  @_hash['m_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[
    m_expand
    m_limitnumber
    m_nopagination
    m_page
    m_pagenumber
    m_projection
    m_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} m_expand: #{@m_expand.inspect}, m_limitnumber: #{@m_limitnumber.inspect},"\
  " m_nopagination: #{@m_nopagination.inspect}, m_page: #{@m_page.inspect}, m_pagenumber:"\
  " #{@m_pagenumber.inspect}, m_projection: #{@m_projection.inspect}, m_selection:"\
  " #{@m_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} m_expand: #{@m_expand}, m_limitnumber: #{@m_limitnumber}, m_nopagination:"\
  " #{@m_nopagination}, m_page: #{@m_page}, m_pagenumber: #{@m_pagenumber}, m_projection:"\
  " #{@m_projection}, m_selection: #{@m_selection}>"
end