plausible_api 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/plausible_api/client.rb +14 -3
- data/lib/plausible_api/version.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: ebd11c78c881b2281f10539221af3d8d73e354907d23a897c1b3802425cbeb83
|
4
|
+
data.tar.gz: '0395a7e8e2f7e05f623c55cf3d328c759c55ad20d49451a547203fe13dd26509'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d725a1bab3837fd49afcdbe62a260f65ff181b2ce4f8867668a2b3dce396d246284acef7298e817adcbef765bdcaebbf259ace20d6afaa6225309761d402b7
|
7
|
+
data.tar.gz: eacc77af2a71f266551b5378354adf44e222bcff5e0a95e0e3fc9dce390d93b4155a23db53bf5ad7a5eb24078ad81869083a586e5a1f66c18a56d4bd921e7dfe
|
data/Gemfile.lock
CHANGED
data/lib/plausible_api/client.rb
CHANGED
@@ -38,12 +38,17 @@ module PlausibleApi
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def valid?
|
41
|
-
|
41
|
+
begin
|
42
|
+
realtime_visitors
|
43
|
+
return true
|
44
|
+
rescue
|
45
|
+
return false
|
46
|
+
end
|
42
47
|
end
|
43
48
|
|
44
49
|
private
|
45
50
|
def call(api)
|
46
|
-
raise StandardError.new
|
51
|
+
raise StandardError.new api.errors unless api.valid?
|
47
52
|
|
48
53
|
url = "#{BASE_URL}#{api.request_url.gsub('$SITE_ID', @site_id)}"
|
49
54
|
uri = URI.parse(url)
|
@@ -54,7 +59,13 @@ module PlausibleApi
|
|
54
59
|
http = Net::HTTP.new(uri.host, uri.port)
|
55
60
|
http.use_ssl = true
|
56
61
|
|
57
|
-
|
62
|
+
response = http.request(req)
|
63
|
+
|
64
|
+
if response.code == "200"
|
65
|
+
api.parse_response response.body
|
66
|
+
else
|
67
|
+
raise StandardError.new response.body
|
68
|
+
end
|
58
69
|
end
|
59
70
|
end
|
60
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plausible_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A very humble wrapper for the new API by Plausible
|
14
14
|
email:
|