sendl 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.7
2
+
3
+ - Handle HTTP 413 (request too large) errors specifically, and other errors more gracefully
4
+
1
5
  0.0.6
2
6
 
3
7
  - Allow STDIN to be shared
@@ -28,9 +28,13 @@ module Sendl
28
28
  upload_file(f)
29
29
  end
30
30
 
31
- # Let's pretend everything worked OK!
32
- r = Curl::Easy.new(url_for("shares/#{@share_id}/finalise.json")) do |curl|
33
- curl.http_post Curl::PostField.content("auth_token", api_key)
31
+ if success?
32
+ debug("success? was true, finalising the share")
33
+ r = Curl::Easy.new(url_for("shares/#{@share_id}/finalise.json")) do |curl|
34
+ curl.http_post Curl::PostField.content("auth_token", api_key)
35
+ end
36
+ else
37
+ STDERR.puts "Could not complete share as there were errors"
34
38
  end
35
39
  end
36
40
 
@@ -75,9 +79,19 @@ module Sendl
75
79
  end
76
80
  curl.http_post Curl::PostField.content("auth_token", api_key), Curl::PostField.content("_method", "PUT"), Curl::PostField.file("file_data[data]", f.filename, f.desired_name)
77
81
  end
82
+
83
+ # Deal specifically with a request entity too large
84
+ if r.response_code == 413
85
+ debug("File was too large")
86
+ @errors << "Could not create share, a file was too big"
87
+ elsif r.response_code != 200
88
+ debug("An unknown error occurred")
89
+ @errors << "An unknown error occurred, the response code was #{r.response_code}"
90
+ end
91
+
78
92
  STDERR.puts
79
93
  else
80
- @errors << "Could not create share_file, response was #{r.response_code}"
94
+ @errors << "Something went wrong, please tell us if you continue to see problems (response code was #{r.response_code})"
81
95
  end
82
96
  end
83
97
 
data/lib/sendl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sendl
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sendl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Will Jessop
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-13 00:00:00 Z
13
+ date: 2011-05-25 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: getopt