Class: Spartacus
- Inherits:
-
Object
- Object
- Spartacus
- Includes:
- AlumniStories, Checkpoints, CourseSubjects, HTTParty, Mentors, Notifications, Resources, RoadmapSections, Roadmaps, Users
- Defined in:
- lib/spartacus.rb
Instance Method Summary collapse
-
#initialize(email, password, api_base_path = "https://www.bloc.io/api/v1") ⇒ Spartacus
constructor
A new instance of Spartacus.
Methods included from Notifications
Methods included from Mentors
#mark_mentor_assessment_read, #mentor_assssments, #mentor_paychecks, #mentor_students, #mentors
Methods included from Users
#get_accomplishments, #get_availability, #get_available_mentors, #get_enrollments, #get_me, #get_user, #get_users, #onboard, #update_password, #update_user
Methods included from BaseClient
#auth_header, #convert_keys, #convert_response, #handle_timeouts, #success?, #whitelist_params
Methods included from Roadmaps
#get_roadmap, #get_sections_for_roadmap, #update_roadmap
Methods included from RoadmapSections
Methods included from Resources
#add_tag_to_resource, #create_resource, #remove_tag_from_resource, #tags_for_resource, #update_resource
Methods included from CourseSubjects
#create_course_subject, #update_course_subject
Methods included from Checkpoints
#batch_create_checkpoints, #get_checkpoint, #update_checkpoint
Methods included from AlumniStories
Constructor Details
#initialize(email, password, api_base_path = "https://www.bloc.io/api/v1") ⇒ Spartacus
Returns a new instance of Spartacus.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/spartacus.rb', line 30 def initialize(email, password, api_base_path="https://www.bloc.io/api/v1") @api_base_path = api_base_path url = "#{@api_base_path}/sessions" response = self.class.post(url, body: { email: email, password: password }) if success?(response.code) response_hash = JSON.parse(response.body) @auth_token = response_hash["auth_token"] else raise response.body end end |