Class: AwsIotDevice::MqttShadowClient::TopicBuilder
- Inherits:
-
Object
- Object
- AwsIotDevice::MqttShadowClient::TopicBuilder
- Defined in:
- lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb
Instance Method Summary collapse
- #get_topic_accepted(action) ⇒ Object
- #get_topic_delta ⇒ Object
- #get_topic_general(action) ⇒ Object
- #get_topic_rejected(action) ⇒ Object
-
#initialize(shadow_name) ⇒ TopicBuilder
constructor
A new instance of TopicBuilder.
- #is_delta?(action) ⇒ Boolean
Constructor Details
#initialize(shadow_name) ⇒ TopicBuilder
Returns a new instance of TopicBuilder.
4 5 6 7 8 9 10 11 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 4 def initialize(shadow_name) raise ArgumentError, "topic_builder initialization, shadow_name is required but undefined" if shadow_name.nil? @shadow_name = shadow_name @topic_delta = "$aws/things/#{shadow_name}/shadow/update/delta" @topic_general = "$aws/things/#{shadow_name}/shadow/" end |
Instance Method Details
#get_topic_accepted(action) ⇒ Object
22 23 24 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 22 def get_topic_accepted(action) get_topic_general(action) + "/accepted" end |
#get_topic_delta ⇒ Object
30 31 32 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 30 def get_topic_delta @topic_delta end |
#get_topic_general(action) ⇒ Object
17 18 19 20 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 17 def get_topic_general(action) raise ArgumentError, "topic_builder, get topic, unreconized action_name \"#{action}\"" unless ACTION_NAME.include?(action) @topic_general + action end |
#get_topic_rejected(action) ⇒ Object
26 27 28 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 26 def get_topic_rejected(action) get_topic_general(action) + "/rejected" end |
#is_delta?(action) ⇒ Boolean
13 14 15 |
# File 'lib/aws_iot_device/mqtt_shadow_client/topic_builder.rb', line 13 def is_delta?(action) action == ACTION_NAME[3] end |