yadisk-client 1.11.1 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -9
  3. data/Gemfile.lock +8 -39
  4. data/README.md +8 -2
  5. data/lib/yadisk/version.rb +1 -1
  6. data/yadisk.gemspec +2 -2
  7. metadata +8 -41
  8. data/spec/lib/yadisk/client_spec.rb +0 -15
  9. data/spec/lib/yadisk/disk_spec.rb +0 -229
  10. data/spec/lib/yadisk/operation_spec.rb +0 -18
  11. data/spec/lib/yadisk/public_spec.rb +0 -45
  12. data/spec/lib/yadisk/trash_spec.rb +0 -43
  13. data/spec/spec_helper.rb +0 -38
  14. data/spec/support/cassette_helpers.rb +0 -23
  15. data/spec/test_data/test_file.txt +0 -1
  16. data/spec/vcr/disk/copy.yml +0 -52
  17. data/spec/vcr/disk/create_dir.yml +0 -52
  18. data/spec/vcr/disk/create_dir_error_409.yml +0 -54
  19. data/spec/vcr/disk/delete.yml +0 -50
  20. data/spec/vcr/disk/download.yml +0 -52
  21. data/spec/vcr/disk/get_meta.yml +0 -52
  22. data/spec/vcr/disk/info.yml +0 -57
  23. data/spec/vcr/disk/last_uploaded.yml +0 -52
  24. data/spec/vcr/disk/list_files.yml +0 -52
  25. data/spec/vcr/disk/list_public.yml +0 -52
  26. data/spec/vcr/disk/move.yml +0 -52
  27. data/spec/vcr/disk/publish.yml +0 -54
  28. data/spec/vcr/disk/unpublish.yml +0 -54
  29. data/spec/vcr/disk/update_meta.yml +0 -54
  30. data/spec/vcr/disk/upload.yml +0 -52
  31. data/spec/vcr/disk/upload_by_url.yml +0 -52
  32. data/spec/vcr/disk/upload_from_file.yml +0 -111
  33. data/spec/vcr/operation/status.yml +0 -52
  34. data/spec/vcr/public/link.yml +0 -52
  35. data/spec/vcr/public/meta.yml +0 -52
  36. data/spec/vcr/public/save.yml +0 -52
  37. data/spec/vcr/trash/delete.yml +0 -50
  38. data/spec/vcr/trash/list.yml +0 -52
  39. data/spec/vcr/trash/restore.yml +0 -52
  40. data/spec/vcr_setup.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4982aa2862e507318dc120ac4446c98b9b27d371eab862fbfb7dfb4c7d103ae
4
- data.tar.gz: 82e9d47908ffa649709f0846b10f087ec057e903a88f8dcbf167d5ceaaf6db10
3
+ metadata.gz: 8591ed6b7cbc602c1ad8475a25475d59ea3c2524fd307bb2e940fc9eafdf1423
4
+ data.tar.gz: bdfcc362b932f717d72bfeadbb0f0a81a1014183a6853e8f95f4de29c78be1b7
5
5
  SHA512:
6
- metadata.gz: 8651187a3484e293e462324873a2eea3f470e5e64ad0f7a64ceb15a6e33efc3e7f1889a3e75bbea12a99f9c57543dfb8b7b10372916b8730e6258a1f3a652665
7
- data.tar.gz: e6cfbe6a81b83b5043d1f8d1039407c2b4c773652a2bbd5bf1e64222ed096da70146d019f0fcd2f39f4335b47dc434ba21d9560e875f1d6e80c8714ae0e96e5e
6
+ metadata.gz: e15c2ab52db5ecc807ccd9eb26d35cf11699ec8aa969cf46ad3a0cd183cb163ea60ac767562720e9fa17faa0bec447aa8e7b5b54cc528c0b92ede34f6e5add97
7
+ data.tar.gz: ccadc6a7e8cccfd550ceaf78172d77482010018268c0a4e24338ee45ab679502596d8a8bf2716243d7e1e5dc3a6d48b8d7ddb1acdb7482826005db123f440b89
data/Gemfile CHANGED
@@ -5,12 +5,3 @@ source "https://rubygems.org"
5
5
  # gem "yadisk-client", path: "./" # dev mode
6
6
 
7
7
  gemspec
8
-
9
- gem "addressable", "~> 2.3", ">= 2.3.7"
10
- gem "minitest", ">= 5.0.5"
11
- gem "rake"
12
- gem "standard"
13
-
14
- gem "rspec"
15
- gem "vcr"
16
- gem "webmock"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yadisk-client (1.11.1)
4
+ yadisk-client (1.11.2)
5
5
  addressable (~> 2.3, >= 2.3.7)
6
6
  faraday (~> 1.7)
7
7
  faraday_middleware (~> 1.1)
@@ -11,7 +11,6 @@ GEM
11
11
  specs:
12
12
  addressable (2.8.1)
13
13
  public_suffix (>= 2.0.2, < 6.0)
14
- ast (2.4.2)
15
14
  crack (0.4.5)
16
15
  rexml
17
16
  diff-lcs (1.5.0)
@@ -42,16 +41,9 @@ GEM
42
41
  faraday_middleware (1.2.0)
43
42
  faraday (~> 1.0)
44
43
  hashdiff (1.0.1)
45
- json (2.6.2)
46
- minitest (5.16.3)
47
44
  multipart-post (2.2.3)
48
- parallel (1.22.1)
49
- parser (3.1.2.1)
50
- ast (~> 2.4.1)
51
45
  public_suffix (5.0.0)
52
- rainbow (3.1.1)
53
- rake (13.0.6)
54
- regexp_parser (2.5.0)
46
+ rake (12.3.3)
55
47
  rexml (3.2.5)
56
48
  rspec (3.11.0)
57
49
  rspec-core (~> 3.11.0)
@@ -66,34 +58,14 @@ GEM
66
58
  diff-lcs (>= 1.2.0, < 2.0)
67
59
  rspec-support (~> 3.11.0)
68
60
  rspec-support (3.11.1)
69
- rubocop (1.35.1)
70
- json (~> 2.3)
71
- parallel (~> 1.10)
72
- parser (>= 3.1.2.1)
73
- rainbow (>= 2.2.2, < 4.0)
74
- regexp_parser (>= 1.8, < 3.0)
75
- rexml (>= 3.2.5, < 4.0)
76
- rubocop-ast (>= 1.20.1, < 2.0)
77
- ruby-progressbar (~> 1.7)
78
- unicode-display_width (>= 1.4.0, < 3.0)
79
- rubocop-ast (1.21.0)
80
- parser (>= 3.1.1.0)
81
- rubocop-performance (1.14.3)
82
- rubocop (>= 1.7.0, < 2.0)
83
- rubocop-ast (>= 0.4.0)
84
- ruby-progressbar (1.11.0)
85
61
  ruby2_keywords (0.0.5)
86
62
  simplecov (0.21.2)
87
63
  docile (~> 1.1)
88
64
  simplecov-html (~> 0.11)
89
65
  simplecov_json_formatter (~> 0.1)
90
66
  simplecov-html (0.12.3)
91
- simplecov-lcov (0.7.0)
67
+ simplecov-lcov (0.8.0)
92
68
  simplecov_json_formatter (0.1.4)
93
- standard (1.16.1)
94
- rubocop (= 1.35.1)
95
- rubocop-performance (= 1.14.3)
96
- unicode-display_width (2.3.0)
97
69
  vcr (6.1.0)
98
70
  webmock (3.18.1)
99
71
  addressable (>= 2.8.0)
@@ -101,20 +73,17 @@ GEM
101
73
  hashdiff (>= 0.4.0, < 2.0.0)
102
74
 
103
75
  PLATFORMS
104
- universal-darwin-21
105
76
  x86_64-darwin-17
77
+ x86_64-linux
106
78
 
107
79
  DEPENDENCIES
108
- addressable (~> 2.3, >= 2.3.7)
109
80
  bundler
110
- minitest (>= 5.0.5)
111
- rake
112
- rspec
81
+ rake (~> 12.3.3)
82
+ rspec (~> 3.0)
113
83
  simplecov (~> 0.9)
114
84
  simplecov-lcov (~> 0.7.0)
115
- standard
116
- vcr
117
- webmock
85
+ vcr (~> 6.1)
86
+ webmock (~> 3.18, >= 3.18.1)
118
87
  yadisk-client!
119
88
 
120
89
  BUNDLED WITH
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/yadisk-client.svg)](https://badge.fury.io/rb/yadisk-client)
4
4
  ![Gem](https://img.shields.io/gem/dt/yadisk-client)
5
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)
6
+ [![Coverage Status](https://coveralls.io/repos/github/Smolget/yadisk/badge.svg?branch=master)](https://coveralls.io/github/Smolget/yadisk?branch=master)
7
7
 
8
8
  ## Install
9
9
 
@@ -11,10 +11,16 @@
11
11
  gem install yadisk-client
12
12
  ```
13
13
 
14
+ Gemfile
15
+
16
+ ```gemfile
17
+ gem 'yadisk-client', '~> 1.11', '>= 1.11.2'
18
+ ```
19
+
14
20
  ## Development
15
21
 
16
22
  ```sh
17
- gem build yadisk.gemspec && gem install yadisk-client && bundle exec rake console
23
+ rake console
18
24
  ```
19
25
 
20
26
  ## Available methods
@@ -3,7 +3,7 @@
3
3
  module Yadisk
4
4
  major = 1 # supported API version
5
5
  minor = 11 # gem release version
6
- patch = 1
6
+ patch = 2
7
7
 
8
8
  VERSION = "#{major}.#{minor}.#{patch}"
9
9
  end
data/yadisk.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.description = "Yandex.Disk API wrapper written in Ruby"
12
12
  s.authors = ["Ilya Brin"]
13
13
  s.email = "ilya@codeplay.ru"
14
- s.files = `git ls-files -z`.split("\x0")
14
+ s.files = `git ls-files`.split($RS).reject {|fn| fn.start_with? "spec" }
15
15
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
  s.homepage = "https://github.com/Smolget/yadisk"
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "rake", "~> 12.3.3"
29
29
  s.add_development_dependency "rspec", "~> 3.0"
30
30
  s.add_development_dependency "simplecov", "~> 0.9"
31
- s.add_development_dependency "simplecov-lcov", "~> 0.7.0"
31
+ s.add_development_dependency "simplecov-lcov", "~> 0.8.0"
32
32
  s.add_development_dependency "vcr", "~> 6.1"
33
33
  s.add_development_dependency "webmock", "~> 3.18", ">= 3.18.1"
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yadisk-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Brin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2022-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 0.7.0
123
+ version: 0.8.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 0.7.0
130
+ version: 0.8.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: vcr
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -195,46 +195,13 @@ files:
195
195
  - lib/yadisk/resources/trash.rb
196
196
  - lib/yadisk/rest.rb
197
197
  - lib/yadisk/version.rb
198
- - spec/lib/yadisk/client_spec.rb
199
- - spec/lib/yadisk/disk_spec.rb
200
- - spec/lib/yadisk/operation_spec.rb
201
- - spec/lib/yadisk/public_spec.rb
202
- - spec/lib/yadisk/trash_spec.rb
203
- - spec/spec_helper.rb
204
- - spec/support/cassette_helpers.rb
205
- - spec/test_data/test_file.txt
206
- - spec/vcr/disk/copy.yml
207
- - spec/vcr/disk/create_dir.yml
208
- - spec/vcr/disk/create_dir_error_409.yml
209
- - spec/vcr/disk/delete.yml
210
- - spec/vcr/disk/download.yml
211
- - spec/vcr/disk/get_meta.yml
212
- - spec/vcr/disk/info.yml
213
- - spec/vcr/disk/last_uploaded.yml
214
- - spec/vcr/disk/list_files.yml
215
- - spec/vcr/disk/list_public.yml
216
- - spec/vcr/disk/move.yml
217
- - spec/vcr/disk/publish.yml
218
- - spec/vcr/disk/unpublish.yml
219
- - spec/vcr/disk/update_meta.yml
220
- - spec/vcr/disk/upload.yml
221
- - spec/vcr/disk/upload_by_url.yml
222
- - spec/vcr/disk/upload_from_file.yml
223
- - spec/vcr/operation/status.yml
224
- - spec/vcr/public/link.yml
225
- - spec/vcr/public/meta.yml
226
- - spec/vcr/public/save.yml
227
- - spec/vcr/trash/delete.yml
228
- - spec/vcr/trash/list.yml
229
- - spec/vcr/trash/restore.yml
230
- - spec/vcr_setup.rb
231
198
  - yadisk.gemspec
232
199
  homepage: https://github.com/Smolget/yadisk
233
200
  licenses:
234
201
  - MIT
235
202
  metadata:
236
203
  rubygems_mfa_required: 'true'
237
- post_install_message:
204
+ post_install_message:
238
205
  rdoc_options: []
239
206
  require_paths:
240
207
  - lib
@@ -249,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
216
  - !ruby/object:Gem::Version
250
217
  version: '0'
251
218
  requirements: []
252
- rubygems_version: 3.0.3.1
253
- signing_key:
219
+ rubygems_version: 3.2.3
220
+ signing_key:
254
221
  specification_version: 4
255
222
  summary: Yandex.Disk API client
256
223
  test_files: []
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe Yadisk::Client do
6
- context "client with token: test" do
7
- it "returns correct instance of Yadisk::Client" do
8
- expect(@yandex).to be_kind_of(Yadisk::Client)
9
- end
10
- end
11
- end
12
-
13
- RSpec.describe Yadisk do
14
- it { expect(described_class::VERSION).to eq "1.11.1" }
15
- end
@@ -1,229 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- # rubocop:disable Metrics/BlockLength
6
- RSpec.describe "#disk" do
7
- describe ".info" do
8
- context "when params is OK" do
9
- subject {
10
- VCR.use_cassette("disk/info") do
11
- @yandex.disk.info
12
- end
13
- }
14
-
15
- it { expect(subject).to be_instance_of Yadisk::Disk }
16
- it { expect(subject.is_paid).to be(true).or be(false) }
17
- end
18
- end
19
-
20
- describe ".create_dir" do
21
- context "when creating a directory is OK" do
22
- subject {
23
- VCR.use_cassette("disk/create_dir") do
24
- @yandex.disk.create_dir path: "yadisk_created_dir"
25
- end
26
- }
27
-
28
- it { expect(subject).to be_an Yadisk::Link }
29
- it { expect(subject.href).to eq "https://cloud-api.yandex.net/v1/disk/resources?path=disk%3A%2Fyadisk_created_dir" }
30
- end
31
-
32
- context "when dir already exists" do
33
- subject {
34
- VCR.use_cassette("disk/create_dir_error_409") do
35
- @yandex.disk.create_dir path: "yadisk_created_dir"
36
- end
37
- }
38
-
39
- it { expect(subject.error).to eq "DiskPathPointsToExistentDirectoryError" }
40
- end
41
- end
42
-
43
- describe ".upload" do
44
- context "when params is OK" do
45
- subject {
46
- VCR.use_cassette("disk/upload") do
47
- @yandex.disk.upload(path: "yadisk_upload_here")
48
- end
49
- }
50
-
51
- it { expect(subject).to be_an Yadisk::ResourceUploadLink }
52
- it { expect(subject.operation_id).to be_an String }
53
- it { expect(subject.href).to match %r{/uploader9x.disk.yandex.net:443/upload-target/} }
54
- end
55
- end
56
-
57
- describe ".upload_from_file" do
58
- context "when params is OK" do
59
- subject {
60
- VCR.use_cassette("disk/upload_from_file") do
61
- @yandex.disk.upload_from_file(
62
- upload_link: "https://uploader9x.disk.yandex.net:443/upload-target/20221018T144311.680.utd.6n9ay2kos10pewsoun8tlx7gf-k7o.674502",
63
- src: "LICENSE"
64
- )
65
- end
66
- }
67
-
68
- it { expect(subject).to be true }
69
- end
70
- end
71
-
72
- describe ".upload_by_url" do
73
- context "when params is OK" do
74
- subject {
75
- VCR.use_cassette("disk/upload_by_url") do
76
- @yandex.disk.upload_by_url(path: "yadisk_test_png.png", url: "https://www.fnordware.com/superpng/pnggrad8rgb.png")
77
- end
78
- }
79
-
80
- it { expect(subject).to be_an Yadisk::Link }
81
- it { expect(subject.href).to be_an String }
82
- end
83
- end
84
-
85
- describe ".update_meta" do
86
- context "when params is OK" do
87
- subject {
88
- VCR.use_cassette("disk/update_meta") do
89
- @yandex.disk.update_meta(path: "yadisk_test_png.png", key: "value")
90
- end
91
- }
92
-
93
- it { expect(subject).to be_an Yadisk::Resource }
94
- it { expect(subject.custom_properties.key).to eq "value" }
95
- end
96
- end
97
-
98
- describe ".get_meta" do
99
- context "when params is OK" do
100
- subject {
101
- VCR.use_cassette("disk/get_meta") do
102
- @yandex.disk.get_meta(path: "yadisk_test_png.png")
103
- end
104
- }
105
-
106
- it { expect(subject).to be_an Yadisk::Resource }
107
- it { expect(subject.custom_properties.key).to eq "value" }
108
- end
109
- end
110
-
111
- describe ".copy" do
112
- context "when params is OK" do
113
- subject {
114
- VCR.use_cassette("disk/copy") do
115
- @yandex.disk.copy(from: "yadisk_test_png.png", to: "yadisk_test_png_copy.png")
116
- end
117
- }
118
-
119
- it { expect(subject).to be_an Yadisk::Link }
120
- it { expect(subject.href).to be_an String }
121
- end
122
- end
123
-
124
- describe ".download" do
125
- context "when params is OK" do
126
- subject {
127
- VCR.use_cassette("disk/download") do
128
- @yandex.disk.download(path: "yadisk_test_png_copy.png")
129
- end
130
- }
131
-
132
- it { expect(subject).to be_an Yadisk::Link }
133
- it { expect(subject.href).to be_an String }
134
- it { expect(subject.href).not_to be nil }
135
- end
136
- end
137
-
138
- describe ".list_files" do
139
- let(:limit) { "1" }
140
- context "with limit param" do
141
- subject {
142
- VCR.use_cassette("disk/list_files") do
143
- @yandex.disk.list_files(limit: limit)
144
- end
145
- }
146
-
147
- it { expect(subject).to be_an Yadisk::Collection }
148
- it { expect(subject.data.first).to be_an Yadisk::Resource }
149
- end
150
- end
151
-
152
- describe ".last_uploaded" do
153
- context "whith limit param" do
154
- subject {
155
- VCR.use_cassette("disk/last_uploaded") do
156
- @yandex.disk.last_uploaded(limit: 1)
157
- end
158
- }
159
-
160
- it { expect(subject).to be_an Yadisk::Collection }
161
- it { expect(subject.data.first).to be_an Yadisk::Resource }
162
- end
163
- end
164
-
165
- describe ".move" do
166
- context "when params is OK" do
167
- subject {
168
- VCR.use_cassette("disk/move") do
169
- @yandex.disk.move(from: "yadisk_test_png_copy.png", to: "yadisk.png")
170
- end
171
- }
172
-
173
- it { expect(subject).to be_an Yadisk::Link }
174
- it { expect(subject.href).to be_an String }
175
- end
176
- end
177
-
178
- describe ".list_public" do
179
- context "whit limit param" do
180
- subject {
181
- VCR.use_cassette("disk/list_public") do
182
- @yandex.disk.list_public(limit: 1)
183
- end
184
- }
185
-
186
- it { expect(subject).to be_an Yadisk::Collection }
187
- it { expect(subject.data.first).to be_an Yadisk::PublicResource }
188
- end
189
- end
190
-
191
- describe ".publish" do
192
- context "when params is OK" do
193
- subject {
194
- VCR.use_cassette("disk/publish") do
195
- @yandex.disk.publish(path: "yadisk.png")
196
- end
197
- }
198
-
199
- it { expect(subject).to be_an Yadisk::Link }
200
- it { expect(subject.href).to be_an String }
201
- end
202
- end
203
-
204
- describe ".unpublish" do
205
- context "when params is OK" do
206
- subject {
207
- VCR.use_cassette("disk/unpublish") do
208
- @yandex.disk.unpublish(path: "yadisk.png")
209
- end
210
- }
211
-
212
- it { expect(subject).to be_an Yadisk::Link }
213
- it { expect(subject.href).to be_an String }
214
- end
215
- end
216
-
217
- describe ".delete" do
218
- context "when params is OK" do
219
- subject {
220
- VCR.use_cassette("disk/delete") do
221
- @yandex.disk.delete(path: "yadisk_test_png.png")
222
- end
223
- }
224
-
225
- it { expect(subject).to be_an Yadisk::Object }
226
- end
227
- end
228
- end
229
- # rubocop:enable Metrics/BlockLength
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe "#operation" do
6
- describe ".status" do
7
- context "when params is OK" do
8
- subject {
9
- VCR.use_cassette("operation/status") do
10
- @yandex.operation.status operation_id: "78ccc91b3a034a941a72dde1ae92fbf26d0facf9bad941eee9b432f4abdfdd1e"
11
- end
12
- }
13
-
14
- it { expect(subject).to be_an String }
15
- it { expect(subject).to eq "success" }
16
- end
17
- end
18
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- # rubocop:disable Metrics/BlockLength
6
- RSpec.describe "#public" do
7
- let(:public_url) { "https://disk.yandex.ru/d/XzWAb9JaK605ig" }
8
-
9
- describe ".meta" do
10
- context "when params is OK" do
11
- subject {
12
- VCR.use_cassette("public/meta") do
13
- @yandex.public_resource.meta public_url: public_url
14
- end
15
- }
16
-
17
- it { expect(subject).to be_an Yadisk::PublicResource }
18
- end
19
- end
20
-
21
- describe ".link" do
22
- context "when params is OK" do
23
- subject {
24
- VCR.use_cassette("public/link") do
25
- @yandex.public_resource.link public_url: public_url
26
- end
27
- }
28
-
29
- it { expect(subject).to be_an Yadisk::Link }
30
- end
31
- end
32
-
33
- describe ".save" do
34
- context "when params is OK" do
35
- subject {
36
- VCR.use_cassette("public/save") do
37
- @yandex.public_resource.save public_url: public_url
38
- end
39
- }
40
-
41
- it { expect(subject).to be_an Yadisk::Link }
42
- end
43
- end
44
- end
45
- # rubocop:enable Metrics/BlockLength
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- # rubocop:disable Metrics/BlockLength
6
- RSpec.describe "#trash" do
7
- describe ".delete" do
8
- context "when params is OK" do
9
- subject {
10
- VCR.use_cassette("trash/delete") do
11
- @yandex.trash.delete path: "yadisk_created_dir_12b63824b98bc5eb70d25c703cfc3224a46e6896"
12
- end
13
- }
14
-
15
- it { expect(subject).to be_an Yadisk::Link }
16
- end
17
- end
18
-
19
- describe ".list" do
20
- context "when params is OK" do
21
- subject {
22
- VCR.use_cassette("trash/list") do
23
- @yandex.trash.list path: ""
24
- end
25
- }
26
-
27
- it { expect(subject).to be_an Yadisk::TrashResource }
28
- end
29
- end
30
-
31
- describe ".restore" do
32
- context "when params is OK" do
33
- subject {
34
- VCR.use_cassette("trash/restore") do
35
- @yandex.trash.restore path: "yadisk_created_dir_857c8d0feba033c7559ade2c7c07fef3ae41c046"
36
- end
37
- }
38
-
39
- it { expect(subject).to be_an Yadisk::Link }
40
- end
41
- end
42
- end
43
- # rubocop:enable Metrics/BlockLength
data/spec/spec_helper.rb DELETED
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "./spec/support/cassette_helpers" # VCR helpers
4
- require File.expand_path("./vcr_setup", __dir__)
5
-
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
-
9
- require "simplecov"
10
- require "simplecov-lcov"
11
-
12
- require_relative "../lib/yadisk"
13
-
14
- SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
15
- SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
16
-
17
- SimpleCov.start do
18
- add_filter "spec/"
19
- add_group "Lib", "lib"
20
- minimum_coverage 80.0
21
- end
22
-
23
- ACCESS_TOKEN = ENV["YANDEX_DISK_ACCESS_TOKEN"] || "your_access_token"
24
-
25
- RSpec.configure do |config|
26
- config.include CassetteHelpers
27
- config.before(:each) do
28
- @yandex = Yadisk::Client.new(token: ACCESS_TOKEN)
29
- end
30
-
31
- config.expect_with :rspec do |c|
32
- c.syntax = %i[expect]
33
- end
34
-
35
- config.mock_with :rspec do |c|
36
- c.syntax = %i[expect]
37
- end
38
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CassetteHelpers
4
- class Use
5
- def initialize(name)
6
- path = "spec/vcr/#{name}.yml"
7
- @cassette = YAML.load_file(path) if File.exist?(path)
8
- end
9
-
10
- # helper method for match request URL from cassette
11
- def url
12
- @cassette["http_interactions"].first["request"]["uri"]
13
- end
14
-
15
- def method
16
- @cassette["http_interactions"].first["request"]["method"]
17
- end
18
-
19
- def code
20
- @cassette["http_interactions"].first["response"]["status"]["code"]
21
- end
22
- end
23
- end
@@ -1 +0,0 @@
1
- test upload method