uploadcare-rails 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/uploadcare/rails/api/rest/base.rb +3 -2
  3. data/lib/uploadcare/rails/api/upload/base.rb +2 -0
  4. data/lib/uploadcare/rails/configuration.rb +3 -1
  5. data/lib/uploadcare/rails/transformations/image_transformations.rb +1 -1
  6. data/lib/uploadcare/rails/version.rb +1 -1
  7. metadata +28 -139
  8. data/spec/fixtures/kitten.jpeg +0 -0
  9. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +0 -62
  10. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +0 -62
  11. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +0 -62
  12. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +0 -62
  13. data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +0 -59
  14. data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +0 -59
  15. data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +0 -60
  16. data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +0 -61
  17. data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +0 -58
  18. data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +0 -61
  19. data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +0 -61
  20. data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +0 -57
  21. data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +0 -61
  22. data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +0 -57
  23. data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +0 -61
  24. data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +0 -56
  25. data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +0 -57
  26. data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +0 -177
  27. data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +0 -59
  28. data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +0 -59
  29. data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +0 -105
  30. data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +0 -111
  31. data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +0 -59
  32. data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +0 -59
  33. data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +0 -59
  34. data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +0 -59
  35. data/spec/generators/uploadcare_config_generator_spec.rb +0 -31
  36. data/spec/spec_helper.rb +0 -27
  37. data/spec/support/generators.rb +0 -41
  38. data/spec/support/vcr.rb +0 -14
  39. data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +0 -40
  40. data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +0 -46
  41. data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +0 -33
  42. data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +0 -32
  43. data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +0 -110
  44. data/spec/uploadcare/rails/api/rest/file_api_spec.rb +0 -76
  45. data/spec/uploadcare/rails/api/rest/group_api_spec.rb +0 -61
  46. data/spec/uploadcare/rails/api/rest/project_api_spec.rb +0 -33
  47. data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +0 -67
  48. data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +0 -82
  49. data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +0 -15
  50. data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +0 -15
  51. data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +0 -15
  52. data/spec/uploadcare/rails/objects/file_spec.rb +0 -77
  53. data/spec/uploadcare/rails/objects/group_spec.rb +0 -65
  54. data/spec/uploadcare/rails/services/id_extractor_spec.rb +0 -26
  55. data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +0 -120
  56. data/spec/uploadcare/rails_spec.rb +0 -7
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'uploadcare/rails/transformations/image_transformations'
5
-
6
- describe Uploadcare::Rails::Transformations::ImageTransformations do
7
- subject { described_class.new(**arguments).call }
8
-
9
- let(:arguments) do
10
- {
11
- # Resize and crop
12
- preview: '300x500',
13
- resize: '300x500',
14
- smart_resize: '300x500',
15
- crop: {
16
- dimensions: '300x500',
17
- coords: '2400,700',
18
- alignment: 'center'
19
- },
20
- scale_crop: {
21
- dimensions: '300x500',
22
- offsets: '50%,50%',
23
- smart_mode: 'smart'
24
- },
25
- setfill: 'ece3d2',
26
- # Compression
27
- format: 'png',
28
- quality: 'smart',
29
- progressive: 'yes',
30
- gif2video: true,
31
- # Colors
32
- brightness: '50',
33
- exposure: '50',
34
- gamma: '50',
35
- contrast: '50',
36
- saturation: '50',
37
- vibrance: '50',
38
- warmth: '50',
39
- enhance: '50',
40
- grayscale: true,
41
- invert: true,
42
- filter: {
43
- name: 'adaris',
44
- amount: 50
45
- },
46
- srgb: 'fast',
47
- max_icc_size: 2,
48
- # Blur and sharpen
49
- blur: {
50
- strength: 50,
51
- amount: 90
52
- },
53
- blur_region: {
54
- dimensions: '300x500',
55
- coords: '2400,700',
56
- strength: 50
57
- },
58
- sharp: 50,
59
- # Overlay
60
- overlay: {
61
- uuid: 'self',
62
- relative_dimensions: '50%x50%',
63
- relative_coordinates: 'center',
64
- opacity: '20p'
65
- },
66
- # Rotate and flip
67
- autorotate: 'yes',
68
- rotate: 90,
69
- flip: true,
70
- mirror: true
71
- }
72
- end
73
- let(:expected_string) do
74
- "/preview/#{arguments[:preview]}/-" \
75
- "/resize/#{arguments[:resize]}/-" \
76
- "/smart_resize/#{arguments[:smart_resize]}/-" \
77
- "/crop/#{arguments[:crop].values.join('/')}/-" \
78
- "/scale_crop/#{arguments[:scale_crop].values.join('/')}/-" \
79
- "/setfill/#{arguments[:setfill]}/-" \
80
- "/format/#{arguments[:format]}/-" \
81
- "/quality/#{arguments[:quality]}/-" \
82
- "/progressive/#{arguments[:progressive]}/-" \
83
- '/gif2video/-' \
84
- "/brightness/#{arguments[:brightness]}/-" \
85
- "/exposure/#{arguments[:exposure]}/-" \
86
- "/gamma/#{arguments[:gamma]}/-" \
87
- "/contrast/#{arguments[:contrast]}/-" \
88
- "/saturation/#{arguments[:saturation]}/-" \
89
- "/vibrance/#{arguments[:vibrance]}/-" \
90
- "/warmth/#{arguments[:warmth]}/-" \
91
- "/enhance/#{arguments[:enhance]}/-" \
92
- '/grayscale/-' \
93
- '/invert/-' \
94
- "/filter/#{arguments[:filter].values.join('/')}/-" \
95
- "/srgb/#{arguments[:srgb]}/-" \
96
- "/max_icc_size/#{arguments[:max_icc_size]}/-" \
97
- "/blur/#{arguments[:blur].values.join('/')}/-" \
98
- "/blur_region/#{arguments[:blur_region].values.join('/')}/-" \
99
- "/sharp/#{arguments[:sharp]}/-" \
100
- "/overlay/#{arguments[:overlay].values.join('/')}/-" \
101
- "/autorotate/#{arguments[:autorotate]}/-" \
102
- "/rotate/#{arguments[:rotate]}/-" \
103
- '/flip/-' \
104
- '/mirror/'
105
- end
106
-
107
- it 'builds image transformations params url' do
108
- expect(subject).to eq expected_string
109
- end
110
-
111
- context 'when sending invalid data' do
112
- context 'and when including spaces in params' do
113
- let(:arguments) { { preview: '300x 500' } }
114
-
115
- it 'removes all spaces from the result string' do
116
- expect(subject).not_to match(/\s/)
117
- end
118
- end
119
- end
120
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Uploadcare::Rails do
4
- it 'has a version number' do
5
- expect(Uploadcare::Rails::VERSION).not_to be nil
6
- end
7
- end