Class: AwsIotDevice::MqttShadowClient::TokenCreator
- Inherits:
-
Object
- Object
- AwsIotDevice::MqttShadowClient::TokenCreator
- Defined in:
- lib/aws_iot_device/mqtt_shadow_client/token_creator.rb
Instance Method Summary collapse
- #create_next_token ⇒ Object
-
#initialize(shadow_name, client_id) ⇒ TokenCreator
constructor
This class manage the clients token.
Constructor Details
#initialize(shadow_name, client_id) ⇒ TokenCreator
This class manage the clients token. Every actions receive a token for a certian interval, meaning that action is waiting to be proceed. When token time run out or the actions have been treated token should deleted.
13 14 15 16 17 |
# File 'lib/aws_iot_device/mqtt_shadow_client/token_creator.rb', line 13 def initialize(shadow_name, client_id) @shadow_name = shadow_name @client_id = client_id @sequence_number = 0 end |
Instance Method Details
#create_next_token ⇒ Object
19 20 21 22 |
# File 'lib/aws_iot_device/mqtt_shadow_client/token_creator.rb', line 19 def create_next_token token = "" token << "#{@client_id}" << "_" << "#{@shadow_name}" << "_" << "#{@sequence_number}" << "_" << "#{random_token_string(5)}" end |