Sha256: 389749b18c4bb1f5d84620ad17e3ecd50650f4ff44d87df41ca6676d03548fb3

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

module Dag
  class Client::API
    module ListParams
      def list_params(options)
        params = {}

        max = options[:max]

        if max.present?
          unless max.kind_of?(Integer)
            raise Dag::Client::ParameterInvalid.new("max should be integer")
          end

          if max < 1
            raise Dag::Client::ParameterInvalid.new("max should be greater than 0:#{max}")
          end

          if max > 100
            raise Dag::Client::ParameterInvalid.new("max should be less than 100 or equal to 100:#{max}")
          end

          params.merge!('max' => max)
        end

        marker = options[:marker]


        if marker.present?
          params.merge!('marker' => marker)
        end

        params
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iij-dag-client-1.0.2 lib/dag/client/api/list_params.rb
iij-dag-client-1.0.1 lib/dag/client/api/list_params.rb