Class: AwsIotDevice::MqttShadowClient::TokenCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_iot_device/mqtt_shadow_client/token_creator.rb

Instance Method Summary collapse

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_tokenObject



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