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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 773e6386c0a726ce03bab8d09c68fde2d11aaad6ba41fa68d6088724ca47f9de
4
- data.tar.gz: cf5fb42c245ba1649b3327f576003511852ac21f272c7b0d83e24fda8de988d8
3
+ metadata.gz: c4982aa2862e507318dc120ac4446c98b9b27d371eab862fbfb7dfb4c7d103ae
4
+ data.tar.gz: 82e9d47908ffa649709f0846b10f087ec057e903a88f8dcbf167d5ceaaf6db10
5
5
  SHA512:
6
- metadata.gz: 11149f7f6bcab071cf404c12606617c3a2e6421103ad92b2629e9c737be9a3d67d5b118cfeb968b2cde0766fc97a2187bd6c9b60e044dd8824656efbd5012cd1
7
- data.tar.gz: 01526162c291d8ad551288e0a81a71ec5d137e475b5b44548060495d4003eb2be7187b1935a17b4e9c77ca8851bcf9fe86dc80170fa677be2197354aa7800de3
6
+ metadata.gz: 8651187a3484e293e462324873a2eea3f470e5e64ad0f7a64ceb15a6e33efc3e7f1889a3e75bbea12a99f9c57543dfb8b7b10372916b8730e6258a1f3a652665
7
+ data.tar.gz: e6cfbe6a81b83b5043d1f8d1039407c2b4c773652a2bbd5bf1e64222ed096da70146d019f0fcd2f39f4335b47dc434ba21d9560e875f1d6e80c8714ae0e96e5e
@@ -0,0 +1,14 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: bundler
5
+ directory: /
6
+ schedule:
7
+ interval: daily
8
+ open-pull-requests-limit: 20
9
+
10
+ - package-ecosystem: "github-actions"
11
+ directory: "/"
12
+ schedule:
13
+ interval: "weekly"
14
+ open-pull-requests-limit: 20
@@ -0,0 +1,50 @@
1
+ name: Ruby specs
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ name: tests
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ os: [ubuntu-latest, macos-latest]
10
+ ruby: ['2.6', '2.7', '3.0', '3.1', head, truffleruby, truffleruby-head]
11
+ runs-on: ${{ matrix.os }}
12
+ continue-on-error: true
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+
19
+ - name: Get the newest rubygems version to rid ourselves of warnings
20
+ run: gem update --system --no-document
21
+
22
+ - name: Install bundler
23
+ run: gem i bundler --no-document
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ bundle config set --local without benchmark
28
+ bundle install --jobs=3
29
+ - name: RSpec testing
30
+ run: |
31
+ JRUBY_OPTS="--dev --debug" bundle exec rspec --color --format documentation
32
+ - name: Coveralls Parallel
33
+ uses: coverallsapp/github-action@1.1.3
34
+ with:
35
+ github-token: ${{ secrets.github_token }}
36
+ flag-name: run-${{ matrix.ruby-version }}
37
+ path-to-lcov: ./coverage/lcov/yadisk.lcov
38
+ parallel: true
39
+
40
+ coverage:
41
+ name: Coverage
42
+ needs: test
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - name: Coveralls Finished
46
+ uses: coverallsapp/github-action@1.1.3
47
+ with:
48
+ github-token: ${{ secrets.github_token }}
49
+ path-to-lcov: ${{ github.workspace }}/coverage/lcov.info
50
+ parallel-finished: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yadisk-client (1.10.2)
4
+ yadisk-client (1.11.1)
5
5
  addressable (~> 2.3, >= 2.3.7)
6
6
  faraday (~> 1.7)
7
7
  faraday_middleware (~> 1.1)
@@ -15,6 +15,7 @@ GEM
15
15
  crack (0.4.5)
16
16
  rexml
17
17
  diff-lcs (1.5.0)
18
+ docile (1.4.0)
18
19
  faraday (1.10.2)
19
20
  faraday-em_http (~> 1.0)
20
21
  faraday-em_synchrony (~> 1.0)
@@ -82,6 +83,13 @@ GEM
82
83
  rubocop-ast (>= 0.4.0)
83
84
  ruby-progressbar (1.11.0)
84
85
  ruby2_keywords (0.0.5)
86
+ simplecov (0.21.2)
87
+ docile (~> 1.1)
88
+ simplecov-html (~> 0.11)
89
+ simplecov_json_formatter (~> 0.1)
90
+ simplecov-html (0.12.3)
91
+ simplecov-lcov (0.7.0)
92
+ simplecov_json_formatter (0.1.4)
85
93
  standard (1.16.1)
86
94
  rubocop (= 1.35.1)
87
95
  rubocop-performance (= 1.14.3)
@@ -98,9 +106,12 @@ PLATFORMS
98
106
 
99
107
  DEPENDENCIES
100
108
  addressable (~> 2.3, >= 2.3.7)
109
+ bundler
101
110
  minitest (>= 5.0.5)
102
111
  rake
103
112
  rspec
113
+ simplecov (~> 0.9)
114
+ simplecov-lcov (~> 0.7.0)
104
115
  standard
105
116
  vcr
106
117
  webmock
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Yadisk - Yandex.Disk API client (ruby gem)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/yadisk-client.svg)](https://badge.fury.io/rb/yadisk-client)
4
+ ![Gem](https://img.shields.io/gem/dt/yadisk-client)
5
+ [![Ruby specs](https://github.com/Smolget/yadisk/actions/workflows/CI.yml/badge.svg)](https://github.com/Smolget/yadisk/actions/workflows/CI.yml)
6
+ [![Coverage Status](https://coveralls.io/repos/github/Smolget/yadisk-client/badge.svg?branch=master)](https://coveralls.io/github/Smolget/yadisk-client?branch=master)
4
7
 
5
8
  ## Install
6
9
 
@@ -56,6 +59,6 @@ client.trash.restore(path:)
56
59
 
57
60
  ## TODOs
58
61
 
59
- - tests
62
+ - ~~tests~~
60
63
  - examples
61
- - readme
64
+ - ~~readme~~
@@ -6,7 +6,6 @@ module Yadisk
6
6
  Disk.new get_request("disk").body
7
7
  end
8
8
 
9
- # TOOO: more test cases
10
9
  def upload(path:)
11
10
  path = Addressable::URI.parse(path).normalize
12
11
  ResourceUploadLink.new get_request("disk/resources/upload?path=#{path}").body
@@ -24,7 +23,7 @@ module Yadisk
24
23
 
25
24
  def delete(path:)
26
25
  path = Addressable::URI.parse(path).normalize
27
- delete_request("disk/resources?path=#{path}")
26
+ Object.new delete_request("disk/resources?path=#{path}").body
28
27
  end
29
28
 
30
29
  def get_meta(path:, **params)
@@ -55,13 +54,13 @@ module Yadisk
55
54
  end
56
55
 
57
56
  def list_files(**params)
58
- resp = get_request("disk/resources/files", params: params).body
59
- Collection.from_response(resp, key: "items", type: FilesResourceList)
57
+ resp = get_request("disk/resources/files", params: params)
58
+ Collection.from_response(resp, key: "items", type: Resource)
60
59
  end
61
60
 
62
61
  def last_uploaded(**params)
63
62
  resp = get_request("disk/resources/last-uploaded", params: params)
64
- Collection.from_response(resp, key: "items", type: LastUploadedResourceList)
63
+ Collection.from_response(resp, key: "items", type: Resource)
65
64
  end
66
65
 
67
66
  def move(from:, to:)
@@ -72,7 +71,7 @@ module Yadisk
72
71
 
73
72
  def list_public(**params)
74
73
  resp = get_request("disk/resources/public", params: params)
75
- Collection.from_response(resp, key: "items", type: PublicResourcesList)
74
+ Collection.from_response(resp, key: "items", type: PublicResource)
76
75
  end
77
76
 
78
77
  def publish(path:)
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Yadisk
4
4
  major = 1 # supported API version
5
- minor = 10 # gem release version
6
- patch = 2
5
+ minor = 11 # gem release version
6
+ patch = 1
7
7
 
8
8
  VERSION = "#{major}.#{minor}.#{patch}"
9
9
  end
@@ -2,18 +2,14 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe Yadisk::Client do
5
+ RSpec.describe Yadisk::Client do
6
6
  context "client with token: test" do
7
7
  it "returns correct instance of Yadisk::Client" do
8
8
  expect(@yandex).to be_kind_of(Yadisk::Client)
9
9
  end
10
10
  end
11
+ end
11
12
 
12
- context "client without token" do
13
- let(:client) { Yadisk::Client.new }
14
- it "returns nil" do
15
- expect { client }.to raise_error(ArgumentError)
16
- .with_message("missing keyword: token")
17
- end
18
- end
13
+ RSpec.describe Yadisk do
14
+ it { expect(described_class::VERSION).to eq "1.11.1" }
19
15
  end