Class: AwsIotDevice::MqttShadowClient::JSONPayloadParser
- Inherits:
-
Object
- Object
- AwsIotDevice::MqttShadowClient::JSONPayloadParser
- Defined in:
- lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb
Instance Method Summary collapse
- #get_attribute_value(key) ⇒ Object
- #get_json ⇒ Object
-
#initialize ⇒ JSONPayloadParser
constructor
This class acts as Basic JSON parser.
- #set_attribute_value(key, value) ⇒ Object
- #set_message(message) ⇒ Object
Constructor Details
#initialize ⇒ JSONPayloadParser
This class acts as Basic JSON parser. The answer from AWS is in a JSON format. All different key of the JSON file should be defined as hash key
13 14 15 |
# File 'lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb', line 13 def initialize @message = {} end |
Instance Method Details
#get_attribute_value(key) ⇒ Object
21 22 23 |
# File 'lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb', line 21 def get_attribute_value(key) @message[key] end |
#get_json ⇒ Object
29 30 31 |
# File 'lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb', line 29 def get_json @message.to_json end |
#set_attribute_value(key, value) ⇒ Object
25 26 27 |
# File 'lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb', line 25 def set_attribute_value(key, value) @message[key] = value end |
#set_message(message) ⇒ Object
17 18 19 |
# File 'lib/aws_iot_device/mqtt_shadow_client/json_payload_parser.rb', line 17 def () @message = JSON.parse() end |