Class: ExtremeOverclockingClient::User
- Inherits:
-
Object
- Object
- ExtremeOverclockingClient::User
- Includes:
- Request
- Defined in:
- lib/extreme_overclocking_client/user.rb
Constant Summary
Constants included from Request
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#rank ⇒ Object
readonly
Returns the value of attribute rank.
-
#retrieved_at ⇒ Object
readonly
Returns the value of attribute retrieved_at.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#wus ⇒ Object
readonly
Returns the value of attribute wus.
Instance Method Summary collapse
-
#initialize(config:, id: nil, name: nil, team_id: nil) ⇒ User
constructor
A new instance of User.
- #refresh ⇒ Object
Methods included from Request
Constructor Details
#initialize(config:, id: nil, name: nil, team_id: nil) ⇒ User
Returns a new instance of User.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/extreme_overclocking_client/user.rb', line 17 def initialize( config:, id: nil, name: nil, team_id: nil ) unless config.is_a?(ExtremeOverclockingClient::Config) raise ArgumentError, "Param 'config' must be an instance of ExtremeOverclockingClient::Config" end params = fetch(config:, id:, name:, team_id:) build(params:) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def name @name end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def points @points end |
#rank ⇒ Object (readonly)
Returns the value of attribute rank.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def rank @rank end |
#retrieved_at ⇒ Object (readonly)
Returns the value of attribute retrieved_at.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def retrieved_at @retrieved_at end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def team @team end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def updated_at @updated_at end |
#wus ⇒ Object (readonly)
Returns the value of attribute wus.
7 8 9 |
# File 'lib/extreme_overclocking_client/user.rb', line 7 def wus @wus end |
Instance Method Details
#refresh ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/extreme_overclocking_client/user.rb', line 31 def refresh time_difference_in_hours = (Time.now.utc - Time.parse(@retrieved_at)) / 3600 return unless time_difference_in_hours >= 3.0 params = fetch(config: @config, id: @id) build(params:) self end |