=begin Artik Cloud API OpenAPI spec version: 2.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git License: MIT http://en.wikipedia.org/wiki/MIT_License Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html =end require 'spec_helper' require 'json' # Unit tests for ArtikCloud::MessagesApi # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'MessagesApi' do before do # run before each test configuration = ArtikCloud::Configuration.new configuration.access_token = '1eef3e3251e147d1ac707a57f6779c49' api_client = ArtikCloud::ApiClient.new(configuration) @instance = ArtikCloud::MessagesApi.new(api_client) end after do # run after each test end describe 'test an instance of MessagesApi' do it 'should create an instact of MessagesApi' do @instance.should be_a(ArtikCloud::MessagesApi) end end # unit tests for send_message_action # Send Message Action # Send a message or an Action:<br/><table><tr><th>Combination</th><th>Parameters</th><th>Description</th></tr><tr><td>Send Message</td><td>sdid, type=message</td><td>Send a message from a Source Device</td></tr><tr><td>Send Action</td><td>ddid, type=action</td><td>Send an action to a Destination Device</td></tr><tr><td>Common</td><td>data, ts, token</td><td>Parameters that can be used with the above combinations.</td></tr></table> # @param data Message or Action object that is passed in the body # @param [Hash] opts the optional parameters # @return [MessageIDEnvelope] describe 'send_message_action test' do it "should work" do message = ArtikCloud::MessageAction.new message.type = "message" message.sdid = "993925c3cd994bf7a51c620884be65e9" message.ts = Time.now.to_f*1000 message.data = { :'volume' => 5 } result = @instance.send_message_action(message) result.should be_a(ArtikCloud::MessageIDEnvelope) message_id = result.data.mid sleep(2) opts = { :mid => message_id } normalized_messages = @instance.get_normalized_messages(opts) normalized_messages.should be_a(ArtikCloud::NormalizedMessagesEnvelope) normalized_messages.size.should == 1 normalized = normalized_messages.data[0] normalized.mid.should == message_id volume = normalized.data["volume"] volume.should_not be_nil volume.should == 5 end end end