Class: Unit::Reward::ListRewardParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/reward/list_reward_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = REWARD_LIMIT, offset = REWARD_OFFSET, transaction_id = nil, rewarded_transaction_id = nil, receiving_account_id = nil, customer_id = nil, card_id = nil, status = nil, since = nil, until_ = nil, tags = nil, sort = nil, include = nil) ⇒ ListRewardParams

Returns a new instance of ListRewardParams.

Parameters:

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

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

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

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

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

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

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

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

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

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

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

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

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



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/unit/models/reward/list_reward_params.rb', line 25

def initialize(limit = REWARD_LIMIT, offset = REWARD_OFFSET, transaction_id = nil, rewarded_transaction_id = nil,
                = nil, customer_id = nil, card_id = nil, status = nil, since = nil,
               until_ = nil, tags = nil, sort = nil, include = nil)
  @limit = limit
  @offset = offset
  @transaction_id = transaction_id
  @rewarded_transaction_id = rewarded_transaction_id
  @receiving_account_id = 
  @customer_id = customer_id
  @card_id = card_id
  @status = status
  @since = since
  @until_ = until_
  @tags = tags
  @sort = sort
  @include = include
end

Instance Attribute Details

#card_idObject (readonly)

Returns the value of attribute card_id.



8
9
10
# File 'lib/unit/models/reward/list_reward_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/reward/list_reward_params.rb', line 8

def customer_id
  @customer_id
end

#includeObject (readonly)

Returns the value of attribute include.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def include
  @include
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def offset
  @offset
end

#receiving_account_idObject (readonly)

Returns the value of attribute receiving_account_id.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def 
  @receiving_account_id
end

#rewarded_transaction_idObject (readonly)

Returns the value of attribute rewarded_transaction_id.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def rewarded_transaction_id
  @rewarded_transaction_id
end

#sinceObject (readonly)

Returns the value of attribute since.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def since
  @since
end

#sortObject (readonly)

Returns the value of attribute sort.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def sort
  @sort
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def status
  @status
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def tags
  @tags
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def transaction_id
  @transaction_id
end

#until_Object (readonly)

Returns the value of attribute until_.



8
9
10
# File 'lib/unit/models/reward/list_reward_params.rb', line 8

def until_
  @until_
end

Instance Method Details

#to_hashObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/unit/models/reward/list_reward_params.rb', line 43

def to_hash
  params = {
    "page[limit]": limit,
    "page[offset]": offset,
    "filter[transactionId]": transaction_id,
    "filter[rewardedTransactionId]": rewarded_transaction_id,
    "filter[receivingAccountId]": ,
    "filter[customerId]": customer_id,
    "filter[cardId]": card_id,
    "filter[since]": since,
    "filter[until]": until_,
    "filter[tags]": tags,
    "sort": sort,
    "include": include&.join(",")
  }
  status&.each_with_index&.map do |val, index|
    params.merge!({ "filter[status][#{index}]": val })
  end
  params.compact
end