Class: Verizon::ActionId
- Defined in:
- lib/verizon/models/action_id.rb
Overview
ActionId Model.
Instance Attribute Summary collapse
-
#originating_station_id ⇒ Integer
Unique ID for originating station.
-
#sequence_number ⇒ Integer
Counter used to differenciate multiple DENMs from same station.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(originating_station_id = nil, sequence_number = nil) ⇒ ActionId
constructor
A new instance of ActionId.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(originating_station_id = nil, sequence_number = nil) ⇒ ActionId
Returns a new instance of ActionId.
38 39 40 41 |
# File 'lib/verizon/models/action_id.rb', line 38 def initialize(originating_station_id = nil, sequence_number = nil) @originating_station_id = originating_station_id @sequence_number = sequence_number end |
Instance Attribute Details
#originating_station_id ⇒ Integer
Unique ID for originating station.
14 15 16 |
# File 'lib/verizon/models/action_id.rb', line 14 def originating_station_id @originating_station_id end |
#sequence_number ⇒ Integer
Counter used to differenciate multiple DENMs from same station.
18 19 20 |
# File 'lib/verizon/models/action_id.rb', line 18 def sequence_number @sequence_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/verizon/models/action_id.rb', line 44 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. originating_station_id = hash.key?('originatingStationId') ? hash['originatingStationId'] : nil sequence_number = hash.key?('sequenceNumber') ? hash['sequenceNumber'] : nil # Create object from extracted values. ActionId.new(originating_station_id, sequence_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/verizon/models/action_id.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['originating_station_id'] = 'originatingStationId' @_hash['sequence_number'] = 'sequenceNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/verizon/models/action_id.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 |
# File 'lib/verizon/models/action_id.rb', line 29 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/verizon/models/action_id.rb', line 60 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.originating_station_id, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.sequence_number, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['originatingStationId'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['sequenceNumber'], ->(val) { val.instance_of? Integer }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
88 89 90 91 92 |
# File 'lib/verizon/models/action_id.rb', line 88 def inspect class_name = self.class.name.split('::').last "<#{class_name} originating_station_id: #{@originating_station_id.inspect},"\ " sequence_number: #{@sequence_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 85 |
# File 'lib/verizon/models/action_id.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} originating_station_id: #{@originating_station_id}, sequence_number:"\ " #{@sequence_number}>" end |