class GfreshPoint::RequestObjects::ConsumePointRequest

Attributes

app_id[RW]
comment[RW]
event_name[RW]
force[RW]
origin_id[RW]
point[RW]
user_id[RW]

Public Class Methods

new(app_id, user_id, point, event_name, origin_id, force, comment) click to toggle source
# File lib/gfresh_point/request_objects/consume_point_request.rb, line 6
def initialize(app_id, user_id, point, event_name, origin_id, force, comment)
  @app_id = app_id
  @user_id = user_id
  @point = point
  @event_name = event_name
  @origin_id = origin_id
  @comment = comment
  @force = force

  if app_id.blank?
    add_error('app_id', "App id can not be blank")
  end
  if user_id.blank?
    add_error('user_id', "User id can not be blank")
  end
  if point.blank?
    add_error('point', "point can not be blank")
  elsif point < 0
    add_error('point', "point must larger than 0")
  end
end