elibri_api_client 1.1.3 → 1.1.4
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/elibri_api_client.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{elibri_api_client}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcin Urba\305\204ski"]
|
12
|
-
s.date = %q{2011-10-
|
12
|
+
s.date = %q{2011-10-13}
|
13
13
|
s.description = %q{API client for elibri.com.pl publishing system}
|
14
14
|
s.email = %q{marcin@urbanski.vdl.pl}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -166,8 +166,6 @@ module Elibri
|
|
166
166
|
|
167
167
|
# Jesli Elibri zwoci jakis blad, to rzucamy odpowiednim wyjatkiem.
|
168
168
|
def raise_if_error_present_in(response)
|
169
|
-
raise Exceptions::Unauthorized, 'Bad login or password' if response.code == 401
|
170
|
-
|
171
169
|
response_xml = response.parsed_response
|
172
170
|
if response_xml && !response_xml.css('error').empty?
|
173
171
|
error_id = response_xml.css('error').first['id']
|
@@ -9,10 +9,10 @@ module Elibri #:nodoc:
|
|
9
9
|
|
10
10
|
module Exceptions #:nodoc:all
|
11
11
|
class UnknownError < RuntimeError; end
|
12
|
-
class Unauthorized < RuntimeError; end
|
13
12
|
class NotFound < RuntimeError; end
|
14
13
|
class Forbidden < RuntimeError; end
|
15
14
|
class ServerError < RuntimeError; end
|
15
|
+
class InvalidLoginOrPassword < RuntimeError; end
|
16
16
|
class QueueDoesNotExists < RuntimeError; end
|
17
17
|
class NoRecentlyPoppedData < RuntimeError; end
|
18
18
|
class InvalidOnixDialect < RuntimeError; end
|
@@ -27,6 +27,7 @@ module Elibri #:nodoc:
|
|
27
27
|
'404' => Exceptions::NotFound,
|
28
28
|
'403' => Exceptions::Forbidden,
|
29
29
|
'500' => Exceptions::ServerError,
|
30
|
+
'1000' => Exceptions::InvalidLoginOrPassword,
|
30
31
|
'1001' => Exceptions::QueueDoesNotExists,
|
31
32
|
'1002' => Exceptions::NoRecentlyPoppedData,
|
32
33
|
'1003' => Exceptions::InvalidOnixDialect,
|
@@ -29,7 +29,7 @@ describe Elibri::ApiClient::ApiAdapters::V1 do
|
|
29
29
|
|
30
30
|
|
31
31
|
it "should define several exception classes" do
|
32
|
-
exception_classes = %w{
|
32
|
+
exception_classes = %w{NotFound Forbidden ServerError InvalidLoginOrPassword QueueDoesNotExists NoRecentlyPoppedData InvalidOnixDialect}
|
33
33
|
exception_classes.each do |exception_class|
|
34
34
|
assert(Elibri::ApiClient::ApiAdapters::V1::Exceptions.const_get(exception_class) < RuntimeError)
|
35
35
|
end
|
@@ -120,6 +120,7 @@ describe Elibri::ApiClient::ApiAdapters::V1 do
|
|
120
120
|
'404' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::NotFound,
|
121
121
|
'403' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::Forbidden,
|
122
122
|
'500' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::ServerError,
|
123
|
+
'1000' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::InvalidLoginOrPassword,
|
123
124
|
'1001' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::QueueDoesNotExists,
|
124
125
|
'1002' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::NoRecentlyPoppedData,
|
125
126
|
'1003' => Elibri::ApiClient::ApiAdapters::V1::Exceptions::InvalidOnixDialect,
|
@@ -136,10 +137,15 @@ describe Elibri::ApiClient::ApiAdapters::V1 do
|
|
136
137
|
end
|
137
138
|
|
138
139
|
|
139
|
-
it "should raise
|
140
|
-
|
140
|
+
it "should raise InvalidLoginOrPassword, when there is 401 response code" do
|
141
|
+
parsed_response = Nokogiri::XML(<<-XML)
|
142
|
+
<error id="1000">
|
143
|
+
<message>Invalid login or password</message>
|
144
|
+
</error>
|
145
|
+
XML
|
146
|
+
response_stub = stub('response_stub', :code => 401, :parsed_response => parsed_response)
|
141
147
|
get_request_expected("#{FAKE_API_HOST}/api/v1/queues").once.returns(response_stub)
|
142
|
-
assert_raises(Elibri::ApiClient::ApiAdapters::V1::Exceptions::
|
148
|
+
assert_raises(Elibri::ApiClient::ApiAdapters::V1::Exceptions::InvalidLoginOrPassword) { @adapter.pending_queues }
|
143
149
|
end
|
144
150
|
|
145
151
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elibri_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Marcin Urba\xC5\x84ski"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-13 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|