Class: LoadosophiaApi
- Inherits:
-
Object
- Object
- LoadosophiaApi
- Defined in:
- lib/loadosophia-api.rb
Constant Summary collapse
- BASE_URI =
URI.parse('https://loadosophia.org')
Instance Method Summary collapse
- #active_tests ⇒ Object
- #distributions(test_id) ⇒ Object
-
#initialize(token, options = {}) ⇒ LoadosophiaApi
constructor
A new instance of LoadosophiaApi.
- #project_groups ⇒ Object
- #projects(group_id) ⇒ Object
- #test_info(test_id) ⇒ Object
- #tests(project_id) ⇒ Object
- #trash ⇒ Object
Constructor Details
#initialize(token, options = {}) ⇒ LoadosophiaApi
Returns a new instance of LoadosophiaApi.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/loadosophia-api.rb', line 9 def initialize(token, = {}) @token = token @http = Net::HTTP.new(BASE_URI.host, BASE_URI.port) @debug = .delete(:debug) @http.set_debug_output $stderr if @debug if BASE_URI.scheme == "https" @http.use_ssl = true end end |
Instance Method Details
#active_tests ⇒ Object
40 41 42 |
# File 'lib/loadosophia-api.rb', line 40 def active_tests get "/active/list/" end |
#distributions(test_id) ⇒ Object
44 45 46 |
# File 'lib/loadosophia-api.rb', line 44 def distributions(test_id) get "/test/data/#{test_id}/GroupsDist/" end |
#project_groups ⇒ Object
20 21 22 |
# File 'lib/loadosophia-api.rb', line 20 def project_groups get("/projectGroup/list/") end |
#projects(group_id) ⇒ Object
24 25 26 |
# File 'lib/loadosophia-api.rb', line 24 def projects(group_id) get "/projectGroup/projects/?PGroupID=#{group_id}&format=json" end |
#test_info(test_id) ⇒ Object
32 33 34 |
# File 'lib/loadosophia-api.rb', line 32 def test_info(test_id) get("/test/info/#{test_id}/")[0] end |
#tests(project_id) ⇒ Object
28 29 30 |
# File 'lib/loadosophia-api.rb', line 28 def tests(project_id) get("/project/tests/#{project_id}/1/") end |
#trash ⇒ Object
36 37 38 |
# File 'lib/loadosophia-api.rb', line 36 def trash get "/user/trashstate/" end |