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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16b223a7e964ee43ca53e6c0e1b274eb5c041ff1f5b6494da48054784f00230b
4
- data.tar.gz: 123d1ceda4adfa6226bd8e20c64accff1e8d6aef24fe636691f9a227cd371d4a
3
+ metadata.gz: 962813e1fb193b723644ff2051b8bebec97103ab7ce3698160a7730ec337576c
4
+ data.tar.gz: 5deb76eefa6378377e2c18343cf4e4e0d0f5cf39ea3f92f0a993b95dcf81ccef
5
5
  SHA512:
6
- metadata.gz: 5b88696f5abfe45cc27824635cb07cbd9764d3f0c3680c8e17e330fb0bb3d7827cd415d0c51ca126fd42b991d38f39d02928a1be975300aa9d58bc49d9cd9275
7
- data.tar.gz: 29a1c0573bb116849ec55f0868b7d5e38fa4fdb14e3ba6828741ea3171955a78d293f5eda649a6e96988839b4fae5902368d17d14ea61995c2f5df8d6e5ade6d
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.zone.now
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
 
@@ -7,4 +7,4 @@ module Queenbee
7
7
  @param = param
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -13,8 +13,15 @@ module Queenbee
13
13
  end
14
14
 
15
15
  def to_s
16
- status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
17
- "#{status_string}#{@message}"
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
@@ -3,7 +3,7 @@ module Queenbee
3
3
  extend Queenbee::APIOperations::Get
4
4
  include Queenbee::APIOperations::Create
5
5
 
6
- def self.all(opts = {})
6
+ def self.all(**opts)
7
7
  Queenbee::Metrics.get("/events?page=#{opts[:page] || 1}")
8
8
  end
9
9
  end
@@ -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, '/metrics/summary')
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('/metrics/all')
10
+ Queenbee::Metrics.get("/metrics/all")
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Queenbee
2
- VERSION = "1.4.1"
2
+ VERSION = "1.5.1"
3
3
  end
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 "Invalid request", rcode, rbody, error_obj
115
+ raise invalid_request_error("Invalid request", rcode, rbody, error_obj).to_s
116
116
  when 401
117
- raise authentication_error "Unauthorized", rcode, rbody, error_obj
117
+ raise authentication_error("Unauthorized", rcode, rbody, error_obj).to_s
118
118
  when 500
119
- raise api_error "Server returned an error", rcode, rbody, error_obj
119
+ raise api_error("Server returned an error", rcode, rbody, error_obj).to_s
120
120
  else
121
- raise api_error "An error has occurred", rcode, rbody, error_obj
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)
@@ -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: { color: "pink", "sport": "basket-ball", "age": 25, "fruit": "banana" }
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.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-05-02 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler