supergood 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/supergood/api.rb +2 -2
- data/lib/supergood/client.rb +3 -1
- data/lib/supergood/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a20e9c78ef66594eaed117db23b1581b3531497aaf3a087ad92466f76a8e07a8
|
4
|
+
data.tar.gz: 22e62c82c3cea5bfba10a8d5199ebf1a385bab78861c6f20efcd55921e65eee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da801337729a2975cd42231da0de2e773aafdcc0a391a69111b4acb55dfe1d8126e1017e72481688dcf410d23a072c51204e9885e8938d9903ed1f947de94bfc
|
7
|
+
data.tar.gz: b9848d4363bcb7b04bb19b46dc61f8adcb8bbf9b911664a3ba367721f171e2ad950c3fdcb3d236192fe5c160e4d33aa926615583647c7b3e44b0038fc4ed6c27
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ gem install supergood
|
|
12
12
|
|
13
13
|
**Environment variables**
|
14
14
|
|
15
|
-
Set the environment variables `SUPERGOOD_CLIENT_ID` and `SUPERGOOD_CLIENT_SECRET` using the API keys generated in the [getting started instructions](
|
15
|
+
Set the environment variables `SUPERGOOD_CLIENT_ID` and `SUPERGOOD_CLIENT_SECRET` using the API keys generated in the [getting started instructions](https://github.com/supergoodsystems/docs/blob/main/getting-started.md).
|
16
16
|
|
17
17
|
Initialize the Supergood client at the root of your application, or anywhere you're making API calls with the following code:
|
18
18
|
|
@@ -26,7 +26,7 @@ Supergood.init()
|
|
26
26
|
|
27
27
|
You can also pass the API keys in manually without setting environment variables.\
|
28
28
|
\
|
29
|
-
Replace `<CLIENT_ID>` and `<CLIENT_SECRET>` with the API keys you generated in the [getting started instructions](
|
29
|
+
Replace `<CLIENT_ID>` and `<CLIENT_SECRET>` with the API keys you generated in the [getting started instructions](https://github.com/supergoodsystems/docs/blob/main/getting-started.md).
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
require 'supergood'
|
data/lib/supergood/api.rb
CHANGED
@@ -29,7 +29,7 @@ module Supergood
|
|
29
29
|
if @local_only
|
30
30
|
@log.debug(payload)
|
31
31
|
else
|
32
|
-
uri = URI(@base_url + '/
|
32
|
+
uri = URI(@base_url + '/events')
|
33
33
|
response = Net::HTTP.post(uri, payload.to_json, @header_options)
|
34
34
|
if response.code == '200'
|
35
35
|
return JSON.parse(response.body, symbolize_names: true)
|
@@ -45,7 +45,7 @@ module Supergood
|
|
45
45
|
if @local_only
|
46
46
|
@log.debug(payload)
|
47
47
|
else
|
48
|
-
uri = URI(@base_url + '/
|
48
|
+
uri = URI(@base_url + '/errors')
|
49
49
|
response = Net::HTTP.post(uri, payload.to_json, @header_options)
|
50
50
|
if response.code == '200'
|
51
51
|
return JSON.parse(response.body, symbolize_names: true)
|
data/lib/supergood/client.rb
CHANGED
@@ -11,7 +11,7 @@ Dotenv.load
|
|
11
11
|
|
12
12
|
module Supergood
|
13
13
|
|
14
|
-
DEFAULT_SUPERGOOD_BASE_URL = 'https://
|
14
|
+
DEFAULT_SUPERGOOD_BASE_URL = 'https://api.supergood.ai'
|
15
15
|
class << self
|
16
16
|
def init(config={})
|
17
17
|
supergood_client_id = config[:client_id] || ENV['SUPERGOOD_CLIENT_ID']
|
@@ -120,11 +120,13 @@ module Supergood
|
|
120
120
|
request_id = SecureRandom.uuid
|
121
121
|
requested_at = Time.now
|
122
122
|
if !ignored?(request[:domain])
|
123
|
+
puts "Caching Request"
|
123
124
|
cache_request(request_id, requested_at, request)
|
124
125
|
end
|
125
126
|
|
126
127
|
response = yield
|
127
128
|
if !ignored?(request[:domain]) && defined?(response)
|
129
|
+
puts "Caching Response"
|
128
130
|
cache_response(request_id, requested_at, response)
|
129
131
|
end
|
130
132
|
|
data/lib/supergood/version.rb
CHANGED