Sha256: 22350cc9cd741845d597a2ff8482d32eb9b86d5ba14fed672a42f8d116ac5679

Contents?: true

Size: 1.75 KB

Versions: 43

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

module Files
  class Inbox
    attr_reader :options, :attributes

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

    # string - User description
    def description
      @attributes[:description]
    end

    # string - Text that will be shown to the users on the Inbox.  Use this field to provide custom instructions.
    def help_text
      @attributes[:help_text]
    end

    # string - Unique key for inbox
    def key
      @attributes[:key]
    end

    # boolean - Show this inbox on site login page?
    def show_on_login_page
      @attributes[:show_on_login_page]
    end

    # string - Inbox title
    def title
      @attributes[:title]
    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("/inboxes", :get, params, options)
      response.data.map { |object| Inbox.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.49 lib/files.com/models/inbox.rb
files.com-1.0.48 lib/files.com/models/inbox.rb
files.com-1.0.47 lib/files.com/models/inbox.rb
files.com-1.0.46 lib/files.com/models/inbox.rb
files.com-1.0.45 lib/files.com/models/inbox.rb
files.com-1.0.44 lib/files.com/models/inbox.rb
files.com-1.0.43 lib/files.com/models/inbox.rb
files.com-1.0.42 lib/files.com/models/inbox.rb
files.com-1.0.41 lib/files.com/models/inbox.rb
files.com-1.0.40 lib/files.com/models/inbox.rb
files.com-1.0.39 lib/files.com/models/inbox.rb
files.com-1.0.38 lib/files.com/models/inbox.rb
files.com-1.0.37 lib/files.com/models/inbox.rb
files.com-1.0.36 lib/files.com/models/inbox.rb
files.com-1.0.35 lib/files.com/models/inbox.rb
files.com-1.0.34 lib/files.com/models/inbox.rb
files.com-1.0.33 lib/files.com/models/inbox.rb
files.com-1.0.32 lib/files.com/models/inbox.rb
files.com-1.0.31 lib/files.com/models/inbox.rb
files.com-1.0.30 lib/files.com/models/inbox.rb