module Validation

Public Instance Methods

is_valid_data(data) click to toggle source
# File lib/tacklebox/apis/error.rb, line 20
def is_valid_data(data)
  !!data
end
is_valid_event_data(data) click to toggle source
# File lib/tacklebox/apis/error.rb, line 41
def is_valid_event_data(data)
  if data['eventType']
    data['event_type'] = data['eventType']
  end
  
  if data['idempotencyKey']
    data['idempotency_key'] = data['idempotencyKey']
  end
  
  (
    data['event_type'] &&
    data['event_type'].class == String &&
    data['idempotency_key'] &&
    data['idempotency_key'].class == String &&
    data['payload']
  )
end
is_valid_id(id) click to toggle source
# File lib/tacklebox/apis/error.rb, line 16
def is_valid_id(id)
  id && id.class == String
end
is_valid_name(data) click to toggle source
# File lib/tacklebox/apis/error.rb, line 24
def is_valid_name(data)
  data['name'] && data['name'].class == String
end
is_valid_subscription_data(data) click to toggle source
# File lib/tacklebox/apis/error.rb, line 28
def is_valid_subscription_data(data)
  if data['eventTypes']
    data['event_types'] = data['eventTypes']
  end
  
  (
    data['url'] &&
    data['url'].class == String &&
    data['event_types'] &&
    data['event_types'].length > 0
  )
end