Class: Unit::RecurringPayment::ListRecurringPaymentParams
- Inherits:
-
Object
- Object
- Unit::RecurringPayment::ListRecurringPaymentParams
- Defined in:
- lib/unit/models/recurring_payment/list_recurring_payment_params.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
-
#from_end_time ⇒ Object
readonly
Returns the value of attribute from_end_time.
-
#from_start_time ⇒ Object
readonly
Returns the value of attribute from_start_time.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#sort ⇒ Object
readonly
Returns the value of attribute sort.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#to_end_time ⇒ Object
readonly
Returns the value of attribute to_end_time.
-
#to_start_time ⇒ Object
readonly
Returns the value of attribute to_start_time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(limit = RECURRING_PAYMENT_LIMIT, offset = RECURRING_PAYMENT_OFFSET, account_id = nil, customer_id = nil, status = nil, type = nil, from_start_time = nil, to_start_time = nil, from_end_time = nil, to_end_time = nil, sort = nil) ⇒ ListRecurringPaymentParams
constructor
A new instance of ListRecurringPaymentParams.
- #to_hash ⇒ Object
Constructor Details
#initialize(limit = RECURRING_PAYMENT_LIMIT, offset = RECURRING_PAYMENT_OFFSET, account_id = nil, customer_id = nil, status = nil, type = nil, from_start_time = nil, to_start_time = nil, from_end_time = nil, to_end_time = nil, sort = nil) ⇒ ListRecurringPaymentParams
Returns a new instance of ListRecurringPaymentParams.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 22 def initialize(limit = RECURRING_PAYMENT_LIMIT, offset = RECURRING_PAYMENT_OFFSET, account_id = nil, customer_id = nil, status = nil, type = nil, from_start_time = nil, to_start_time = nil, from_end_time = nil, to_end_time = nil, sort = nil) @limit = limit @offset = offset @account_id = account_id @customer_id = customer_id @status = status @type = type @from_start_date = from_start_time @to_start_date = to_start_time @from_end_date = from_end_time @to_end_date = to_end_time @sort = sort end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def account_id @account_id end |
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def customer_id @customer_id end |
#from_end_time ⇒ Object (readonly)
Returns the value of attribute from_end_time.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def from_end_time @from_end_time end |
#from_start_time ⇒ Object (readonly)
Returns the value of attribute from_start_time.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def from_start_time @from_start_time end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def offset @offset end |
#sort ⇒ Object (readonly)
Returns the value of attribute sort.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def sort @sort end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def status @status end |
#to_end_time ⇒ Object (readonly)
Returns the value of attribute to_end_time.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def to_end_time @to_end_time end |
#to_start_time ⇒ Object (readonly)
Returns the value of attribute to_start_time.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def to_start_time @to_start_time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 8 def type @type end |
Instance Method Details
#to_hash ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/unit/models/recurring_payment/list_recurring_payment_params.rb', line 37 def to_hash payload = { "page[limit]": limit, "page[offset]": offset, "filter[accountId]": account_id, "filter[customerId]": customer_id, "filter[fromStartTime]": from_start_time, "filter[toStartTime]": to_start_time, "filter[fromEndTime]": from_end_time, "filter[toEndTime]": to_end_time, "sort": sort } filters = %i[status type] filters.each do |filter| values = send(filter) values&.each_with_index&.map do |val, index| params.merge!({ "filter[#{filter}][#{index}]": val }) end end payload.compact! end |