uploadcare-ruby 2.1.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +20 -0
  3. data/.github/workflows/ruby.yml +52 -0
  4. data/.gitignore +13 -6
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +33 -0
  7. data/.yardopts +4 -0
  8. data/CHANGELOG.md +29 -47
  9. data/DEVELOPMENT.md +18 -0
  10. data/Gemfile +2 -0
  11. data/LICENSE +1 -1
  12. data/README.md +433 -527
  13. data/Rakefile +5 -5
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/lib/uploadcare/api/api.rb +25 -0
  17. data/lib/uploadcare/client/conversion/base_conversion_client.rb +59 -0
  18. data/lib/uploadcare/client/conversion/document_conversion_client.rb +41 -0
  19. data/lib/uploadcare/client/conversion/video_conversion_client.rb +46 -0
  20. data/lib/uploadcare/client/file_client.rb +44 -0
  21. data/lib/uploadcare/client/file_list_client.rb +46 -0
  22. data/lib/uploadcare/client/group_client.rb +45 -0
  23. data/lib/uploadcare/client/multipart_upload/chunks_client.rb +57 -0
  24. data/lib/uploadcare/client/multipart_upload_client.rb +64 -0
  25. data/lib/uploadcare/client/project_client.rb +18 -0
  26. data/lib/uploadcare/client/rest_client.rb +74 -0
  27. data/lib/uploadcare/client/rest_group_client.rb +23 -0
  28. data/lib/uploadcare/client/upload_client.rb +43 -0
  29. data/lib/uploadcare/client/uploader_client.rb +101 -0
  30. data/lib/uploadcare/client/webhook_client.rb +47 -0
  31. data/lib/uploadcare/concern/error_handler.rb +54 -0
  32. data/lib/uploadcare/concern/throttle_handler.rb +25 -0
  33. data/lib/uploadcare/concern/upload_error_handler.rb +32 -0
  34. data/lib/uploadcare/entity/conversion/base_converter.rb +36 -0
  35. data/lib/uploadcare/entity/conversion/document_converter.rb +15 -0
  36. data/lib/uploadcare/entity/conversion/video_converter.rb +15 -0
  37. data/lib/uploadcare/entity/decorator/paginator.rb +79 -0
  38. data/lib/uploadcare/entity/entity.rb +18 -0
  39. data/lib/uploadcare/entity/file.rb +106 -0
  40. data/lib/uploadcare/entity/file_list.rb +31 -0
  41. data/lib/uploadcare/entity/group.rb +40 -0
  42. data/lib/uploadcare/entity/group_list.rb +24 -0
  43. data/lib/uploadcare/entity/project.rb +13 -0
  44. data/lib/uploadcare/entity/uploader.rb +81 -0
  45. data/lib/uploadcare/entity/webhook.rb +14 -0
  46. data/lib/uploadcare/exception/conversion_error.rb +8 -0
  47. data/lib/uploadcare/exception/request_error.rb +9 -0
  48. data/lib/uploadcare/exception/throttle_error.rb +16 -0
  49. data/lib/uploadcare/param/authentication_header.rb +25 -0
  50. data/lib/uploadcare/param/conversion/document/processing_job_url_builder.rb +39 -0
  51. data/lib/uploadcare/param/conversion/video/processing_job_url_builder.rb +64 -0
  52. data/lib/uploadcare/param/param.rb +10 -0
  53. data/lib/uploadcare/param/secure_auth_header.rb +37 -0
  54. data/lib/uploadcare/param/simple_auth_header.rb +14 -0
  55. data/lib/uploadcare/param/upload/signature_generator.rb +24 -0
  56. data/lib/uploadcare/param/upload/upload_params_generator.rb +23 -0
  57. data/lib/uploadcare/param/user_agent.rb +21 -0
  58. data/lib/uploadcare/ruby/version.rb +5 -0
  59. data/lib/uploadcare.rb +36 -32
  60. data/uploadcare-ruby.gemspec +50 -37
  61. metadata +107 -113
  62. data/.travis.yml +0 -26
  63. data/UPGRADE_NOTES.md +0 -36
  64. data/lib/uploadcare/api/file_api.rb +0 -7
  65. data/lib/uploadcare/api/file_list_api.rb +0 -19
  66. data/lib/uploadcare/api/file_storage_api.rb +0 -34
  67. data/lib/uploadcare/api/group_api.rb +0 -38
  68. data/lib/uploadcare/api/group_list_api.rb +0 -17
  69. data/lib/uploadcare/api/project_api.rb +0 -9
  70. data/lib/uploadcare/api/raw_api.rb +0 -38
  71. data/lib/uploadcare/api/uploading_api/upload_params.rb +0 -72
  72. data/lib/uploadcare/api/uploading_api.rb +0 -71
  73. data/lib/uploadcare/api/validators/file_list_options_validator.rb +0 -73
  74. data/lib/uploadcare/api/validators/group_list_options_validator.rb +0 -49
  75. data/lib/uploadcare/api.rb +0 -26
  76. data/lib/uploadcare/errors/errors.rb +0 -64
  77. data/lib/uploadcare/resources/file.rb +0 -164
  78. data/lib/uploadcare/resources/file_list.rb +0 -14
  79. data/lib/uploadcare/resources/group.rb +0 -115
  80. data/lib/uploadcare/resources/group_list.rb +0 -14
  81. data/lib/uploadcare/resources/project.rb +0 -13
  82. data/lib/uploadcare/resources/resource_list.rb +0 -83
  83. data/lib/uploadcare/rest/auth/auth.rb +0 -31
  84. data/lib/uploadcare/rest/auth/secure.rb +0 -43
  85. data/lib/uploadcare/rest/auth/simple.rb +0 -16
  86. data/lib/uploadcare/rest/connections/api_connection.rb +0 -53
  87. data/lib/uploadcare/rest/connections/upload_connection.rb +0 -22
  88. data/lib/uploadcare/rest/middlewares/auth_middleware.rb +0 -24
  89. data/lib/uploadcare/rest/middlewares/parse_json_middleware.rb +0 -33
  90. data/lib/uploadcare/rest/middlewares/raise_error_middleware.rb +0 -21
  91. data/lib/uploadcare/utils/parser.rb +0 -71
  92. data/lib/uploadcare/utils/user_agent.rb +0 -44
  93. data/lib/uploadcare/version.rb +0 -3
  94. data/spec/api/file_list_api_spec.rb +0 -95
  95. data/spec/api/file_storage_api_spec.rb +0 -88
  96. data/spec/api/group_list_api_spec.rb +0 -59
  97. data/spec/api/raw_api_spec.rb +0 -25
  98. data/spec/api/uploading_api/upload_params_spec.rb +0 -99
  99. data/spec/api/uploading_api_spec.rb +0 -59
  100. data/spec/resources/file_list_spec.rb +0 -25
  101. data/spec/resources/file_spec.rb +0 -223
  102. data/spec/resources/group_list_spec.rb +0 -25
  103. data/spec/resources/group_spec.rb +0 -101
  104. data/spec/resources/operations_spec.rb +0 -59
  105. data/spec/resources/project_spec.rb +0 -21
  106. data/spec/rest/api_connection_spec.rb +0 -68
  107. data/spec/rest/auth/secure_spec.rb +0 -66
  108. data/spec/rest/auth/simple_spec.rb +0 -31
  109. data/spec/rest/errors_spec.rb +0 -75
  110. data/spec/rest/upload_connection_spec.rb +0 -19
  111. data/spec/shared/resource_list.rb +0 -188
  112. data/spec/spec_helper.rb +0 -54
  113. data/spec/uploadcare_spec.rb +0 -43
  114. data/spec/utils/parser_spec.rb +0 -85
  115. data/spec/utils/user_agent_spec.rb +0 -46
  116. data/spec/view.png +0 -0
  117. data/spec/view2.jpg +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 228937684b8d8c141f9e9d9333b938631f3d8a581164d119925815dad392c6e7
4
- data.tar.gz: 3bcd8e452aa580499afcd736beb03fb1c6eb8a91e0ea1d17759f2947ac925292
3
+ metadata.gz: '08303dd0379957a7780c58d562c2ddbf9ae42e02d8069e19404defb9d7455292'
4
+ data.tar.gz: d661a6c49bdcb5b5789b3e22dac0a0a439012f0a1bfc5a55b3cdc0c64094ef8b
5
5
  SHA512:
6
- metadata.gz: c0d81628907eb8d0c8db49d63c23b1a4c4049eae305536a21cb553a057b2efda95659232ddb67467749b9e24708068f8e3564987eeca6c398be56446ea462542
7
- data.tar.gz: 838ff37a6ecdbb783fb9677694fc28985ec83054dabaf10a3c932de5aab22d8129612ebdaa6a13dbdba5d8c624fe601a4f6e679763c7c5a30ae345707d378dcb
6
+ metadata.gz: b4b2c4f5342f48908731446e7ca2fa5aabef6568d99dede4ca46f3ed3df13993a156f70f84ac6a87d36799b2d589bc465814c7efeefcbfd6a3e459d3e378814f
7
+ data.tar.gz: 0ffba57715c58eeeabc2d2b44884e67d09a5ee41b916fd10248e46822d5b35d3dd5c24c450ec4961a03b5a6f01903a5867007248bd347b88ac3568d89104c592
@@ -0,0 +1,20 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v1
13
+
14
+ - name: Release Gem
15
+ if: contains(github.ref, 'refs/tags/v')
16
+ uses: cadwallion/publish-rubygems-action@v1.0.0
17
+ env:
18
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
19
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
20
+ RELEASE_COMMAND: rake release
@@ -0,0 +1,52 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on: [push, pull_request]
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: [
19
+ '2.4', '2.5', # eol
20
+ '2.6', '2.7', # maintained
21
+ ]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true
30
+ - name: Run tests
31
+ run: bundle exec rake
32
+ env:
33
+ UPLOADCARE_PUBLIC_KEY: demopublickey
34
+ UPLOADCARE_SECRET_KEY: demoprivatekey
35
+
36
+ style-check:
37
+ runs-on: ubuntu-latest
38
+ continue-on-error: true
39
+ strategy:
40
+ matrix:
41
+ ruby-version: ['2.7',]
42
+ steps:
43
+ - uses: actions/checkout@v2
44
+ - name: Set up Ruby
45
+ uses: ruby/setup-ruby@v1
46
+ with:
47
+ ruby-version: ${{ matrix.ruby-version }}
48
+ bundler-cache: true
49
+ - name: Install Rubocop
50
+ run: gem install rubocop
51
+ - name: Check codestyle
52
+ run: rubocop
data/.gitignore CHANGED
@@ -1,7 +1,14 @@
1
- Gemfile.lock
2
- .ruby-gemset
3
- .ruby-version
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /spec/fixtures/big.jpeg
4
10
 
5
- *.DS_Store
6
- *.gem
7
- coverage
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ .byebug_history
14
+ Gemfile.lock
data/.rspec CHANGED
@@ -1 +1,3 @@
1
+ --format documentation
1
2
  --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,33 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.7
3
+
4
+ Metrics/LineLength:
5
+ Max: 120
6
+
7
+ IneffectiveAccessModifier:
8
+ Enabled: false
9
+
10
+ Style/HashTransformKeys:
11
+ Exclude:
12
+ - 'lib/uploadcare/entity/decorator/paginator.rb'
13
+ - 'lib/uploadcare/client/conversion/video_conversion_client.rb'
14
+ - 'lib/uploadcare/entity/file.rb'
15
+
16
+ Gemspec/RequiredRubyVersion:
17
+ Exclude:
18
+ - 'uploadcare-ruby.gemspec'
19
+
20
+ Metrics/BlockLength:
21
+ Exclude:
22
+ - 'bin/'
23
+ - 'spec/**/*'
24
+ - 'uploadcare-ruby.gemspec'
25
+
26
+ Metrics/MethodLength:
27
+ Max: 20
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
32
+ Style/OptionalBooleanParameter:
33
+ AllowedMethods: ['create']
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ -
2
+ DEVELOPMENT.md
3
+ CHANGELOG.md
4
+ LICENSE
data/CHANGELOG.md CHANGED
@@ -1,65 +1,47 @@
1
1
  # Changelog
2
- All notable changes to this project will be documented in this file.
3
2
 
4
- The format is based now on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
- and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
3
+ ## 3.1.0 2021-09-21
6
4
 
7
- ## [2.1.2] - 2018-06-11
5
+ - Added documents and videos conversion
6
+ - Added new attributes to the Entity class (variations, video_info, source, rekognition_info)
7
+ - Added an opportunity to add custom logic to large files uploading process
8
8
 
9
- ### Fixed
10
- - Show Uploadcare::USER_AGENT deprecation warning only when the constant is being used
9
+ ## 3.0.5 2021-04-15
11
10
 
12
- ## [2.1.1] - 2018-05-24
11
+ - Replace Travis-CI with Github Actions
12
+ - Automate gem pushing
13
13
 
14
- ### Changed
15
- - Allow user to override User-Agent header
16
- - User-Agent format reports gem name, version and environment
14
+ ## 3.0.4-dev 2020-03-19
17
15
 
18
- ## 2.1.0 - 2018-04-23 [YANKED]
16
+ - Added better pagination methods for GroupList & FileList
17
+ - Improved documentation and install instructions
18
+ - Added CI
19
19
 
20
- ## 2.0.0 - 2017-09-26
20
+ ## 3.0.3-dev 2020-03-13
21
+ - Added better pagination and iterators for GroupList & FileList
21
22
 
22
- There are **breaking** changes in this release, please read [upgrade notes](UPGRADE_NOTES.md#v1---v2)
23
+ ## 3.0.2-dev 2020-03-11
23
24
 
24
- ### Added
25
- - Support for `store` flag in [Upload API](https://uploadcare.com/documentation/upload/) methods
26
- - Methods to store/delete multiple files at once: `Uploadcare::Api#store_files` & `Uploadcare::Api#delete_files`
25
+ - Expanded File and Group entities
26
+ - Changed user agent syntax
27
27
 
28
- ### Changed
29
- - Upgraded to REST API v0.5
30
- - All POST/PUT/DELETE params are now being sent as JSON instead of being form-encoded
31
- - Pagination implementation for files and groups
28
+ ## 3.0.1-dev 2020-03-11
32
29
 
30
+ - Added Upload/group functionality
31
+ - Added user API
32
+ - Added user agent
33
+ - Isolated clients, entities and concerns
34
+ - Expanded documentation
33
35
 
34
- ### [1.2.1] - 2018-05-24
36
+ ## 3.0.0-dev 2020-02-18
35
37
 
36
38
  ### Changed
37
- - Allow user to override User-Agent header
38
- - User-Agent format reports gem name, version and environment
39
-
40
-
41
- ## 1.1.0 - 2017-03-21
39
+ - Rewrote gem from scratch
42
40
 
43
41
  ### Added
44
- - Added to new methods to `Uploadcare::Api::File`, `#internal_copy` and `#external_copy`.
45
- - Added support of [secure authorization](https://uploadcare.com/documentation/rest/#request) for REST API. It is now used by default (can be overriden in config)
46
-
47
- ### Fixed
48
- - Fixed middleware names that could break other gems ([#13](https://github.com/uploadcare/uploadcare-ruby/issues/13)).
49
-
50
- ### Deprecated
51
- - `Uploadcare::Api::File#copy` in favor of `#internal_copy` and `#external_copy`.
52
-
53
-
54
- ## 1.0.6, 2017-01-30
55
-
56
- ### Added
57
- - Ruby version and public API key sent via User-Agent header (can be overriden in config)
58
-
59
- ### Fixed
60
- - Incorrect dependencies
61
-
62
42
 
63
- [Unreleased]: https://github.com/uploadcare/uploadcare-ruby/compare/v2.1.1...HEAD
64
- [2.1.1]: https://github.com/uploadcare/uploadcare-ruby/compare/v2.0.0...v2.1.1
65
- [1.2.1]: https://github.com/uploadcare/uploadcare-ruby/compare/6dde...v1.2.1
43
+ - Client wrappers for REST API
44
+ - Serializers for REST API
45
+ - Client wrappers for Upload API
46
+ - Serializers for Upload API
47
+ - rdoc documentation
data/DEVELOPMENT.md ADDED
@@ -0,0 +1,18 @@
1
+ ## How to contribute
2
+
3
+ https://github.com/uploadcare/.github/blob/master/CONTRIBUTING.md
4
+
5
+ ## Useful docs
6
+
7
+ ### Uploadcare:
8
+
9
+ * https://uploadcare.com/docs/api_reference/
10
+ * https://uploadcare.com/api-refs/rest-api/
11
+
12
+ ### ApiStruct:
13
+
14
+ * https://github.com/rubygarage/api_struct/
15
+
16
+ ## Uploadcare-ruby gem architecture
17
+
18
+ ![http://www.plantuml.com/plantuml/uml/bPHDRzj838Rl-XM4zn1WiHRsOoyR88iuXOFcKWHDqcimaLxBquvcL9AowtxyzqepqYGrYY050cH69X-IByav5pMiVUkAed96X5QTfIy54T7jrWgDVrx16rE1De6fGKkzW2NQB9VB-7_zoRIT0zLmQ8oYfXQw3RMS9ZFgEnTCFLqsrk7UMT7YsnnsxTNguIZoNNIg38DMrrU4P2DWQvpz32wZzPtqnha3MStXXH9rIe8qq2jduPMSEO3_Y7x6rzJ0WwD3fjOK7jwZKg4DXvOOqWKlIB6klAZn5JBPS3v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PHEKj4d4PBqe0SpfXmyTHnsjivZTZBDQlca8S5NO2zJ2Mlcm5GPhRPWYMEB-6ax71tusG8MY-Xu7praiI0sLY13dpceEYHuDBQRk6KCxTbBdc7QMzrI5MhGlt__bx4f-BqcZlNDm5Rp0K9cAZbcgcmH9uTxJrR9DCRw56-_XSSEF7vke4SvFSfnRTYqUJmXo5qqd5VDFhZfVKeRFIH4kwdthszlhwaRAL6gED2MCVJay8A1pfDyOnjlj6VCCGBBcEMgiuFFr__dD-mqx_VJ1sZ-DTPKf4joc_RlzBdNosC_sHLvOSe9ESFAUVIBYLWcwOeyJ-NCE8Ul-zPz1m00)
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in uploadcare-ruby.gemspec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Uploadcare, LLC
3
+ Copyright (c) 2021 Uploadcare Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal