Class: Wonde::Client

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

Overview

Main client class that the user will interface with

Examples:

require 'wondeclient'
client = Wonde::Client.new('TOKEN_GOES_HERE')
client.schools.all().each do |school|
  p school.name
end

Returns:

  • (Object)

Constant Summary collapse

@@version =
'0.0.6'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Object

Initialize a Client Object

Examples:

Wonde::Client.new("SOMETOKEN") #=> #<Wonde::Client:0x007fb223953da0 @token="SOMETOKEN">

Parameters:

  • token (String)


28
29
30
31
32
33
# File 'lib/client.rb', line 28

def initialize(token)
  @@token = token
  @token = token
  @schools = Wonde::Schools.new(token)
  @attendanceCodes = Wonde::AttendanceCodes.new(token)
end

Instance Attribute Details

#attendanceCodesObject

Returns the value of attribute attendanceCodes.



17
18
19
# File 'lib/client.rb', line 17

def attendanceCodes
  @attendanceCodes
end

#schoolsObject

Returns the value of attribute schools.



17
18
19
# File 'lib/client.rb', line 17

def schools
  @schools
end

#tokenObject

Returns the value of attribute token.



17
18
19
# File 'lib/client.rb', line 17

def token
  @token
end

Instance Method Details

#requestAccess(schoolId) ⇒ Object

requestAccess endpoint POST

Examples:

client = Wonde::Client.new("SOMETOKEN")
client.requestAccess("A0000000000")

Parameters:

  • schoolId (String)

Returns:

  • (Object)


55
56
57
# File 'lib/client.rb', line 55

def requestAccess(schoolId)
  return Wonde::Endpoints.new(@token, ('schools/' + schoolId + '/request-access')).post()
end

#revokeAccess(schoolId) ⇒ Object

revokeAccess endpoint DELETE

Examples:

client = Wonde::Client.new("SOMETOKEN")
client.revokeAccess('A0000000000')

Parameters:

  • schoolId (String)

Returns:

  • (Object)


67
68
69
# File 'lib/client.rb', line 67

def revokeAccess(schoolId)
  return Wonde::Endpoints.new(@token, ('schools/' + schoolId + '/revoke-access')).delete()
end

#school(id) ⇒ Object

Get School/Schools Object

Examples:

client = Wonde::Client.new("SOMETOKEN")
school = client.school('SCHOOLID')

Parameters:

  • id (String)

Returns:

  • (Object)


43
44
45
# File 'lib/client.rb', line 43

def school(id)
  return Wonde::Schools.new(@token, id)
end