queenbee 1.4.1 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/queenbee/errors/invalid_request_error.rb +1 -1
- data/lib/queenbee/errors/queenbee_error.rb +10 -3
- data/lib/queenbee/event.rb +1 -1
- data/lib/queenbee/metrics.rb +3 -3
- data/lib/queenbee/version.rb +1 -1
- data/lib/queenbee.rb +6 -6
- data/test/queenbee/event_test.rb +1 -1
- 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: 962813e1fb193b723644ff2051b8bebec97103ab7ce3698160a7730ec337576c
|
4
|
+
data.tar.gz: 5deb76eefa6378377e2c18343cf4e4e0d0f5cf39ea3f92f0a993b95dcf81ccef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c627fde5ae0cf5155bd3b12aa3fc1cb748612ba53403254976fbace8c4183a3433084be28b3908c902b251f14e31ab2c8f0b95ee88798dafb1d9a0c2a31c46
|
7
|
+
data.tar.gz: 5a992a3aa287ea3c1fbe8cdf7a8c4c6098dbd3755ddad0447724fa34cd4de28c3b1dd3c3e30c053f21b864297b5061c12845b2c0db36a7d2752c0195a97d2c92
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ unsubscribed_at: '2016-05-05 20:13:45'
|
|
59
59
|
```ruby
|
60
60
|
Queenbee::Order.save(
|
61
61
|
uid: '111',
|
62
|
-
unsubscribed_at: Time.
|
62
|
+
unsubscribed_at: Time.current
|
63
63
|
)
|
64
64
|
```
|
65
65
|
|
@@ -69,6 +69,13 @@ Queenbee::Order.save(
|
|
69
69
|
Queenbee::Order.delete('111')
|
70
70
|
```
|
71
71
|
|
72
|
+
## Development
|
73
|
+
|
74
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
75
|
+
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
|
+
|
78
|
+
To experiment with that code, run `bin/console` for an interactive prompt.
|
72
79
|
|
73
80
|
## Tests
|
74
81
|
|
@@ -13,8 +13,15 @@ module Queenbee
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_s
|
16
|
-
|
17
|
-
|
16
|
+
[
|
17
|
+
status_string,
|
18
|
+
json_body,
|
19
|
+
message
|
20
|
+
].compact.join(" - ")
|
21
|
+
end
|
22
|
+
|
23
|
+
def status_string
|
24
|
+
http_status.nil? ? "" : "(Status #{http_status})"
|
18
25
|
end
|
19
26
|
end
|
20
|
-
end
|
27
|
+
end
|
data/lib/queenbee/event.rb
CHANGED
data/lib/queenbee/metrics.rb
CHANGED
@@ -2,12 +2,12 @@ module Queenbee
|
|
2
2
|
class Metrics < APIResource
|
3
3
|
extend Queenbee::APIOperations::Get
|
4
4
|
|
5
|
-
def self.summary(params
|
6
|
-
Queenbee::Metrics.get(params,
|
5
|
+
def self.summary(**params)
|
6
|
+
Queenbee::Metrics.get(params, "/metrics/summary")
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.all
|
10
|
-
Queenbee::Metrics.get(
|
10
|
+
Queenbee::Metrics.get("/metrics/all")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/queenbee/version.rb
CHANGED
data/lib/queenbee.rb
CHANGED
@@ -110,20 +110,20 @@ module Queenbee
|
|
110
110
|
raise general_api_error(rcode, rbody)
|
111
111
|
end
|
112
112
|
|
113
|
-
case rcode
|
113
|
+
case rcode.to_i
|
114
114
|
when 400, 404, 422
|
115
|
-
raise invalid_request_error
|
115
|
+
raise invalid_request_error("Invalid request", rcode, rbody, error_obj).to_s
|
116
116
|
when 401
|
117
|
-
raise authentication_error
|
117
|
+
raise authentication_error("Unauthorized", rcode, rbody, error_obj).to_s
|
118
118
|
when 500
|
119
|
-
raise api_error
|
119
|
+
raise api_error("Server returned an error", rcode, rbody, error_obj).to_s
|
120
120
|
else
|
121
|
-
raise api_error
|
121
|
+
raise api_error("An error has occurred", rcode, rbody, error_obj).to_s
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
125
|
def self.invalid_request_error(message, rcode, rbody, error_obj)
|
126
|
-
InvalidRequestError.new(message, rcode, rbody, error_obj)
|
126
|
+
InvalidRequestError.new(message, nil, rcode, rbody, error_obj)
|
127
127
|
end
|
128
128
|
|
129
129
|
def self.authentication_error(message, rcode, rbody, error_obj)
|
data/test/queenbee/event_test.rb
CHANGED
@@ -7,7 +7,7 @@ module Queenbee
|
|
7
7
|
date: "2014-07-01 14:50:28",
|
8
8
|
status: "confirmed",
|
9
9
|
message: "From the API",
|
10
|
-
metadata: {
|
10
|
+
metadata: {color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana"}
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
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.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|