castle-rb 1.2.10 → 1.2.11

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: 0b9687bad28a3aaeb6e2ecdb50f04f6425dc9b97
4
- data.tar.gz: d7d194bd380eb3a4d72413ee11b0bec011f964a6
3
+ metadata.gz: ba0f2b39431a260b85e4466f76901325b5c23726
4
+ data.tar.gz: c08ad55dd0965329595500f61b309dade6be0448
5
5
  SHA512:
6
- metadata.gz: 95a04daea6032aa501dfa7d17a0a07a1483fd5f3bde9277b126f58bc8dab1bd90dc0669b4fe640dd7c3c928c78e73faae190831fe2b318af90980461cd0a9211
7
- data.tar.gz: 5e7fe2a8f175164ce9d62addd7413c7b0f9c4ae99df889dc921eefd82453bc8d8f4ebbbd46fd67536c83b29f00614e26367dc886a5671d741bf410eaf886ddff
6
+ metadata.gz: f1fd3a088e41699773103700b66f76f5db17f659f0b125a7c855461f06dee6c914781bab11564724b0b3a9cfd81a92817dd71ec8210f8218046cba1bc67962c1
7
+ data.tar.gz: 24b821b597b5d660c33ae72b7e0a04419be415d8c7d15aa6c55f9d7ad5187edc5f34c1e035f36d5b8c772de5996593c20a43f04e4e770f136fdc888d53813ed6
@@ -1,7 +1,7 @@
1
1
  module Castle
2
2
  class Client
3
3
 
4
- attr_accessor :request_context
4
+ attr_accessor :request_context, :do_not_track
5
5
 
6
6
  def initialize(request, response, opts = {})
7
7
  # Save a reference in the per-request store so that the request
@@ -17,13 +17,23 @@ module Castle
17
17
  end
18
18
 
19
19
  def identify(user_id, opts = {})
20
+ return if @do_not_track
20
21
  Castle::User.save_existing(user_id, opts)
21
22
  end
22
23
 
23
24
  def track(opts = {})
25
+ return if @do_not_track
24
26
  Castle::Event.create(opts)
25
27
  end
26
28
 
29
+ def do_not_track!
30
+ @do_not_track = true
31
+ end
32
+
33
+ def track!
34
+ @do_not_track = false
35
+ end
36
+
27
37
  def authenticate(user_id)
28
38
  Castle::Authentication.create(user_id: user_id)
29
39
  end
@@ -0,0 +1,7 @@
1
+ module Castle
2
+ class Label < Model
3
+ def self.destroy_all(*args)
4
+ self.delete('/v1/labels', *args)
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Castle
2
- VERSION = "1.2.10"
2
+ VERSION = "1.2.11"
3
3
  end
data/lib/castle-rb.rb CHANGED
@@ -37,4 +37,5 @@ require 'castle-rb/models/location'
37
37
  require 'castle-rb/models/user_agent'
38
38
  require 'castle-rb/models/context'
39
39
  require 'castle-rb/models/user'
40
+ require 'castle-rb/models/label'
40
41
  require 'castle-rb/models/authentication'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: castle-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Brissmyr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: her
@@ -166,6 +166,7 @@ files:
166
166
  - lib/castle-rb/models/authentication.rb
167
167
  - lib/castle-rb/models/context.rb
168
168
  - lib/castle-rb/models/event.rb
169
+ - lib/castle-rb/models/label.rb
169
170
  - lib/castle-rb/models/location.rb
170
171
  - lib/castle-rb/models/model.rb
171
172
  - lib/castle-rb/models/user.rb