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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15bbde497a81fb8a7a9daab192b9fbf1ce9bcb75
4
- data.tar.gz: a3b586f93cdc6e60d9e275b755a7a14f7b03f241
3
+ metadata.gz: 7e3deabd0e6dce046e95416f9c6441e7079050dd
4
+ data.tar.gz: a9b175550b1a79e7288300e9fecc55dd9f5305ad
5
5
  SHA512:
6
- metadata.gz: b63d329d028e6b9b7402fa647654ac1eb1420d12acc88e6253c6850bb26ce024bfab984fdaa307c8969686a7235e407cea4191d855cede55b99739b9e7dd5f3d
7
- data.tar.gz: 1aecd3a5fdd00e06d40c8fb795706aa035eb55f9f6c79fe81d148aa3ef6c60f8a19eb36af74dd526a8e02e9f6c3be500c70ff13a2dd2ff8d43b05a8d20e0d249
6
+ metadata.gz: ac5d6e5a4687ac956f0321e639c18da0d57c47a99cc0206aa2a92a1e2b240fdffd385bfb50b45159ae40c65d7256c1c25083c2eb24f2d28977677631eb112ad1
7
+ data.tar.gz: 03c8774f8b863b3f57616ff016394f34d562d301d88d01ae77b2c0bb1179edb958d45c2b70b4fe8c67eb59a08830cb639e5225c5b6aa1cb724ec954ddf8cb74b
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.6
2
+
3
+ - base_uri can now be customized on client setup
4
+
1
5
  # 0.2.0
2
6
 
3
7
  - Add support for two new API endpoints, POST /verify and GET /events
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.
@@ -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
 
@@ -12,7 +12,6 @@ module ThisData
12
12
  LOG_OUT = 'log-out'
13
13
  LOG_IN_DENIED = 'log-in-denied'
14
14
  LOG_IN_CHALLENGE = 'log-in-challenge'
15
- LOG_IN_CHALLENGE = 'log-in-challenge'
16
15
  DESKTOP_LOGIN_SUCCESS = 'desktop-login-success'
17
16
 
18
17
  ACCESS = 'access'
@@ -1,3 +1,3 @@
1
1
  module ThisData
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
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.5
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: 2018-09-18 00:00:00.000000000 Z
12
+ date: 2019-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty