=begin #Fatture in Cloud API v2 - API Reference #Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 500.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol. The version of the OpenAPI document: 2.0.27 Contact: info@fattureincloud.it Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.5.0 =end require 'spec_helper' require 'json' # Unit tests for FattureInCloud_Ruby_Sdk::WebhooksApi # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'WebhooksApi' do before do # run before each test @api_instance = FattureInCloud_Ruby_Sdk::WebhooksApi.new @create_webhooks_subscription_response_obj = { data: { id: 'SUB123', sink: 'https://endpoint.test', verified: true, types: ['it.fattureincloud.webhooks.cashbook.create'] }, warnings: ['error'] } allow(@api_instance).to receive(:create_webhooks_subscription) { @create_webhooks_subscription_response_obj } @get_webhooks_subscription_response_obj = { data: { id: 'SUB123', sink: 'https://endpoint.test', verified: true, types: ['it.fattureincloud.webhooks.cashbook.create'] } } allow(@api_instance).to receive(:get_webhooks_subscription) { @get_webhooks_subscription_response_obj } @list_webhooks_subscriptions_response_obj = { data: [ { id: 'SUB123', sink: 'https://endpoint.test', verified: true, types: ['it.fattureincloud.webhooks.cashbook.create'] }, { id: 'SUB123', sink: 'https://endpoint.test', verified: true, types: ['it.fattureincloud.webhooks.cashbook.update'] } ] } allow(@api_instance).to receive(:list_webhooks_subscriptions) { @list_webhooks_subscriptions_response_obj } @modify_webhooks_subscription_response_obj = { data: { id: 'SUB123', sink: 'https://endpoint.test', verified: true, types: ['it.fattureincloud.webhooks.cashbook.create'] }, warnings: ['error'] } allow(@api_instance).to receive(:modify_webhooks_subscription) { @modify_webhooks_subscription_response_obj } end after do # run after each test end describe 'test an instance of WebhooksApi' do it 'should create an instance of WebhooksApi' do expect(@api_instance).to be_instance_of(FattureInCloud_Ruby_Sdk::WebhooksApi) end end # unit tests for create_webhooks_subscription # Create a Webhook Subscription # Register some webhooks Subscriptions. # @param company_id The ID of the company. # @param [Hash] opts the optional parameters # @option opts [CreateWebhooksSubscriptionRequest] :create_webhooks_subscription_request # @return [CreateWebhooksSubscriptionResponse] describe 'create_webhooks_subscription test' do it 'should work' do opts = { data: { sink: 'https://endpoint.test', types: ['it.fattureincloud.webhooks.cashbook.create'] } } response = @api_instance.create_webhooks_subscription(2, opts) response_obj = JSON.parse(response.to_json, object_class: OpenStruct) expected_json = @create_webhooks_subscription_response_obj.to_json actual_json = response.to_json expect(actual_json).to eq(expected_json) end end # unit tests for delete_webhooks_subscription # Delete Webhooks Subscription # Delete a webhooks subscription. # @param company_id The ID of the company. # @param subscription_id The ID of the subscription. # @param [Hash] opts the optional parameters # @return [nil] describe 'delete_webhooks_subscription test' do it 'should work' do expect(true).to eq(true) end end # unit tests for get_webhooks_subscription # Get Webhooks Subscription # Get a webhooks subscription. # @param company_id The ID of the company. # @param subscription_id The ID of the subscription. # @param [Hash] opts the optional parameters # @return [GetWebhooksSubscriptionResponse] describe 'get_webhooks_subscription test' do it 'should work' do response = @api_instance.get_webhooks_subscription(2, "SUB123") response_obj = JSON.parse(response.to_json, object_class: OpenStruct) expected_json = @get_webhooks_subscription_response_obj.to_json actual_json = response.to_json expect(actual_json).to eq(expected_json) end end # unit tests for list_webhooks_subscriptions # List Webhooks Subscriptions # List active webhooks subscriptions. # @param company_id The ID of the company. # @param [Hash] opts the optional parameters # @return [ListWebhooksSubscriptionsResponse] describe 'list_webhooks_subscriptions test' do it 'should work' do response = @api_instance.list_webhooks_subscriptions(2) response_obj = JSON.parse(response.to_json, object_class: OpenStruct) expected_json = @list_webhooks_subscriptions_response_obj.to_json actual_json = response.to_json expect(actual_json).to eq(expected_json) end end # unit tests for modify_webhooks_subscription # Modify Webhooks Subscription # Edit a webhooks subscription. # @param company_id The ID of the company. # @param subscription_id The ID of the subscription. # @param [Hash] opts the optional parameters # @option opts [ModifyWebhooksSubscriptionRequest] :modify_webhooks_subscription_request # @return [ModifyWebhooksSubscriptionResponse] describe 'modify_webhooks_subscription test' do it 'should work' do response = @api_instance.modify_webhooks_subscription(2, "SUB123") response_obj = JSON.parse(response.to_json, object_class: OpenStruct) expected_json = @modify_webhooks_subscription_response_obj.to_json actual_json = response.to_json expect(actual_json).to eq(expected_json) end end end