queenbee 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/queenbee.rb +4 -7
- data/lib/queenbee/api_operations/delete.rb +3 -3
- data/lib/queenbee/api_resource.rb +2 -2
- data/lib/queenbee/version.rb +1 -1
- data/test/queenbee/order_test.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ece24ddacceb784702c9312a8cd56275adc0e421245451900fdd2f197fb67f
|
4
|
+
data.tar.gz: 239bbaffd30734f33568b1a0da6807d79745c8f0f597204715ec7fc666c7ede0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5070b0bbd74c6a39a9cdcb8cc6af8140e5a5c26b6c94c7c440eaa35789a27013c55343f287625fc8072d9cb467db1c8df75157c557184d023f5a5544e4f4437c
|
7
|
+
data.tar.gz: b27cb2fa91db43d6a97461a1b1e0f201d6f22ac6281708c462cb5ba6e8c7f35db30ce0a640b4f5d46f8a358e152c370c5decab12667c37c55209dd8528cfbe03
|
data/lib/queenbee.rb
CHANGED
@@ -66,12 +66,9 @@ module Queenbee
|
|
66
66
|
http.use_ssl = true if uri.scheme == "https"
|
67
67
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if uri.scheme == "https"
|
68
68
|
|
69
|
-
response = http.start {|h|
|
70
|
-
h.request(request)
|
71
|
-
}
|
69
|
+
response = http.start { |h| h.request(request) }
|
72
70
|
|
73
|
-
|
74
|
-
handle_api_error(response.code, response.body)
|
71
|
+
handle_api_error(response.code, response.body) unless (200..299).include?(response.code.to_i)
|
75
72
|
|
76
73
|
rescue SocketError => e
|
77
74
|
handle_connection_error(e)
|
@@ -82,7 +79,7 @@ module Queenbee
|
|
82
79
|
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
|
83
80
|
handle_connection_error(e)
|
84
81
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
85
|
-
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
|
82
|
+
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
86
83
|
handle_connection_error(e)
|
87
84
|
end
|
88
85
|
|
@@ -122,7 +119,7 @@ module Queenbee
|
|
122
119
|
when 500
|
123
120
|
raise api_error error, rcode, rbody, error_obj
|
124
121
|
else
|
125
|
-
|
122
|
+
raise api_error error, rcode, rbody, error_obj
|
126
123
|
end
|
127
124
|
end
|
128
125
|
|
@@ -2,9 +2,9 @@ module Queenbee
|
|
2
2
|
module APIOperations
|
3
3
|
module Delete
|
4
4
|
module ClassMethods
|
5
|
-
def delete(
|
6
|
-
url = self.url +
|
7
|
-
response, token = Queenbee.request(:delete, url, token
|
5
|
+
def delete(id, token = nil)
|
6
|
+
url = self.url + "/" + id
|
7
|
+
response, token = Queenbee.request(:delete, url, token)
|
8
8
|
response
|
9
9
|
end
|
10
10
|
end
|
@@ -6,7 +6,7 @@ module Queenbee
|
|
6
6
|
|
7
7
|
def self.url()
|
8
8
|
if self == APIResource
|
9
|
-
raise NotImplementedError.new('APIResource is an abstract class.
|
9
|
+
raise NotImplementedError.new('APIResource is an abstract class. You should perform actions on its subclasses)')
|
10
10
|
end
|
11
11
|
"/#{CGI.escape(class_name.downcase)}s"
|
12
12
|
end
|
@@ -18,4 +18,4 @@ module Queenbee
|
|
18
18
|
"#{self.class.url}/#{CGI.escape(id)}"
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/lib/queenbee/version.rb
CHANGED
data/test/queenbee/order_test.rb
CHANGED
@@ -51,11 +51,11 @@ module Queenbee
|
|
51
51
|
# assert_equal "404", response.code
|
52
52
|
# end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
should "Delete should return 204" do
|
55
|
+
response1 = Queenbee::Order.create(@valid_params)
|
56
|
+
response = Queenbee::Order.delete(@uid)
|
57
|
+
assert_equal "204", response.code
|
58
|
+
end
|
59
59
|
|
60
60
|
# should "Delete should return 404 if UID incorrect" do
|
61
61
|
# response = Queenbee::Order.delete("fakeuid")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queenbee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|