yadisk-client 1.10.2 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -0
  3. data/.github/workflows/CI.yml +50 -0
  4. data/Gemfile.lock +12 -1
  5. data/README.md +5 -2
  6. data/lib/yadisk/resources/disk.rb +5 -6
  7. data/lib/yadisk/version.rb +2 -2
  8. data/spec/lib/yadisk/client_spec.rb +4 -8
  9. data/spec/lib/yadisk/disk_spec.rb +220 -217
  10. data/spec/lib/yadisk/operation_spec.rb +18 -0
  11. data/spec/lib/yadisk/public_spec.rb +31 -37
  12. data/spec/lib/yadisk/trash_spec.rb +27 -56
  13. data/spec/spec_helper.rb +15 -1
  14. data/spec/vcr/disk/{POST_copy.yml → copy.yml} +10 -8
  15. data/spec/vcr/disk/create_dir.yml +52 -0
  16. data/spec/vcr/disk/{PUT_create_dir.yml → create_dir_error_409.yml} +10 -6
  17. data/spec/vcr/disk/{DELETE_delete.yml → delete.yml} +3 -3
  18. data/spec/vcr/{operations/GET_status.yml → disk/download.yml} +4 -4
  19. data/spec/vcr/disk/get_meta.yml +52 -0
  20. data/spec/vcr/disk/info.yml +57 -0
  21. data/spec/vcr/disk/last_uploaded.yml +52 -0
  22. data/spec/vcr/disk/list_files.yml +52 -0
  23. data/spec/vcr/disk/list_public.yml +52 -0
  24. data/spec/vcr/disk/{POST_move.yml → move.yml} +10 -8
  25. data/spec/vcr/disk/{PUT_publish.yml → publish.yml} +4 -4
  26. data/spec/vcr/disk/{PUT_unpublish.yml → unpublish.yml} +4 -4
  27. data/spec/vcr/disk/update_meta.yml +54 -0
  28. data/spec/vcr/disk/{GET_get_meta.yml → upload.yml} +5 -5
  29. data/spec/vcr/disk/{POST_upload_by_url.yml → upload_by_url.yml} +4 -4
  30. data/spec/vcr/disk/upload_from_file.yml +111 -0
  31. data/spec/vcr/{disk/GET_download.yml → operation/status.yml} +4 -4
  32. data/spec/vcr/{disk/GET_list_public.yml → public/link.yml} +4 -4
  33. data/spec/vcr/public/meta.yml +52 -0
  34. data/spec/vcr/public/save.yml +52 -0
  35. data/spec/vcr/trash/{DELETE_delete.yml → delete.yml} +3 -3
  36. data/spec/vcr/trash/list.yml +52 -0
  37. data/spec/vcr/trash/{PUT_restore.yml → restore.yml} +6 -5
  38. data/spec/vcr_setup.rb +0 -4
  39. data/yadisk.gemspec +8 -0
  40. metadata +133 -23
  41. data/spec/lib/yadisk/errors_spec.rb +0 -16
  42. data/spec/lib/yadisk/operations_spec.rb +0 -23
  43. data/spec/vcr/disk/ERROR_info.yml +0 -48
  44. data/spec/vcr/disk/GET_info.yml +0 -52
  45. data/spec/vcr/disk/GET_upload.yml +0 -48
  46. data/spec/vcr/disk/PATCH_update_meta.yml +0 -54
  47. data/spec/vcr/trash/DELETE_delete_error.yml +0 -49
  48. data/spec/vcr/trash/GET_list.yml +0 -51
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- describe Yadisk::Client do
6
- context "client with bad credentials.", :vcr do
7
- let(:client) { Yadisk::Client.new(token: "very bad token").disk.info }
8
- let(:name) { "disk/ERROR_info" }
9
- it "UnauthorizedError" do
10
- VCR.use_cassette(name, allow_playback_repeats: true) do
11
- expect { client }.to raise_error(Yadisk::Error)
12
- .with_message(/did not supply valid authentication/)
13
- end
14
- end
15
- end
16
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- describe Yadisk::Client do
6
- # TODO: describe > context > it
7
- context "#operations" do
8
- it "#status", :vcr do
9
- name = "operations/GET_status"
10
- VCR.use_cassette(name, allow_playback_repeats: true) do
11
- id = "a6e706d94c4adcd17298c1eed06729f9e9217569e6376a51c38de74d8d6367c5"
12
- resp = @yandex.operation.status(operation_id: id)
13
- CassetteHelpers::Use.new(name) do |c|
14
- expect(c.url).to eq("https://cloud-api.yandex.net/v1/disk/operations/#{id}")
15
- expect(c.code).to eq(200)
16
- expect(c.method).to eq("get")
17
- end
18
- expect(resp).to be_instance_of(String)
19
- expect(resp).to eq("in-progress")
20
- end
21
- end
22
- end
23
- end
@@ -1,48 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cloud-api.yandex.net/v1/disk
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 401
21
- message: UNAUTHORIZED
22
- headers:
23
- Server:
24
- - nginx
25
- Date:
26
- - Wed, 05 Oct 2022 14:32:20 GMT
27
- Content-Type:
28
- - application/json
29
- Content-Length:
30
- - '99'
31
- Connection:
32
- - keep-alive
33
- Access-Control-Allow-Credentials:
34
- - 'true'
35
- Yandex-Cloud-Request-Id:
36
- - omitted
37
- Cache-Control:
38
- - no-cache
39
- Access-Control-Allow-Origin:
40
- - "*"
41
- Access-Control-Allow-Headers:
42
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
43
- Authorization
44
- body:
45
- encoding: UTF-8
46
- string: '{"items":[{"key":"value"}]}'
47
- recorded_at: Wed, 05 Oct 2022 14:32:20 GMT
48
- recorded_with: VCR 6.1.0
@@ -1,52 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cloud-api.yandex.net/v1/disk
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Server:
24
- - nginx
25
- Date:
26
- - Wed, 05 Oct 2022 14:32:12 GMT
27
- Content-Type:
28
- - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Vary:
34
- - Accept-Encoding
35
- Access-Control-Allow-Methods:
36
- - GET, OPTIONS
37
- Access-Control-Allow-Credentials:
38
- - 'true'
39
- Yandex-Cloud-Request-Id:
40
- - omitted
41
- Cache-Control:
42
- - no-cache
43
- Access-Control-Allow-Origin:
44
- - "*"
45
- Access-Control-Allow-Headers:
46
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
47
- Authorization
48
- body:
49
- encoding: UTF-8
50
- string: '{"items":[{"key":"value"}]}'
51
- recorded_at: Wed, 05 Oct 2022 14:32:12 GMT
52
- recorded_with: VCR 6.1.0
@@ -1,48 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cloud-api.yandex.net/v1/disk/resources/upload?path=remote_file.txt
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 409
21
- message: CONFLICT
22
- headers:
23
- Server:
24
- - nginx
25
- Date:
26
- - Wed, 05 Oct 2022 14:32:12 GMT
27
- Content-Type:
28
- - application/json
29
- Content-Length:
30
- - '177'
31
- Connection:
32
- - keep-alive
33
- Access-Control-Allow-Credentials:
34
- - 'true'
35
- Yandex-Cloud-Request-Id:
36
- - omitted
37
- Cache-Control:
38
- - no-cache
39
- Access-Control-Allow-Origin:
40
- - "*"
41
- Access-Control-Allow-Headers:
42
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
43
- Authorization
44
- body:
45
- encoding: UTF-8
46
- string: '{"items":[{"key":"value"}]}'
47
- recorded_at: Wed, 05 Oct 2022 14:32:12 GMT
48
- recorded_with: VCR 6.1.0
@@ -1,54 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: patch
5
- uri: https://cloud-api.yandex.net/v1/disk/resources?path=remote_file.txt
6
- body:
7
- encoding: UTF-8
8
- string: '{"custom_properties":{"key_one":"value_1","key_two":"value_2"}}'
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Content-Type:
15
- - application/json
16
- Accept-Encoding:
17
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
- Accept:
19
- - "*/*"
20
- response:
21
- status:
22
- code: 200
23
- message: OK
24
- headers:
25
- Server:
26
- - nginx
27
- Date:
28
- - Wed, 05 Oct 2022 14:32:14 GMT
29
- Content-Type:
30
- - application/json; charset=utf-8
31
- Transfer-Encoding:
32
- - chunked
33
- Connection:
34
- - keep-alive
35
- Vary:
36
- - Accept-Encoding
37
- Access-Control-Allow-Methods:
38
- - PUT, PATCH, DELETE, GET, OPTIONS
39
- Access-Control-Allow-Credentials:
40
- - 'true'
41
- Yandex-Cloud-Request-Id:
42
- - omitted
43
- Cache-Control:
44
- - no-cache
45
- Access-Control-Allow-Origin:
46
- - "*"
47
- Access-Control-Allow-Headers:
48
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
49
- Authorization
50
- body:
51
- encoding: UTF-8
52
- string: '{"items":[{"key":"value"}]}'
53
- recorded_at: Wed, 05 Oct 2022 14:32:14 GMT
54
- recorded_with: VCR 6.1.0
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: delete
5
- uri: https://cloud-api.yandex.net/v1/disk/trash/resources?path=trash:/remote_file.txt_ade2b12db666598e14c09a28a55a11cee8ae14e7
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 404
21
- message: NOT FOUND
22
- headers:
23
- Server:
24
- - nginx
25
- Date:
26
- - Wed, 05 Oct 2022 14:23:35 GMT
27
- Content-Type:
28
- - application/json
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Vary:
34
- - Accept-Encoding
35
- Access-Control-Allow-Credentials:
36
- - 'true'
37
- Yandex-Cloud-Request-Id:
38
- - omitted
39
- Cache-Control:
40
- - no-cache
41
- Access-Control-Allow-Origin:
42
- - "*"
43
- Access-Control-Allow-Headers:
44
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
45
- Authorization
46
- body:
47
- encoding: UTF-8
48
- string: '{"items":[{"key":"value"}]}'
49
- recorded_at: Wed, 05 Oct 2022 14:23:35 GMT
@@ -1,51 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cloud-api.yandex.net/v1/disk/trash/resources?path=/
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v1.10.2
12
- Authorization:
13
- - "[**********]"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Server:
24
- - nginx
25
- Date:
26
- - Wed, 05 Oct 2022 14:34:55 GMT
27
- Content-Type:
28
- - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Vary:
34
- - Accept-Encoding
35
- Access-Control-Allow-Methods:
36
- - GET, DELETE, OPTIONS
37
- Access-Control-Allow-Credentials:
38
- - 'true'
39
- Yandex-Cloud-Request-Id:
40
- - omitted
41
- Cache-Control:
42
- - no-cache
43
- Access-Control-Allow-Origin:
44
- - "*"
45
- Access-Control-Allow-Headers:
46
- - Accept-Language, Accept, X-Uid, X-HTTP-Method, X-Requested-With, Content-Type,
47
- Authorization
48
- body:
49
- encoding: UTF-8
50
- string: '{"items":[{"key":"value"}]}'
51
- recorded_at: Wed, 05 Oct 2022 14:34:55 GMT