acfs 1.6.0 → 2.0.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 +4 -4
- data/CHANGELOG.md +144 -115
- data/README.md +33 -41
- data/acfs.gemspec +9 -10
- data/lib/acfs/adapter/typhoeus.rb +6 -4
- data/lib/acfs/collections/paginatable.rb +11 -11
- data/lib/acfs/configuration.rb +13 -3
- data/lib/acfs/errors.rb +7 -7
- data/lib/acfs/global.rb +4 -4
- data/lib/acfs/location.rb +2 -2
- data/lib/acfs/operation.rb +1 -1
- data/lib/acfs/request/callbacks.rb +1 -1
- data/lib/acfs/request.rb +1 -1
- data/lib/acfs/resource/attributes/uuid.rb +2 -2
- data/lib/acfs/resource/attributes.rb +1 -1
- data/lib/acfs/resource/dirty.rb +1 -1
- data/lib/acfs/resource/locatable.rb +2 -2
- data/lib/acfs/resource/operational.rb +4 -4
- data/lib/acfs/resource/query_methods.rb +5 -5
- data/lib/acfs/response/status.rb +1 -1
- data/lib/acfs/runner.rb +15 -15
- data/lib/acfs/service/middleware.rb +2 -2
- data/lib/acfs/singleton_resource.rb +2 -2
- data/lib/acfs/stub.rb +35 -30
- data/lib/acfs/version.rb +3 -3
- data/lib/acfs/yard.rb +1 -0
- data/spec/acfs/adapter/typhoeus_spec.rb +4 -4
- data/spec/acfs/collection_spec.rb +66 -41
- data/spec/acfs/configuration_spec.rb +22 -12
- data/spec/acfs/global_spec.rb +14 -12
- data/spec/acfs/location_spec.rb +1 -1
- data/spec/acfs/middleware/json_spec.rb +9 -9
- data/spec/acfs/middleware/{msgpack_spec.rb → message_pack_spec.rb} +7 -7
- data/spec/acfs/operation_spec.rb +4 -3
- data/spec/acfs/request/callbacks_spec.rb +19 -10
- data/spec/acfs/request_spec.rb +15 -19
- data/spec/acfs/resource/attributes/boolean_spec.rb +32 -32
- data/spec/acfs/resource/attributes/date_time_spec.rb +17 -9
- data/spec/acfs/resource/attributes/dict_spec.rb +16 -10
- data/spec/acfs/resource/attributes/float_spec.rb +21 -11
- data/spec/acfs/resource/attributes/integer_spec.rb +11 -6
- data/spec/acfs/resource/attributes/list_spec.rb +13 -8
- data/spec/acfs/resource/attributes/uuid_spec.rb +14 -8
- data/spec/acfs/resource/attributes_spec.rb +33 -32
- data/spec/acfs/resource/dirty_spec.rb +7 -4
- data/spec/acfs/resource/initialization_spec.rb +4 -5
- data/spec/acfs/resource/loadable_spec.rb +3 -1
- data/spec/acfs/resource/locatable_spec.rb +24 -18
- data/spec/acfs/resource/{persistance_spec.rb → persistence_spec.rb} +119 -87
- data/spec/acfs/resource/query_methods_spec.rb +144 -111
- data/spec/acfs/resource/validation_spec.rb +34 -27
- data/spec/acfs/response/formats_spec.rb +8 -8
- data/spec/acfs/response/status_spec.rb +16 -9
- data/spec/acfs/runner_spec.rb +22 -20
- data/spec/acfs/service/middleware_spec.rb +3 -3
- data/spec/acfs/service_spec.rb +5 -4
- data/spec/acfs/singleton_resource_spec.rb +2 -1
- data/spec/acfs/stub_spec.rb +64 -65
- data/spec/acfs_spec.rb +112 -94
- data/spec/spec_helper.rb +10 -6
- data/spec/support/hash.rb +1 -1
- data/spec/support/response.rb +2 -2
- data/spec/support/service.rb +1 -1
- data/spec/support/shared/find_callbacks.rb +14 -10
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/README.md +23 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/rubocop-config.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/CHANGELOG.md +205 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/README.rdoc +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/CHANGELOG.md +67 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/CHANGELOG.md +110 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/README.rdoc +266 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/CHANGELOG.md +157 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/README.md +243 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/appraisal.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/benchmark.gemspec +32 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/bigdecimal.gemspec +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/README.md +167 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/connection_pool.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/README.md +43 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/License.md +41 -0
- data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/README.rdoc +84 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/drb.gemspec +41 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/ethon.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/CHANGELOG.md +465 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/README.md +137 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/ffi.gemspec +42 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/README.md +298 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/changelog.md +119 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/hashdiff.gemspec +39 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/README.md +127 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/README.md +195 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/json.gemspec +64 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/logger.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/CHANGELOG.md +591 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/MIT-LICENSE.txt +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/README.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.4/README.rdoc +835 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE.md +9 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/README.md +293 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/CHANGELOG.md +491 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/README.md +222 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/CHANGELOG.md +998 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/README.md +328 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/license.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/readme.md +47 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/MIT-LICENSE +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/README.md +91 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/rake.gemspec +101 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/README.md +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/LICENSE.md +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/README.md +47 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/Changelog.md +68 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/LICENSE.txt +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/README.md +76 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/rspec-collection_matchers.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/Changelog.md +2415 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/LICENSE.md +26 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/README.md +389 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/Changelog.md +1352 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/LICENSE.md +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/README.md +326 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/Changelog.md +73 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/LICENSE.txt +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/rspec-its.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/Changelog.md +1299 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/LICENSE.md +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/README.md +465 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/Changelog.md +408 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/LICENSE.md +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/README.md +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/README.md +45 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/thor.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/typhoeus.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.2/README.md +55 -0
- data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/CHANGELOG.md +2104 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/README.md +1222 -0
- data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.1.gemspec +36 -0
- data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.1.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/activemodel-8.0.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.1.gemspec +38 -0
- data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/appraisal-2.5.0.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/base64-0.2.0.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.0.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.1.9.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.0.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/crack-1.0.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.5.1.gemspec +37 -0
- data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.1.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/ethon-0.16.0.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/ffi-1.17.1-x86_64-linux-gnu.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/hashdiff-1.1.2.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.6.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/json-2.9.1.gemspec +0 -0
- data/vendor/bundle/ruby/3.4.0/specifications/logger-1.6.5.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.4.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/multi_json-1.15.0.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.1-x86_64-linux-gnu.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.1.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-3.1.8.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.0.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.2.0.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rake-13.2.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rexml-3.4.0.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.0.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-collection_matchers-1.2.1.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.2.gemspec +39 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.3.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-its-2.0.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.2.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.2.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/thor-1.3.2.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/typhoeus-1.4.1.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.2.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/webmock-3.24.0.gemspec +45 -0
- metadata +208 -70
data/README.md
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
# Acfs - *API client for services*
|
|
2
2
|
|
|
3
3
|
[](https://rubygems.org/gems/acfs)
|
|
4
|
-
[](https://github.com/jgraichen/acfs/actions?query=branch%3Amaster)
|
|
4
|
+
[](https://github.com/jgraichen/acfs/actions)
|
|
6
5
|
[](https://coveralls.io/r/jgraichen/acfs)
|
|
7
6
|
[](http://rubydoc.info/github/jgraichen/acfs/master/frames)
|
|
8
7
|
|
|
9
8
|
Acfs is a library to develop API client libraries for single services within a larger service oriented application.
|
|
10
9
|
|
|
11
|
-
Acfs covers model and service abstraction, convenient query and filter methods, full middleware stack for pre-processing requests and responses
|
|
12
|
-
|
|
10
|
+
Acfs covers model and service abstraction, convenient query and filter methods, full middleware stack for pre-processing requests and responses, as well as automatic request queuing and parallel processing.
|
|
13
11
|
|
|
14
12
|
## Installation
|
|
15
13
|
|
|
16
14
|
Add this line to your application's Gemfile:
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
```ruby
|
|
17
|
+
gem 'acfs', '~> 2.0'
|
|
18
|
+
```
|
|
19
19
|
|
|
20
20
|
And then execute:
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
```console
|
|
23
|
+
bundle
|
|
24
|
+
```
|
|
23
25
|
|
|
24
26
|
Or install it yourself as:
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
```console
|
|
29
|
+
gem install acfs
|
|
30
|
+
```
|
|
28
31
|
|
|
29
32
|
## Usage
|
|
30
33
|
|
|
@@ -32,7 +35,7 @@ First you need to define your service(s):
|
|
|
32
35
|
|
|
33
36
|
```ruby
|
|
34
37
|
class UserService < Acfs::Service
|
|
35
|
-
self.base_url = '
|
|
38
|
+
self.base_url = 'https://users.myapp.org'
|
|
36
39
|
|
|
37
40
|
# You can configure middlewares you want to use for the service here.
|
|
38
41
|
# Each service has it own middleware stack.
|
|
@@ -118,10 +121,11 @@ Acfs.run # This call will fire all request as parallel as possible.
|
|
|
118
121
|
|
|
119
122
|
@user.name # => "John
|
|
120
123
|
@comments.size # => 25
|
|
121
|
-
@friends[0].name # => "
|
|
124
|
+
@friends[0].name # => "Miracolix"
|
|
122
125
|
```
|
|
123
126
|
|
|
124
|
-
Use `.find_by` to get first element only. `.find_by` will call the `index`-Action and return the first resource. Optionally passed
|
|
127
|
+
Use `.find_by` to get first element only. `.find_by` will call the `index`-Action and return the first resource. Optionally passed parameters will be sent as `GET` parameters and can be used for filtering in the service's controller.
|
|
128
|
+
|
|
125
129
|
```ruby
|
|
126
130
|
@user = User.find_by age: 24
|
|
127
131
|
|
|
@@ -129,6 +133,7 @@ Acfs.run # Will request `http://users.myapp.org/users?age=24`
|
|
|
129
133
|
|
|
130
134
|
@user # Contains the first user object returned by the index action
|
|
131
135
|
```
|
|
136
|
+
|
|
132
137
|
If no object can be found, `.find_by` will return `nil`. The optional callback will then be called with `nil` as parameter. Use `.find_by!` to raise an `Acfs::ResourceNotFound` exception if no object can be found. `.find_by!` will only invoke the optional callback if an object was successfully loaded.
|
|
133
138
|
|
|
134
139
|
Acfs has basic update support using `PUT` requests:
|
|
@@ -147,7 +152,6 @@ Acfs has basic update support using `PUT` requests:
|
|
|
147
152
|
@user.persisted? # => true
|
|
148
153
|
```
|
|
149
154
|
|
|
150
|
-
|
|
151
155
|
## Singleton resources
|
|
152
156
|
|
|
153
157
|
Singletons can be used in Acfs by creating a new resource which inherits from `SingletonResource`:
|
|
@@ -179,19 +183,16 @@ my_single.save # sends PUT request to /single
|
|
|
179
183
|
my_single.delete # sends DELETE request to /single
|
|
180
184
|
```
|
|
181
185
|
|
|
182
|
-
You also can pass parameters to the find call
|
|
186
|
+
You also can pass parameters to the find call. They will be sent as query parameters to the index action:
|
|
183
187
|
|
|
184
188
|
```ruby
|
|
185
189
|
my_single = Single.find name: 'Max'
|
|
186
190
|
Acfs.run # sends GET request with param to /single?name=Max
|
|
187
191
|
```
|
|
188
192
|
|
|
189
|
-
|
|
190
193
|
## Resource Inheritance
|
|
191
194
|
|
|
192
|
-
Acfs provides a resource inheritance similar to ActiveRecord Single Table Inheritance. If a
|
|
193
|
-
`type` attribute exists and is a valid subclass of your resource they will be converted
|
|
194
|
-
to you subclassed resources:
|
|
195
|
+
Acfs provides a resource inheritance similar to ActiveRecord Single Table Inheritance. If a `type` attribute exists and is a valid subclass of your resource they will be converted to you subclassed resources:
|
|
195
196
|
|
|
196
197
|
```ruby
|
|
197
198
|
class Computer < Acfs::Resource
|
|
@@ -202,8 +203,7 @@ class Pc < Computer end
|
|
|
202
203
|
class Mac < Computer end
|
|
203
204
|
```
|
|
204
205
|
|
|
205
|
-
With the following response on `GET /computers` the collection will contain the appropriate
|
|
206
|
-
subclass resources:
|
|
206
|
+
With the following response on `GET /computers` the collection will contain the appropriate subclass resources:
|
|
207
207
|
|
|
208
208
|
```json
|
|
209
209
|
[
|
|
@@ -223,7 +223,6 @@ Acfs.run
|
|
|
223
223
|
@computer[2].class # => Pc
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
|
|
227
226
|
## Stubbing
|
|
228
227
|
|
|
229
228
|
You can stub resources in applications using an Acfs service client:
|
|
@@ -248,9 +247,9 @@ it 'should find user number one' do
|
|
|
248
247
|
user = MyUser.find 1
|
|
249
248
|
Acfs.run
|
|
250
249
|
|
|
251
|
-
expect(user.id).to
|
|
252
|
-
expect(user.name).to
|
|
253
|
-
expect(user.age).to
|
|
250
|
+
expect(user.id).to eq 1
|
|
251
|
+
expect(user.name).to eq 'John Smith'
|
|
252
|
+
expect(user.age).to eq 32
|
|
254
253
|
|
|
255
254
|
expect(@stub).to be_called
|
|
256
255
|
expect(@stub).to_not be_called 5.times
|
|
@@ -265,12 +264,12 @@ end
|
|
|
265
264
|
it 'should allow stub resource creation' do
|
|
266
265
|
session = Session.create! ident: 'john@exmaple.org', password: 's3cr3t'
|
|
267
266
|
|
|
268
|
-
expect(session.id).to
|
|
269
|
-
expect(session.user).to
|
|
267
|
+
expect(session.id).to eq 'longhash'
|
|
268
|
+
expect(session.user).to eq 1
|
|
270
269
|
end
|
|
271
270
|
```
|
|
272
271
|
|
|
273
|
-
By default Acfs raises an error when a non stubbed resource should be requested. You can switch of the behavior:
|
|
272
|
+
By default, Acfs raises an error when a non stubbed resource should be requested. You can switch of the behavior:
|
|
274
273
|
|
|
275
274
|
```ruby
|
|
276
275
|
before do
|
|
@@ -284,12 +283,9 @@ it 'should find user number one' do
|
|
|
284
283
|
end
|
|
285
284
|
```
|
|
286
285
|
|
|
287
|
-
|
|
288
286
|
## Instrumentation
|
|
289
287
|
|
|
290
|
-
Acfs supports [instrumentation via active support][1]
|
|
291
|
-
|
|
292
|
-
Acfs expose to following events
|
|
288
|
+
Acfs supports [instrumentation via active support][1] and exposes the following events:
|
|
293
289
|
|
|
294
290
|
* `acfs.operation.complete(operation, response)`: Acfs operation completed
|
|
295
291
|
* `acfs.runner.sync_run(operation)`: Run operation right now skipping queue.
|
|
@@ -297,25 +293,21 @@ Acfs expose to following events
|
|
|
297
293
|
* `acfs.before_run`: directly before `acfs.run`
|
|
298
294
|
* `acfs.run`: Run all queued operations.
|
|
299
295
|
|
|
300
|
-
Read [official guide][2]
|
|
296
|
+
Read the [official guide][2] on how to subscribe to these events.
|
|
301
297
|
|
|
302
298
|
[1]: http://guides.rubyonrails.org/active_support_instrumentation.html
|
|
303
299
|
[2]: http://guides.rubyonrails.org/active_support_instrumentation.html#subscribing-to-an-event
|
|
304
300
|
|
|
305
|
-
|
|
306
301
|
## Contributing
|
|
307
302
|
|
|
308
303
|
1. Fork it
|
|
309
304
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
305
|
+
3. Add specs for your feature
|
|
306
|
+
4. Implement your feature
|
|
307
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
|
308
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
|
309
|
+
7. Create new Pull Request
|
|
316
310
|
|
|
317
311
|
## License
|
|
318
312
|
|
|
319
|
-
MIT License
|
|
320
|
-
|
|
321
|
-
Copyright (c) 2013-2020 Jan Graichen. MIT license, see LICENSE for more details.
|
|
313
|
+
[MIT License](LICENSE)
|
data/acfs.gemspec
CHANGED
|
@@ -16,23 +16,22 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
An abstract API base client for service oriented application.
|
|
17
17
|
SUMMARY
|
|
18
18
|
|
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
20
|
+
|
|
19
21
|
spec.files = Dir['**/*'].grep(%r{
|
|
20
22
|
^((bin|lib|test|spec|features)/|
|
|
21
23
|
.*\.gemspec|.*LICENSE.*|.*README.*|.*CHANGELOG.*)
|
|
22
24
|
}xi)
|
|
23
25
|
|
|
24
26
|
spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
|
|
25
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
26
27
|
spec.require_paths = %w[lib]
|
|
27
28
|
|
|
28
|
-
spec.required_ruby_version = '>=
|
|
29
|
-
|
|
30
|
-
spec.add_runtime_dependency 'actionpack', '>= 5.2'
|
|
31
|
-
spec.add_runtime_dependency 'activemodel', '>= 5.2'
|
|
32
|
-
spec.add_runtime_dependency 'activesupport', '>= 5.2'
|
|
33
|
-
spec.add_runtime_dependency 'multi_json', '~> 1.0'
|
|
34
|
-
spec.add_runtime_dependency 'rack'
|
|
35
|
-
spec.add_runtime_dependency 'typhoeus', '~> 1.0'
|
|
29
|
+
spec.required_ruby_version = '>= 3.1.0'
|
|
36
30
|
|
|
37
|
-
spec.
|
|
31
|
+
spec.add_dependency 'actionpack', '>= 7.0'
|
|
32
|
+
spec.add_dependency 'activemodel', '>= 7.0'
|
|
33
|
+
spec.add_dependency 'activesupport', '>= 7.0'
|
|
34
|
+
spec.add_dependency 'multi_json', '~> 1.0'
|
|
35
|
+
spec.add_dependency 'rack'
|
|
36
|
+
spec.add_dependency 'typhoeus', '~> 1.0'
|
|
38
37
|
end
|
|
@@ -7,7 +7,7 @@ module Acfs
|
|
|
7
7
|
DEFAULT_OPTIONS = {
|
|
8
8
|
tcp_keepalive: true,
|
|
9
9
|
tcp_keepidle: 5,
|
|
10
|
-
tcp_keepintvl: 5
|
|
10
|
+
tcp_keepintvl: 5,
|
|
11
11
|
}.freeze
|
|
12
12
|
|
|
13
13
|
# Adapter for Typhoeus.
|
|
@@ -16,8 +16,10 @@ module Acfs
|
|
|
16
16
|
def initialize(**kwargs)
|
|
17
17
|
super
|
|
18
18
|
|
|
19
|
+
extra_opts = kwargs.delete(:opts)
|
|
20
|
+
|
|
19
21
|
@opts = DEFAULT_OPTIONS
|
|
20
|
-
@opts = @opts.merge(
|
|
22
|
+
@opts = @opts.merge(extra_opts) if extra_opts
|
|
21
23
|
@kwargs = kwargs
|
|
22
24
|
end
|
|
23
25
|
|
|
@@ -50,9 +52,9 @@ module Acfs
|
|
|
50
52
|
params: req.params,
|
|
51
53
|
headers: req.headers.merge(
|
|
52
54
|
'Expect' => '',
|
|
53
|
-
'Transfer-Encoding' => ''
|
|
55
|
+
'Transfer-Encoding' => '',
|
|
54
56
|
),
|
|
55
|
-
body: req.body
|
|
57
|
+
body: req.body,
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
request = ::Typhoeus::Request.new(req.url, **@opts, **opts)
|
|
@@ -5,7 +5,7 @@ module Acfs::Collections
|
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
|
|
7
7
|
included do
|
|
8
|
-
def self.operation(_action, **opts, &
|
|
8
|
+
def self.operation(_action, **opts, &)
|
|
9
9
|
opts[:url]
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -17,26 +17,26 @@ module Acfs::Collections
|
|
|
17
17
|
setup_headers response.headers
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def next_page(&
|
|
21
|
-
page
|
|
20
|
+
def next_page(&)
|
|
21
|
+
page('next', &)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def prev_page(&
|
|
25
|
-
page
|
|
24
|
+
def prev_page(&)
|
|
25
|
+
page('prev', &)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def first_page(&
|
|
29
|
-
page
|
|
28
|
+
def first_page(&)
|
|
29
|
+
page('first', &)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def last_page(&
|
|
33
|
-
page
|
|
32
|
+
def last_page(&)
|
|
33
|
+
page('last', &)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def page(rel, &
|
|
36
|
+
def page(rel, &)
|
|
37
37
|
return unless relations[rel]
|
|
38
38
|
|
|
39
|
-
@resource_class.all
|
|
39
|
+
@resource_class.all(nil, url: relations[rel], &)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
private
|
data/lib/acfs/configuration.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Acfs
|
|
|
28
28
|
#
|
|
29
29
|
def configure(&block)
|
|
30
30
|
if block.arity.positive?
|
|
31
|
-
|
|
31
|
+
yield self
|
|
32
32
|
else
|
|
33
33
|
instance_eval(&block)
|
|
34
34
|
end
|
|
@@ -70,8 +70,8 @@ module Acfs
|
|
|
70
70
|
# @return [undefined]
|
|
71
71
|
#
|
|
72
72
|
def load(filename)
|
|
73
|
-
config =
|
|
74
|
-
env
|
|
73
|
+
config = load_yaml_file(filename)
|
|
74
|
+
env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
|
|
75
75
|
|
|
76
76
|
config = config[env] if config.key? env
|
|
77
77
|
config.each do |key, value|
|
|
@@ -116,5 +116,15 @@ module Acfs
|
|
|
116
116
|
@current = configuration if configuration.is_a? Configuration
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
|
|
122
|
+
def load_yaml_file(path)
|
|
123
|
+
if YAML.respond_to?(:safe_load_file)
|
|
124
|
+
YAML.safe_load_file(path, aliases: true)
|
|
125
|
+
else
|
|
126
|
+
YAML.safe_load_file(path, [], [], true)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
119
129
|
end
|
|
120
130
|
end
|
data/lib/acfs/errors.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Acfs
|
|
|
5
5
|
#
|
|
6
6
|
class Error < StandardError
|
|
7
7
|
def initialize(opts = {}, message = nil)
|
|
8
|
-
opts
|
|
9
|
-
super
|
|
8
|
+
opts[:message] = message if message
|
|
9
|
+
super(opts[:message])
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ module Acfs
|
|
|
20
20
|
|
|
21
21
|
message = "#{message}: #{request.method.upcase} #{request.url}"
|
|
22
22
|
|
|
23
|
-
super
|
|
23
|
+
super(message: message)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -40,13 +40,13 @@ module Acfs
|
|
|
40
40
|
|
|
41
41
|
message = if response
|
|
42
42
|
(opts[:message] ? "#{opts[:message]}:" : 'Received') +
|
|
43
|
-
" #{response.code} for #{response.request.method.upcase}" \
|
|
44
|
-
"
|
|
43
|
+
" #{response.code} for #{response.request.method.upcase} " \
|
|
44
|
+
"#{response.request.url} #{response.request.format}"
|
|
45
45
|
else
|
|
46
46
|
opts[:message] || 'Received erroneous response'
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
super
|
|
49
|
+
super(opts, message)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -63,7 +63,7 @@ module Acfs
|
|
|
63
63
|
"on #{operation.resource}.\n" +
|
|
64
64
|
stubs.map {|s| " #{s.opts.pretty_inspect}" }.join
|
|
65
65
|
|
|
66
|
-
super
|
|
66
|
+
super(opts, message)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
data/lib/acfs/global.rb
CHANGED
|
@@ -41,8 +41,8 @@ module Acfs
|
|
|
41
41
|
# @return [undefined]
|
|
42
42
|
# @see Configuration#configure
|
|
43
43
|
#
|
|
44
|
-
def configure(&
|
|
45
|
-
Configuration.current.configure(&
|
|
44
|
+
def configure(&)
|
|
45
|
+
Configuration.current.configure(&)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# @api public
|
|
@@ -71,12 +71,12 @@ module Acfs
|
|
|
71
71
|
def add_callback(resource, &block)
|
|
72
72
|
unless resource.respond_to?(:__callbacks__)
|
|
73
73
|
raise ArgumentError.new 'Given resource is not an Acfs resource ' \
|
|
74
|
-
|
|
74
|
+
"delegator but a: #{resource.class.name}"
|
|
75
75
|
end
|
|
76
76
|
return false if block.nil?
|
|
77
77
|
|
|
78
78
|
if resource.nil? || resource.loaded?
|
|
79
|
-
|
|
79
|
+
yield resource
|
|
80
80
|
else
|
|
81
81
|
resource.__callbacks__ << block
|
|
82
82
|
end
|
data/lib/acfs/location.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Acfs
|
|
|
8
8
|
class Location
|
|
9
9
|
attr_reader :arguments, :raw, :struct, :vars
|
|
10
10
|
|
|
11
|
-
REGEXP = /^:([A-z][A-z0-9_]*)
|
|
11
|
+
REGEXP = /^:([A-z][A-z0-9_]*)$/
|
|
12
12
|
|
|
13
13
|
def initialize(uri, vars = {})
|
|
14
14
|
@raw = URI.parse uri
|
|
@@ -30,7 +30,7 @@ module Acfs
|
|
|
30
30
|
|
|
31
31
|
def str
|
|
32
32
|
uri = raw.dup
|
|
33
|
-
uri.path = "/#{struct.map(
|
|
33
|
+
uri.path = "/#{struct.map {|s| lookup_variable(s) }.join('/')}"
|
|
34
34
|
uri.to_s
|
|
35
35
|
end
|
|
36
36
|
|
data/lib/acfs/operation.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Acfs
|
|
|
56
56
|
|
|
57
57
|
def request
|
|
58
58
|
request = ::Acfs::Request.new url, method: method, params: params,
|
|
59
|
-
|
|
59
|
+
data: data, operation: self
|
|
60
60
|
request.on_complete do |response|
|
|
61
61
|
::ActiveSupport::Notifications.instrument 'acfs.operation.complete',
|
|
62
62
|
operation: self,
|
data/lib/acfs/request.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Acfs::Resource::Attributes
|
|
|
11
11
|
# end
|
|
12
12
|
#
|
|
13
13
|
class UUID < Base
|
|
14
|
-
UUID_REGEXP = /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/i
|
|
14
|
+
UUID_REGEXP = /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/i
|
|
15
15
|
|
|
16
16
|
# @api public
|
|
17
17
|
#
|
|
@@ -35,7 +35,7 @@ module Acfs::Resource::Attributes
|
|
|
35
35
|
def cast_value(value)
|
|
36
36
|
if value.blank?
|
|
37
37
|
nil
|
|
38
|
-
elsif value.to_s
|
|
38
|
+
elsif UUID_REGEXP.match?(value.to_s)
|
|
39
39
|
value
|
|
40
40
|
else
|
|
41
41
|
raise TypeError.new "Invalid UUID: `#{value}'"
|
|
@@ -264,7 +264,7 @@ end
|
|
|
264
264
|
|
|
265
265
|
# Load attribute type classes.
|
|
266
266
|
#
|
|
267
|
-
Dir[File.join(__dir__, 'attributes/*.rb')].
|
|
267
|
+
Dir[File.join(__dir__, 'attributes/*.rb')].each do |path|
|
|
268
268
|
filename = File.basename(path)
|
|
269
269
|
require "acfs/resource/attributes/#{filename}"
|
|
270
270
|
end
|
data/lib/acfs/resource/dirty.rb
CHANGED
|
@@ -116,8 +116,8 @@ class Acfs::Resource
|
|
|
116
116
|
return nil if need_primary_key? && !primary_key?
|
|
117
117
|
|
|
118
118
|
self.class.service
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
.location(self.class, **opts, action: :read)
|
|
120
|
+
.build(attributes).str
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
# @api private
|
|
@@ -12,14 +12,14 @@ class Acfs::Resource
|
|
|
12
12
|
module Operational
|
|
13
13
|
extend ActiveSupport::Concern
|
|
14
14
|
|
|
15
|
-
def operation(
|
|
16
|
-
self.class.operation(
|
|
15
|
+
def operation(...)
|
|
16
|
+
self.class.operation(...)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
module ClassMethods
|
|
20
20
|
# Invoke CRUD operation.
|
|
21
|
-
def operation(
|
|
22
|
-
Acfs.runner.process ::Acfs::Operation.new(self,
|
|
21
|
+
def operation(...)
|
|
22
|
+
Acfs.runner.process ::Acfs::Operation.new(self, ...)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -56,11 +56,11 @@ class Acfs::Resource
|
|
|
56
56
|
#
|
|
57
57
|
# @return [Collection] Collection of requested resources.
|
|
58
58
|
#
|
|
59
|
-
def find(id_or_ids, **opts, &
|
|
59
|
+
def find(id_or_ids, **opts, &)
|
|
60
60
|
if id_or_ids.respond_to? :each
|
|
61
|
-
find_multiple
|
|
61
|
+
find_multiple(id_or_ids, opts, &)
|
|
62
62
|
else
|
|
63
|
-
find_single
|
|
63
|
+
find_single(id_or_ids, opts, &)
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -139,7 +139,7 @@ class Acfs::Resource
|
|
|
139
139
|
find_by params do |m|
|
|
140
140
|
if m.nil?
|
|
141
141
|
raise Acfs::ResourceNotFound.new message: 'Received erroneous ' \
|
|
142
|
-
|
|
142
|
+
"response: no `#{name}` with params #{params} found"
|
|
143
143
|
end
|
|
144
144
|
block&.call m
|
|
145
145
|
end
|
|
@@ -210,7 +210,7 @@ class Acfs::Resource
|
|
|
210
210
|
model = Acfs::Util::ResourceDelegator.new new
|
|
211
211
|
|
|
212
212
|
opts[:params] ||= {}
|
|
213
|
-
opts[:params]
|
|
213
|
+
opts[:params][:id] = id unless id.nil?
|
|
214
214
|
|
|
215
215
|
model.__callbacks__ << block unless block.nil?
|
|
216
216
|
|
data/lib/acfs/response/status.rb
CHANGED
data/lib/acfs/runner.rb
CHANGED
|
@@ -17,16 +17,16 @@ module Acfs
|
|
|
17
17
|
# Process an operation. Synchronous operations will be run
|
|
18
18
|
# and parallel operations will be queued.
|
|
19
19
|
#
|
|
20
|
-
def process(
|
|
21
|
-
::ActiveSupport::Notifications.instrument
|
|
22
|
-
|
|
20
|
+
def process(operation)
|
|
21
|
+
::ActiveSupport::Notifications.instrument('acfs.operation.before_process', operation: operation)
|
|
22
|
+
operation.synchronous? ? run(operation) : enqueue(operation)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
# Run operation right now skipping queue.
|
|
26
26
|
#
|
|
27
|
-
def run(
|
|
28
|
-
::ActiveSupport::Notifications.instrument
|
|
29
|
-
|
|
27
|
+
def run(operation)
|
|
28
|
+
::ActiveSupport::Notifications.instrument('acfs.runner.sync_run', operation: operation) do
|
|
29
|
+
operation_request(operation) {|req| adapter.run req }
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -38,12 +38,12 @@ module Acfs
|
|
|
38
38
|
|
|
39
39
|
# Enqueue operation to be run later.
|
|
40
40
|
#
|
|
41
|
-
def enqueue(
|
|
42
|
-
::ActiveSupport::Notifications.instrument
|
|
41
|
+
def enqueue(operation)
|
|
42
|
+
::ActiveSupport::Notifications.instrument('acfs.runner.enqueue', operation: operation) do
|
|
43
43
|
if running?
|
|
44
|
-
|
|
44
|
+
operation_request(operation) {|req| adapter.queue req }
|
|
45
45
|
else
|
|
46
|
-
queue <<
|
|
46
|
+
queue << operation
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -82,15 +82,15 @@ module Acfs
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def enqueue_operations
|
|
85
|
-
while (
|
|
86
|
-
|
|
85
|
+
while (operation = queue.shift)
|
|
86
|
+
operation_request(operation) {|req| adapter.queue req }
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
def
|
|
91
|
-
return if Acfs::Stub.enabled? && Acfs::Stub.stubbed(
|
|
90
|
+
def operation_request(operation)
|
|
91
|
+
return if Acfs::Stub.enabled? && Acfs::Stub.stubbed(operation)
|
|
92
92
|
|
|
93
|
-
req =
|
|
93
|
+
req = operation.service.prepare(operation.request)
|
|
94
94
|
return unless req.is_a? Acfs::Request
|
|
95
95
|
|
|
96
96
|
req = prepare req
|
|
@@ -35,9 +35,9 @@ module Acfs
|
|
|
35
35
|
# @param [Proc] block Block passed to klass initialize
|
|
36
36
|
# @return [undefined]
|
|
37
37
|
#
|
|
38
|
-
def use(klass,
|
|
38
|
+
def use(klass, ...)
|
|
39
39
|
# Backward compatible behavior
|
|
40
|
-
middleware.insert(0, klass,
|
|
40
|
+
middleware.insert(0, klass, ...)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
# @api private
|