supergood 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -28
- data/lib/supergood/client.rb +0 -3
- 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: 8b55de34e8a2ab872a9d2556a4e1e8a4e544bff0536c02fcf123fb93c30fde87
|
4
|
+
data.tar.gz: 974a1af1a188f5a85e77c603e9545370c360367edeb4327c009c6b12ec44a8b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0c8f7c3b9af56109324314aa9af0220624bf9d05d2e06a8d2706b5cfac3f6d6ba2e7e8613b82803cc7365e66e6e76d85b1180c62d368ae01f55892276b730c3
|
7
|
+
data.tar.gz: 5bf07755f863ca866c5381f465957689616826f6db09734beda707a15099fc55b3a1fcee4b76f5c9df6623a5b5b1d9b26cb1782924a480e5f66dc279ae353a8b
|
data/README.md
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
#
|
1
|
+
# Ruby
|
2
2
|
|
3
|
-
|
3
|
+
The Supergood Ruby client connects Supergood to your Ruby application. Follow these steps to integrate with the Ruby client.
|
4
4
|
|
5
|
-
|
5
|
+
## 1. Install the Supergood library
|
6
6
|
|
7
|
-
|
7
|
+
```bash
|
8
|
+
gem install supergood
|
9
|
+
```
|
8
10
|
|
9
|
-
##
|
11
|
+
## 2. Initialize the Supergood Library
|
10
12
|
|
11
|
-
|
13
|
+
**Environment variables**
|
12
14
|
|
13
|
-
|
14
|
-
gem 'supergood'
|
15
|
-
```
|
15
|
+
Set the environment variables `SUPERGOOD_CLIENT_ID` and `SUPERGOOD_CLIENT_SECRET` using the API keys generated in the [getting started instructions](../../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
|
|
19
|
-
|
20
|
-
|
21
|
-
Or install it yourself as:
|
19
|
+
```ruby
|
20
|
+
require 'supergood'
|
22
21
|
|
23
|
-
|
22
|
+
Supergood.init()
|
23
|
+
```
|
24
24
|
|
25
|
-
|
25
|
+
**Passing keys**
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
You can also pass the API keys in manually without setting environment variables.\
|
28
|
+
\
|
29
|
+
Replace `<CLIENT_ID>` and `<CLIENT_SECRET>` with the API keys you generated in the [getting started instructions](../../getting-started.md).
|
30
30
|
|
31
|
-
```
|
31
|
+
```ruby
|
32
32
|
require 'supergood'
|
33
33
|
|
34
|
-
Supergood.init(
|
34
|
+
Supergood.init({ client_id: "<CLIENT_ID>", client_secret: "<CLIENT_SECRET>" })
|
35
35
|
```
|
36
|
-
OR
|
37
|
-
|
38
|
-
set `SUPERGOOD_CLIENT_ID` and `SUPERGOOD_CLIENT_SECRET` as environment variables and leave the init function as `Supergood.init`
|
39
36
|
|
37
|
+
#### Local development
|
40
38
|
|
41
|
-
|
39
|
+
Setting the `CLIENT_ID` and `CLIENT_SECRET_ID` to `local-client-id` and `local-client-secret`, respectively, will disable making API calls to the supergood.ai server and instead log the payloads to the local console.
|
42
40
|
|
43
|
-
|
41
|
+
## 3. Monitor your API calls
|
44
42
|
|
45
|
-
|
43
|
+
You're all set to use Supergood!
|
46
44
|
|
47
|
-
|
45
|
+
Head back to your [dashboard](https://dashboard.supergood.ai) to start monitoring your API calls and receiving reports.
|
48
46
|
|
49
|
-
|
47
|
+
## Links
|
50
48
|
|
49
|
+
* [Supergood RubyGems Project](https://rubygems.org/gems/supergood)
|
50
|
+
* [Supergood-rb Source Code](https://github.com/supergoodsystems/supergood-rb)
|
data/lib/supergood/client.rb
CHANGED
@@ -75,7 +75,6 @@ module Supergood
|
|
75
75
|
api.post_events(data)
|
76
76
|
rescue => e
|
77
77
|
log.error(data, e, e.message)
|
78
|
-
cleanup()
|
79
78
|
ensure
|
80
79
|
@response_cache.clear
|
81
80
|
@request_cache.clear if force
|
@@ -147,7 +146,6 @@ module Supergood
|
|
147
146
|
}
|
148
147
|
rescue => e
|
149
148
|
log.error({ request: request }, e, ERRORS[:CACHING_REQUEST])
|
150
|
-
cleanup()
|
151
149
|
end
|
152
150
|
end
|
153
151
|
|
@@ -173,7 +171,6 @@ module Supergood
|
|
173
171
|
{ request: request_payload, response: response_payload },
|
174
172
|
e, ERRORS[:CACHING_RESPONSE]
|
175
173
|
)
|
176
|
-
cleanup()
|
177
174
|
end
|
178
175
|
end
|
179
176
|
|
data/lib/supergood/version.rb
CHANGED