Class: ShellEv::ChargingController
- Inherits:
-
BaseController
- Object
- BaseController
- ShellEv::ChargingController
- Defined in:
- lib/shell_ev/controllers/charging_controller.rb
Overview
ChargingController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#active(request_id, ema_id) ⇒ ActiveResponse200Json
Fetrches the active sessions for user.
-
#get_charge_session_retrieve(request_id, session_id) ⇒ GetChargeSessionRetrieveResponse200Json
This endpoint returns the details of the session if the session is found.
-
#start(request_id, body: nil) ⇒ InlineResponse202
This endpoint start the charging session for the user.
-
#stop(request_id, session_id) ⇒ InlineResponse2021
Accepts a request to stop an active session when a valid session id is provided.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from ShellEv::BaseController
Instance Method Details
#active(request_id, ema_id) ⇒ ActiveResponse200Json
Fetrches the active sessions for user. unique identifier value that can be used by the consumer to correlate each request /response .
Format.
Its canonical textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens)
Identifier(Ema-ID)
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/shell_ev/controllers/charging_controller.rb', line 168 def active(request_id, ema_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v2/charge-session/active', Server::DEFAULT) .header_param(new_parameter(request_id, key: 'RequestId')) .query_param(new_parameter(ema_id, key: 'emaId')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BearerAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ActiveResponse200Json.method(:from_hash))) .execute end |
#get_charge_session_retrieve(request_id, session_id) ⇒ GetChargeSessionRetrieveResponse200Json
This endpoint returns the details of the session if the session is found. unique identifier value that can be used by the consumer to correlate each request /response .
Format.
Its canonical textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens)
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/shell_ev/controllers/charging_controller.rb', line 119 def get_charge_session_retrieve(request_id, session_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v2/charge-session/retrieve', Server::DEFAULT) .header_param(new_parameter(request_id, key: 'RequestId')) .query_param(new_parameter(session_id, key: 'sessionId')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BearerAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetChargeSessionRetrieveResponse200Json.method(:from_hash)) .local_error('400', 'The server cannot or will not process the request due to'\ ' something that is perceived to be a client error (e.g.,'\ ' malformed request syntax, invalid request message framing, or'\ ' deceptive request routing).', BadRequestException) .local_error('401', 'The request has not been applied because it lacks valid'\ ' authentication credentials for the target resource.', UnauthorizedException) .local_error('404', 'Location Not Found', V2ChargeSessionRetrieve404ErrorException) .local_error('429', 'The Request reached maximum allocated rate limit', TooManyRequestsException) .local_error('500', 'Internal Server error', InternalServerErrorException) .local_error('503', 'Service unavailable', ServiceunavailableException)) .execute end |
#start(request_id, body: nil) ⇒ InlineResponse202
This endpoint start the charging session for the user. unique identifier value that can be used by the consumer to correlate each request /response .
Format.
Its canonical textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens)
description here
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/shell_ev/controllers/charging_controller.rb', line 20 def start(request_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/v2/charge-session/start', Server::DEFAULT) .header_param(new_parameter(request_id, key: 'RequestId')) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BearerAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InlineResponse202.method(:from_hash)) .local_error('400', 'The server cannot or will not process the request due to'\ ' something that is perceived to be a client error (e.g.,'\ ' malformed request syntax, invalid request message framing, or'\ ' deceptive request routing).', BadRequestException) .local_error('401', 'The request has not been applied because it lacks valid'\ ' authentication credentials for the target resource.', UnauthorizedException) .local_error('404', 'Location Not Found', V2ChargeSessionStart404ErrorException) .local_error('429', 'The Request reached maximum allocated rate limit', TooManyRequestsException) .local_error('500', 'Internal Server error', InternalServerErrorException) .local_error('503', 'Service unavailable', ServiceunavailableException)) .execute end |
#stop(request_id, session_id) ⇒ InlineResponse2021
Accepts a request to stop an active session when a valid session id is provided. unique identifier value that can be used by the consumer to correlate each request /response .
Format.
Its canonical textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens)
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/shell_ev/controllers/charging_controller.rb', line 71 def stop(request_id, session_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/v2/charge-session/stop', Server::DEFAULT) .header_param(new_parameter(request_id, key: 'RequestId')) .query_param(new_parameter(session_id, key: 'sessionId')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BearerAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InlineResponse2021.method(:from_hash)) .local_error('400', 'The server cannot or will not process the request due to'\ ' something that is perceived to be a client error (e.g.,'\ ' malformed request syntax, invalid request message framing, or'\ ' deceptive request routing).', BadRequestException) .local_error('401', 'The request has not been applied because it lacks valid'\ ' authentication credentials for the target resource.', UnauthorizedException) .local_error('404', 'Location Not Found', V2ChargeSessionStop404ErrorException) .local_error('429', 'The Request reached maximum allocated rate limit', TooManyRequestsException) .local_error('500', 'Internal Server error', InternalServerErrorException) .local_error('503', 'Service unavailable', ServiceunavailableException)) .execute end |