encodingdotcom 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/encodingdotcom.gemspec +2 -2
- data/lib/encoding_dot_com/connection.rb +21 -13
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/encodingdotcom.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{encodingdotcom}
|
8
|
-
s.version = "0.2.
|
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-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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.
|
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-
|
12
|
+
date: 2009-10-27 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|