Sha256: 099e8c4a1c5e93fb614a07bc854b662901bb915cf02b0755691edeac2a0aca95

Contents?: true

Size: 764 Bytes

Versions: 9

Compression:

Stored size: 764 Bytes

Contents

module Paddle
  class Report < Object
    class << self
      def list(**params)
        response = Client.get_request("reports", params: params)
        Collection.from_response(response, type: Report)
      end

      def create(type:, filters:, **params)
        attrs = { type: type, filters: filters }
        response = Client.post_request("reports", body: attrs.merge(params))
        Report.new(response.body["data"])
      end

      def retrieve(id:)
        response = Client.get_request("reports/#{id}")
        Report.new(response.body["data"])
      end

      def csv(id:)
        response = Client.get_request("reports/#{id}/download-url")
        if response.success?
          response.body["data"]["url"]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/models/report.rb
paddle-2.6.0 lib/paddle/models/report.rb
paddle-2.5.2 lib/paddle/models/report.rb
paddle-2.5.1 lib/paddle/models/report.rb
paddle-2.5.0 lib/paddle/models/report.rb
paddle-2.4.1 lib/paddle/models/report.rb
paddle-2.4.0 lib/paddle/models/report.rb
paddle-2.3.0 lib/paddle/models/report.rb
paddle-2.2.1 lib/paddle/models/report.rb