Class: GfreshPoint::RequestObjects::EarnPointRequest

Inherits:
RequestObject
  • Object
show all
Defined in:
lib/gfresh_point/request_objects/earn_point_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestObject

#add_error, #errors, #has_errors, #success?

Constructor Details

#initialize(app_id, user_id, event_name, origin_id, comment) ⇒ EarnPointRequest

Returns a new instance of EarnPointRequest.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 6

def initialize(app_id, user_id, event_name, origin_id, comment)
  @app_id = app_id
  @user_id = user_id
  @event_name = event_name
  @origin_id = origin_id
  @comment = comment

  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 event_name.blank?
    add_error('event_name', "event_name can not be blank")
  end
end

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



4
5
6
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 4

def app_id
  @app_id
end

#commentObject

Returns the value of attribute comment.



4
5
6
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 4

def comment
  @comment
end

#event_nameObject

Returns the value of attribute event_name.



4
5
6
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 4

def event_name
  @event_name
end

#origin_idObject

Returns the value of attribute origin_id.



4
5
6
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 4

def origin_id
  @origin_id
end

#user_idObject

Returns the value of attribute user_id.



4
5
6
# File 'lib/gfresh_point/request_objects/earn_point_request.rb', line 4

def user_id
  @user_id
end