Sha256: 9f4c6ce8065b49241ce2ee7c7fd2897d6de400f14821c2e007c5ae58d3d80bd7

Contents?: true

Size: 579 Bytes

Versions: 16

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module FinApps
  module REST
    class OrderReports < FinAppsCore::REST::Resources # :nodoc:
      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)
        %i(json html pdf).include? format.to_sym
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
finapps-4.0.3 lib/finapps/rest/order_reports.rb
finapps-4.0.2 lib/finapps/rest/order_reports.rb
finapps-4.0.1 lib/finapps/rest/order_reports.rb
finapps-3.0.7 lib/finapps/rest/order_reports.rb
finapps-3.0.6 lib/finapps/rest/order_reports.rb
finapps-3.0.5 lib/finapps/rest/order_reports.rb
finapps-3.0.4 lib/finapps/rest/order_reports.rb
finapps-3.0.3 lib/finapps/rest/order_reports.rb
finapps-3.0.2 lib/finapps/rest/order_reports.rb
finapps-3.0.1 lib/finapps/rest/order_reports.rb
finapps-2.3.7 lib/finapps/rest/order_reports.rb
finapps-2.3.6 lib/finapps/rest/order_reports.rb
finapps-2.3.5 lib/finapps/rest/order_reports.rb
finapps-2.3.3 lib/finapps/rest/order_reports.rb
finapps-2.3.2 lib/finapps/rest/order_reports.rb
finapps-2.3.1 lib/finapps/rest/order_reports.rb