openstax_accounts 9.2.0 → 9.3.0

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
  SHA256:
3
- metadata.gz: 62551f377f8696bbba00fe09aa6aa6f05e73f19228a53ff80b887ecdd928cbf5
4
- data.tar.gz: 2c44edd556152ed485164f79c4f22eb7bf6678f3ae9f89549c3e522f33df3b7c
3
+ metadata.gz: c0afe5b4c7d13abc030803addf862691d260ea3036361a2043d8f85bf88fa7fb
4
+ data.tar.gz: 24502a41f6cb02271869bdff9869ed3f8efedbe1b393227193746ae6c5d8fc0c
5
5
  SHA512:
6
- metadata.gz: f99971a6f9896957b4cef704c78cc577a91ed54b5569ec887a76f347490a216cb73da401901939a46fdbf965ec1197b99ceb9b7a2a53536e0f01f7a5e6ec66d6
7
- data.tar.gz: ec791f1e30ca7465f151c7ac2e7900993d43d0c387007f046dd2107fef8fd52f76efe1a28e4425ef913b05eb7765df4319aab24d6df449782ac447bb19a98f6f
6
+ metadata.gz: 31573e6b6cef57ee9fb3e8cef36b20ffed6a0e122cf667857daedc1c4049753f7a7bdfcee67f8400711708c9aed795f474dddc194fb1876aa71d654a75ee42e0
7
+ data.tar.gz: ecd575021a0091b2f6f75d93416b09be0335e499498448b10383091ea4aa8eec1d110718b41a50486c54e6b8649fac45e9d06feed7fb0e3916c51461e677c5c0
@@ -34,6 +34,7 @@ module OpenStax
34
34
  account.faculty_status ||= :no_faculty_info
35
35
  account.role ||= :unknown_role
36
36
  account.school_type ||= :unknown_school_type
37
+ account.school_location ||= :unknown_school_location
37
38
  end
38
39
 
39
40
  outputs.account.save if outputs.account.changed?
@@ -12,6 +12,7 @@ module OpenStax::Accounts
12
12
  :self_reported_role,
13
13
  :faculty_status,
14
14
  :school_type,
15
+ :school_location,
15
16
  :salesforce_contact_id,
16
17
  :support_identifier,
17
18
  :is_test,
@@ -26,6 +27,7 @@ module OpenStax::Accounts
26
27
  :confirmed_faculty,
27
28
  :rejected_faculty
28
29
  ]
30
+
29
31
  enum role: [
30
32
  :unknown_role,
31
33
  :student,
@@ -37,15 +39,23 @@ module OpenStax::Accounts
37
39
  :adjunct,
38
40
  :homeschool
39
41
  ]
42
+
40
43
  enum school_type: [
41
44
  :unknown_school_type,
42
45
  :other_school_type,
43
46
  :college,
44
47
  :high_school,
45
- :k12_school
48
+ :k12_school,
49
+ :home_school
50
+ ]
51
+
52
+ enum school_location: [
53
+ :unknown_school_location,
54
+ :domestic_school,
55
+ :foreign_school
46
56
  ]
47
57
 
48
- validates :faculty_status, :role, :school_type, presence: true
58
+ validates :faculty_status, :role, :school_type, :school_location, presence: true
49
59
 
50
60
  validates :uuid, presence: true, uniqueness: true
51
61
  validates :support_identifier, uniqueness: { allow_nil: true }
@@ -9,8 +9,9 @@ module OpenStax
9
9
  # and so must allow read/write on all properties
10
10
  # Do not use it in create/update APIs!
11
11
 
12
- # Otherwise, this representer can be used directly or subclassed
13
- # for an object that delegates openstax_uid, username, first_name, last_name, full_name, # title, faculty_status, role, school_type and salesforce_contact_id to an account
12
+ # This representer can be used directly or subclassed for an object that delegates
13
+ # openstax_uid, username, first_name, last_name, full_name, title, faculty_status,
14
+ # role, school_type, school_location and salesforce_contact_id to an account
14
15
 
15
16
  include Roar::JSON
16
17
 
@@ -85,6 +86,14 @@ module OpenStax
85
86
  }"
86
87
  }
87
88
 
89
+ property :school_location,
90
+ type: String,
91
+ schema_info: {
92
+ description: "One of #{
93
+ OpenStax::Accounts::Account.school_locations.keys.map(&:to_s).inspect
94
+ }"
95
+ }
96
+
88
97
  property :uuid,
89
98
  type: String,
90
99
  schema_info: {
@@ -32,6 +32,8 @@ module OpenStax
32
32
  role: inputs[:role] || :unknown_role,
33
33
  uuid: SecureRandom.uuid,
34
34
  support_identifier: "cs_#{SecureRandom.hex(4)}",
35
+ school_type: inputs[:school_type] || :unknown_school_type,
36
+ school_location: inputs[:school_location] || :unknown_school_location,
35
37
  is_test: true
36
38
  )
37
39
 
@@ -7,7 +7,7 @@ module OpenStax
7
7
 
8
8
  def exec(email: nil, username: nil, password: nil, first_name: nil, last_name: nil,
9
9
  full_name: nil, title: nil, salesforce_contact_id: nil, faculty_status: nil,
10
- role: nil, school_type: nil, is_test: nil)
10
+ role: nil, school_type: nil, school_location: nil, is_kip: nil, is_test: nil)
11
11
  raise(
12
12
  ArgumentError,
13
13
  'You must specify either an email address or a username (and an optional password)'
@@ -23,7 +23,8 @@ module OpenStax
23
23
  email: email, username: username, password: password,
24
24
  first_name: first_name, last_name: last_name, full_name: full_name,
25
25
  salesforce_contact_id: salesforce_contact_id, faculty_status: faculty_status,
26
- role: role, school_type: school_type, is_test: is_test
26
+ role: role, school_type: school_type, school_location: school_location,
27
+ is_kip: is_kip, is_test: is_test
27
28
  )
28
29
  fatal_error(code: :invalid_inputs) unless (200..202).include?(response.status)
29
30
 
@@ -45,7 +46,9 @@ module OpenStax
45
46
  account.faculty_status = faculty_status || :no_faculty_info
46
47
  account.role = role || :unknown_role
47
48
  account.school_type = school_type || :unknown_school_type
49
+ account.school_location = school_location || :unknown_school_location
48
50
  account.support_identifier = support_identifier
51
+ account.is_kip = is_kip
49
52
  account.is_test = is_test
50
53
  end
51
54
 
@@ -0,0 +1,5 @@
1
+ class AddSchoolLocationToOpenStaxAccountsAccounts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :openstax_accounts_accounts, :school_location, :integer, default: 0, null: false
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = '9.2.0'
3
+ VERSION = '9.3.0'
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ FactoryBot.define do
6
6
  faculty_status { OpenStax::Accounts::Account.faculty_statuses[:no_faculty_info] }
7
7
  role { OpenStax::Accounts::Account.roles[:unknown_role] }
8
8
  school_type { OpenStax::Accounts::Account.school_types[:unknown_school_type] }
9
+ school_location { OpenStax::Accounts::Account.school_locations[:unknown_school_location] }
9
10
  uuid { SecureRandom.uuid }
10
11
  support_identifier { "cs_#{SecureRandom.hex(4)}" }
11
12
  is_test { true }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.0
4
+ version: 9.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -342,6 +342,7 @@ files:
342
342
  - db/migrate/14_drop_openstax_uid_and_username_uniqueness.rb
343
343
  - db/migrate/15_drop_accounts_groups.rb
344
344
  - db/migrate/16_add_is_kip_to_openstax_accounts_accounts.rb
345
+ - db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb
345
346
  - db/migrate/1_create_openstax_accounts_groups.rb
346
347
  - db/migrate/2_create_openstax_accounts_group_members.rb
347
348
  - db/migrate/3_create_openstax_accounts_group_owners.rb