yandex-disk 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23dcd981d7eb0cc5b888019fd9807d936b7dfe3c
4
- data.tar.gz: 1a39ad88ca3b303cdc1c9e8f13958a79bc0d5ee1
3
+ metadata.gz: 2373008c136eba6c7c1bf1992cd0c7c9866c546b
4
+ data.tar.gz: 5e8029a4482dc046169e9a8b34b6a4f6e26671f6
5
5
  SHA512:
6
- metadata.gz: b2539167f83cb414f64e790a923f39dd2a024266e3efe7e753cb22e55678b0a885ec75329a260bd1290fa95b18a8e01cb9bc1b96835947275c9fbbd03dd0731a
7
- data.tar.gz: 86d90585dc811a40d49f333076fcade0bd9c9a92b3044ec9fed4228ebdb15508a4954a6754bcb0632b9ad191bc2b2f93460cff7a2daa80d6c3bcccd9eb1b6c60
6
+ metadata.gz: 013c2a3742601670d8d9fbdaa06a99e19b752afc717ae0cf5d533e67a17254e5cb3ff0ed80850122453d0695fd85b04084d5776b98c43e83cba49c4cf76d7662
7
+ data.tar.gz: df5bb80dfd8be83cd80bf68c017f4d943748d850c2fa431f01062c21cac7daedee3565fb44aad8349d2536d73a2ee0d1573af4c0067cb742769d7b00b8dd4094
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  large-file.psd
18
18
  tmp
19
+ .idea/
@@ -14,11 +14,13 @@ module Yandex
14
14
  def initialize options={}
15
15
  @timeout = options[:timeout] || 300
16
16
  @http = Faraday.new(:url => 'https://webdav.yandex.ru') do |builder|
17
- if options[:access_token].present?
17
+ if options[:access_token] && options[:access_token].length > 0
18
18
  builder.request :authorization, "OAuth", options[:access_token]
19
- else
19
+ elsif options[:login] && options[:password]
20
20
  basic_token = Base64.encode64("#{options[:login]}:#{options[:password]}")
21
21
  builder.request :authorization, "Basic", basic_token
22
+ else
23
+ raise ArgumentError, 'No :access_token or :login and :password'
22
24
  end
23
25
 
24
26
  builder.response :follow_redirects
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yandex
4
4
  module Disk
5
- VERSION = "0.0.5"
5
+ VERSION = '0.0.6'
6
6
  end
7
7
  end
@@ -1,6 +1,8 @@
1
- require 'test/unit'
1
+ require "minitest/autorun"
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../lib/yandex/disk')
3
3
 
4
+ MiniTest::Unit.autorun
5
+
4
6
  class YandexDiskTest < MiniTest::Unit::TestCase
5
7
 
6
8
  def setup
@@ -9,6 +11,20 @@ class YandexDiskTest < MiniTest::Unit::TestCase
9
11
 
10
12
  def test_initilize
11
13
  assert @disk
14
+
15
+ error_message = 'No :access_token or :login and :password'
16
+
17
+ assert_raises ArgumentError, error_message do
18
+ Yandex::Disk::Client.new
19
+ end
20
+
21
+ assert_raises ArgumentError, error_message do
22
+ Yandex::Disk::Client.new login: 'login_without_password'
23
+ end
24
+
25
+ assert_raises ArgumentError, error_message do
26
+ Yandex::Disk::Client.new password: 'password_without_login'
27
+ end
12
28
  end
13
29
 
14
30
  def test_put_and_get
@@ -22,13 +38,8 @@ class YandexDiskTest < MiniTest::Unit::TestCase
22
38
  # end
23
39
 
24
40
  def test_put!
25
- assert_raises RuntimeError do
26
- begin
27
- @disk.put!('README.md', '/folder/that/doesnt/exists/README.md')
28
- rescue RuntimeError => e
29
- assert_equal 'store: parent folder was not found', e.message
30
- raise e
31
- end
41
+ assert_raises RuntimeError, 'store: parent folder was not found' do
42
+ @disk.put!('README.md', '/folder/that/doesnt/exists/README.md')
32
43
  end
33
44
  end
34
45
 
@@ -42,13 +53,8 @@ class YandexDiskTest < MiniTest::Unit::TestCase
42
53
 
43
54
  def test_delete!
44
55
  @disk.delete('/a')
45
- assert_raises RuntimeError do
46
- begin
47
- @disk.delete!('/a')
48
- rescue RuntimeError => e
49
- assert_equal 'resource not found', e.message
50
- raise e
51
- end
56
+ assert_raises RuntimeError, 'resource not found' do
57
+ @disk.delete!('/a')
52
58
  end
53
59
  end
54
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex-disk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Korolev
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-28 00:00:00.000000000 Z
12
+ date: 2014-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.8'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0.8'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: nokogiri
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.6.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.6.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: faraday_middleware
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 0.9.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.9.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: excon
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0.16'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0.16'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: bundler
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.3'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '1.3'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  description: Ruby client for Yandex.Disk
@@ -103,7 +103,7 @@ executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
- - .gitignore
106
+ - ".gitignore"
107
107
  - Gemfile
108
108
  - LICENSE.txt
109
109
  - README.md
@@ -127,17 +127,17 @@ require_paths:
127
127
  - lib
128
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.0.3
140
+ rubygems_version: 2.2.0
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Ruby client for Yandex.Disk with backup gem support