Class: XporterOnDemand::Client

Inherits:
Object
  • Object
show all
Includes:
API, Utils
Defined in:
lib/xporter_on_demand/client.rb

Direct Known Subclasses

Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#assign_attributes, #configure_request, #create_result, #dont_raise_exception, #handle_exceptions, #parameterize, #unwrap

Methods included from API

#changed_rows, #db_status, #fetch, #get_endpoint, #query

Constructor Details

#initialize(token = nil, args = {}) ⇒ Client

Returns a new instance of Client.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xporter_on_demand/client.rb', line 13

def initialize(token = nil, args = {})
  @token            = token
  @args             = args

  details           = token_details
  @available_scopes = details["Scopes"]
  @estab            = @args.delete(:estab)
  @estab            ||= details["Estab"]

  args[:edubase] ? edubase_client : school_client
end

Instance Attribute Details

#available_scopesObject (readonly)

Returns the value of attribute available_scopes.



11
12
13
# File 'lib/xporter_on_demand/client.rb', line 11

def available_scopes
  @available_scopes
end

#estabObject (readonly)

Returns the value of attribute estab.



11
12
13
# File 'lib/xporter_on_demand/client.rb', line 11

def estab
  @estab
end

#tokenObject (readonly)

Returns the value of attribute token.



11
12
13
# File 'lib/xporter_on_demand/client.rb', line 11

def token
  @token
end

#uriObject (readonly)

Returns the value of attribute uri.



11
12
13
# File 'lib/xporter_on_demand/client.rb', line 11

def uri
  @uri
end

Instance Method Details

#edubase_clientObject

This is not finished and probably won’t even work.



34
35
36
# File 'lib/xporter_on_demand/client.rb', line 34

def edubase_client
  @uri = API_PATH + "RunQuery/?"
end

#school_clientObject



29
30
31
# File 'lib/xporter_on_demand/client.rb', line 29

def school_client
  @uri = API_PATH + "School/" + estab + "/"
end