Class: Verizon::SearchDeviceByPropertyFields

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

Overview

List of device sensors and their most recently reported values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(acceleration = SKIP, battery = SKIP, humidity = SKIP, light = SKIP, pressure = SKIP, signal_strength = SKIP, temperature = SKIP, device_propertylocation = SKIP) ⇒ SearchDeviceByPropertyFields

Returns a new instance of SearchDeviceByPropertyFields.



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 77

def initialize(acceleration = SKIP, battery = SKIP, humidity = SKIP,
               light = SKIP, pressure = SKIP, signal_strength = SKIP,
               temperature = SKIP, device_propertylocation = SKIP)
  @acceleration = acceleration unless acceleration == SKIP
  @battery = battery unless battery == SKIP
  @humidity = humidity unless humidity == SKIP
  @light = light unless light == SKIP
  @pressure = pressure unless pressure == SKIP
  @signal_strength = signal_strength unless signal_strength == SKIP
  @temperature = temperature unless temperature == SKIP
  @device_propertylocation = device_propertylocation unless device_propertylocation == SKIP
end

Instance Attribute Details

#accelerationAcceleration

TODO: Write general description for this method

Returns:



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

def acceleration
  @acceleration
end

#batteryString

TODO: Write general description for this method

Returns:

  • (String)


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

def battery
  @battery
end

#device_propertylocationDevicePropertylocation

TODO: Write general description for this method



42
43
44
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 42

def device_propertylocation
  @device_propertylocation
end

#humidityString

TODO: Write general description for this method

Returns:

  • (String)


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

def humidity
  @humidity
end

#lightString

TODO: Write general description for this method

Returns:

  • (String)


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

def light
  @light
end

#pressureString

TODO: Write general description for this method

Returns:

  • (String)


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

def pressure
  @pressure
end

#signal_strengthString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 34

def signal_strength
  @signal_strength
end

#temperatureString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 38

def temperature
  @temperature
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  acceleration = Acceleration.from_hash(hash['acceleration']) if hash['acceleration']
  battery = hash.key?('battery') ? hash['battery'] : SKIP
  humidity = hash.key?('humidity') ? hash['humidity'] : SKIP
  light = hash.key?('light') ? hash['light'] : SKIP
  pressure = hash.key?('pressure') ? hash['pressure'] : SKIP
  signal_strength =
    hash.key?('signalStrength') ? hash['signalStrength'] : SKIP
  temperature = hash.key?('temperature') ? hash['temperature'] : SKIP
  device_propertylocation = DevicePropertylocation.from_hash(hash['DevicePropertylocation']) if
    hash['DevicePropertylocation']

  # Create object from extracted values.
  SearchDeviceByPropertyFields.new(acceleration,
                                   battery,
                                   humidity,
                                   light,
                                   pressure,
                                   signal_strength,
                                   temperature,
                                   device_propertylocation)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['acceleration'] = 'acceleration'
  @_hash['battery'] = 'battery'
  @_hash['humidity'] = 'humidity'
  @_hash['light'] = 'light'
  @_hash['pressure'] = 'pressure'
  @_hash['signal_strength'] = 'signalStrength'
  @_hash['temperature'] = 'temperature'
  @_hash['device_propertylocation'] = 'DevicePropertylocation'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/verizon/models/search_device_by_property_fields.rb', line 59

def self.optionals
  %w[
    acceleration
    battery
    humidity
    light
    pressure
    signal_strength
    temperature
    device_propertylocation
  ]
end