queenbee 1.1.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- 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/lib/queenbee.rb +5 -8
- data/test/queenbee/order_test.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec35ec081436adddbf6ea80a83a1e20d9eda1e35bf0d1c2f94040976e5f4e9d0
|
4
|
+
data.tar.gz: ce8bad72ac6c0391d8737ecb63a046828467b70a30451e89d1b90001744a3b3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2396e77d70f3432f2b5a359d77ab6c81a7359b7c72c3fb5271b2f5008a0bbb812c48b460ced66c19467ab1588f27aa0d7e2a1b3790dd8b38ea3a981e3497f0dc
|
7
|
+
data.tar.gz: 5b2fe4cde93f5ebde93ab477c207fd88b4fc60e3118895129fec816440d5ac9efca9f03cfd87bccc9e3e5db36b395d5d15dd2a22fd0ebe5f72c199c5dff96ada
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Queenbee
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://semaphoreci.com/api/v1/olimart/queenbee-ruby/branches/master/badge.svg)](https://semaphoreci.com/olimart/queenbee-ruby)
|
4
4
|
|
5
5
|
Simple gem for communicating with external API. Heavily inspired by stripe gem.
|
6
6
|
|
@@ -45,7 +45,7 @@ Queenbee::Order.create(
|
|
45
45
|
)
|
46
46
|
```
|
47
47
|
|
48
|
-
Optional attributes are
|
48
|
+
Optional attributes are available for subscription-type application such as:
|
49
49
|
|
50
50
|
```ruby
|
51
51
|
subscribed_at: '2015-05-05 20:13:45',
|
@@ -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/lib/queenbee.rb
CHANGED
@@ -30,7 +30,7 @@ require "queenbee/errors/invalid_request_error"
|
|
30
30
|
require "queenbee/errors/authentication_error"
|
31
31
|
|
32
32
|
module Queenbee
|
33
|
-
@api_base = "https://queenbee
|
33
|
+
@api_base = "https://queenbee.yafoy.com/api"
|
34
34
|
|
35
35
|
class << self
|
36
36
|
attr_accessor :token, :api_base, :verify_ssl_certs, :api_version
|
@@ -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
|
|
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.3.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: 2022-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,12 +127,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.3.7
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
|
-
summary:
|
133
|
+
summary: Ruby gem to send orders & events to Queenbee main app.
|
134
134
|
test_files:
|
135
|
+
- test/queenbee/event_test.rb
|
135
136
|
- test/queenbee/metrics_test.rb
|
136
137
|
- test/queenbee/order_test.rb
|
137
|
-
- test/queenbee/event_test.rb
|
138
138
|
- test/test_helper.rb
|