Class: Osu::User

Inherits:
Object
  • Object
show all
Defined in:
lib/osu/data.rb

Overview

An Osu! player

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, mode) ⇒ User


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/osu/data.rb', line 62

def initialize(data, mode)
  @id = data['user_id'].to_i
  @name = data['username']

  @count300 = data['count300'].to_i
  @count100 = data['count100'].to_i
  @count50 = data['count50'].to_i

  @playcount = data['playcount'].to_i

  @ranked_score = data['ranked_score'].to_i
  @total_score = data['total_score'].to_i

  @pp_rank = data['pp_rank'].to_i
  @level = data['level'].to_f
  @pp_raw = data['pp_raw'].to_f
  @accuracy = data['accuracy'].to_f

  @count_rank = {
    ss: data['count_rank_ss'].to_i,
    s: data['count_rank_s'].to_i,
    a: data['count_rank_a'].to_i
  }

  @country = data['country']
  @pp_country_rank = data['pp_country_rank'].to_i

  @events = data['events'].map { |e| Event.new e }

  @mode = mode
end

Instance Attribute Details

#accuracyFloat (readonly)


42
43
44
# File 'lib/osu/data.rb', line 42

def accuracy
  @accuracy
end

#count100Integer (readonly)


18
19
20
# File 'lib/osu/data.rb', line 18

def count100
  @count100
end

#count300Integer (readonly)


15
16
17
# File 'lib/osu/data.rb', line 15

def count300
  @count300
end

#count50Integer (readonly)


21
22
23
# File 'lib/osu/data.rb', line 21

def count50
  @count50
end

#count_rankHash<Symbol, Integer> (readonly)

A hash of the number of times this User has completed a game with ss, s, or a rank


48
49
50
# File 'lib/osu/data.rb', line 48

def count_rank
  @count_rank
end

#countryString (readonly)


51
52
53
# File 'lib/osu/data.rb', line 51

def country
  @country
end

#eventsArray<Event> (readonly)


57
58
59
# File 'lib/osu/data.rb', line 57

def events
  @events
end

#idInteger (readonly)


9
10
11
# File 'lib/osu/data.rb', line 9

def id
  @id
end

#levelFloat (readonly)


36
37
38
# File 'lib/osu/data.rb', line 36

def level
  @level
end

#modeSymbol (readonly)


60
61
62
# File 'lib/osu/data.rb', line 60

def mode
  @mode
end

#nameString (readonly)


12
13
14
# File 'lib/osu/data.rb', line 12

def name
  @name
end

#playcountInteger (readonly)


24
25
26
# File 'lib/osu/data.rb', line 24

def playcount
  @playcount
end

#pp_country_rankInteger (readonly)


54
55
56
# File 'lib/osu/data.rb', line 54

def pp_country_rank
  @pp_country_rank
end

#pp_rankInteger (readonly)


33
34
35
# File 'lib/osu/data.rb', line 33

def pp_rank
  @pp_rank
end

#pp_rawFloat (readonly)


39
40
41
# File 'lib/osu/data.rb', line 39

def pp_raw
  @pp_raw
end

#ranked_scoreInteger (readonly)


27
28
29
# File 'lib/osu/data.rb', line 27

def ranked_score
  @ranked_score
end

#total_scoreInteger (readonly)


30
31
32
# File 'lib/osu/data.rb', line 30

def total_score
  @total_score
end

Instance Method Details

#profile_urlString


95
96
97
# File 'lib/osu/data.rb', line 95

def profile_url
  "#{API::BASE_URL}/u/#{id}"
end