plausible_api 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -9
- data/lib/plausible_api/client.rb +17 -7
- data/lib/plausible_api/version.rb +1 -1
- data/plausible_api.gemspec +0 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e5dc3ef2295b911db3855a3dd745f9f6bfe964fd9744fca791071785dcfe10
|
4
|
+
data.tar.gz: 90f4ee8e828ed9318e2a990bc4f9ed928af6e828c073020a179bb656ad4538c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f76963510fbb456467cd9cca3cbfdb7100ddddf0b7aaf38848153386b5d09dd1617839416a52bf59b8cf755b829913748335826c908ed1826f496d7b164f29e
|
7
|
+
data.tar.gz: a0750f809ecd8982532cc8a325361a660d0152610b37dd8c34ad83179b08ea3468a8e3eac8c6c92c37e54468cbe7f55e7b74b005e346e32f9d8d16b15de3742a
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plausible_api (0.1.
|
5
|
-
faraday (~> 1.0)
|
4
|
+
plausible_api (0.1.2)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
|
-
faraday (1.3.0)
|
11
|
-
faraday-net_http (~> 1.0)
|
12
|
-
multipart-post (>= 1.2, < 3)
|
13
|
-
ruby2_keywords
|
14
|
-
faraday-net_http (1.0.1)
|
15
9
|
minitest (5.14.3)
|
16
|
-
multipart-post (2.1.1)
|
17
10
|
rake (12.3.3)
|
18
|
-
ruby2_keywords (0.0.4)
|
19
11
|
|
20
12
|
PLATFORMS
|
21
13
|
ruby
|
data/lib/plausible_api/client.rb
CHANGED
@@ -4,8 +4,10 @@ require 'plausible_api/stats/realtime/visitors'
|
|
4
4
|
require 'plausible_api/stats/aggregate'
|
5
5
|
require 'plausible_api/stats/timeseries'
|
6
6
|
|
7
|
-
require 'faraday'
|
8
7
|
require 'json'
|
8
|
+
require "net/http"
|
9
|
+
require "uri"
|
10
|
+
require "cgi"
|
9
11
|
|
10
12
|
module PlausibleApi
|
11
13
|
class Client
|
@@ -29,14 +31,22 @@ module PlausibleApi
|
|
29
31
|
call PlausibleApi::Stats::Realtime::Visitors.new
|
30
32
|
end
|
31
33
|
|
34
|
+
def test
|
35
|
+
realtime_visitors.is_a? Integer
|
36
|
+
end
|
37
|
+
|
32
38
|
private
|
33
|
-
def call(api)
|
39
|
+
def call(api)
|
34
40
|
url = "#{BASE_URL}#{api.request_url.gsub('$SITE_ID', @site_id)}"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
uri = URI.parse(url)
|
42
|
+
|
43
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
44
|
+
req.add_field('Authorization', "Bearer #{@token}")
|
45
|
+
|
46
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
47
|
+
http.use_ssl = true
|
48
|
+
|
49
|
+
JSON.parse http.request(req).body
|
40
50
|
end
|
41
51
|
end
|
42
52
|
end
|
data/plausible_api.gemspec
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
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.2
|
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-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: faraday
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
11
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: A very humble wrapper for the new API by Plausible
|
28
14
|
email:
|
29
15
|
- gustavo@dailytics.com
|