openstax_accounts 9.0.3 → 9.0.4
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 +4 -4
- data/app/handlers/openstax/accounts/sessions_callback.rb +1 -0
- data/app/models/openstax/accounts/account.rb +12 -2
- data/app/representers/openstax/accounts/api/v1/account_representer.rb +11 -2
- data/app/routines/openstax/accounts/dev/create_account.rb +2 -0
- data/app/routines/openstax/accounts/find_or_create_account.rb +3 -2
- data/db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb +5 -0
- data/lib/openstax/accounts/version.rb +1 -1
- data/spec/factories/openstax_accounts_account.rb +1 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 90b87730485400afb68d52f5ffc0c2c54348a8ccc4a0484afdbade1c10a7e9ae
         | 
| 4 | 
            +
              data.tar.gz: 31a2ce0e354d58d33313260f5c125649b5a1c0124ef6362a61123afdeb5bb834
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 022e79a44e3d134d1661fc7087a5bab2937e256c8f3ac9d3a5096790758f4a59175c8940a85753b78574294f0a3f277c2723d22d51efd4d121af902fbc0d1fd3
         | 
| 7 | 
            +
              data.tar.gz: 6f62aac96d93356f27631c2edbc70e4434942da615069939be98a151bb03e24788aaff320b450f1ef31a4492bfd2854f1904d80172122753607d9f675a3de6d8
         | 
| @@ -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 | 
            -
                      #  | 
| 13 | 
            -
                      #  | 
| 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_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,7 @@ 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, is_test: is_test
         | 
| 27 27 | 
             
                      )
         | 
| 28 28 | 
             
                      fatal_error(code: :invalid_inputs) unless (200..202).include?(response.status)
         | 
| 29 29 |  | 
| @@ -45,6 +45,7 @@ module OpenStax | |
| 45 45 | 
             
                      account.faculty_status = faculty_status || :no_faculty_info
         | 
| 46 46 | 
             
                      account.role = role || :unknown_role
         | 
| 47 47 | 
             
                      account.school_type = school_type || :unknown_school_type
         | 
| 48 | 
            +
                      account.school_location = school_location || :unknown_school_location
         | 
| 48 49 | 
             
                      account.support_identifier = support_identifier
         | 
| 49 50 | 
             
                      account.is_test = is_test
         | 
| 50 51 | 
             
                    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.0. | 
| 4 | 
            +
              version: 9.0.4
         | 
| 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- | 
| 11 | 
            +
            date: 2020-05-29 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
         |