acfs 1.6.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +144 -115
  3. data/README.md +33 -41
  4. data/acfs.gemspec +9 -10
  5. data/lib/acfs/adapter/typhoeus.rb +6 -4
  6. data/lib/acfs/collections/paginatable.rb +11 -11
  7. data/lib/acfs/configuration.rb +13 -3
  8. data/lib/acfs/errors.rb +7 -7
  9. data/lib/acfs/global.rb +4 -4
  10. data/lib/acfs/location.rb +2 -2
  11. data/lib/acfs/operation.rb +1 -1
  12. data/lib/acfs/request/callbacks.rb +1 -1
  13. data/lib/acfs/request.rb +1 -1
  14. data/lib/acfs/resource/attributes/uuid.rb +2 -2
  15. data/lib/acfs/resource/attributes.rb +1 -1
  16. data/lib/acfs/resource/dirty.rb +1 -1
  17. data/lib/acfs/resource/locatable.rb +2 -2
  18. data/lib/acfs/resource/operational.rb +4 -4
  19. data/lib/acfs/resource/query_methods.rb +5 -5
  20. data/lib/acfs/response/status.rb +1 -1
  21. data/lib/acfs/runner.rb +15 -15
  22. data/lib/acfs/service/middleware.rb +2 -2
  23. data/lib/acfs/singleton_resource.rb +2 -2
  24. data/lib/acfs/stub.rb +35 -30
  25. data/lib/acfs/version.rb +3 -3
  26. data/lib/acfs/yard.rb +1 -0
  27. data/spec/acfs/adapter/typhoeus_spec.rb +4 -4
  28. data/spec/acfs/collection_spec.rb +66 -41
  29. data/spec/acfs/configuration_spec.rb +22 -12
  30. data/spec/acfs/global_spec.rb +14 -12
  31. data/spec/acfs/location_spec.rb +1 -1
  32. data/spec/acfs/middleware/json_spec.rb +9 -9
  33. data/spec/acfs/middleware/{msgpack_spec.rb → message_pack_spec.rb} +7 -7
  34. data/spec/acfs/operation_spec.rb +4 -3
  35. data/spec/acfs/request/callbacks_spec.rb +19 -10
  36. data/spec/acfs/request_spec.rb +15 -19
  37. data/spec/acfs/resource/attributes/boolean_spec.rb +32 -32
  38. data/spec/acfs/resource/attributes/date_time_spec.rb +17 -9
  39. data/spec/acfs/resource/attributes/dict_spec.rb +16 -10
  40. data/spec/acfs/resource/attributes/float_spec.rb +21 -11
  41. data/spec/acfs/resource/attributes/integer_spec.rb +11 -6
  42. data/spec/acfs/resource/attributes/list_spec.rb +13 -8
  43. data/spec/acfs/resource/attributes/uuid_spec.rb +14 -8
  44. data/spec/acfs/resource/attributes_spec.rb +33 -32
  45. data/spec/acfs/resource/dirty_spec.rb +7 -4
  46. data/spec/acfs/resource/initialization_spec.rb +4 -5
  47. data/spec/acfs/resource/loadable_spec.rb +3 -1
  48. data/spec/acfs/resource/locatable_spec.rb +24 -18
  49. data/spec/acfs/resource/{persistance_spec.rb → persistence_spec.rb} +119 -87
  50. data/spec/acfs/resource/query_methods_spec.rb +144 -111
  51. data/spec/acfs/resource/validation_spec.rb +34 -27
  52. data/spec/acfs/response/formats_spec.rb +8 -8
  53. data/spec/acfs/response/status_spec.rb +16 -9
  54. data/spec/acfs/runner_spec.rb +22 -20
  55. data/spec/acfs/service/middleware_spec.rb +3 -3
  56. data/spec/acfs/service_spec.rb +5 -4
  57. data/spec/acfs/singleton_resource_spec.rb +2 -1
  58. data/spec/acfs/stub_spec.rb +64 -65
  59. data/spec/acfs_spec.rb +112 -94
  60. data/spec/spec_helper.rb +10 -6
  61. data/spec/support/hash.rb +1 -1
  62. data/spec/support/response.rb +2 -2
  63. data/spec/support/service.rb +1 -1
  64. data/spec/support/shared/find_callbacks.rb +14 -10
  65. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/LICENSE +21 -0
  66. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/README.md +23 -0
  67. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/rubocop-config.gemspec +31 -0
  68. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/CHANGELOG.md +205 -0
  69. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/MIT-LICENSE +21 -0
  70. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/README.rdoc +57 -0
  71. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/CHANGELOG.md +67 -0
  72. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/MIT-LICENSE +21 -0
  73. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/README.rdoc +40 -0
  74. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/CHANGELOG.md +110 -0
  75. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/MIT-LICENSE +21 -0
  76. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/README.rdoc +266 -0
  77. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/CHANGELOG.md +157 -0
  78. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/MIT-LICENSE +20 -0
  79. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/README.rdoc +40 -0
  80. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
  81. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
  82. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
  83. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
  84. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/MIT-LICENSE +21 -0
  85. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/README.md +243 -0
  86. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/appraisal.gemspec +29 -0
  87. data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
  88. data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
  89. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
  90. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/benchmark.gemspec +32 -0
  91. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
  92. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/bigdecimal.gemspec +57 -0
  93. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
  94. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
  95. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
  96. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
  97. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
  98. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
  99. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/LICENSE +20 -0
  100. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/README.md +167 -0
  101. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/connection_pool.gemspec +24 -0
  102. data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/LICENSE +20 -0
  103. data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/README.md +43 -0
  104. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
  105. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
  106. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
  107. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/License.md +41 -0
  108. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/README.rdoc +84 -0
  109. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
  110. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/drb.gemspec +41 -0
  111. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
  112. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
  113. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
  114. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
  115. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
  116. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
  117. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/ethon.gemspec +26 -0
  118. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/CHANGELOG.md +465 -0
  119. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE +24 -0
  120. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE.SPECS +22 -0
  121. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/README.md +137 -0
  122. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/ffi.gemspec +42 -0
  123. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/LICENSE +19 -0
  124. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/README.md +298 -0
  125. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/changelog.md +119 -0
  126. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/hashdiff.gemspec +39 -0
  127. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/MIT-LICENSE +20 -0
  128. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/README.md +127 -0
  129. data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/README.md +195 -0
  130. data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/json.gemspec +64 -0
  131. data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/README.md +104 -0
  132. data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/logger.gemspec +28 -0
  133. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/CHANGELOG.md +591 -0
  134. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/MIT-LICENSE.txt +23 -0
  135. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/README.md +410 -0
  136. data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.4/README.rdoc +835 -0
  137. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
  138. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
  139. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
  140. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
  141. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE.md +9 -0
  142. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/README.md +293 -0
  143. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/CHANGELOG.md +491 -0
  144. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/LICENSE.txt +22 -0
  145. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/README.md +222 -0
  146. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
  147. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  148. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
  149. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/CHANGELOG.md +998 -0
  150. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/MIT-LICENSE +20 -0
  151. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/README.md +328 -0
  152. data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/license.md +72 -0
  153. data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/readme.md +47 -0
  154. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
  155. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
  156. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/MIT-LICENSE +23 -0
  157. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/README.md +91 -0
  158. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
  159. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
  160. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
  161. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
  162. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
  163. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/rake.gemspec +101 -0
  164. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
  165. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
  166. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
  167. data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/LICENSE.txt +22 -0
  168. data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/README.md +57 -0
  169. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/LICENSE.md +27 -0
  170. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/README.md +47 -0
  171. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/Changelog.md +68 -0
  172. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/LICENSE.txt +27 -0
  173. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/README.md +76 -0
  174. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/rspec-collection_matchers.gemspec +33 -0
  175. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/Changelog.md +2415 -0
  176. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/LICENSE.md +26 -0
  177. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/README.md +389 -0
  178. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/Changelog.md +1352 -0
  179. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/LICENSE.md +25 -0
  180. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/README.md +326 -0
  181. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/Changelog.md +73 -0
  182. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/LICENSE.txt +27 -0
  183. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/README.md +104 -0
  184. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/rspec-its.gemspec +31 -0
  185. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/Changelog.md +1299 -0
  186. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/LICENSE.md +25 -0
  187. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/README.md +465 -0
  188. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/Changelog.md +408 -0
  189. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/LICENSE.md +23 -0
  190. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/README.md +40 -0
  191. data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
  192. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/LICENSE.md +20 -0
  193. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/README.md +45 -0
  194. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/thor.gemspec +33 -0
  195. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
  196. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
  197. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
  198. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/typhoeus.gemspec +25 -0
  199. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
  200. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
  201. data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.2/README.md +55 -0
  202. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
  203. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
  204. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/CHANGELOG.md +2104 -0
  205. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/LICENSE +20 -0
  206. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/README.md +1222 -0
  207. data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.1.gemspec +36 -0
  208. data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.1.gemspec +33 -0
  209. data/vendor/bundle/ruby/3.4.0/specifications/activemodel-8.0.1.gemspec +26 -0
  210. data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.1.gemspec +38 -0
  211. data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
  212. data/vendor/bundle/ruby/3.4.0/specifications/appraisal-2.5.0.gemspec +31 -0
  213. data/vendor/bundle/ruby/3.4.0/specifications/base64-0.2.0.gemspec +23 -0
  214. data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.0.gemspec +23 -0
  215. data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.1.9.gemspec +25 -0
  216. data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
  217. data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
  218. data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.0.gemspec +28 -0
  219. data/vendor/bundle/ruby/3.4.0/specifications/crack-1.0.0.gemspec +27 -0
  220. data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
  221. data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.5.1.gemspec +37 -0
  222. data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.1.gemspec +22 -0
  223. data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
  224. data/vendor/bundle/ruby/3.4.0/specifications/ethon-0.16.0.gemspec +24 -0
  225. data/vendor/bundle/ruby/3.4.0/specifications/ffi-1.17.1-x86_64-linux-gnu.gemspec +31 -0
  226. data/vendor/bundle/ruby/3.4.0/specifications/hashdiff-1.1.2.gemspec +30 -0
  227. data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.6.gemspec +27 -0
  228. data/vendor/bundle/ruby/3.4.0/specifications/json-2.9.1.gemspec +0 -0
  229. data/vendor/bundle/ruby/3.4.0/specifications/logger-1.6.5.gemspec +22 -0
  230. data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.0.gemspec +27 -0
  231. data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.4.gemspec +31 -0
  232. data/vendor/bundle/ruby/3.4.0/specifications/multi_json-1.15.0.gemspec +26 -0
  233. data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.1-x86_64-linux-gnu.gemspec +31 -0
  234. data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.1.gemspec +24 -0
  235. data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
  236. data/vendor/bundle/ruby/3.4.0/specifications/rack-3.1.8.gemspec +31 -0
  237. data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.0.gemspec +30 -0
  238. data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
  239. data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.2.0.gemspec +28 -0
  240. data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
  241. data/vendor/bundle/ruby/3.4.0/specifications/rake-13.2.1.gemspec +26 -0
  242. data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
  243. data/vendor/bundle/ruby/3.4.0/specifications/rexml-3.4.0.gemspec +25 -0
  244. data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.0.gemspec +31 -0
  245. data/vendor/bundle/ruby/3.4.0/specifications/rspec-collection_matchers-1.2.1.gemspec +27 -0
  246. data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.2.gemspec +39 -0
  247. data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.3.gemspec +33 -0
  248. data/vendor/bundle/ruby/3.4.0/specifications/rspec-its-2.0.0.gemspec +27 -0
  249. data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.2.gemspec +33 -0
  250. data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.2.gemspec +29 -0
  251. data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
  252. data/vendor/bundle/ruby/3.4.0/specifications/thor-1.3.2.gemspec +28 -0
  253. data/vendor/bundle/ruby/3.4.0/specifications/typhoeus-1.4.1.gemspec +24 -0
  254. data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
  255. data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.2.gemspec +23 -0
  256. data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
  257. data/vendor/bundle/ruby/3.4.0/specifications/webmock-3.24.0.gemspec +45 -0
  258. metadata +208 -70
data/README.md CHANGED
@@ -1,30 +1,33 @@
1
1
  # Acfs - *API client for services*
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/acfs?logo=ruby)](https://rubygems.org/gems/acfs)
4
- [![Build Status](https://img.shields.io/travis/jgraichen/acfs/master?logo=travis)](https://travis-ci.org/jgraichen/acfs)
5
- [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jgraichen/acfs/Test/master?logo=github)](https://github.com/jgraichen/acfs/actions?query=branch%3Amaster)
4
+ [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jgraichen/acfs/test.yml?logo=github)](https://github.com/jgraichen/acfs/actions)
6
5
  [![Coverage Status](http://img.shields.io/coveralls/jgraichen/acfs/master.svg)](https://coveralls.io/r/jgraichen/acfs)
7
6
  [![RubyDoc Documentation](http://img.shields.io/badge/rubydoc-here-blue.svg)](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 on a per service level and automatic request queuing and parallel processing. See Usage for more.
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
- gem 'acfs', '~> 1.3'
16
+ ```ruby
17
+ gem 'acfs', '~> 2.0'
18
+ ```
19
19
 
20
20
  And then execute:
21
21
 
22
- > bundle
22
+ ```console
23
+ bundle
24
+ ```
23
25
 
24
26
  Or install it yourself as:
25
27
 
26
- > gem install acfs
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 = 'http://users.myapp.org'
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 # => "Miraculix"
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 params will be sent as `GET` parameters and can be used for filtering in the service's controller.
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, these will sent as GET params to the index action:
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 be == 1
252
- expect(user.name).to be == 'John Smith'
253
- expect(user.age).to be == 32
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 be == 'longhash'
269
- expect(session.user).to be == 1
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] to see to to subscribe.
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
- 4. Add specs for your feature
311
- 5. Implement your feature
312
- 6. Commit your changes (`git commit -am 'Add some feature'`)
313
- 7. Push to the branch (`git push origin my-new-feature`)
314
- 8. Create new Pull Request
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 = '>= 2.5.0'
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.add_development_dependency 'bundler'
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(opts) if (opts = kwargs.delete(:opts))
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, &_block)
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(&block)
21
- page 'next', &block
20
+ def next_page(&)
21
+ page('next', &)
22
22
  end
23
23
 
24
- def prev_page(&block)
25
- page 'prev', &block
24
+ def prev_page(&)
25
+ page('prev', &)
26
26
  end
27
27
 
28
- def first_page(&block)
29
- page 'first', &block
28
+ def first_page(&)
29
+ page('first', &)
30
30
  end
31
31
 
32
- def last_page(&block)
33
- page 'last', &block
32
+ def last_page(&)
33
+ page('last', &)
34
34
  end
35
35
 
36
- def page(rel, &block)
36
+ def page(rel, &)
37
37
  return unless relations[rel]
38
38
 
39
- @resource_class.all nil, url: relations[rel], &block
39
+ @resource_class.all(nil, url: relations[rel], &)
40
40
  end
41
41
 
42
42
  private
@@ -28,7 +28,7 @@ module Acfs
28
28
  #
29
29
  def configure(&block)
30
30
  if block.arity.positive?
31
- block.call self
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 = YAML.safe_load(File.read(filename), [], [], true)
74
- env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
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.merge! message: message if message
9
- super opts[:message]
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 message: message
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
- " #{response.request.url} #{response.request.format}"
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 opts, message
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 opts, message
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(&block)
45
- Configuration.current.configure(&block)
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
- "delegator but a: #{resource.class.name}"
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
- block.call resource
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_]*)$/.freeze
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(&method(:lookup_variable)).join('/')}"
33
+ uri.path = "/#{struct.map {|s| lookup_variable(s) }.join('/')}"
34
34
  uri.to_s
35
35
  end
36
36
 
@@ -56,7 +56,7 @@ module Acfs
56
56
 
57
57
  def request
58
58
  request = ::Acfs::Request.new url, method: method, params: params,
59
- data: data, operation: self
59
+ data: data, operation: self
60
60
  request.on_complete do |response|
61
61
  ::ActiveSupport::Notifications.instrument 'acfs.operation.complete',
62
62
  operation: self,
@@ -21,7 +21,7 @@ module Acfs
21
21
  # @return [ Acfs::Request ] The request itself.
22
22
  #
23
23
  def on_complete(&block)
24
- callbacks.insert 0, block if block_given?
24
+ callbacks.insert 0, block if block
25
25
  self
26
26
  end
27
27
 
data/lib/acfs/request.rb CHANGED
@@ -22,7 +22,7 @@ module Acfs
22
22
 
23
23
  @operation = options.delete(:operation) || nil
24
24
 
25
- on_complete(&block) if block_given?
25
+ on_complete(&block) if block
26
26
  end
27
27
 
28
28
  def data?
@@ -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.freeze
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 =~ UUID_REGEXP
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')].sort.each do |path|
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
@@ -17,7 +17,7 @@ class Acfs::Resource
17
17
  # @api private
18
18
  #
19
19
  def save!(**kwargs)
20
- super(**kwargs).tap {|_| changes_applied }
20
+ super.tap {|_| changes_applied }
21
21
  end
22
22
 
23
23
  # @api private
@@ -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
- .location(self.class, **opts, action: :read)
120
- .build(attributes).str
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(*args, **kwargs, &block)
16
- self.class.operation(*args, **kwargs, &block)
15
+ def operation(...)
16
+ self.class.operation(...)
17
17
  end
18
18
 
19
19
  module ClassMethods
20
20
  # Invoke CRUD operation.
21
- def operation(action, **opts, &block)
22
- Acfs.runner.process ::Acfs::Operation.new(self, action, **opts, &block)
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, &block)
59
+ def find(id_or_ids, **opts, &)
60
60
  if id_or_ids.respond_to? :each
61
- find_multiple id_or_ids, opts, &block
61
+ find_multiple(id_or_ids, opts, &)
62
62
  else
63
- find_single id_or_ids, opts, &block
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
- "response: no `#{name}` with params #{params} found"
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].merge! id: id unless id.nil?
213
+ opts[:params][:id] = id unless id.nil?
214
214
 
215
215
  model.__callbacks__ << block unless block.nil?
216
216
 
@@ -9,7 +9,7 @@ module Acfs
9
9
  # request was not executed or failed on client side.
10
10
  #
11
11
  def status_code
12
- return @status.to_i if defined? :@status
12
+ @status.to_i if defined?(@status)
13
13
  # return response.response_code unless response.nil?
14
14
  # 0
15
15
  end
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(op)
21
- ::ActiveSupport::Notifications.instrument 'acfs.operation.before_process', operation: op
22
- op.synchronous? ? run(op) : enqueue(op)
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(op)
28
- ::ActiveSupport::Notifications.instrument 'acfs.runner.sync_run', operation: op do
29
- op_request(op) {|req| adapter.run req }
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(op)
42
- ::ActiveSupport::Notifications.instrument 'acfs.runner.enqueue', operation: op do
41
+ def enqueue(operation)
42
+ ::ActiveSupport::Notifications.instrument('acfs.runner.enqueue', operation: operation) do
43
43
  if running?
44
- op_request(op) {|req| adapter.queue req }
44
+ operation_request(operation) {|req| adapter.queue req }
45
45
  else
46
- queue << op
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 (op = queue.shift)
86
- op_request(op) {|req| adapter.queue req }
85
+ while (operation = queue.shift)
86
+ operation_request(operation) {|req| adapter.queue req }
87
87
  end
88
88
  end
89
89
 
90
- def op_request(op)
91
- return if Acfs::Stub.enabled? && Acfs::Stub.stubbed(op)
90
+ def operation_request(operation)
91
+ return if Acfs::Stub.enabled? && Acfs::Stub.stubbed(operation)
92
92
 
93
- req = op.service.prepare op.request
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, *args, &block)
38
+ def use(klass, ...)
39
39
  # Backward compatible behavior
40
- middleware.insert(0, klass, *args, &block)
40
+ middleware.insert(0, klass, ...)
41
41
  end
42
42
 
43
43
  # @api private
@@ -59,8 +59,8 @@ module Acfs
59
59
  #
60
60
  # @return [ self ] Resource object.
61
61
  #
62
- def find(*attrs, &block)
63
- find_single nil, params: attrs.extract_options!, &block
62
+ def find(*attrs, &)
63
+ find_single(nil, params: attrs.extract_options!, &)
64
64
  end
65
65
 
66
66
  # @api public