Class: LoyaltyApIs::EvChargingDetails
- Defined in:
- lib/loyalty_ap_is/models/ev_charging_details.rb
Overview
EvChargingDetails Model.
Instance Attribute Summary collapse
-
#charge_point_connector_type_cd ⇒ String
Charging point connector type.
-
#charge_point_connector_type_desc ⇒ String
Charging point connector description.
-
#charge_point_serial_id ⇒ String
Charging point serial ID.
-
#duration ⇒ Integer
Duration of the transaction in seconds.
-
#end_date_time ⇒ DateTime
Date and time at which the transaction ended.
-
#start_date_time ⇒ DateTime
Date and time at which the transaction started.
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(charge_point_serial_id:, start_date_time:, end_date_time:, duration: 0, charge_point_connector_type_cd: SKIP, charge_point_connector_type_desc: SKIP, additional_properties: nil) ⇒ EvChargingDetails
constructor
A new instance of EvChargingDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_end_date_time ⇒ Object
- #to_custom_start_date_time ⇒ Object
-
#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(charge_point_serial_id:, start_date_time:, end_date_time:, duration: 0, charge_point_connector_type_cd: SKIP, charge_point_connector_type_desc: SKIP, additional_properties: nil) ⇒ EvChargingDetails
Returns a new instance of EvChargingDetails.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 65 def initialize(charge_point_serial_id:, start_date_time:, end_date_time:, duration: 0, charge_point_connector_type_cd: SKIP, charge_point_connector_type_desc: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @charge_point_serial_id = charge_point_serial_id unless charge_point_connector_type_cd == SKIP @charge_point_connector_type_cd = charge_point_connector_type_cd end unless charge_point_connector_type_desc == SKIP @charge_point_connector_type_desc = charge_point_connector_type_desc end @start_date_time = start_date_time @end_date_time = end_date_time @duration = duration @additional_properties = additional_properties end |
Instance Attribute Details
#charge_point_connector_type_cd ⇒ String
Charging point connector type
19 20 21 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 19 def charge_point_connector_type_cd @charge_point_connector_type_cd end |
#charge_point_connector_type_desc ⇒ String
Charging point connector description
23 24 25 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 23 def charge_point_connector_type_desc @charge_point_connector_type_desc end |
#charge_point_serial_id ⇒ String
Charging point serial ID
15 16 17 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 15 def charge_point_serial_id @charge_point_serial_id end |
#duration ⇒ Integer
Duration of the transaction in seconds.
37 38 39 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 37 def duration @duration end |
#end_date_time ⇒ DateTime
Date and time at which the transaction ended. Format as per ISO 8601 standard.
33 34 35 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 33 def end_date_time @end_date_time end |
#start_date_time ⇒ DateTime
Date and time at which the transaction started. Format as per ISO 8601 standard.
28 29 30 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 28 def start_date_time @start_date_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 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 116 117 118 119 120 121 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. charge_point_serial_id = hash.key?('chargePointSerialId') ? hash['chargePointSerialId'] : nil start_date_time = if hash.key?('startDateTime') (DateTimeHelper.from_rfc3339(hash['startDateTime']) if hash['startDateTime']) end end_date_time = if hash.key?('endDateTime') (DateTimeHelper.from_rfc3339(hash['endDateTime']) if hash['endDateTime']) end duration = hash['duration'] ||= 0 charge_point_connector_type_cd = hash.key?('chargePointConnectorTypeCd') ? hash['chargePointConnectorTypeCd'] : SKIP charge_point_connector_type_desc = hash.key?('chargePointConnectorTypeDesc') ? hash['chargePointConnectorTypeDesc'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. EvChargingDetails.new(charge_point_serial_id: charge_point_serial_id, start_date_time: start_date_time, end_date_time: end_date_time, duration: duration, charge_point_connector_type_cd: charge_point_connector_type_cd, charge_point_connector_type_desc: charge_point_connector_type_desc, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['charge_point_serial_id'] = 'chargePointSerialId' @_hash['charge_point_connector_type_cd'] = 'chargePointConnectorTypeCd' @_hash['charge_point_connector_type_desc'] = 'chargePointConnectorTypeDesc' @_hash['start_date_time'] = 'startDateTime' @_hash['end_date_time'] = 'endDateTime' @_hash['duration'] = 'duration' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
53 54 55 56 57 58 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 53 def self.optionals %w[ charge_point_connector_type_cd charge_point_connector_type_desc ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 149 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} charge_point_serial_id: #{@charge_point_serial_id.inspect},"\ " charge_point_connector_type_cd: #{@charge_point_connector_type_cd.inspect},"\ " charge_point_connector_type_desc: #{@charge_point_connector_type_desc.inspect},"\ " start_date_time: #{@start_date_time.inspect}, end_date_time: #{@end_date_time.inspect},"\ " duration: #{@duration.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_end_date_time ⇒ Object
127 128 129 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 127 def to_custom_end_date_time DateTimeHelper.to_rfc3339(end_date_time) end |
#to_custom_start_date_time ⇒ Object
123 124 125 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 123 def to_custom_start_date_time DateTimeHelper.to_rfc3339(start_date_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
132 133 134 135 136 137 138 139 |
# File 'lib/loyalty_ap_is/models/ev_charging_details.rb', line 132 def to_s class_name = self.class.name.split('::').last "<#{class_name} charge_point_serial_id: #{@charge_point_serial_id},"\ " charge_point_connector_type_cd: #{@charge_point_connector_type_cd},"\ " charge_point_connector_type_desc: #{@charge_point_connector_type_desc}, start_date_time:"\ " #{@start_date_time}, end_date_time: #{@end_date_time}, duration: #{@duration},"\ " additional_properties: #{@additional_properties}>" end |