absorb_api 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02c5a03c4a4758a27209109699ae55a57d849e66
4
- data.tar.gz: f50ab6a6793e5d6297e4902771326d89011236c3
3
+ metadata.gz: c3eb2f3a9b826a7ecace98a90ee361669a68c6a5
4
+ data.tar.gz: 40de4863fd8c9b706c802d778fbf6763b25b5748
5
5
  SHA512:
6
- metadata.gz: 122994a2244511e8885ee0ba69ec7c52b8c16cb0e55984b5641a7d2aa009d468d0d07cd6237da2f63cff609b40164138557fa73447a657acd56656e5e4592790
7
- data.tar.gz: 499c482b9374b50c36f210154bca7d92fcf28257b9322560e79479f5004ad7c16da29f371c2e67af3d11526aea08f83571dbb991445e64fb2f8e8a8dcf163ede
6
+ metadata.gz: 0200d4112113652248aa63b2b633bfac3860627afc44561c9715ac6c86ac355faa2cd4318f19071bae8b178ee78dc0c9f3a46943b9ac5619566951527962ac8d
7
+ data.tar.gz: 682411c891a5a79d2816a10c847fd0d300ca4dfb10a26af86b585d4abdc0921b8c70fda313bbbd747a4f8eb666b460481229ed0fe056345b2d44644624822816
data/Gemfile CHANGED
@@ -9,3 +9,4 @@ gem 'json'
9
9
  gem 'faraday_middleware'
10
10
  gem 'activesupport'
11
11
  gem 'activemodel'
12
+ gem 'pry'
@@ -2,16 +2,35 @@ module AbsorbApi
2
2
  class User < Base
3
3
  include Relations
4
4
 
5
- attr_accessor :id, :department_id, :first_name, :middle_name, :last_name, :username, :password, :email_address, :cc_email_addresses, :language_id, :gender, :address, :address2, :city, :province_id, :country_id, :postal_code, :phone, :employee_number, :location, :job_title, :reference_number, :date_hired, :date_terminated, :notes, :custom_fields, :role_ids, :active_status, :is_learner, :is_admin, :is_instructor, :external_id, :supervisor_id, :decimal2, :string1, :decimal1, :string2, :decimal3, :job_title
5
+ attr_accessor :id, :department_id, :first_name, :middle_name, :last_name,
6
+ :username, :password, :email_address, :cc_email_addresses,
7
+ :language_id, :gender, :address, :address2, :city,
8
+ :province_id, :country_id, :postal_code, :phone,
9
+ :employee_number, :location, :job_title, :reference_number,
10
+ :date_hired, :date_terminated, :notes, :custom_fields,
11
+ :role_ids, :active_status, :is_learner, :is_admin,
12
+ :is_instructor, :external_id, :supervisor_id, :decimal2,
13
+ :string1, :decimal1, :string2, :decimal3, :job_title
6
14
 
7
15
  has_many :courses
8
16
  has_many :enrollments, klass: :course_enrollment
9
17
  has_many :certificates
10
18
  has_many :resources
11
19
 
20
+ def update(attrs)
21
+ attrs.keys.each { |k| attrs[k.to_s.camelize] = attrs.delete(k) }
22
+ attrs['Username'] = username
23
+
24
+ response = AbsorbApi.api.put("users/#{id}", attrs)
25
+ raise ValidationError if response.status == 500
26
+ raise RouteNotFound if response.status == 405
27
+
28
+ self
29
+ end
30
+
12
31
  # gets all associated courses given a collection of users
13
32
  # all calls are called in parallel
14
- # users are chunked in groups of 105 to keep typhoeus from getting bogged down
33
+ # users are chunked in groups of 105 to keep typhoeus from bogging down
15
34
  def self.courses_from_collection(users)
16
35
  courses = []
17
36
  users.each_slice(105) do |user_slice|
@@ -1,3 +1,3 @@
1
1
  module AbsorbApi
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: absorb_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - npezza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -177,3 +177,4 @@ signing_key:
177
177
  specification_version: 4
178
178
  summary: API wrapper for Absorb LMS
179
179
  test_files: []
180
+ has_rdoc: