yadisk-client 1.10.2

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 (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +37 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +142 -0
  5. data/Gemfile +16 -0
  6. data/Gemfile.lock +110 -0
  7. data/LICENSE +7 -0
  8. data/README.md +61 -0
  9. data/Rakefile +16 -0
  10. data/lib/yadisk/client.rb +44 -0
  11. data/lib/yadisk/collection.rb +26 -0
  12. data/lib/yadisk/error.rb +6 -0
  13. data/lib/yadisk/object.rb +25 -0
  14. data/lib/yadisk/objects/disk.rb +6 -0
  15. data/lib/yadisk/objects/link.rb +5 -0
  16. data/lib/yadisk/objects/operation.rb +5 -0
  17. data/lib/yadisk/objects/public.rb +6 -0
  18. data/lib/yadisk/objects/resource.rb +11 -0
  19. data/lib/yadisk/objects/trash.rb +6 -0
  20. data/lib/yadisk/resources/disk.rb +88 -0
  21. data/lib/yadisk/resources/operation.rb +10 -0
  22. data/lib/yadisk/resources/public.rb +17 -0
  23. data/lib/yadisk/resources/trash.rb +20 -0
  24. data/lib/yadisk/rest.rb +58 -0
  25. data/lib/yadisk/version.rb +9 -0
  26. data/lib/yadisk.rb +35 -0
  27. data/spec/lib/yadisk/client_spec.rb +19 -0
  28. data/spec/lib/yadisk/disk_spec.rb +226 -0
  29. data/spec/lib/yadisk/errors_spec.rb +16 -0
  30. data/spec/lib/yadisk/operations_spec.rb +23 -0
  31. data/spec/lib/yadisk/public_spec.rb +51 -0
  32. data/spec/lib/yadisk/trash_spec.rb +72 -0
  33. data/spec/spec_helper.rb +24 -0
  34. data/spec/support/cassette_helpers.rb +23 -0
  35. data/spec/test_data/test_file.txt +1 -0
  36. data/spec/vcr/disk/DELETE_delete.yml +50 -0
  37. data/spec/vcr/disk/ERROR_info.yml +48 -0
  38. data/spec/vcr/disk/GET_download.yml +52 -0
  39. data/spec/vcr/disk/GET_get_meta.yml +52 -0
  40. data/spec/vcr/disk/GET_info.yml +52 -0
  41. data/spec/vcr/disk/GET_list_public.yml +52 -0
  42. data/spec/vcr/disk/GET_upload.yml +48 -0
  43. data/spec/vcr/disk/PATCH_update_meta.yml +54 -0
  44. data/spec/vcr/disk/POST_copy.yml +50 -0
  45. data/spec/vcr/disk/POST_move.yml +50 -0
  46. data/spec/vcr/disk/POST_upload_by_url.yml +52 -0
  47. data/spec/vcr/disk/PUT_create_dir.yml +50 -0
  48. data/spec/vcr/disk/PUT_publish.yml +54 -0
  49. data/spec/vcr/disk/PUT_unpublish.yml +54 -0
  50. data/spec/vcr/operations/GET_status.yml +52 -0
  51. data/spec/vcr/trash/DELETE_delete.yml +50 -0
  52. data/spec/vcr/trash/DELETE_delete_error.yml +49 -0
  53. data/spec/vcr/trash/GET_list.yml +51 -0
  54. data/spec/vcr/trash/PUT_restore.yml +51 -0
  55. data/spec/vcr_setup.rb +35 -0
  56. data/yadisk.gemspec +26 -0
  57. metadata +146 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cloud-api.yandex.net/v1/disk/operations/a6e706d94c4adcd17298c1eed06729f9e9217569e6376a51c38de74d8d6367c5
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
+ - Mon, 03 Oct 2022 18:41:25 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: '{"status":"in-progress"}'
51
+ recorded_at: Mon, 03 Oct 2022 18:41:25 GMT
52
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,50 @@
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_f7fc32168f3b30e60994fd2e82af7d230dab5c91
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: 204
21
+ message: NO CONTENT
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Wed, 05 Oct 2022 14:34:13 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '0'
31
+ Connection:
32
+ - keep-alive
33
+ Access-Control-Allow-Methods:
34
+ - GET, DELETE, OPTIONS
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: ''
49
+ recorded_at: Wed, 05 Oct 2022 14:34:14 GMT
50
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,49 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://cloud-api.yandex.net/v1/disk/trash/resources/restore?path=trash:/remote_file.txt_ade2b12db666598e14c09a28a55a11cee8ae14e7
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - "[**********]"
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
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: 201
23
+ message: CREATED
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Wed, 05 Oct 2022 14:23:34 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '121'
33
+ Connection:
34
+ - keep-alive
35
+ Access-Control-Allow-Methods:
36
+ - PUT, 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:23:34 GMT
data/spec/vcr_setup.rb ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "vcr"
4
+ require "webmock"
5
+ require "webmock/rspec"
6
+ require "addressable/uri"
7
+
8
+ VCR.configure do |config|
9
+ config.uri_parser = Addressable::URI
10
+ config.cassette_library_dir = "spec/vcr"
11
+ config.hook_into :webmock
12
+ config.configure_rspec_metadata!
13
+
14
+ config.filter_sensitive_data("[**********]") {|data|
15
+ data.dig(:request, :headers, "Authorization", 0)
16
+ }
17
+
18
+ config.filter_sensitive_data("omitted") {|data|
19
+ data.dig(:response, :headers, "Yandex-Cloud-Request-Id", 0)
20
+ }
21
+
22
+ config.filter_sensitive_data('{"items":[{"key":"value"}]}') {|data|
23
+ data["response"]["body"]
24
+ }
25
+
26
+ config.before_record do |r|
27
+ r.response.body.force_encoding(Encoding::UTF_8)
28
+ end
29
+
30
+ config.default_cassette_options = {
31
+ record: :new_episodes,
32
+ re_record_interval: 259_200,
33
+ match_requests_on: %i[method uri body]
34
+ }
35
+ end
data/yadisk.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "yadisk/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "yadisk-client"
9
+ s.version = Yadisk::VERSION
10
+ s.summary = "Yandex.Disk API client"
11
+ s.description = "Yandex.Disk API wrapper written in Ruby"
12
+ s.authors = ["Ilya Brin"]
13
+ s.email = "ilya@codeplay.ru"
14
+ s.files = `git ls-files -z`.split("\x0")
15
+ s.executables = s.files.grep(%r{^bin/}) {|f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+ s.homepage = "https://github.com/Smolget/yadisk"
18
+ s.license = "MIT"
19
+ s.required_ruby_version = ">= 2.6"
20
+
21
+ s.metadata["rubygems_mfa_required"] = "true"
22
+
23
+ s.add_dependency "addressable", "~> 2.3", ">= 2.3.7"
24
+ s.add_dependency "faraday", "~> 1.7"
25
+ s.add_dependency "faraday_middleware", "~> 1.1"
26
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yadisk-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.10.2
5
+ platform: ruby
6
+ authors:
7
+ - Ilya Brin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: addressable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.7
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.7
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.7'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: faraday_middleware
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.1'
61
+ description: Yandex.Disk API wrapper written in Ruby
62
+ email: ilya@codeplay.ru
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - ".gitignore"
68
+ - ".rspec"
69
+ - ".rubocop.yml"
70
+ - Gemfile
71
+ - Gemfile.lock
72
+ - LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - lib/yadisk.rb
76
+ - lib/yadisk/client.rb
77
+ - lib/yadisk/collection.rb
78
+ - lib/yadisk/error.rb
79
+ - lib/yadisk/object.rb
80
+ - lib/yadisk/objects/disk.rb
81
+ - lib/yadisk/objects/link.rb
82
+ - lib/yadisk/objects/operation.rb
83
+ - lib/yadisk/objects/public.rb
84
+ - lib/yadisk/objects/resource.rb
85
+ - lib/yadisk/objects/trash.rb
86
+ - lib/yadisk/resources/disk.rb
87
+ - lib/yadisk/resources/operation.rb
88
+ - lib/yadisk/resources/public.rb
89
+ - lib/yadisk/resources/trash.rb
90
+ - lib/yadisk/rest.rb
91
+ - lib/yadisk/version.rb
92
+ - spec/lib/yadisk/client_spec.rb
93
+ - spec/lib/yadisk/disk_spec.rb
94
+ - spec/lib/yadisk/errors_spec.rb
95
+ - spec/lib/yadisk/operations_spec.rb
96
+ - spec/lib/yadisk/public_spec.rb
97
+ - spec/lib/yadisk/trash_spec.rb
98
+ - spec/spec_helper.rb
99
+ - spec/support/cassette_helpers.rb
100
+ - spec/test_data/test_file.txt
101
+ - spec/vcr/disk/DELETE_delete.yml
102
+ - spec/vcr/disk/ERROR_info.yml
103
+ - spec/vcr/disk/GET_download.yml
104
+ - spec/vcr/disk/GET_get_meta.yml
105
+ - spec/vcr/disk/GET_info.yml
106
+ - spec/vcr/disk/GET_list_public.yml
107
+ - spec/vcr/disk/GET_upload.yml
108
+ - spec/vcr/disk/PATCH_update_meta.yml
109
+ - spec/vcr/disk/POST_copy.yml
110
+ - spec/vcr/disk/POST_move.yml
111
+ - spec/vcr/disk/POST_upload_by_url.yml
112
+ - spec/vcr/disk/PUT_create_dir.yml
113
+ - spec/vcr/disk/PUT_publish.yml
114
+ - spec/vcr/disk/PUT_unpublish.yml
115
+ - spec/vcr/operations/GET_status.yml
116
+ - spec/vcr/trash/DELETE_delete.yml
117
+ - spec/vcr/trash/DELETE_delete_error.yml
118
+ - spec/vcr/trash/GET_list.yml
119
+ - spec/vcr/trash/PUT_restore.yml
120
+ - spec/vcr_setup.rb
121
+ - yadisk.gemspec
122
+ homepage: https://github.com/Smolget/yadisk
123
+ licenses:
124
+ - MIT
125
+ metadata:
126
+ rubygems_mfa_required: 'true'
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '2.6'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubygems_version: 3.0.3.1
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Yandex.Disk API client
146
+ test_files: []