spec/api/messages_api_spec.rb in artikcloud-2.1.1 vs spec/api/messages_api_spec.rb in artikcloud-2.2.2

- old
+ new

@@ -1,17 +1,14 @@ =begin -Artik Cloud API +#ARTIK Cloud API +#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + 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' @@ -44,88 +41,132 @@ # @option opts [String] :field Message field being queried for building histogram. # @option opts [String] :interval Interval of time for building histogram blocks. (Valid values: minute, hour, day, month, year) # @return [AggregatesHistogramResponse] describe 'get_aggregates_histogram test' do it "should work" do - message = ArtikCloud::Message.new - message.type = "message" - message.sdid = device.id - message.ts = Time.now.to_f*1000 - message.data = { - :'steps' => 500 - } + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - result = instance.send_message(message) - expect(result).to be_a(ArtikCloud::MessageIDEnvelope) - message_id = result.data.mid + # unit tests for get_field_presence + # Get normalized message presence + # Get normalized message presence. + # @param start_date startDate + # @param end_date endDate + # @param interval String representing grouping interval. One of: 'minute' (1 hour limit), 'hour' (1 day limit), 'day' (31 days limit), 'month' (1 year limit), or 'year' (10 years limit). + # @param [Hash] opts the optional parameters + # @option opts [String] :sdid Source device ID of the messages being searched. + # @option opts [String] :field_presence String representing a field from the specified device ID. + # @return [FieldPresenceEnvelope] + describe 'get_field_presence test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - sleep(2) + # unit tests for get_last_normalized_messages + # Get Last Normalized Message + # Get last messages normalized. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :count Number of items to return per query. + # @option opts [String] :sdids Comma separated list of source device IDs (minimum: 1). + # @option opts [String] :field_presence String representing a field from the specified device ID. + # @return [NormalizedMessagesEnvelope] + describe 'get_last_normalized_messages test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - opts = { - :mid => message_id - } + # unit tests for get_message_aggregates + # Get Normalized Message Aggregates + # Get Aggregates on normalized messages. + # @param sdid Source device ID of the messages being searched. + # @param field Message field being queried for aggregates. + # @param start_date Timestamp of earliest message (in milliseconds since epoch). + # @param end_date Timestamp of latest message (in milliseconds since epoch). + # @param [Hash] opts the optional parameters + # @return [AggregatesResponse] + describe 'get_message_aggregates test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - normalized_messages = instance.get_normalized_messages(opts) - expect(normalized_messages).to be_a(ArtikCloud::NormalizedMessagesEnvelope) - expect(normalized_messages.size).to eq 1 + # unit tests for get_message_snapshots + # Get Message Snapshots + # Get message snapshots. + # @param sdids Device IDs for which the snapshots are requested. Max 100 device ids per call. + # @param [Hash] opts the optional parameters + # @option opts [BOOLEAN] :include_timestamp Indicates whether to return timestamps of the last update for each field. + # @return [SnapshotResponses] + describe 'get_message_snapshots test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - normalized = normalized_messages.data[0] - expect(normalized.mid).to eq message_id + # unit tests for get_normalized_actions + # Get Normalized Actions + # Get the actions normalized + # @param [Hash] opts the optional parameters + # @option opts [String] :uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. + # @option opts [String] :ddid Destination device ID of the actions being searched. + # @option opts [String] :mid The message ID being searched. + # @option opts [String] :offset A string that represents the starting item, should be the value of 'next' field received in the last response. (required for pagination) + # @option opts [Integer] :count count + # @option opts [Integer] :start_date startDate + # @option opts [Integer] :end_date endDate + # @option opts [String] :order Desired sort order: 'asc' or 'desc' + # @return [NormalizedActionsEnvelope] + describe 'get_normalized_actions test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end - volume = normalized.data["steps"] - expect(volume).to_not be_nil - expect(volume).to eq 500 + # unit tests for get_normalized_messages + # Get Normalized Messages + # Get the messages normalized + # @param [Hash] opts the optional parameters + # @option opts [String] :uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. + # @option opts [String] :sdid Source device ID of the messages being searched. + # @option opts [String] :mid The message ID being searched. + # @option opts [String] :field_presence String representing a field from the specified device ID. + # @option opts [String] :filter Filter. + # @option opts [String] :offset A string that represents the starting item, should be the value of 'next' field received in the last response. (required for pagination) + # @option opts [Integer] :count count + # @option opts [Integer] :start_date startDate + # @option opts [Integer] :end_date endDate + # @option opts [String] :order Desired sort order: 'asc' or 'desc' + # @return [NormalizedMessagesEnvelope] + describe 'get_normalized_messages test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end - describe 'get_message_snapshots' do - it 'should work' do - result = instance.get_message_snapshots(device.id) - expect(result.sdids).to eq device.id - expect(result.data.first.sdid).to eq device.id - expect(result.data.first.data['steps'][:value]).to eq 500 + # unit tests for send_actions + # Send Actions + # Send Actions + # @param data Actions that are passed in the body + # @param [Hash] opts the optional parameters + # @return [MessageIDEnvelope] + describe 'send_actions test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end - describe 'send_actions' do - let(:device) { FactoryGirl.create(:device_tv) } - - it 'should work' do - action = ArtikCloud::Action.new - action.name = 'setVolume' - action.parameters = {'volume' => 5} - - action_array = ArtikCloud::ActionArray.new - action_array.actions = [action] - - actions = ArtikCloud::Actions.new - actions.ddid = device.id - actions.ts = Time.now.to_f*1000 - actions.data = action_array - - mid = instance.send_actions(actions).data.mid - - sleep(2) - - result = instance.get_normalized_actions( - uid: nil, - ddid: nil, - mid: mid, - offset: nil, - count: nil, - startDate: nil, - endDate: nil, - order: nil - ) - expect(result.size).to eq 1 - - normalized = result.data[0] - action_rx = normalized.data.actions[0] - - expect(action_rx.name).to eq 'setVolume' - - volume = action_rx.parameters['volume'] - expect(volume).to_not be_nil - expect(volume).to eq 5 + # unit tests for send_message + # Send Message + # Send a message + # @param data Message object that is passed in the body + # @param [Hash] opts the optional parameters + # @return [MessageIDEnvelope] + describe 'send_message test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end + end