Sha256: efd2aa7696601ed2cae13d5571c5cbc4c28fc1b2ad8b337a9060e929eb069d74

Contents?: true

Size: 640 Bytes

Versions: 7

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true
module FinApps
  module REST
    class OrderReports < FinAppsCore::REST::Resources # :nodoc:
      using ObjectExtensions
      using StringExtensions

      def show(id, format)
        not_blank(id, :id)
        not_blank(format, :format)
        raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: format' unless accepted_format?(format)

        path = "orders/#{ERB::Util.url_encode(id)}/report.#{ERB::Util.url_encode(format)}"
        super nil, path
      end

      private

      def accepted_format?(format)
        [:json, :html, :pdf].include? format.to_sym
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
finapps-2.2.7 lib/finapps/rest/order_reports.rb
finapps-2.2.6 lib/finapps/rest/order_reports.rb
finapps-2.2.5 lib/finapps/rest/order_reports.rb
finapps-2.2.4 lib/finapps/rest/order_reports.rb
finapps-2.2.3 lib/finapps/rest/order_reports.rb
finapps-2.2.2 lib/finapps/rest/order_reports.rb
finapps-2.2.1 lib/finapps/rest/order_reports.rb