Class: Unit::Application::ListApplicationParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/application/list_application_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(offset = APPLICATION_LIST_OFFSET, limit = APPLICATION_LIST_LIMIT, email = nil, tags = nil, query = nil, status = nil, sort = nil) ⇒ ListApplicationParams

Returns a new instance of ListApplicationParams.

Parameters:

  • offset (Integer) (defaults to: APPLICATION_LIST_OFFSET)

    Number of resources to skip. See pagination: docs.unit.co/#intro-pagination

  • limit (Integer) (defaults to: APPLICATION_LIST_LIMIT)

    The limit Maximum number of resources that will be returned. Maximum is 1000 resources.

  • email (String) (defaults to: nil)

    Filter applications by email address (case sensitive).

  • tags (Hash) (defaults to: nil)

    Filter applications by tags. More information regarding tags: docs.unit.co/#tags

  • query (String) (defaults to: nil)

    Search term according to the: docs.unit.co/#full-text-search

  • status (String) (defaults to: nil)

    Filter applications by status: docs.unit.co/applications/#application-statuses

  • sort (String) (defaults to: nil)

    Sorts the resources by the specified field.

  • sort=createdAt (Hash)

    a customizable set of options

  • sort=-createdAt (Hash)

    a customizable set of options



19
20
21
22
23
24
25
26
27
28
# File 'lib/unit/models/application/list_application_params.rb', line 19

def initialize(offset = APPLICATION_LIST_OFFSET, limit = APPLICATION_LIST_LIMIT, email = nil, tags = nil,
               query = nil, status = nil, sort = nil)
  @offset = offset
  @limit = limit
  @email = email
  @tags = tags
  @query = query
  @status = status
  @sort = sort
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def email
  @email
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def offset
  @offset
end

#queryObject (readonly)

Returns the value of attribute query.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def query
  @query
end

#sortObject (readonly)

Returns the value of attribute sort.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def sort
  @sort
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def status
  @status
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/application/list_application_params.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_hashObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/unit/models/application/list_application_params.rb', line 30

def to_hash
  params = { "page[limit]": limit,
             "page[offset]": offset,
             "filter[email]": email,
             "filter[tags]": tags,
             "filter[query]": query,
             "filter[status]": status,
             "sort": sort }
  params.compact
end