quiz_api_client 4.15.0 → 4.16.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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8956ccc8a8479d5daeeb2522f42581495c2e39934d221df99fbc4e697e6d13ca
         | 
| 4 | 
            +
              data.tar.gz: 8399e28b565d2f608d1315e78220fa49d6bade8c06483c88f396ebb802f850c3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5eaeeec5e0452e1c71aa4f3a9ea86228e73ab1fc7b9d82aa7eee73d94154dfb65af0d76468cb9d826c2bd22ff8b71ec6b39767dc0de1119fff6fa1b7b2be744b
         | 
| 7 | 
            +
              data.tar.gz: b045527ab2f0cc7114124d950bbcd4811cee1014fe93db94fe12e33beff083e986c0be38b67ec6a68cea334cdbc3e6e4c08738bc6b43bb1e65660d5abf731151
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            module QuizApiClient::Services
         | 
| 2 | 
            +
              class AccountService < BaseApiService
         | 
| 3 | 
            +
                def update(params, token: nil)
         | 
| 4 | 
            +
                  patch_to_quiz_api(params: params, token: token)
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                private
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def patch_to_quiz_api(params:, token:)
         | 
| 10 | 
            +
                  client(token: token).patch(
         | 
| 11 | 
            +
                    '/api/account',
         | 
| 12 | 
            +
                    course: params
         | 
| 13 | 
            +
                  )
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
    
        data/lib/quiz_api_client.rb
    CHANGED
    
    | @@ -18,6 +18,10 @@ module QuizApiClient | |
| 18 18 | 
             
                  yield(config) if block_given?
         | 
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 | 
            +
                def account_service
         | 
| 22 | 
            +
                  @_account_service ||= Services::AccountService.new(config)
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 21 25 | 
             
                def bank_service
         | 
| 22 26 | 
             
                  @_bank_service ||= Services::BankService.new(config)
         | 
| 23 27 | 
             
                end
         | 
| @@ -134,6 +138,7 @@ require 'quiz_api_client/http_request/metrics' | |
| 134 138 | 
             
            require 'quiz_api_client/services/jwt_service'
         | 
| 135 139 | 
             
            require 'quiz_api_client/services/base_api_service'
         | 
| 136 140 |  | 
| 141 | 
            +
            require 'quiz_api_client/services/account_service'
         | 
| 137 142 | 
             
            require 'quiz_api_client/services/bank_service'
         | 
| 138 143 | 
             
            require 'quiz_api_client/services/bank_entries_service'
         | 
| 139 144 | 
             
            require 'quiz_api_client/services/content_exports_service'
         | 
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            RSpec.describe QuizApiClient::Services::AccountService do
         | 
| 2 | 
            +
              let(:host) { 'api.host' }
         | 
| 3 | 
            +
              let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
         | 
| 4 | 
            +
              let(:subject) { described_class.new(config) }
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              describe '#update' do
         | 
| 7 | 
            +
                let(:params) do
         | 
| 8 | 
            +
                  {
         | 
| 9 | 
            +
                    account: { tenant_domain: 'foo.instructure.com' }
         | 
| 10 | 
            +
                  }
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                let(:response) do
         | 
| 14 | 
            +
                  {
         | 
| 15 | 
            +
                    'id' => '1',
         | 
| 16 | 
            +
                    'uuid' => '5862e3c7-b598-40c8-996f-cd0cd1778358',
         | 
| 17 | 
            +
                    'tenant_domain' => params[:tenant_domain]
         | 
| 18 | 
            +
                  }
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                let(:expected_url) { "https://#{host}/api/account" }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                before do
         | 
| 24 | 
            +
                  stub_request(:patch, 'https://api.host/api/account')
         | 
| 25 | 
            +
                    .to_return(
         | 
| 26 | 
            +
                      status: 200,
         | 
| 27 | 
            +
                      body: response.to_json,
         | 
| 28 | 
            +
                      headers: { 'Content-Type' => 'application/json' }
         | 
| 29 | 
            +
                    )
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                it 'pathces to the correct endpoint and returns the response' do
         | 
| 33 | 
            +
                  expect(
         | 
| 34 | 
            +
                    subject.update(params: params, token: 'token').parsed_response
         | 
| 35 | 
            +
                  ).to eq(response)
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: quiz_api_client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.16.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alex Slaughter
         | 
| @@ -15,7 +15,7 @@ authors: | |
| 15 15 | 
             
            autorequire: 
         | 
| 16 16 | 
             
            bindir: exe
         | 
| 17 17 | 
             
            cert_chain: []
         | 
| 18 | 
            -
            date: 2024- | 
| 18 | 
            +
            date: 2024-06-04 00:00:00.000000000 Z
         | 
| 19 19 | 
             
            dependencies:
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 21 21 | 
             
              name: httparty
         | 
| @@ -179,6 +179,7 @@ files: | |
| 179 179 | 
             
            - lib/quiz_api_client/http_request/failure.rb
         | 
| 180 180 | 
             
            - lib/quiz_api_client/http_request/metrics.rb
         | 
| 181 181 | 
             
            - lib/quiz_api_client/json_formatter.rb
         | 
| 182 | 
            +
            - lib/quiz_api_client/services/account_service.rb
         | 
| 182 183 | 
             
            - lib/quiz_api_client/services/analyses_service.rb
         | 
| 183 184 | 
             
            - lib/quiz_api_client/services/bank_entries_service.rb
         | 
| 184 185 | 
             
            - lib/quiz_api_client/services/bank_service.rb
         | 
| @@ -212,6 +213,7 @@ files: | |
| 212 213 | 
             
            - spec/quiz_api_client/http_request/failure_spec.rb
         | 
| 213 214 | 
             
            - spec/quiz_api_client/http_request/metrics_spec.rb
         | 
| 214 215 | 
             
            - spec/quiz_api_client_spec.rb
         | 
| 216 | 
            +
            - spec/services/account_service_spec.rb
         | 
| 215 217 | 
             
            - spec/services/analyses_service_spec.rb
         | 
| 216 218 | 
             
            - spec/services/bank_entries_service_spec.rb
         | 
| 217 219 | 
             
            - spec/services/bank_service_spec.rb
         | 
| @@ -267,6 +269,7 @@ test_files: | |
| 267 269 | 
             
            - spec/quiz_api_client/http_request/failure_spec.rb
         | 
| 268 270 | 
             
            - spec/quiz_api_client/http_request/metrics_spec.rb
         | 
| 269 271 | 
             
            - spec/quiz_api_client_spec.rb
         | 
| 272 | 
            +
            - spec/services/account_service_spec.rb
         | 
| 270 273 | 
             
            - spec/services/analyses_service_spec.rb
         | 
| 271 274 | 
             
            - spec/services/bank_entries_service_spec.rb
         | 
| 272 275 | 
             
            - spec/services/bank_service_spec.rb
         |