cloudsmith-api 0.51.34 → 0.52.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +14 -5
  4. data/build.json +1 -1
  5. data/docs/AlpinePackageUpload.md +63 -0
  6. data/docs/ConanPackageUpload.md +1 -0
  7. data/docs/EntitlementsCreate.md +1 -1
  8. data/docs/EntitlementsPartialUpdate.md +1 -1
  9. data/docs/EntitlementsRefresh.md +1 -1
  10. data/docs/MavenPackageUpload.md +1 -0
  11. data/docs/Package.md +2 -0
  12. data/docs/PackageCopy.md +2 -0
  13. data/docs/PackageMove.md +2 -0
  14. data/docs/PackagesApi.md +238 -39
  15. data/docs/PackagesCopy.md +1 -1
  16. data/docs/PackagesMove.md +0 -1
  17. data/docs/PackagesTag.md +10 -0
  18. data/docs/PackagesUploadAlpine.md +1 -0
  19. data/docs/PackagesUploadCargo.md +1 -0
  20. data/docs/PackagesUploadCocoapods.md +1 -0
  21. data/docs/PackagesUploadComposer.md +1 -0
  22. data/docs/PackagesUploadConan.md +3 -0
  23. data/docs/PackagesUploadCran.md +1 -0
  24. data/docs/PackagesUploadDart.md +1 -0
  25. data/docs/PackagesUploadDeb.md +3 -0
  26. data/docs/PackagesUploadDocker.md +1 -0
  27. data/docs/PackagesUploadGo.md +1 -0
  28. data/docs/PackagesUploadHelm.md +1 -0
  29. data/docs/PackagesUploadLuarocks.md +1 -0
  30. data/docs/PackagesUploadMaven.md +1 -0
  31. data/docs/PackagesUploadNpm.md +1 -0
  32. data/docs/PackagesUploadNuget.md +1 -0
  33. data/docs/PackagesUploadPython.md +1 -0
  34. data/docs/PackagesUploadRaw.md +1 -0
  35. data/docs/PackagesUploadRpm.md +1 -0
  36. data/docs/PackagesUploadRuby.md +1 -0
  37. data/docs/{PackagesResync.md → PackagesUploadTerraform.md} +3 -1
  38. data/docs/PackagesUploadVagrant.md +1 -0
  39. data/docs/PackagesValidateuploadAlpine.md +1 -0
  40. data/docs/PackagesValidateuploadCargo.md +1 -0
  41. data/docs/PackagesValidateuploadCocoapods.md +1 -0
  42. data/docs/PackagesValidateuploadComposer.md +1 -0
  43. data/docs/PackagesValidateuploadConan.md +3 -0
  44. data/docs/PackagesValidateuploadCran.md +1 -0
  45. data/docs/PackagesValidateuploadDart.md +1 -0
  46. data/docs/PackagesValidateuploadDeb.md +3 -0
  47. data/docs/PackagesValidateuploadDocker.md +1 -0
  48. data/docs/PackagesValidateuploadGo.md +1 -0
  49. data/docs/PackagesValidateuploadHelm.md +1 -0
  50. data/docs/PackagesValidateuploadLuarocks.md +1 -0
  51. data/docs/PackagesValidateuploadMaven.md +1 -0
  52. data/docs/PackagesValidateuploadNpm.md +1 -0
  53. data/docs/PackagesValidateuploadNuget.md +1 -0
  54. data/docs/PackagesValidateuploadPython.md +1 -0
  55. data/docs/PackagesValidateuploadRaw.md +1 -0
  56. data/docs/PackagesValidateuploadRpm.md +1 -0
  57. data/docs/PackagesValidateuploadRuby.md +1 -0
  58. data/docs/PackagesValidateuploadTerraform.md +10 -0
  59. data/docs/PackagesValidateuploadVagrant.md +1 -0
  60. data/docs/RawPackageUpload.md +1 -0
  61. data/docs/ReposCreate.md +4 -7
  62. data/docs/ReposPartialUpdate.md +3 -7
  63. data/docs/Repository.md +11 -10
  64. data/docs/RepositoryToken.md +3 -3
  65. data/docs/RepositoryTokenRefresh.md +3 -3
  66. data/docs/RepositoryTokenSyncTokens.md +3 -3
  67. data/docs/RepositoryWebhook.md +1 -0
  68. data/docs/StorageRegion.md +9 -0
  69. data/docs/StorageregionsApi.md +122 -0
  70. data/docs/VagrantPackageUpload.md +1 -0
  71. data/docs/WebhooksCreate.md +1 -0
  72. data/docs/WebhooksPartialUpdate.md +1 -0
  73. data/lib/cloudsmith-api.rb +6 -1
  74. data/lib/cloudsmith-api/api/packages_api.rb +237 -53
  75. data/lib/cloudsmith-api/api/storageregions_api.rb +119 -0
  76. data/lib/cloudsmith-api/models/alpine_package_upload.rb +743 -0
  77. data/lib/cloudsmith-api/models/conan_package_upload.rb +11 -1
  78. data/lib/cloudsmith-api/models/entitlements_create.rb +1 -1
  79. data/lib/cloudsmith-api/models/entitlements_partial_update.rb +1 -1
  80. data/lib/cloudsmith-api/models/entitlements_refresh.rb +1 -1
  81. data/lib/cloudsmith-api/models/maven_package_upload.rb +11 -1
  82. data/lib/cloudsmith-api/models/package.rb +21 -1
  83. data/lib/cloudsmith-api/models/package_copy.rb +21 -1
  84. data/lib/cloudsmith-api/models/package_move.rb +21 -1
  85. data/lib/cloudsmith-api/models/packages_copy.rb +1 -1
  86. data/lib/cloudsmith-api/models/packages_move.rb +4 -14
  87. data/lib/cloudsmith-api/models/packages_tag.rb +211 -0
  88. data/lib/cloudsmith-api/models/packages_upload_alpine.rb +14 -4
  89. data/lib/cloudsmith-api/models/packages_upload_cargo.rb +14 -4
  90. data/lib/cloudsmith-api/models/packages_upload_cocoapods.rb +14 -4
  91. data/lib/cloudsmith-api/models/packages_upload_composer.rb +14 -4
  92. data/lib/cloudsmith-api/models/packages_upload_conan.rb +34 -4
  93. data/lib/cloudsmith-api/models/packages_upload_cran.rb +14 -4
  94. data/lib/cloudsmith-api/models/packages_upload_dart.rb +14 -4
  95. data/lib/cloudsmith-api/models/packages_upload_deb.rb +34 -4
  96. data/lib/cloudsmith-api/models/packages_upload_docker.rb +14 -4
  97. data/lib/cloudsmith-api/models/packages_upload_go.rb +14 -4
  98. data/lib/cloudsmith-api/models/packages_upload_helm.rb +14 -4
  99. data/lib/cloudsmith-api/models/packages_upload_luarocks.rb +14 -4
  100. data/lib/cloudsmith-api/models/packages_upload_maven.rb +11 -1
  101. data/lib/cloudsmith-api/models/packages_upload_npm.rb +14 -4
  102. data/lib/cloudsmith-api/models/packages_upload_nuget.rb +14 -4
  103. data/lib/cloudsmith-api/models/packages_upload_python.rb +14 -4
  104. data/lib/cloudsmith-api/models/packages_upload_raw.rb +11 -1
  105. data/lib/cloudsmith-api/models/packages_upload_rpm.rb +14 -4
  106. data/lib/cloudsmith-api/models/packages_upload_ruby.rb +14 -4
  107. data/lib/cloudsmith-api/models/packages_upload_terraform.rb +214 -0
  108. data/lib/cloudsmith-api/models/packages_upload_vagrant.rb +11 -1
  109. data/lib/cloudsmith-api/models/packages_validateupload_alpine.rb +14 -4
  110. data/lib/cloudsmith-api/models/packages_validateupload_cargo.rb +14 -4
  111. data/lib/cloudsmith-api/models/packages_validateupload_cocoapods.rb +14 -4
  112. data/lib/cloudsmith-api/models/packages_validateupload_composer.rb +14 -4
  113. data/lib/cloudsmith-api/models/packages_validateupload_conan.rb +34 -4
  114. data/lib/cloudsmith-api/models/packages_validateupload_cran.rb +14 -4
  115. data/lib/cloudsmith-api/models/packages_validateupload_dart.rb +14 -4
  116. data/lib/cloudsmith-api/models/packages_validateupload_deb.rb +34 -4
  117. data/lib/cloudsmith-api/models/packages_validateupload_docker.rb +14 -4
  118. data/lib/cloudsmith-api/models/packages_validateupload_go.rb +14 -4
  119. data/lib/cloudsmith-api/models/packages_validateupload_helm.rb +14 -4
  120. data/lib/cloudsmith-api/models/packages_validateupload_luarocks.rb +14 -4
  121. data/lib/cloudsmith-api/models/packages_validateupload_maven.rb +11 -1
  122. data/lib/cloudsmith-api/models/packages_validateupload_npm.rb +14 -4
  123. data/lib/cloudsmith-api/models/packages_validateupload_nuget.rb +14 -4
  124. data/lib/cloudsmith-api/models/packages_validateupload_python.rb +14 -4
  125. data/lib/cloudsmith-api/models/packages_validateupload_raw.rb +11 -1
  126. data/lib/cloudsmith-api/models/packages_validateupload_rpm.rb +14 -4
  127. data/lib/cloudsmith-api/models/packages_validateupload_ruby.rb +14 -4
  128. data/lib/cloudsmith-api/models/packages_validateupload_terraform.rb +214 -0
  129. data/lib/cloudsmith-api/models/packages_validateupload_vagrant.rb +11 -1
  130. data/lib/cloudsmith-api/models/raw_package_upload.rb +11 -1
  131. data/lib/cloudsmith-api/models/repos_create.rb +17 -57
  132. data/lib/cloudsmith-api/models/repos_partial_update.rb +4 -44
  133. data/lib/cloudsmith-api/models/repository.rb +24 -24
  134. data/lib/cloudsmith-api/models/repository_token.rb +3 -3
  135. data/lib/cloudsmith-api/models/repository_token_refresh.rb +3 -3
  136. data/lib/cloudsmith-api/models/repository_token_sync_tokens.rb +3 -3
  137. data/lib/cloudsmith-api/models/repository_webhook.rb +11 -1
  138. data/lib/cloudsmith-api/models/{packages_resync.rb → storage_region.rb} +29 -9
  139. data/lib/cloudsmith-api/models/vagrant_package_upload.rb +11 -1
  140. data/lib/cloudsmith-api/models/webhooks_create.rb +11 -1
  141. data/lib/cloudsmith-api/models/webhooks_partial_update.rb +11 -1
  142. data/lib/cloudsmith-api/version.rb +1 -1
  143. data/spec/api/packages_api_spec.rb +59 -17
  144. data/spec/api/storageregions_api_spec.rb +58 -0
  145. data/spec/models/alpine_package_upload_spec.rb +372 -0
  146. data/spec/models/conan_package_upload_spec.rb +6 -0
  147. data/spec/models/maven_package_upload_spec.rb +6 -0
  148. data/spec/models/package_copy_spec.rb +12 -0
  149. data/spec/models/package_move_spec.rb +12 -0
  150. data/spec/models/package_spec.rb +12 -0
  151. data/spec/models/packages_move_spec.rb +0 -6
  152. data/spec/models/packages_tag_spec.rb +54 -0
  153. data/spec/models/packages_upload_alpine_spec.rb +6 -0
  154. data/spec/models/packages_upload_cargo_spec.rb +6 -0
  155. data/spec/models/packages_upload_cocoapods_spec.rb +6 -0
  156. data/spec/models/packages_upload_composer_spec.rb +6 -0
  157. data/spec/models/packages_upload_conan_spec.rb +18 -0
  158. data/spec/models/packages_upload_cran_spec.rb +6 -0
  159. data/spec/models/packages_upload_dart_spec.rb +6 -0
  160. data/spec/models/packages_upload_deb_spec.rb +18 -0
  161. data/spec/models/packages_upload_docker_spec.rb +6 -0
  162. data/spec/models/packages_upload_go_spec.rb +6 -0
  163. data/spec/models/packages_upload_helm_spec.rb +6 -0
  164. data/spec/models/packages_upload_luarocks_spec.rb +6 -0
  165. data/spec/models/packages_upload_maven_spec.rb +6 -0
  166. data/spec/models/packages_upload_npm_spec.rb +6 -0
  167. data/spec/models/packages_upload_nuget_spec.rb +6 -0
  168. data/spec/models/packages_upload_python_spec.rb +6 -0
  169. data/spec/models/packages_upload_raw_spec.rb +6 -0
  170. data/spec/models/packages_upload_rpm_spec.rb +6 -0
  171. data/spec/models/packages_upload_ruby_spec.rb +6 -0
  172. data/spec/models/packages_upload_terraform_spec.rb +54 -0
  173. data/spec/models/packages_upload_vagrant_spec.rb +6 -0
  174. data/spec/models/packages_validateupload_alpine_spec.rb +6 -0
  175. data/spec/models/packages_validateupload_cargo_spec.rb +6 -0
  176. data/spec/models/packages_validateupload_cocoapods_spec.rb +6 -0
  177. data/spec/models/packages_validateupload_composer_spec.rb +6 -0
  178. data/spec/models/packages_validateupload_conan_spec.rb +18 -0
  179. data/spec/models/packages_validateupload_cran_spec.rb +6 -0
  180. data/spec/models/packages_validateupload_dart_spec.rb +6 -0
  181. data/spec/models/packages_validateupload_deb_spec.rb +18 -0
  182. data/spec/models/packages_validateupload_docker_spec.rb +6 -0
  183. data/spec/models/packages_validateupload_go_spec.rb +6 -0
  184. data/spec/models/packages_validateupload_helm_spec.rb +6 -0
  185. data/spec/models/packages_validateupload_luarocks_spec.rb +6 -0
  186. data/spec/models/packages_validateupload_maven_spec.rb +6 -0
  187. data/spec/models/packages_validateupload_npm_spec.rb +6 -0
  188. data/spec/models/packages_validateupload_nuget_spec.rb +6 -0
  189. data/spec/models/packages_validateupload_python_spec.rb +6 -0
  190. data/spec/models/packages_validateupload_raw_spec.rb +6 -0
  191. data/spec/models/packages_validateupload_rpm_spec.rb +6 -0
  192. data/spec/models/packages_validateupload_ruby_spec.rb +6 -0
  193. data/spec/models/packages_validateupload_terraform_spec.rb +54 -0
  194. data/spec/models/packages_validateupload_vagrant_spec.rb +6 -0
  195. data/spec/models/raw_package_upload_spec.rb +6 -0
  196. data/spec/models/repos_create_spec.rb +3 -21
  197. data/spec/models/repos_partial_update_spec.rb +0 -24
  198. data/spec/models/repository_spec.rb +6 -0
  199. data/spec/models/repository_webhook_spec.rb +6 -0
  200. data/spec/models/{packages_resync_spec.rb → storage_region_spec.rb} +13 -7
  201. data/spec/models/vagrant_package_upload_spec.rb +6 -0
  202. data/spec/models/webhooks_create_spec.rb +6 -0
  203. data/spec/models/webhooks_partial_update_spec.rb +6 -0
  204. data/vendor/bundle/ruby/2.6.0/cache/diff-lcs-1.4.4.gem +0 -0
  205. data/vendor/bundle/ruby/2.6.0/cache/json-2.3.1.gem +0 -0
  206. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.2.17/gem_make.out +1 -1
  207. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.13.1/gem_make.out +2 -2
  208. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/gem.build_complete +0 -0
  209. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/gem_make.out +5 -5
  210. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.1/json/ext/generator.so +0 -0
  211. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.1/json/ext/parser.so +0 -0
  212. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/mkmf.log +0 -0
  213. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/.rspec +0 -0
  214. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Code-of-Conduct.md +0 -0
  215. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/Contributing.md +118 -0
  216. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/History.md +319 -0
  217. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/License.md +0 -0
  218. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Manifest.txt +8 -0
  219. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/README.rdoc +10 -10
  220. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Rakefile +39 -22
  221. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/autotest/discover.rb +3 -0
  222. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/bin/htmldiff +7 -4
  223. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/bin/ldiff +4 -1
  224. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/docs/COPYING.txt +0 -0
  225. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/docs/artistic.txt +0 -0
  226. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/lib/diff-lcs.rb +3 -0
  227. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs.rb +184 -170
  228. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/array.rb +1 -1
  229. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/lib/diff/lcs/backports.rb +9 -0
  230. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/block.rb +1 -1
  231. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/callbacks.rb +15 -12
  232. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/change.rb +30 -37
  233. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/htmldiff.rb +17 -16
  234. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/hunk.rb +156 -74
  235. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/internals.rb +36 -39
  236. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/ldiff.rb +46 -42
  237. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/string.rb +1 -1
  238. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/change_spec.rb +31 -7
  239. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3/spec/ldiff_spec.rb → diff-lcs-1.4.4/spec/diff_spec.rb} +15 -11
  240. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/aX +1 -0
  241. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/bXaX +1 -0
  242. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/fixtures/ds1.csv +0 -0
  243. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/fixtures/ds2.csv +0 -0
  244. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff +4 -0
  245. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-c +7 -0
  246. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-e +3 -0
  247. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-f +3 -0
  248. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-u +5 -0
  249. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/hunk_spec.rb +83 -0
  250. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/issues_spec.rb +154 -0
  251. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/lcs_spec.rb +10 -10
  252. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/ldiff_spec.rb +87 -0
  253. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/patch_spec.rb +93 -99
  254. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/sdiff_spec.rb +214 -0
  255. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/spec_helper.rb +118 -64
  256. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/traverse_balanced_spec.rb +310 -0
  257. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/traverse_sequences_spec.rb +28 -28
  258. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.13.1/ext/ffi_c/Makefile +3 -3
  259. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/.gitignore +0 -0
  260. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/.travis.yml +2 -0
  261. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/CHANGES.md +33 -0
  262. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/Gemfile +0 -0
  263. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/README-json-jruby.md +0 -0
  264. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/README.md +16 -0
  265. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/Rakefile +8 -87
  266. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/VERSION +1 -0
  267. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/diagrams/.keep +0 -0
  268. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/fbuffer/fbuffer.h +0 -0
  269. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/.sitearchdir.-.json.-.ext.time +0 -0
  270. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/depend +0 -0
  271. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/extconf.rb +0 -0
  272. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/generator.c +71 -1
  273. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/generator.h +0 -0
  274. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/generator/generator.so +0 -0
  275. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/.sitearchdir.-.json.-.ext.time +0 -0
  276. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/depend +0 -0
  277. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/extconf.rb +0 -0
  278. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.c +71 -70
  279. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.h +0 -0
  280. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.rl +1 -0
  281. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/parser/parser.so +0 -0
  282. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/extconf.rb +0 -0
  283. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/install.rb +0 -0
  284. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/ByteListTranscoder.java +0 -0
  285. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Generator.java +0 -0
  286. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorMethods.java +0 -0
  287. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorService.java +0 -0
  288. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorState.java +0 -0
  289. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/OptionsReader.java +0 -0
  290. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Parser.java +0 -0
  291. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Parser.rl +0 -0
  292. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/ParserService.java +0 -0
  293. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/RuntimeInfo.java +0 -0
  294. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/StringDecoder.java +0 -0
  295. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/StringEncoder.java +0 -0
  296. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Utils.java +0 -0
  297. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/json-java.gemspec +3 -3
  298. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/json.gemspec +139 -0
  299. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/json_pure.gemspec +8 -13
  300. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json.rb +412 -0
  301. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/bigdecimal.rb +0 -0
  302. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/complex.rb +0 -0
  303. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/core.rb +0 -0
  304. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/date.rb +0 -0
  305. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/date_time.rb +0 -0
  306. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/exception.rb +0 -0
  307. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/ostruct.rb +0 -0
  308. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/range.rb +0 -0
  309. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/rational.rb +0 -0
  310. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/regexp.rb +0 -0
  311. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/set.rb +0 -0
  312. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/struct.rb +0 -0
  313. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/symbol.rb +0 -0
  314. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/time.rb +0 -0
  315. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/common.rb +691 -0
  316. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/ext.rb +0 -0
  317. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/ext/.keep +0 -0
  318. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/ext/generator.so +0 -0
  319. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/ext/parser.so +0 -0
  320. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/generic_object.rb +0 -0
  321. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure.rb +0 -0
  322. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure/generator.rb +1 -1
  323. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure/parser.rb +2 -2
  324. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/version.rb +1 -1
  325. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/references/rfc7159.txt +0 -0
  326. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail10.json +0 -0
  327. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail11.json +0 -0
  328. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail12.json +0 -0
  329. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail13.json +0 -0
  330. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail14.json +0 -0
  331. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail18.json +0 -0
  332. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail19.json +0 -0
  333. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail2.json +0 -0
  334. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail20.json +0 -0
  335. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail21.json +0 -0
  336. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail22.json +0 -0
  337. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail23.json +0 -0
  338. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail24.json +0 -0
  339. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail25.json +0 -0
  340. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail27.json +0 -0
  341. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail28.json +0 -0
  342. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail3.json +0 -0
  343. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail4.json +0 -0
  344. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail5.json +0 -0
  345. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail6.json +0 -0
  346. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail7.json +0 -0
  347. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail8.json +0 -0
  348. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail9.json +0 -0
  349. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/obsolete_fail1.json +0 -0
  350. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass1.json +0 -0
  351. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass15.json +0 -0
  352. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass16.json +0 -0
  353. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass17.json +0 -0
  354. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass2.json +0 -0
  355. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass26.json +0 -0
  356. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass3.json +0 -0
  357. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_addition_test.rb +0 -0
  358. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_common_interface_test.rb +0 -0
  359. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_encoding_test.rb +0 -0
  360. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_ext_parser_test.rb +0 -0
  361. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_fixtures_test.rb +6 -1
  362. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_generator_test.rb +0 -0
  363. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_generic_object_test.rb +0 -0
  364. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_parser_test.rb +0 -0
  365. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_string_matching_test.rb +0 -0
  366. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/test_helper.rb +0 -0
  367. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/diff.sh +0 -0
  368. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/fuzz.rb +0 -0
  369. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/server.rb +0 -0
  370. data/vendor/bundle/ruby/2.6.0/specifications/{diff-lcs-1.3.gemspec → diff-lcs-1.4.4.gemspec} +11 -13
  371. data/vendor/bundle/ruby/2.6.0/specifications/{json-2.3.0.gemspec → json-2.3.1.gemspec} +0 -0
  372. data/vendor/bundle/ruby/2.6.0/specifications/sys-uname-1.2.1.gemspec +1 -1
  373. metadata +276 -249
  374. data/vendor/bundle/ruby/2.6.0/cache/diff-lcs-1.3.gem +0 -0
  375. data/vendor/bundle/ruby/2.6.0/cache/json-2.3.0.gem +0 -0
  376. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.0/json/ext/generator.so +0 -0
  377. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.0/json/ext/parser.so +0 -0
  378. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/Contributing.md +0 -83
  379. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/History.md +0 -220
  380. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/autotest/discover.rb +0 -1
  381. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/lib/diff-lcs.rb +0 -3
  382. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/diff_spec.rb +0 -47
  383. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/hunk_spec.rb +0 -72
  384. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/issues_spec.rb +0 -49
  385. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/sdiff_spec.rb +0 -214
  386. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/traverse_balanced_spec.rb +0 -310
  387. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/LICENSE +0 -56
  388. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/VERSION +0 -1
  389. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/ext/json/ext/generator/generator.so +0 -0
  390. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/ext/json/ext/parser/parser.so +0 -0
  391. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/json.gemspec +0 -0
  392. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json.rb +0 -63
  393. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/common.rb +0 -456
  394. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/ext/generator.so +0 -0
  395. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/ext/parser.so +0 -0
@@ -0,0 +1,691 @@
1
+ #frozen_string_literal: false
2
+ require 'json/version'
3
+ require 'json/generic_object'
4
+
5
+ module JSON
6
+ class << self
7
+ # If +object+ is a
8
+ # {String-convertible object}[doc/implicit_conversion_rdoc.html#label-String-Convertible+Objects]
9
+ # (implementing +to_str+), calls JSON.parse with +object+ and +opts+:
10
+ # json = '[0, 1, null]'
11
+ # JSON[json]# => [0, 1, nil]
12
+ #
13
+ # Otherwise, calls JSON.generate with +object+ and +opts+:
14
+ # ruby = [0, 1, nil]
15
+ # JSON[ruby] # => '[0,1,null]'
16
+ def [](object, opts = {})
17
+ if object.respond_to? :to_str
18
+ JSON.parse(object.to_str, opts)
19
+ else
20
+ JSON.generate(object, opts)
21
+ end
22
+ end
23
+
24
+ # Returns the JSON parser class that is used by JSON. This is either
25
+ # JSON::Ext::Parser or JSON::Pure::Parser:
26
+ # JSON.parser # => JSON::Ext::Parser
27
+ attr_reader :parser
28
+
29
+ # Set the JSON parser class _parser_ to be used by JSON.
30
+ def parser=(parser) # :nodoc:
31
+ @parser = parser
32
+ remove_const :Parser if const_defined?(:Parser, false)
33
+ const_set :Parser, parser
34
+ end
35
+
36
+ # Return the constant located at _path_. The format of _path_ has to be
37
+ # either ::A::B::C or A::B::C. In any case, A has to be located at the top
38
+ # level (absolute namespace path?). If there doesn't exist a constant at
39
+ # the given path, an ArgumentError is raised.
40
+ def deep_const_get(path) # :nodoc:
41
+ path.to_s.split(/::/).inject(Object) do |p, c|
42
+ case
43
+ when c.empty? then p
44
+ when p.const_defined?(c, true) then p.const_get(c)
45
+ else
46
+ begin
47
+ p.const_missing(c)
48
+ rescue NameError => e
49
+ raise ArgumentError, "can't get const #{path}: #{e}"
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ # Set the module _generator_ to be used by JSON.
56
+ def generator=(generator) # :nodoc:
57
+ old, $VERBOSE = $VERBOSE, nil
58
+ @generator = generator
59
+ generator_methods = generator::GeneratorMethods
60
+ for const in generator_methods.constants
61
+ klass = deep_const_get(const)
62
+ modul = generator_methods.const_get(const)
63
+ klass.class_eval do
64
+ instance_methods(false).each do |m|
65
+ m.to_s == 'to_json' and remove_method m
66
+ end
67
+ include modul
68
+ end
69
+ end
70
+ self.state = generator::State
71
+ const_set :State, self.state
72
+ const_set :SAFE_STATE_PROTOTYPE, State.new
73
+ const_set :FAST_STATE_PROTOTYPE, State.new(
74
+ :indent => '',
75
+ :space => '',
76
+ :object_nl => "",
77
+ :array_nl => "",
78
+ :max_nesting => false
79
+ )
80
+ const_set :PRETTY_STATE_PROTOTYPE, State.new(
81
+ :indent => ' ',
82
+ :space => ' ',
83
+ :object_nl => "\n",
84
+ :array_nl => "\n"
85
+ )
86
+ ensure
87
+ $VERBOSE = old
88
+ end
89
+
90
+ # Returns the JSON generator module that is used by JSON. This is
91
+ # either JSON::Ext::Generator or JSON::Pure::Generator:
92
+ # JSON.generator # => JSON::Ext::Generator
93
+ attr_reader :generator
94
+
95
+ # Sets or Returns the JSON generator state class that is used by JSON. This is
96
+ # either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
97
+ # JSON.state # => JSON::Ext::Generator::State
98
+ attr_accessor :state
99
+
100
+ # Sets or returns create identifier, which is used to decide if the _json_create_
101
+ # hook of a class should be called; initial value is +json_class+:
102
+ # JSON.create_id # => 'json_class'
103
+ attr_accessor :create_id
104
+ end
105
+ self.create_id = 'json_class'
106
+
107
+ NaN = 0.0/0
108
+
109
+ Infinity = 1.0/0
110
+
111
+ MinusInfinity = -Infinity
112
+
113
+ # The base exception for JSON errors.
114
+ class JSONError < StandardError
115
+ def self.wrap(exception)
116
+ obj = new("Wrapped(#{exception.class}): #{exception.message.inspect}")
117
+ obj.set_backtrace exception.backtrace
118
+ obj
119
+ end
120
+ end
121
+
122
+ # This exception is raised if a parser error occurs.
123
+ class ParserError < JSONError; end
124
+
125
+ # This exception is raised if the nesting of parsed data structures is too
126
+ # deep.
127
+ class NestingError < ParserError; end
128
+
129
+ # :stopdoc:
130
+ class CircularDatastructure < NestingError; end
131
+ # :startdoc:
132
+
133
+ # This exception is raised if a generator or unparser error occurs.
134
+ class GeneratorError < JSONError; end
135
+ # For backwards compatibility
136
+ UnparserError = GeneratorError # :nodoc:
137
+
138
+ # This exception is raised if the required unicode support is missing on the
139
+ # system. Usually this means that the iconv library is not installed.
140
+ class MissingUnicodeSupport < JSONError; end
141
+
142
+ module_function
143
+
144
+ # :call-seq:
145
+ # JSON.parse(source, opts) -> object
146
+ #
147
+ # Argument +source+ contains the \String to be parsed. It must be a
148
+ # {String-convertible object}[doc/implicit_conversion_rdoc.html#label-String-Convertible+Objects]
149
+ # (implementing +to_str+), and must contain valid \JSON data.
150
+ #
151
+ # Argument +opts+, if given, contains options for the parsing, and must be a
152
+ # {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash-Convertible+Objects]
153
+ # (implementing +to_hash+).
154
+ #
155
+ # Returns the Ruby objects created by parsing the given +source+.
156
+ #
157
+ # ---
158
+ #
159
+ # When +source+ is a \JSON array, returns a Ruby \Array:
160
+ # source = '["foo", 1.0, true, false, null]'
161
+ # ruby = JSON.parse(source)
162
+ # ruby # => ["foo", 1.0, true, false, nil]
163
+ # ruby.class # => Array
164
+ #
165
+ # When +source+ is a \JSON object, returns a Ruby \Hash:
166
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
167
+ # ruby = JSON.parse(source)
168
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
169
+ # ruby.class # => Hash
170
+ #
171
+ # For examples of parsing for all \JSON data types, see
172
+ # {Parsing \JSON}[#module-JSON-label-Parsing+JSON].
173
+ #
174
+ # ====== Input Options
175
+ #
176
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth allowed;
177
+ # defaults to +100+; specify +false+ to disable depth checking.
178
+ #
179
+ # With the default, +false+:
180
+ # source = '[0, [1, [2, [3]]]]'
181
+ # ruby = JSON.parse(source)
182
+ # ruby # => [0, [1, [2, [3]]]]
183
+ # Too deep:
184
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
185
+ # JSON.parse(source, {max_nesting: 1})
186
+ # Bad value:
187
+ # # Raises TypeError (wrong argument type Symbol (expected Fixnum)):
188
+ # JSON.parse(source, {max_nesting: :foo})
189
+ #
190
+ # ---
191
+ #
192
+ # Option +allow_nan+ (boolean) specifies whether to allow
193
+ # NaN, Infinity, and MinusInfinity in +source+;
194
+ # defaults to +false+.
195
+ #
196
+ # With the default, +false+:
197
+ # # Raises JSON::ParserError (225: unexpected token at '[NaN]'):
198
+ # JSON.parse('[NaN]')
199
+ # # Raises JSON::ParserError (232: unexpected token at '[Infinity]'):
200
+ # JSON.parse('[Infinity]')
201
+ # # Raises JSON::ParserError (248: unexpected token at '[-Infinity]'):
202
+ # JSON.parse('[-Infinity]')
203
+ # Allow:
204
+ # source = '[NaN, Infinity, -Infinity]'
205
+ # ruby = JSON.parse(source, {allow_nan: true})
206
+ # ruby # => [NaN, Infinity, -Infinity]
207
+ #
208
+ # ====== Output Options
209
+ #
210
+ # Option +symbolize_names+ (boolean) specifies whether returned \Hash keys
211
+ # should be Symbols;
212
+ # defaults to +false+ (use Strings).
213
+ #
214
+ # With the default, +false+:
215
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
216
+ # ruby = JSON.parse(source)
217
+ # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
218
+ # Use Symbols:
219
+ # ruby = JSON.parse(source, {symbolize_names: true})
220
+ # ruby # => {:a=>"foo", :b=>1.0, :c=>true, :d=>false, :e=>nil}
221
+ #
222
+ # ---
223
+ #
224
+ # Option +object_class+ (\Class) specifies the Ruby class to be used
225
+ # for each \JSON object;
226
+ # defaults to \Hash.
227
+ #
228
+ # With the default, \Hash:
229
+ # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
230
+ # ruby = JSON.parse(source)
231
+ # ruby.class # => Hash
232
+ # Use class \OpenStruct:
233
+ # ruby = JSON.parse(source, {object_class: OpenStruct})
234
+ # ruby # => #<OpenStruct a="foo", b=1.0, c=true, d=false, e=nil>
235
+ #
236
+ # ---
237
+ #
238
+ # Option +array_class+ (\Class) specifies the Ruby class to be used
239
+ # for each \JSON array;
240
+ # defaults to \Array.
241
+ #
242
+ # With the default, \Array:
243
+ # source = '["foo", 1.0, true, false, null]'
244
+ # ruby = JSON.parse(source)
245
+ # ruby.class # => Array
246
+ # Use class \Set:
247
+ # ruby = JSON.parse(source, {array_class: Set})
248
+ # ruby # => #<Set: {"foo", 1.0, true, false, nil}>
249
+ #
250
+ # ---
251
+ #
252
+ # Option +create_additions+ (boolean) specifies whether to use \JSON additions in parsing.
253
+ # See {\JSON Additions}[#module-JSON-label-JSON+Additions].
254
+ #
255
+ # ====== Exceptions
256
+ #
257
+ # Raises an exception if +source+ is not valid JSON:
258
+ #
259
+ # # Raises JSON::ParserError (783: unexpected token at ''):
260
+ # JSON.parse('')
261
+ #
262
+ def parse(source, opts = {})
263
+ Parser.new(source, **(opts||{})).parse
264
+ end
265
+
266
+ # :call-seq:
267
+ # JSON.parse!(source, opts) -> object
268
+ #
269
+ # Calls
270
+ # parse(source, opts)
271
+ # with +source+ and possibly modified +opts+.
272
+ #
273
+ # Differences from JSON.parse:
274
+ # - Option +max_nesting+, if not provided, defaults to +false+,
275
+ # which disables checking for nesting depth.
276
+ # - Option +allow_nan+, if not provided, defaults to +true+.
277
+ def parse!(source, opts = {})
278
+ opts = {
279
+ :max_nesting => false,
280
+ :allow_nan => true
281
+ }.merge(opts)
282
+ Parser.new(source, **(opts||{})).parse
283
+ end
284
+
285
+ # :call-seq:
286
+ # JSON.generate(obj, opts = nil) -> new_string
287
+ #
288
+ # Argument +obj+ is the Ruby object to be converted to \JSON.
289
+ #
290
+ # Argument +opts+, if given, contains options for the generation, and must be a
291
+ # {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash-Convertible+Objects]
292
+ # (implementing +to_hash+).
293
+ #
294
+ # Returns a \String containing the generated \JSON data.
295
+ #
296
+ # See also JSON.fast_generate, JSON.pretty_generate.
297
+ #
298
+ # ---
299
+ #
300
+ # When +obj+ is an
301
+ # {Array-convertible object}[doc/implicit_conversion_rdoc.html#label-Array-Convertible+Objects]
302
+ # (implementing +to_ary+), returns a \String containing a \JSON array:
303
+ # obj = ["foo", 1.0, true, false, nil]
304
+ # json = JSON.generate(obj)
305
+ # json # => '["foo",1.0,true,false,null]'
306
+ #
307
+ # When +obj+ is a
308
+ # {Hash-convertible object}[doc/implicit_conversion_rdoc.html#label-Hash-Convertible+Objects],
309
+ # return a \String containing a \JSON object:
310
+ # obj = {foo: 0, bar: 's', baz: :bat}
311
+ # json = JSON.generate(obj)
312
+ # json # => '{"foo":0,"bar":"s","baz":"bat"}'
313
+ #
314
+ # For examples of generating from other Ruby objects, see
315
+ # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects].
316
+ #
317
+ # ====== Input Options
318
+ #
319
+ # Option +allow_nan+ (boolean) specifies whether
320
+ # +NaN+, +Infinity+, and <tt>-Infinity</tt> may be generated;
321
+ # defaults to +false+.
322
+ #
323
+ # With the default, +false+:
324
+ # # Raises JSON::GeneratorError (920: NaN not allowed in JSON):
325
+ # JSON.generate(JSON::NaN)
326
+ # # Raises JSON::GeneratorError (917: Infinity not allowed in JSON):
327
+ # JSON.generate(JSON::Infinity)
328
+ # # Raises JSON::GeneratorError (917: -Infinity not allowed in JSON):
329
+ # JSON.generate(JSON::MinusInfinity)
330
+ #
331
+ # Allow:
332
+ # ruby = [Float::NaN, Float::Infinity, Float::MinusInfinity]
333
+ # JSON.generate(ruby, allow_nan: true) # => '[NaN,Infinity,-Infinity]'
334
+ #
335
+ # ---
336
+ #
337
+ # Option +max_nesting+ (\Integer) specifies the maximum nesting depth
338
+ # in +obj+; defaults to +100+.
339
+ #
340
+ # With the default, +100+:
341
+ # obj = [[[[[[0]]]]]]
342
+ # JSON.generate(obj) # => '[[[[[[0]]]]]]'
343
+ #
344
+ # Too deep:
345
+ # # Raises JSON::NestingError (nesting of 2 is too deep):
346
+ # JSON.generate(obj, max_nesting: 2)
347
+ #
348
+ # ====== Output Options
349
+ #
350
+ # The default formatting options generate the most compact
351
+ # \JSON data, all on one line and with no whitespace.
352
+ #
353
+ # You can use these formatting options to generate
354
+ # \JSON data in a more open format, using whitespace.
355
+ # See also JSON.pretty_generate.
356
+ #
357
+ # - Option +array_nl+ (\String) specifies a string (usually a newline)
358
+ # to be inserted after each \JSON array; defaults to the empty \String, <tt>''</tt>.
359
+ # - Option +object_nl+ (\String) specifies a string (usually a newline)
360
+ # to be inserted after each \JSON object; defaults to the empty \String, <tt>''</tt>.
361
+ # - Option +indent+ (\String) specifies the string (usually spaces) to be
362
+ # used for indentation; defaults to the empty \String, <tt>''</tt>;
363
+ # defaults to the empty \String, <tt>''</tt>;
364
+ # has no effect unless options +array_nl+ or +object_nl+ specify newlines.
365
+ # - Option +space+ (\String) specifies a string (usually a space) to be
366
+ # inserted after the colon in each \JSON object's pair;
367
+ # defaults to the empty \String, <tt>''</tt>.
368
+ # - Option +space_before+ (\String) specifies a string (usually a space) to be
369
+ # inserted before the colon in each \JSON object's pair;
370
+ # defaults to the empty \String, <tt>''</tt>.
371
+ #
372
+ # In this example, +obj+ is used first to generate the shortest
373
+ # \JSON data (no whitespace), then again with all formatting options
374
+ # specified:
375
+ #
376
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
377
+ # json = JSON.generate(obj)
378
+ # puts 'Compact:', json
379
+ # opts = {
380
+ # array_nl: "\n",
381
+ # object_nl: "\n",
382
+ # indent+: ' ',
383
+ # space_before: ' ',
384
+ # space: ' '
385
+ # }
386
+ # puts 'Open:', JSON.generate(obj, opts)
387
+ #
388
+ # Output:
389
+ # Compact:
390
+ # {"foo":["bar","baz"],"bat":{"bam":0,"bad":1}}
391
+ # Open:
392
+ # {
393
+ # "foo" : [
394
+ # "bar",
395
+ # "baz"
396
+ # ],
397
+ # "bat" : {
398
+ # "bam" : 0,
399
+ # "bad" : 1
400
+ # }
401
+ # }
402
+ #
403
+ # ---
404
+ #
405
+ # Raises an exception if any formatting option is not a \String.
406
+ #
407
+ # ====== Exceptions
408
+ #
409
+ # Raises an exception if +obj+ contains circular references:
410
+ # a = []; b = []; a.push(b); b.push(a)
411
+ # # Raises JSON::NestingError (nesting of 100 is too deep):
412
+ # JSON.generate(a)
413
+ #
414
+ def generate(obj, opts = nil)
415
+ if State === opts
416
+ state, opts = opts, nil
417
+ else
418
+ state = SAFE_STATE_PROTOTYPE.dup
419
+ end
420
+ if opts
421
+ if opts.respond_to? :to_hash
422
+ opts = opts.to_hash
423
+ elsif opts.respond_to? :to_h
424
+ opts = opts.to_h
425
+ else
426
+ raise TypeError, "can't convert #{opts.class} into Hash"
427
+ end
428
+ state = state.configure(opts)
429
+ end
430
+ state.generate(obj)
431
+ end
432
+
433
+ # :stopdoc:
434
+ # I want to deprecate these later, so I'll first be silent about them, and
435
+ # later delete them.
436
+ alias unparse generate
437
+ module_function :unparse
438
+ # :startdoc:
439
+
440
+ # Arguments +obj+ and +opts+ here are the same as
441
+ # arguments +obj+ and +opts+ in JSON.generate.
442
+ #
443
+ # By default, generates \JSON data without checking
444
+ # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled).
445
+ #
446
+ # Raises an exception if +obj+ contains circular references:
447
+ # a = []; b = []; a.push(b); b.push(a)
448
+ # # Raises SystemStackError (stack level too deep):
449
+ # JSON.fast_generate(a)
450
+ def fast_generate(obj, opts = nil)
451
+ if State === opts
452
+ state, opts = opts, nil
453
+ else
454
+ state = FAST_STATE_PROTOTYPE.dup
455
+ end
456
+ if opts
457
+ if opts.respond_to? :to_hash
458
+ opts = opts.to_hash
459
+ elsif opts.respond_to? :to_h
460
+ opts = opts.to_h
461
+ else
462
+ raise TypeError, "can't convert #{opts.class} into Hash"
463
+ end
464
+ state.configure(opts)
465
+ end
466
+ state.generate(obj)
467
+ end
468
+
469
+ # :stopdoc:
470
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
471
+ alias fast_unparse fast_generate
472
+ module_function :fast_unparse
473
+ # :startdoc:
474
+
475
+ # :call-seq:
476
+ # JSON.pretty_generate(obj, opts = nil) -> new_string
477
+ #
478
+ # Arguments +obj+ and +opts+ here are the same as
479
+ # arguments +obj+ and +opts+ in JSON.generate.
480
+ #
481
+ # Default options are:
482
+ # {
483
+ # indent: ' ', # Two spaces
484
+ # space: ' ', # One space
485
+ # array_nl: "\n", # Newline
486
+ # object_nl: "\n" # Newline
487
+ # }
488
+ #
489
+ # Example:
490
+ # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}}
491
+ # json = JSON.pretty_generate(obj)
492
+ # puts json
493
+ # Output:
494
+ # {
495
+ # "foo": [
496
+ # "bar",
497
+ # "baz"
498
+ # ],
499
+ # "bat": {
500
+ # "bam": 0,
501
+ # "bad": 1
502
+ # }
503
+ # }
504
+ #
505
+ def pretty_generate(obj, opts = nil)
506
+ if State === opts
507
+ state, opts = opts, nil
508
+ else
509
+ state = PRETTY_STATE_PROTOTYPE.dup
510
+ end
511
+ if opts
512
+ if opts.respond_to? :to_hash
513
+ opts = opts.to_hash
514
+ elsif opts.respond_to? :to_h
515
+ opts = opts.to_h
516
+ else
517
+ raise TypeError, "can't convert #{opts.class} into Hash"
518
+ end
519
+ state.configure(opts)
520
+ end
521
+ state.generate(obj)
522
+ end
523
+
524
+ # :stopdoc:
525
+ # I want to deprecate these later, so I'll first be silent about them, and later delete them.
526
+ alias pretty_unparse pretty_generate
527
+ module_function :pretty_unparse
528
+ # :startdoc:
529
+
530
+ class << self
531
+ # Sets or returns default options for the JSON.load method.
532
+ # Initially:
533
+ # opts = JSON.load_default_options
534
+ # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true}
535
+ attr_accessor :load_default_options
536
+ end
537
+ self.load_default_options = {
538
+ :max_nesting => false,
539
+ :allow_nan => true,
540
+ :allow_blank => true,
541
+ :create_additions => true,
542
+ }
543
+
544
+ # Load a ruby data structure from a JSON _source_ and return it. A source can
545
+ # either be a string-like object, an IO-like object, or an object responding
546
+ # to the read method. If _proc_ was given, it will be called with any nested
547
+ # Ruby object as an argument recursively in depth first order. To modify the
548
+ # default options pass in the optional _options_ argument as well.
549
+ #
550
+ # BEWARE: This method is meant to serialise data from trusted user input,
551
+ # like from your own database server or clients under your control, it could
552
+ # be dangerous to allow untrusted users to pass JSON sources into it. The
553
+ # default options for the parser can be changed via the load_default_options
554
+ # method.
555
+ #
556
+ # This method is part of the implementation of the load/dump interface of
557
+ # Marshal and YAML.
558
+ def load(source, proc = nil, options = {})
559
+ opts = load_default_options.merge options
560
+ if source.respond_to? :to_str
561
+ source = source.to_str
562
+ elsif source.respond_to? :to_io
563
+ source = source.to_io.read
564
+ elsif source.respond_to?(:read)
565
+ source = source.read
566
+ end
567
+ if opts[:allow_blank] && (source.nil? || source.empty?)
568
+ source = 'null'
569
+ end
570
+ result = parse(source, opts)
571
+ recurse_proc(result, &proc) if proc
572
+ result
573
+ end
574
+
575
+ # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_
576
+ def recurse_proc(result, &proc)
577
+ case result
578
+ when Array
579
+ result.each { |x| recurse_proc x, &proc }
580
+ proc.call result
581
+ when Hash
582
+ result.each { |x, y| recurse_proc x, &proc; recurse_proc y, &proc }
583
+ proc.call result
584
+ else
585
+ proc.call result
586
+ end
587
+ end
588
+
589
+ alias restore load
590
+ module_function :restore
591
+
592
+ class << self
593
+ # Sets or returns the default options for the JSON.dump method.
594
+ # Initially:
595
+ # opts = JSON.dump_default_options
596
+ # opts # => {:max_nesting=>false, :allow_nan=>true}
597
+ attr_accessor :dump_default_options
598
+ end
599
+ self.dump_default_options = {
600
+ :max_nesting => false,
601
+ :allow_nan => true,
602
+ }
603
+
604
+ # Dumps _obj_ as a JSON string, i.e. calls generate on the object and returns
605
+ # the result.
606
+ #
607
+ # If anIO (an IO-like object or an object that responds to the write method)
608
+ # was given, the resulting JSON is written to it.
609
+ #
610
+ # If the number of nested arrays or objects exceeds _limit_, an ArgumentError
611
+ # exception is raised. This argument is similar (but not exactly the
612
+ # same!) to the _limit_ argument in Marshal.dump.
613
+ #
614
+ # The default options for the generator can be changed via the
615
+ # dump_default_options method.
616
+ #
617
+ # This method is part of the implementation of the load/dump interface of
618
+ # Marshal and YAML.
619
+ def dump(obj, anIO = nil, limit = nil)
620
+ if anIO and limit.nil?
621
+ anIO = anIO.to_io if anIO.respond_to?(:to_io)
622
+ unless anIO.respond_to?(:write)
623
+ limit = anIO
624
+ anIO = nil
625
+ end
626
+ end
627
+ opts = JSON.dump_default_options
628
+ opts = opts.merge(:max_nesting => limit) if limit
629
+ result = generate(obj, opts)
630
+ if anIO
631
+ anIO.write result
632
+ anIO
633
+ else
634
+ result
635
+ end
636
+ rescue JSON::NestingError
637
+ raise ArgumentError, "exceed depth limit"
638
+ end
639
+
640
+ # Encodes string using String.encode.
641
+ def self.iconv(to, from, string)
642
+ string.encode(to, from)
643
+ end
644
+ end
645
+
646
+ module ::Kernel
647
+ private
648
+
649
+ # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in
650
+ # one line.
651
+ def j(*objs)
652
+ objs.each do |obj|
653
+ puts JSON::generate(obj, :allow_nan => true, :max_nesting => false)
654
+ end
655
+ nil
656
+ end
657
+
658
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
659
+ # indentation and over many lines.
660
+ def jj(*objs)
661
+ objs.each do |obj|
662
+ puts JSON::pretty_generate(obj, :allow_nan => true, :max_nesting => false)
663
+ end
664
+ nil
665
+ end
666
+
667
+ # If _object_ is string-like, parse the string and return the parsed result as
668
+ # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data
669
+ # structure object and return it.
670
+ #
671
+ # The _opts_ argument is passed through to generate/parse respectively. See
672
+ # generate and parse for their documentation.
673
+ def JSON(object, *args)
674
+ if object.respond_to? :to_str
675
+ JSON.parse(object.to_str, args.first)
676
+ else
677
+ JSON.generate(object, args.first)
678
+ end
679
+ end
680
+ end
681
+
682
+ # Extends any Class to include _json_creatable?_ method.
683
+ class ::Class
684
+ # Returns true if this class can be used to create an instance
685
+ # from a serialised JSON string. The class has to implement a class
686
+ # method _json_create_ that expects a hash as first parameter. The hash
687
+ # should include the required data.
688
+ def json_creatable?
689
+ respond_to?(:json_create)
690
+ end
691
+ end