Sha256: 2d5cf47b86918e9f4c638100813b8da95111aa65ad5dd88dff04aba53b90e650

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

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

      def show(id)
        raise MissingArgumentsError.new 'Missing argument: id.' if id.blank?
        super
      end

      def list(_params=nil)
        # TODO: get the paramaters for the pagination
        # GET /v2/list/orders/:page/:requested/:sort/:asc
        # :page - page number requested
        # :requested - number of results per page requested
        # :sort - sort order
        # options:
        #     date - the date of the order
        #     status - the status of the order
        # :asc - sort order true for asc false for desc

        super 'list/orders/1/10000/date/false'
      end

      def update(id, params)
        raise MissingArgumentsError.new 'Missing argument: id.' if id.blank?
        raise MissingArgumentsError.new 'Missing argument: params' if params.blank?
        # Params array need matching Institution ids & Account ids
        # Validations to check each Institution id has at least one account id
        # Validations to check at least 1 Institution id or 1 account "params.length >= 1"

        path = "#{end_point}/#{ERB::Util.url_encode(id)}"

        super params, path
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
finapps-2.0.27 lib/finapps/rest/orders.rb
finapps-2.0.26 lib/finapps/rest/orders.rb
finapps-2.0.25 lib/finapps/rest/orders.rb
finapps-2.0.24 lib/finapps/rest/orders.rb
finapps-2.0.23 lib/finapps/rest/orders.rb
finapps-2.0.22 lib/finapps/rest/orders.rb
finapps-2.0.21 lib/finapps/rest/orders.rb