dummy_dropbox 0.0.9 → 0.0.11

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.
@@ -27,7 +27,7 @@ module Dropbox
27
27
  end
28
28
 
29
29
  def authorize_url(*args)
30
- return 'dummy url'
30
+ return 'https://www.dropbox.com/0/oauth/authorize'
31
31
  end
32
32
 
33
33
  def authorize(options={})
@@ -69,9 +69,19 @@ module Dropbox
69
69
  # TODO: the original gem method allow a lot of types for 'local_path' parameter
70
70
  # this dummy version only allows a file_path
71
71
  def upload(local_file_path, remote_folder_path, options={})
72
- FileUtils.cp( local_file_path, "#{Dropbox.files_root_path}/#{remote_folder_path}/" )
72
+ if(local_file_path.kind_of? StringIO)
73
+ local_file = Tempfile.new("dummy_dropbox_#{Time.now.to_i}") do |f|
74
+ f.write local_file_path.to_s
75
+ end
76
+ local_file_path = local_file.path
77
+ FileUtils.cp( local_file_path, "#{Dropbox.files_root_path}/#{remote_folder_path}/#{options[:as]}" )
78
+ outfile = "#{remote_folder_path}/#{options[:as]}"
79
+ else
80
+ FileUtils.cp( local_file_path, "#{Dropbox.files_root_path}/#{remote_folder_path}/" )
81
+ outfile = "#{remote_folder_path}/#{File.basename(local_file_path)}"
82
+ end
73
83
 
74
- return self.metadata( "#{remote_folder_path}/#{File.basename(local_file_path)}" )
84
+ return self.metadata( outfile )
75
85
  end
76
86
 
77
87
  def metadata(path, options={})
@@ -121,6 +131,7 @@ module Dropbox
121
131
  {
122
132
  "country": "",
123
133
  "display_name": "John Q. User",
134
+ "email": "john@user.com",
124
135
  "quota_info": {
125
136
  "shared": 37378890,
126
137
  "quota": 62277025792,
@@ -1,3 +1,3 @@
1
1
  module DummyDropbox
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -56,5 +56,9 @@ class DummyDropboxTest < Test::Unit::TestCase
56
56
  )
57
57
  assert( !metadata.directory? )
58
58
  FileUtils.rm_r( "#{DummyDropbox.root_path}/file.txt" )
59
+
60
+ metadata = @session.upload( StringIO.new("stuff"), '/', :as => "stringio.txt")
61
+ assert( File.exists?( "#{DummyDropbox.root_path}/#{metadata.path}" ) )
62
+ FileUtils.rm_r( "#{DummyDropbox.root_path}/stringio.txt" ) if File.exists?( "#{DummyDropbox.root_path}/stringio.txt" )
59
63
  end
60
64
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dummy_dropbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fernando Guillen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-24 00:00:00 +02:00
18
+ date: 2011-10-08 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency