Class: ShellEv::ChargeRetrieveState
- Defined in:
- lib/shell_ev/models/charge_retrieve_state.rb
Overview
ChargeRetrieveState Model.
Instance Attribute Summary collapse
-
#error ⇒ ChargeError
Describes the session state started, stopped, start-requested, stop-requested, failed-to-start, failed-to-stop.
-
#status ⇒ String
Describes the session state started, stopped, start-requested, stop-requested, failed-to-start, failed-to-stop.
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.
Instance Method Summary collapse
-
#initialize(status = SKIP, error = SKIP) ⇒ ChargeRetrieveState
constructor
A new instance of ChargeRetrieveState.
Methods inherited from BaseModel
Constructor Details
#initialize(status = SKIP, error = SKIP) ⇒ ChargeRetrieveState
Returns a new instance of ChargeRetrieveState.
45 46 47 48 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 45 def initialize(status = SKIP, error = SKIP) @status = status unless status == SKIP @error = error unless error == SKIP end |
Instance Attribute Details
#error ⇒ ChargeError
Describes the session state started, stopped, start-requested, stop-requested, failed-to-start, failed-to-stop
22 23 24 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 22 def error @error end |
#status ⇒ String
Describes the session state started, stopped, start-requested, stop-requested, failed-to-start, failed-to-stop
16 17 18 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 16 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : SKIP error = ChargeError.from_hash(hash['error']) if hash['error'] # Create object from extracted values. ChargeRetrieveState.new(status, error) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['error'] = 'error' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 38 |
# File 'lib/shell_ev/models/charge_retrieve_state.rb', line 33 def self.optionals %w[ status error ] end |