encodingdotcom 0.2.0 → 0.2.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{encodingdotcom}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mick Staugaard"]
12
- s.date = %q{2009-10-11}
12
+ s.date = %q{2009-10-27}
13
13
  s.description = %q{a library for integrating with encoding.com}
14
14
  s.email = %q{mick@staugaard.com}
15
15
  s.extra_rdoc_files = [
@@ -2,6 +2,14 @@ require 'httparty'
2
2
 
3
3
  module EncodingDotCom
4
4
  class EncodingDotComError < StandardError
5
+ def initialize(message, request_xml)
6
+ super(message)
7
+ @request_xml = request_xml
8
+ end
9
+
10
+ def to_s
11
+ "#{super}\nRequest:\n#{@request_xml}"
12
+ end
5
13
  end
6
14
 
7
15
  class BadRequestError < EncodingDotComError
@@ -44,18 +52,18 @@ module EncodingDotCom
44
52
  if response['errors']
45
53
  message = response['errors']['error']
46
54
  case message
47
- when /Wrong XML/, /No XML/, /Wrong query format/, /Invalid action/, /No formats specified/, /No output format specified/, /Output format .* is not allowed/
48
- raise(BadRequestError, message)
49
- when /Wrong user id or key/
50
- raise(AuthenticationError, message)
51
- when /Media ID is not indicated/, /Wrong Media ID/
52
- raise(NotFoundError, message)
53
- when /Wrong source file url/, /Source file is not indicated/
54
- raise(BadSourceUrlError, message)
55
- when /Wrong destination file url/
56
- raise(BadDestinationUrlError, message)
57
- else
58
- raise(EncodingDotComError, message)
55
+ when /Wrong XML/, /No XML/, /Wrong query format/, /Invalid action/, /No formats specified/, /No output format specified/, /Output format .* is not allowed/
56
+ raise(BadRequestError.new(message, request_xml_document))
57
+ when /Wrong user id or key/
58
+ raise(AuthenticationError.new(message, request_xml_document))
59
+ when /Media ID is not indicated/, /Wrong Media ID/
60
+ raise(NotFoundError.new(message, request_xml_document))
61
+ when /Wrong source file url/, /Source file is not indicated/
62
+ raise(BadSourceUrlError.new(message, request_xml_document))
63
+ when /Wrong destination file url/
64
+ raise(BadDestinationUrlError.new(message, request_xml_document))
65
+ else
66
+ raise(EncodingDotComError.new(message, request_xml_document))
59
67
  end
60
68
  end
61
69
 
@@ -63,4 +71,4 @@ module EncodingDotCom
63
71
  end
64
72
  end
65
73
  end
66
- end
74
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encodingdotcom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-11 00:00:00 -07:00
12
+ date: 2009-10-27 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency