thisdata 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.md +4 -3
- data/lib/generators/this_data/install_generator.rb +4 -1
- data/lib/this_data/client.rb +2 -4
- data/lib/this_data/configuration.rb +5 -1
- data/lib/this_data/verbs.rb +0 -1
- data/lib/this_data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3deabd0e6dce046e95416f9c6441e7079050dd
|
4
|
+
data.tar.gz: a9b175550b1a79e7288300e9fecc55dd9f5305ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac5d6e5a4687ac956f0321e639c18da0d57c47a99cc0206aa2a92a1e2b240fdffd385bfb50b45159ae40c65d7256c1c25083c2eb24f2d28977677631eb112ad1
|
7
|
+
data.tar.gz: 03c8774f8b863b3f57616ff016394f34d562d301d88d01ae77b2c0bb1179edb958d45c2b70b4fe8c67eb59a08830cb639e5225c5b6aa1cb724ec954ddf8cb74b
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -41,6 +41,7 @@ ThisData.setup do |config|
|
|
41
41
|
config.api_key = 'API_KEY_HERE' # Don't commit your key to source control!
|
42
42
|
config.logger = Logger.new($stdout)
|
43
43
|
config.async = false
|
44
|
+
config.base_uri = 'https://api.thisdata.com/v1/' # optional. This is the default
|
44
45
|
end
|
45
46
|
```
|
46
47
|
|
@@ -102,8 +103,8 @@ events.first.user.id
|
|
102
103
|
|
103
104
|
#### Managing custom Rules
|
104
105
|
You can get, create, update and delete custom rules. Note that no error handling is done
|
105
|
-
within the API wrapper so you will need to watch out for error `messages` in the
|
106
|
-
response body of each call.
|
106
|
+
within the API wrapper so you will need to watch out for error `messages` in the
|
107
|
+
response body of each call.
|
107
108
|
|
108
109
|
Create a rule
|
109
110
|
```ruby
|
@@ -117,7 +118,7 @@ rule = ThisData::Rule.create({
|
|
117
118
|
filters: ["0.0.0.0/0"]
|
118
119
|
})
|
119
120
|
|
120
|
-
puts rule.id
|
121
|
+
puts rule.id
|
121
122
|
puts rule.name
|
122
123
|
...
|
123
124
|
```
|
@@ -2,7 +2,7 @@ require 'this_data'
|
|
2
2
|
module ThisData
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
|
5
|
-
argument :api_key
|
5
|
+
argument :api_key, :base_uri
|
6
6
|
|
7
7
|
desc "This generator creates a configuration file for the ThisData ruby client inside config/initializers"
|
8
8
|
def create_configuration_file
|
@@ -16,6 +16,9 @@ ThisData.setup do |config|
|
|
16
16
|
# Default: nil
|
17
17
|
config.api_key = "#{api_key}"
|
18
18
|
|
19
|
+
# Base URI for the API
|
20
|
+
config.base_uri = "#{base_uri}"
|
21
|
+
|
19
22
|
# Define a Logger instance if you want to debug or track errors
|
20
23
|
# This tells ThisData to log in the development environment.
|
21
24
|
# Comment it out to use the default behaviour across all environments.
|
data/lib/this_data/client.rb
CHANGED
@@ -8,9 +8,8 @@ module ThisData
|
|
8
8
|
|
9
9
|
include HTTParty
|
10
10
|
|
11
|
-
base_uri "https://api.thisdata.com/v1/"
|
12
|
-
|
13
11
|
def initialize
|
12
|
+
self.class.base_uri ThisData.configuration.base_uri
|
14
13
|
@api_key = require_api_key
|
15
14
|
@headers = {
|
16
15
|
"User-Agent" => USER_AGENT
|
@@ -30,7 +29,7 @@ module ThisData
|
|
30
29
|
# - event (Required: Hash) a Hash containing details about the event.
|
31
30
|
# See http://help.thisdata.com/v1.0/docs/apiv1events for a
|
32
31
|
# full & current list of available options.
|
33
|
-
def track(event, options={})
|
32
|
+
def track(event, options = {})
|
34
33
|
post(ThisData::EVENTS_ENDPOINT, query: options, body: JSON.generate(event))
|
35
34
|
end
|
36
35
|
|
@@ -64,6 +63,5 @@ module ThisData
|
|
64
63
|
def print_api_key_warning
|
65
64
|
$stderr.puts(NO_API_KEY_MESSAGE)
|
66
65
|
end
|
67
|
-
|
68
66
|
end
|
69
67
|
end
|
@@ -29,6 +29,9 @@ module ThisData
|
|
29
29
|
# Log the events sent
|
30
30
|
config_option :logger
|
31
31
|
|
32
|
+
# API Base URI
|
33
|
+
config_option :base_uri
|
34
|
+
|
32
35
|
# ThisData's JS library (optional) adds a cookie.
|
33
36
|
# If you're using the library, set this to true, so that we know to expect
|
34
37
|
# a cookie value
|
@@ -60,7 +63,8 @@ module ThisData
|
|
60
63
|
user_name_method: :name,
|
61
64
|
user_email_method: :email,
|
62
65
|
user_mobile_method: :mobile,
|
63
|
-
expect_js_cookie: false
|
66
|
+
expect_js_cookie: false,
|
67
|
+
base_uri: 'https://api.thisdata.com/v1/'
|
64
68
|
})
|
65
69
|
end
|
66
70
|
|
data/lib/this_data/verbs.rb
CHANGED
data/lib/this_data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thisdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThisData Ltd
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|