Class: Openstud::Base

Inherits:
Object
  • Object
show all
Includes:
Authenticator, Bio
Defined in:
lib/openstud/base.rb

Overview

main class that includes all Openstud services

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Bio

#info_student!

Methods included from Authenticator

#login!, #refresh_token!

Constructor Details

#initialize(student_id: '', password: '') ⇒ Base

Returns a new instance of Base

Since:

  • 0.1.0


16
17
18
19
20
# File 'lib/openstud/base.rb', line 16

def initialize(student_id: '', password: '')
  @student_id = student_id
  @password = password
  @max_tries = 3
end

Instance Attribute Details

#max_triesObject (readonly)

Since:

  • 0.1.0


14
15
16
# File 'lib/openstud/base.rb', line 14

def max_tries
  @max_tries
end

#passwordObject

Since:

  • 0.1.0


12
13
14
# File 'lib/openstud/base.rb', line 12

def password
  @password
end

#student_idObject

Since:

  • 0.1.0


11
12
13
# File 'lib/openstud/base.rb', line 11

def student_id
  @student_id
end

#tokenObject

Since:

  • 0.1.0


13
14
15
# File 'lib/openstud/base.rb', line 13

def token
  @token
end

Instance Method Details

#valid_id?Boolean

Since:

  • 0.1.0


26
27
28
# File 'lib/openstud/base.rb', line 26

def valid_id?
  /\A\d+\z/.match @student_id
end

#valid_password?Boolean

Since:

  • 0.1.0


22
23
24
# File 'lib/openstud/base.rb', line 22

def valid_password?
  !@password.empty?
end