Class: AbsorbApi::User
- Includes:
- Relations
- Defined in:
- lib/absorb_api/user.rb
Instance Attribute Summary collapse
-
#active_status ⇒ Object
Returns the value of attribute active_status.
-
#address ⇒ Object
Returns the value of attribute address.
-
#address2 ⇒ Object
Returns the value of attribute address2.
-
#cc_email_addresses ⇒ Object
Returns the value of attribute cc_email_addresses.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country_id ⇒ Object
Returns the value of attribute country_id.
-
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
-
#date_hired ⇒ Object
Returns the value of attribute date_hired.
-
#date_terminated ⇒ Object
Returns the value of attribute date_terminated.
-
#decimal1 ⇒ Object
Returns the value of attribute decimal1.
-
#decimal2 ⇒ Object
Returns the value of attribute decimal2.
-
#decimal3 ⇒ Object
Returns the value of attribute decimal3.
-
#department_id ⇒ Object
Returns the value of attribute department_id.
-
#email_address ⇒ Object
Returns the value of attribute email_address.
-
#employee_number ⇒ Object
Returns the value of attribute employee_number.
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_admin ⇒ Object
Returns the value of attribute is_admin.
-
#is_instructor ⇒ Object
Returns the value of attribute is_instructor.
-
#is_learner ⇒ Object
Returns the value of attribute is_learner.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#language_id ⇒ Object
Returns the value of attribute language_id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#location ⇒ Object
Returns the value of attribute location.
-
#middle_name ⇒ Object
Returns the value of attribute middle_name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#password ⇒ Object
Returns the value of attribute password.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#province_id ⇒ Object
Returns the value of attribute province_id.
-
#reference_number ⇒ Object
Returns the value of attribute reference_number.
-
#role_ids ⇒ Object
Returns the value of attribute role_ids.
-
#string1 ⇒ Object
Returns the value of attribute string1.
-
#string2 ⇒ Object
Returns the value of attribute string2.
-
#supervisor_id ⇒ Object
Returns the value of attribute supervisor_id.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
-
.courses_from_collection(users) ⇒ Object
gets all associated courses given a collection of users all calls are called in parallel users are chunked in groups of 105 to keep typhoeus from bogging down.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from AbsorbApi::Base
Instance Attribute Details
#active_status ⇒ Object
Returns the value of attribute active_status.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def active_status @active_status end |
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def address @address end |
#address2 ⇒ Object
Returns the value of attribute address2.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def address2 @address2 end |
#cc_email_addresses ⇒ Object
Returns the value of attribute cc_email_addresses.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def cc_email_addresses @cc_email_addresses end |
#city ⇒ Object
Returns the value of attribute city.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def city @city end |
#country_id ⇒ Object
Returns the value of attribute country_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def country_id @country_id end |
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def custom_fields @custom_fields end |
#date_hired ⇒ Object
Returns the value of attribute date_hired.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def date_hired @date_hired end |
#date_terminated ⇒ Object
Returns the value of attribute date_terminated.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def date_terminated @date_terminated end |
#decimal1 ⇒ Object
Returns the value of attribute decimal1.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def decimal1 @decimal1 end |
#decimal2 ⇒ Object
Returns the value of attribute decimal2.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def decimal2 @decimal2 end |
#decimal3 ⇒ Object
Returns the value of attribute decimal3.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def decimal3 @decimal3 end |
#department_id ⇒ Object
Returns the value of attribute department_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def department_id @department_id end |
#email_address ⇒ Object
Returns the value of attribute email_address.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def email_address @email_address end |
#employee_number ⇒ Object
Returns the value of attribute employee_number.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def employee_number @employee_number end |
#external_id ⇒ Object
Returns the value of attribute external_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def external_id @external_id end |
#first_name ⇒ Object
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def first_name @first_name end |
#gender ⇒ Object
Returns the value of attribute gender.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def gender @gender end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def id @id end |
#is_admin ⇒ Object
Returns the value of attribute is_admin.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def is_admin @is_admin end |
#is_instructor ⇒ Object
Returns the value of attribute is_instructor.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def is_instructor @is_instructor end |
#is_learner ⇒ Object
Returns the value of attribute is_learner.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def is_learner @is_learner end |
#job_title ⇒ Object
Returns the value of attribute job_title.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def job_title @job_title end |
#language_id ⇒ Object
Returns the value of attribute language_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def language_id @language_id end |
#last_name ⇒ Object
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def last_name @last_name end |
#location ⇒ Object
Returns the value of attribute location.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def location @location end |
#middle_name ⇒ Object
Returns the value of attribute middle_name.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def middle_name @middle_name end |
#notes ⇒ Object
Returns the value of attribute notes.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def notes @notes end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def password @password end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def phone @phone end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def postal_code @postal_code end |
#province_id ⇒ Object
Returns the value of attribute province_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def province_id @province_id end |
#reference_number ⇒ Object
Returns the value of attribute reference_number.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def reference_number @reference_number end |
#role_ids ⇒ Object
Returns the value of attribute role_ids.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def role_ids @role_ids end |
#string1 ⇒ Object
Returns the value of attribute string1.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def string1 @string1 end |
#string2 ⇒ Object
Returns the value of attribute string2.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def string2 @string2 end |
#supervisor_id ⇒ Object
Returns the value of attribute supervisor_id.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def supervisor_id @supervisor_id end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/absorb_api/user.rb', line 5 def username @username end |
Class Method Details
.courses_from_collection(users) ⇒ Object
gets all associated courses given a collection of users all calls are called in parallel users are chunked in groups of 105 to keep typhoeus from bogging down
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/absorb_api/user.rb', line 34 def self.courses_from_collection(users) courses = [] users.each_slice(105) do |user_slice| AbsorbApi.api.in_parallel do user_slice.each do |user| courses << AbsorbApi.api.get("users/#{user.id}/courses") end end end courses.map { |response| response.body.map { |body| Course.new(body) } }.flatten end |
Instance Method Details
#update(attrs) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/absorb_api/user.rb', line 20 def update(attrs) attrs.keys.each { |k| attrs[k.to_s.camelize] = attrs.delete(k) } attrs['Username'] = username response = AbsorbApi.api.put("users/#{id}", attrs) raise ValidationError if response.status == 500 raise RouteNotFound if response.status == 405 self end |