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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 040cbafdc8f270ac3f2bfdcaed7501535f801e93ba1059e6b776be42258714e9
4
- data.tar.gz: 9e5511a3d7bb752a1b0a89e0f4d3b405eea5a6ca56262cf684626d7cf444dafc
3
+ metadata.gz: ebd11c78c881b2281f10539221af3d8d73e354907d23a897c1b3802425cbeb83
4
+ data.tar.gz: '0395a7e8e2f7e05f623c55cf3d328c759c55ad20d49451a547203fe13dd26509'
5
5
  SHA512:
6
- metadata.gz: 83077cd7edeb80de8388afbea3fd85d2ba2e8068345e10df04331c6356f7dc5a7c7096da9774bfe2fa6324d76fd68ec5c80cf4c39f1dd499a39dbb8d73ba24c7
7
- data.tar.gz: fc95a48bf881567cce4f126c899206e18cdfbbc0b0f3ddeba6e66f37553a12f2a77a541472005eafd3c07ddc435d70886fc95d13b751b906056d616bd5604a42
6
+ metadata.gz: e4d725a1bab3837fd49afcdbe62a260f65ff181b2ce4f8867668a2b3dce396d246284acef7298e817adcbef765bdcaebbf259ace20d6afaa6225309761d402b7
7
+ data.tar.gz: eacc77af2a71f266551b5378354adf44e222bcff5e0a95e0e3fc9dce390d93b4155a23db53bf5ad7a5eb24078ad81869083a586e5a1f66c18a56d4bd921e7dfe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plausible_api (0.1.6)
4
+ plausible_api (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -38,12 +38,17 @@ module PlausibleApi
38
38
  end
39
39
 
40
40
  def valid?
41
- realtime_visitors.is_a? Integer
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 "There is some invalid parameters." unless api.valid?
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
- api.parse_response http.request(req).body
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
@@ -1,3 +1,3 @@
1
1
  module PlausibleApi
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  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.6
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-25 00:00:00.000000000 Z
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: