def report(*reports, transactions: [], service_id: nil, extensions: nil, service_token: nil, **rest)
      if (!transactions || transactions.empty?) && rest.empty?
        raise ArgumentError, 'no transactions to report'
      end

      transactions = transactions.concat(reports)

      unless rest.empty?
        warn DEPRECATION_MSG_OLD_REPORT if @warn_deprecated
        transactions.concat([rest])
      end

      payload = encode_transactions(transactions)
      if @service_tokens
        raise ArgumentError, "service_token or service_id not specified" unless service_token && service_id
        payload['service_token'] = CGI.escape(service_token)
      else
        payload['provider_key'] = CGI.escape(@provider_key)
      end
      payload['service_id'] = CGI.escape(service_id.to_s) if service_id

      headers = extensions_to_header extensions if extensions
      http_response = @http.post('/transactions.xml', payload, headers: headers)

      case http_response
      when Net::HTTPSuccess
        build_report_response
      when Net::HTTPClientError
        build_error_response(http_response.body)
      else
        raise ServerError.new(http_response)
      end
    end
def report(*reports, transactions: [], service_id: nil, extensions: nil, service_token: nil, **rest)
      if (!transactions || transactions.empty?) && rest.empty?
        raise ArgumentError, 'no transactions to report'
      end

      transactions = transactions.concat(reports)

      unless rest.empty?
        warn DEPRECATION_MSG_OLD_REPORT if @warn_deprecated
        transactions.concat([rest])
      end

      payload = encode_transactions(transactions)
      if @service_tokens
        raise ArgumentError, "service_token or service_id not specified" unless service_token && service_id
        payload['service_token'] = CGI.escape(service_token)
      else
        payload['provider_key'] = CGI.escape(@provider_key)
      end
      payload['service_id'] = CGI.escape(service_id.to_s) if service_id

      headers = extensions_to_header extensions if extensions
      http_response = @http.post('/transactions.xml', payload, headers: headers)

      case http_response
      when Net::HTTPSuccess
        build_report_response
      when Net::HTTPClientError
        build_error_response(http_response.body)
      else
        raise ServerError.new(http_response)
      end
    end
Report transaction(s).

 == Parameters

 Hash with up to three fields:

   transactions::   Required. Enumerable. Each element is a hash with the fields:
         app_id:    ID of the application to report the transaction for. This parameter is
                    required.
         usage:     Hash of usage values. The keys are metric names and values are
                    corresponding numeric values. Example: {'hits' => 1, 'transfer' => 1024}.
                    This parameter is required.
         timestamp: Timestamp of the transaction. This can be either a object of the
                    ruby's Time class, or a string in the "YYYY-MM-DD HH:MM:SS" format
                    (if the time is in the UTC), or a string in
                    the "YYYY-MM-DD HH:MM:SS ZZZZZ" format, where the ZZZZZ is the time offset
                    from the UTC. For example, "US Pacific Time" has offset -0800, "Tokyo"
                    has offset +0900. This parameter is optional, and if not provided, equals
                    to the current time.
         user_id:   Identifies an end user. Required only when the application is rate limiting
                    end users.
   service_id::     ID of the service. It is optional. When not specified, the transactions
                    are reported to the default service.
   service_token::  Token granting access to the specified service ID.

 == Return

 A Response object with method +success?+ that returns true if the report was successful,
 or false if there was an error. See ThreeScale::Response class for more information.

 In case of unexpected internal server error, this method raises a ThreeScale::ServerError
 exception.

 == Examples

    Report two transactions of two applications. Using the default service.
    client.report(transactions: [{:app_id => 'foo', :usage => {'hits' => 1}},
                                 {:app_id => 'bar', :usage => {'hits' => 1}}])

    Report one transaction with timestamp. Using the default service.
    client.report(transactions: [{:app_id    => 'foo',
                                  :timestamp => Time.local(2010, 4, 27, 15, 14),
                                  :usage     => {'hits' => 1}])

    Report a transaction specifying the service.
    client.report(transactions: [{:app_id => 'foo', :usage => {'hits' => 1}}],
                  service_id: 'a_service_id')

 == Note

 The signature of this method is a bit complicated because we decided to
 keep backwards compatibility with a previous version of the method:
 def report(*transactions)