Sha256: e6734ce5124f3b7ac0f5d1af81c7c68d200c5ece87784768dff1cc2b73d6cadf

Contents?: true

Size: 1.31 KB

Versions: 43

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module Files
  class Warning
    attr_reader :options, :attributes

    def initialize(attributes = {}, options = {})
      @attributes = attributes || {}
      @options = options || {}
    end

    # array - A list of warnings
    def warnings
      @attributes[:warnings]
    end

    # Parameters:
    #   page - integer - Current page number.
    #   per_page - integer - Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
    #   action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
    def self.list(params = {}, options = {})
      raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
      raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
      raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)

      response, options = Api.send_request("/warnings", :get, params, options)
      response.data.map { |object| Warning.new(object, options) }
    end

    def self.all(params = {}, options = {})
      list(params, options)
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
files.com-1.0.9 lib/files.com/models/warning.rb
files.com-1.0.8 lib/files.com/models/warning.rb
files.com-1.0.7 lib/files.com/models/warning.rb