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: https://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: https://docs.unit.co/#tags

  • query (String) (defaults to: nil) —

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

  • status (String) (defaults to: nil) —
  • 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

#email ⇒ Object (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

#limit ⇒ Object (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

#offset ⇒ Object (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

#query ⇒ Object (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

#sort ⇒ Object (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

#status ⇒ Object (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

#tags ⇒ Object (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_hash ⇒ Object



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