=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SubskribeDevClient class RevenueRecognitionApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a revenue recognition rule # Creates a revenue recognition rule. # @param body recognition rule details # @param [Hash] opts the optional parameters # @return [nil] def add_recognition_rule(body, opts = {}) add_recognition_rule_with_http_info(body, opts) nil end # Create a revenue recognition rule # Creates a revenue recognition rule. # @param body recognition rule details # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def add_recognition_rule_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.add_recognition_rule ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RevenueRecognitionApi.add_recognition_rule" end # resource path local_var_path = '/revrec/rules' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#add_recognition_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a revenue recognition event # Creates a revenue recognition event, only if it is different from the previous event for same subscription and charge. # @param body recognition event details # @param [Hash] opts the optional parameters # @return [nil] def create_recognition_event(body, opts = {}) create_recognition_event_with_http_info(body, opts) nil end # Create a revenue recognition event # Creates a revenue recognition event, only if it is different from the previous event for same subscription and charge. # @param body recognition event details # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def create_recognition_event_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.create_recognition_event ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RevenueRecognitionApi.create_recognition_event" end # resource path local_var_path = '/revrec/events' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#create_recognition_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a recognition rule # Deletes a recognition rule. Note you can't delete a recognition rule that's in use. # @param rule_id id of the recognition rule # @param [Hash] opts the optional parameters # @return [RecognitionRule] def delete_rule(rule_id, opts = {}) data, _status_code, _headers = delete_rule_with_http_info(rule_id, opts) data end # Delete a recognition rule # Deletes a recognition rule. Note you can't delete a recognition rule that's in use. # @param rule_id id of the recognition rule # @param [Hash] opts the optional parameters # @return [Array<(RecognitionRule, Fixnum, Hash)>] RecognitionRule data, response status code and response headers def delete_rule_with_http_info(rule_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.delete_rule ...' end # verify the required parameter 'rule_id' is set if @api_client.config.client_side_validation && rule_id.nil? fail ArgumentError, "Missing the required parameter 'rule_id' when calling RevenueRecognitionApi.delete_rule" end # resource path local_var_path = '/revrec/rules/{ruleId}'.sub('{' + 'ruleId' + '}', rule_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RecognitionRule') if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#delete_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get revenue recognition events # Gets revenue recognition events for the specified subscription and charge. # @param subscription_id id of the subscription # @param charge_id id of the charge # @param [Hash] opts the optional parameters # @option opts [String] :accounting_period_id id of the accounting period to limit events to # @return [Array] def get_recognition_events_by_subscription_id_charge_id(subscription_id, charge_id, opts = {}) data, _status_code, _headers = get_recognition_events_by_subscription_id_charge_id_with_http_info(subscription_id, charge_id, opts) data end # Get revenue recognition events # Gets revenue recognition events for the specified subscription and charge. # @param subscription_id id of the subscription # @param charge_id id of the charge # @param [Hash] opts the optional parameters # @option opts [String] :accounting_period_id id of the accounting period to limit events to # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_recognition_events_by_subscription_id_charge_id_with_http_info(subscription_id, charge_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.get_recognition_events_by_subscription_id_charge_id ...' end # verify the required parameter 'subscription_id' is set if @api_client.config.client_side_validation && subscription_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_id' when calling RevenueRecognitionApi.get_recognition_events_by_subscription_id_charge_id" end # verify the required parameter 'charge_id' is set if @api_client.config.client_side_validation && charge_id.nil? fail ArgumentError, "Missing the required parameter 'charge_id' when calling RevenueRecognitionApi.get_recognition_events_by_subscription_id_charge_id" end # resource path local_var_path = '/revrec/events' # query parameters query_params = {} query_params[:'subscriptionId'] = subscription_id query_params[:'chargeId'] = charge_id query_params[:'accountingPeriodId'] = opts[:'accounting_period_id'] if !opts[:'accounting_period_id'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#get_recognition_events_by_subscription_id_charge_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get revenue recognition rules # Get revenue recognition rules. # @param [Hash] opts the optional parameters # @return [nil] def get_recognition_rule_by_id(opts = {}) get_recognition_rule_by_id_with_http_info(opts) nil end # Get revenue recognition rules # Get revenue recognition rules. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_recognition_rule_by_id_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.get_recognition_rule_by_id ...' end # resource path local_var_path = '/revrec/rules' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#get_recognition_rule_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get revenue recognition rule # Get a revenue recognition rule using id. # @param id id of the recognition rule # @param [Hash] opts the optional parameters # @return [nil] def get_recognition_rule_by_id1(id, opts = {}) get_recognition_rule_by_id1_with_http_info(id, opts) nil end # Get revenue recognition rule # Get a revenue recognition rule using id. # @param id id of the recognition rule # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_recognition_rule_by_id1_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.get_recognition_rule_by_id1 ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RevenueRecognitionApi.get_recognition_rule_by_id1" end # resource path local_var_path = '/revrec/rules/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#get_recognition_rule_by_id1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Download waterfall report # Downloads a revenue waterfall report in csv format. # @param [Hash] opts the optional parameters # @option opts [Integer] :start_date report start date as unix timestamp # @option opts [Integer] :end_date report end date as unix timestamp # @return [nil] def get_revenue_waterfall(opts = {}) get_revenue_waterfall_with_http_info(opts) nil end # Download waterfall report # Downloads a revenue waterfall report in csv format. # @param [Hash] opts the optional parameters # @option opts [Integer] :start_date report start date as unix timestamp # @option opts [Integer] :end_date report end date as unix timestamp # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_revenue_waterfall_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.get_revenue_waterfall ...' end # resource path local_var_path = '/revrec/waterfall' # query parameters query_params = {} query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#get_revenue_waterfall\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Download waterfall report # Downloads a revenue waterfall report in csv format. # @param [Hash] opts the optional parameters # @return [nil] def get_revenue_waterfall_report_v2(opts = {}) get_revenue_waterfall_report_v2_with_http_info(opts) nil end # Download waterfall report # Downloads a revenue waterfall report in csv format. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_revenue_waterfall_report_v2_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.get_revenue_waterfall_report_v2 ...' end # resource path local_var_path = '/revrec/waterfall/v2' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#get_revenue_waterfall_report_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Upload revenue events # Uploads revenue events from a csv file. The format of the file is Subscription.Id,Charge.Id,Alias.Id,RevrecEvent.PercentComplete Percent complete should be a decimal. # @param [Hash] opts the optional parameters # @option opts [File] :file # @return [nil] def upload_completion_events(opts = {}) upload_completion_events_with_http_info(opts) nil end # Upload revenue events # Uploads revenue events from a csv file. The format of the file is Subscription.Id,Charge.Id,Alias.Id,RevrecEvent.PercentComplete Percent complete should be a decimal. # @param [Hash] opts the optional parameters # @option opts [File] :file # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def upload_completion_events_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RevenueRecognitionApi.upload_completion_events ...' end # resource path local_var_path = '/revrec/events/upload' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RevenueRecognitionApi#upload_completion_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end