Class: Verizon::ResourceOnBoardSensor

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

Overview

ResourceOnBoardSensor 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(deveui:, appeui:, appkey:, mclass:, kind:, description:, name:, customdata: SKIP) ⇒ ResourceOnBoardSensor

Returns a new instance of ResourceOnBoardSensor.



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 74

def initialize(deveui:, appeui:, appkey:, mclass:, kind:, description:,
               name:, customdata: SKIP)
  @deveui = deveui
  @appeui = appeui
  @appkey = appkey
  @mclass = mclass
  @kind = kind
  @description = description
  @name = name
  @customdata = customdata unless customdata == SKIP
end

Instance Attribute Details

#appeuiString

global application ID in IEEE EUI64 address space that uniquely identifies the entity able to process the JoinReq frame

Returns:

  • (String)


20
21
22
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 20

def appeui
  @appeui
end

#appkeyString

an encryption key used for messages during every over the air activation

Returns:

  • (String)


24
25
26
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 24

def appkey
  @appkey
end

#customdataHash[String, Object]

Name/value pair, where the value is client defined. The purpose is to keep track of current state per device action.

Returns:

  • (Hash[String, Object])


46
47
48
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 46

def customdata
  @customdata
end

#descriptionString

The kind of sensor device

Returns:

  • (String)


37
38
39
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 37

def description
  @description
end

#deveuiString

the IEEE EUI64 address space used to identify a device. It is supplied by the device manufacturer

Returns:

  • (String)


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

def deveui
  @deveui
end

#kindString

The kind of sensor device

Returns:

  • (String)


33
34
35
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 33

def kind
  @kind
end

#mclassString

Class of the sensor device. Valid values are Class A (A), Class B (B), and Class C ©. All LoRaWAN devices must implement Class A

Returns:

  • (String)


29
30
31
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 29

def mclass
  @mclass
end

#nameString

The kind of sensor device

Returns:

  • (String)


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

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  deveui = hash.key?('deveui') ? hash['deveui'] : nil
  appeui = hash.key?('appeui') ? hash['appeui'] : nil
  appkey = hash.key?('appkey') ? hash['appkey'] : nil
  mclass = hash.key?('class') ? hash['class'] : nil
  kind = hash.key?('kind') ? hash['kind'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  customdata = hash.key?('customdata') ? hash['customdata'] : SKIP

  # Create object from extracted values.
  ResourceOnBoardSensor.new(deveui: deveui,
                            appeui: appeui,
                            appkey: appkey,
                            mclass: mclass,
                            kind: kind,
                            description: description,
                            name: name,
                            customdata: customdata)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['deveui'] = 'deveui'
  @_hash['appeui'] = 'appeui'
  @_hash['appkey'] = 'appkey'
  @_hash['mclass'] = 'class'
  @_hash['kind'] = 'kind'
  @_hash['description'] = 'description'
  @_hash['name'] = 'name'
  @_hash['customdata'] = 'customdata'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



63
64
65
66
67
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 63

def self.optionals
  %w[
    customdata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 120

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} deveui: #{@deveui.inspect}, appeui: #{@appeui.inspect}, appkey:"\
  " #{@appkey.inspect}, mclass: #{@mclass.inspect}, kind: #{@kind.inspect}, description:"\
  " #{@description.inspect}, name: #{@name.inspect}, customdata: #{@customdata.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



112
113
114
115
116
117
# File 'lib/verizon/models/resource_on_board_sensor.rb', line 112

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} deveui: #{@deveui}, appeui: #{@appeui}, appkey: #{@appkey}, mclass:"\
  " #{@mclass}, kind: #{@kind}, description: #{@description}, name: #{@name}, customdata:"\
  " #{@customdata}>"
end