Class: Unit::Customer::ListCustomerParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/customer/list_customer_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = 100, offset = 0, query = nil, email = nil, tags = nil, status = nil, sort = nil) ⇒ ListCustomerParams

Returns a new instance of ListCustomerParams.

Parameters:

  • optional

    limit [Integer] Maximum number of resources that will be returned. Maximum is 1000 resources.

  • optional

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

  • optional

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

  • optional

    email [String] Filter customers by email address (case sensitive).

  • optional

    tags [Hash] Filter customers by tags. More information regarding tags: docs.unit.co/#tags

  • optional

    status [String] Filter customers by status. One of: Active, Archived

  • optional

    sort [String] 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/customer/list_customer_params.rb', line 19

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

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def email
  @email
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def offset
  @offset
end

#queryObject (readonly)

Returns the value of attribute query.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def query
  @query
end

#sortObject (readonly)

Returns the value of attribute sort.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def sort
  @sort
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/unit/models/customer/list_customer_params.rb', line 8

def status
  @status
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/customer/list_customer_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/customer/list_customer_params.rb', line 30

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