Class: IActionable::Objects::LeaderboardReport

Inherits:
IActionableObject show all
Defined in:
lib/iactionable/objects/leaderboard_report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ LeaderboardReport

Returns a new instance of LeaderboardReport.



11
12
13
14
15
16
# File 'lib/iactionable/objects/leaderboard_report.rb', line 11

def initialize(key_values={})
  @leaderboard = IActionable::Objects::PointType.new(key_values.delete("Leaderboard"))
  @point_type = IActionable::Objects::PointType.new(key_values.delete("PointType"))
  @profiles = extract_many_as(key_values, "Profiles", IActionable::Objects::ProfileSummary)
  super(key_values)
end

Instance Attribute Details

#leaderboardObject

Returns the value of attribute leaderboard.



7
8
9
# File 'lib/iactionable/objects/leaderboard_report.rb', line 7

def leaderboard
  @leaderboard
end

#page_countObject

Returns the value of attribute page_count.



4
5
6
# File 'lib/iactionable/objects/leaderboard_report.rb', line 4

def page_count
  @page_count
end

#page_numberObject

Returns the value of attribute page_number.



5
6
7
# File 'lib/iactionable/objects/leaderboard_report.rb', line 5

def page_number
  @page_number
end

#point_typeObject

Returns the value of attribute point_type.



8
9
10
# File 'lib/iactionable/objects/leaderboard_report.rb', line 8

def point_type
  @point_type
end

#profilesObject

Returns the value of attribute profiles.



9
10
11
# File 'lib/iactionable/objects/leaderboard_report.rb', line 9

def profiles
  @profiles
end

#total_countObject

Returns the value of attribute total_count.



6
7
8
# File 'lib/iactionable/objects/leaderboard_report.rb', line 6

def total_count
  @total_count
end

Instance Method Details

#to_hashObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/iactionable/objects/leaderboard_report.rb', line 18

def to_hash
  {
    "PageCount" => @page_count,
    "PageNumber" => @page_number,
    "TotalCount" => @total_count,
    "Leaderboard" => @leaderboard.to_hash,
    "PointType" => @point_type.to_hash,
    "Profiles" => @profiles.map{|profile| profile.to_hash}
  }
end