Class: SubscriptionValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/util/validation/subscription.rb

Class Method Summary collapse

Class Method Details

.create(data) ⇒ Object



8
9
10
11
# File 'lib/util/validation/subscription.rb', line 8

def self.create(data)
  HelperValidation.validate_string_start(data[:card_id], "crd")
  HelperValidation.validate_string_start(data[:plan_id], "pln")
end

.list(data) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/util/validation/subscription.rb', line 13

def self.list(data)
  # Validate card_brand
  if data.key?('plan_id')
    HelperValidation.validate_string_start(data[:plan_id], "pln")
  end

  # Validate date filter
  if data.key?('creation_date_from') && data.key?('creation_date_to')
    Helpers.validate_date_filter(data[:creation_date_from], data[:creation_date_to])
  end
end