Class: PortalsAPI

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

Constant Summary collapse

PORTALS_HOST =
'https://portal2-beta.instructure.com/'.freeze
PORTALS_USER =
'rkuss2'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(portal_access_token) ⇒ PortalsAPI



10
11
12
# File 'lib/portals_api.rb', line 10

def initialize(portal_access_token)
  @access_token = portal_access_token
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/portals_api.rb', line 5

def access_token
  @access_token
end

Instance Method Details

#cancel_portal_request(portals_host = PORTALS_HOST, portals_user = PORTALS_USER) ⇒ Object



36
37
38
39
# File 'lib/portals_api.rb', line 36

def cancel_portal_request(portals_host = PORTALS_HOST, portals_user = PORTALS_USER)
  portal_endpoint = portals_host + 'canvas/cancelRequest?user=' + portals_user
  get_request(portal_endpoint).body
end

#checkout_patchset(patchset_name = 'master', dbcreate = false, portals_host = PORTALS_HOST, portals_user = PORTALS_USER) ⇒ Object



29
30
31
32
33
34
# File 'lib/portals_api.rb', line 29

def checkout_patchset(patchset_name = 'master', dbcreate = false,
  portals_host = PORTALS_HOST, portals_user = PORTALS_USER)
  portal_endpoint = portals_host + 'canvas/checkoutPatchset?user=' + portals_user + '&patchset=' + patchset_name
  portal_endpoint += '&db_created=0' if dbcreate
  get_request(portal_endpoint).body
end

#retrieve_checkedout_patchset(portals_host = PORTALS_HOST, portals_user = PORTALS_USER) ⇒ Object



24
25
26
27
# File 'lib/portals_api.rb', line 24

def retrieve_checkedout_patchset(portals_host = PORTALS_HOST, portals_user = PORTALS_USER)
  portal_endpoint = portals_host + 'canvas/isCheckedOut/' + portals_user
  get_request(portal_endpoint).body
end

#retrieve_portal_status(portals_host = PORTALS_HOST, portals_user = PORTALS_USER) ⇒ Object



14
15
16
17
# File 'lib/portals_api.rb', line 14

def retrieve_portal_status(portals_host = PORTALS_HOST, portals_user = PORTALS_USER)
  portal_endpoint = portals_host + 'canvas/isStarted/' + portals_user
  get_request(portal_endpoint).body
end

#start_stop_portal(portals_host = PORTALS_HOST, portals_user = PORTALS_USER) ⇒ Object



19
20
21
22
# File 'lib/portals_api.rb', line 19

def start_stop_portal(portals_host = PORTALS_HOST, portals_user = PORTALS_USER)
  portal_endpoint = portals_host + 'canvas/startStopPortal/' + portals_user
  get_request(portal_endpoint).body
end