Class: Unit::Transaction::ListTransactionParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/transaction/list_transaction_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = TRANSACTION_LIST_LIMIT, offset = TRANSACTION_LIST_OFFSET, account_id = nil, customer_id = nil, query = nil, tags = nil, since = nil, _until = nil, card_id = nil, type = nil, from_amount = nil, to_amount = nil, direction = nil, exclude_fees = nil, sort = nil, include = nil) ⇒ ListTransactionParams

Returns a new instance of ListTransactionParams.

Parameters:

  • limit (Integer) (defaults to: TRANSACTION_LIST_LIMIT)
    • optional

  • offset (Integer) (defaults to: TRANSACTION_LIST_OFFSET)
    • optional

  • account_id (String) (defaults to: nil)
    • optional

  • customer_id (String) (defaults to: nil)
    • optional

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

  • tags (String) (defaults to: nil)
    • optional

  • since (String) (defaults to: nil)
    • optional

  • _until (String) (defaults to: nil)
    • optional

  • card_id (String) (defaults to: nil)
    • optional

  • type (Array<String>) (defaults to: nil)
    • optional

  • from_amount (Integer) (defaults to: nil)
    • optional

  • to_amount (Integer) (defaults to: nil)
    • optional

  • direction (String) (defaults to: nil)
    • optional

  • exclude_fees (Boolean) (defaults to: nil)
    • optional

  • sort (String) (defaults to: nil)
    • optional

  • include (Array<String>) (defaults to: nil)
    • optional



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 26

def initialize(limit = TRANSACTION_LIST_LIMIT, offset = TRANSACTION_LIST_OFFSET,  = nil, customer_id = nil,
               query = nil, tags = nil, since = nil, _until = nil, card_id = nil, type = nil, from_amount = nil, to_amount = nil,
               direction = nil, exclude_fees = nil, sort = nil, include = nil)
  @limit = limit
  @offset = offset
  @account_id = 
  @customer_id = customer_id
  @query = query
  @tags = tags
  @since = since
  @_until = _until
  @card_id = card_id
  @type = type
  @from_amount = from_amount
  @to_amount = to_amount
  @direction = direction
  @exclude_fees = exclude_fees
  @sort = sort
  @include = include
end

Instance Attribute Details

#_untilObject (readonly)

Returns the value of attribute _until.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def _until
  @_until
end

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def 
  @account_id
end

#card_idObject (readonly)

Returns the value of attribute card_id.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def card_id
  @card_id
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def customer_id
  @customer_id
end

#directionObject (readonly)

Returns the value of attribute direction.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def direction
  @direction
end

#exclude_feesObject (readonly)

Returns the value of attribute exclude_fees.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def exclude_fees
  @exclude_fees
end

#from_amountObject (readonly)

Returns the value of attribute from_amount.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def from_amount
  @from_amount
end

#includeObject (readonly)

Returns the value of attribute include.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def include
  @include
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def offset
  @offset
end

#queryObject (readonly)

Returns the value of attribute query.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def query
  @query
end

#sinceObject (readonly)

Returns the value of attribute since.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def since
  @since
end

#sortObject (readonly)

Returns the value of attribute sort.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def sort
  @sort
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def tags
  @tags
end

#to_amountObject (readonly)

Returns the value of attribute to_amount.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def to_amount
  @to_amount
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 8

def type
  @type
end

Instance Method Details

#to_hashObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/unit/models/transaction/list_transaction_params.rb', line 47

def to_hash
  params = { "page[limit]": limit,
             "page[offset]": offset,
             "filter[accountId]": ,
             "filter[customerId]": customer_id,
             "filter[query]": query,
             "filter[tags]": tags,
             "filter[since]": since,
             "filter[until]": _until,
             "filter[cardId]": card_id,
             "filter[fromAmount]": from_amount,
             "filter[toAmount]": to_amount,
             "filter[direction]": direction,
             "excludeFees": exclude_fees,
             "sort": sort,
             "include": include&.join(",") }
  type&.each_with_index&.map do |val, index|
    params.merge!({ "filter[type][#{index}]": val })
  end
  params.compact
end