=begin #DaDaPush Public API #DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices. The version of the OpenAPI document: v1 Contact: contacts@dadapush.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.0.2 =end require 'spec_helper' require 'json' # Unit tests for DaDaPushClient::DaDaPushMessageApi # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'DaDaPushMessageApi' do before do # run before each test config = DaDaPushClient::Configuration.new config.scheme = "http" config.host = "127.0.0.1:8080" # @config = Configuration.new() api_client = DaDaPushClient::ApiClient.new(@config = config) @api_instance = DaDaPushClient::DaDaPushMessageApi.new(@api_client = api_client) end after do # run after each test end describe 'test an instance of DaDaPushMessageApi' do it 'should create an instance of DaDaPushMessageApi' do expect(@api_instance).to be_instance_of(DaDaPushClient::DaDaPushMessageApi) end end # unit tests for create_message # push Message to a Channel # <h2>Rate Limit:</h2><ul><li>1 request per 1s</li><li>30 request per 1m</li><li>500 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul> # @param body body # @param [Hash] opts the optional parameters # @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list # @return [ResultOfMessagePushResponse] describe 'create_message test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers body = DaDaPushClient::MessagePushRequest.new body.title = "Good News!" body.content = "Good News! DaDaPush releasing new version" body.need_push = TRUE action = DaDaPushClient::Action.new({"name": "view", "url": "https://www.dadapush.com/", "type": "link"}) body.actions = [action] opts = { x_channel_token: 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf' } response = @api_instance.create_message(body, opts) puts response end end # unit tests for delete_message # delete a Channel Message # <h2>Rate Limit:</h2><ul><li>10 request per 1s</li><li>100 request per 1m</li><li>1000 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul> # @param message_id messageId # @param [Hash] opts the optional parameters # @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list # @return [Result] describe 'delete_message test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers opts = { x_channel_token: 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf' } message_id = 227847 response = @api_instance.delete_message(message_id, opts) puts response end end # unit tests for get_message # get a Channel Message # <h2>Rate Limit:</h2><ul><li>10 request per 1s</li><li>100 request per 1m</li><li>1000 request per 1h</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul> # @param message_id messageId # @param [Hash] opts the optional parameters # @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list # @return [ResultOfMessageObject] describe 'get_message test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers opts = { x_channel_token: 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf' } message_id = 227847 response = @api_instance.get_message(message_id, opts) puts response end end # unit tests for get_messages # get Message List # <h2>Rate Limit:</h2><ul><li>1 request per 1s</li><li>45 request per 1m</li></ul><h2>Result code/errmsg List:</h2><ul><li>0: ok</li><li>1: server error</li><li>101: channel is exists</li><li>102: channel is not exists</li><li>103: channel token error</li><li>104: channel is not exists</li><li>105: message is not exists</li><li>204: bad request</li><li>205: permission deny</li><li>206: too many request, please after 5 minutes to try!</li><li>301: duplicate username/email</li><li>302: user is not exists</li><li>303: user password is error</li><li>304: client push token is error</li><li>305: user is disabled</li><li>306: your subscription is expired</li><li>307: user not subscribe channel</li></ul> # @param page greater than 1 # @param page_size range is 1,50 # @param [Hash] opts the optional parameters # @option opts [String] :x_channel_token see: https://www.dadapush.com/channel/list # @return [ResultOfPageResponseOfMessageObject] describe 'get_messages test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers opts = { x_channel_token: 'ctb3lwO6AeiZOwqZgp8BE8980FdNgp0cp6MCf' } page = 1 page_size = 10 response = @api_instance.get_messages(page, page_size, opts) puts response end end end