Sha256: 66cf76a09f3943b65a7a88a0a4eaeea3cacac14decba1bfcc364b5dc2ffbdb51

Contents?: true

Size: 581 Bytes

Versions: 15

Compression:

Stored size: 581 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)
        [:json, :html, :pdf].include? format.to_sym
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
finapps-2.2.22 lib/finapps/rest/order_reports.rb
finapps-2.2.21 lib/finapps/rest/order_reports.rb
finapps-2.2.20 lib/finapps/rest/order_reports.rb
finapps-2.2.19 lib/finapps/rest/order_reports.rb
finapps-2.2.18 lib/finapps/rest/order_reports.rb
finapps-2.2.17 lib/finapps/rest/order_reports.rb
finapps-2.2.16 lib/finapps/rest/order_reports.rb
finapps-2.2.15 lib/finapps/rest/order_reports.rb
finapps-2.2.14 lib/finapps/rest/order_reports.rb
finapps-2.2.13 lib/finapps/rest/order_reports.rb
finapps-2.2.12 lib/finapps/rest/order_reports.rb
finapps-2.2.11 lib/finapps/rest/order_reports.rb
finapps-2.2.10 lib/finapps/rest/order_reports.rb
finapps-2.2.9 lib/finapps/rest/order_reports.rb
finapps-2.2.8 lib/finapps/rest/order_reports.rb