splitclient-rb 7.0.1.pre.rc3-java → 7.0.1.pre.rc4-java

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: f06ff490d26a6c2496a122f207dbb7e867f92374
4
- data.tar.gz: 7932e399420c15cc1a8fb0b9e9b2eaa2aac1b5f7
3
+ metadata.gz: 2d7fb0aac1322c96814f636b8b14ab290e360387
4
+ data.tar.gz: bc03504719ee0679e6574cab51afd87ea595375e
5
5
  SHA512:
6
- metadata.gz: 5904c40d72cc43ef41d6be006371c1062e2ff527f1f23fd9cb17cb15bcb6d1385ffeeb51555579a07e215b3567b072beb6a1a8d320760607f00719bbf9568434
7
- data.tar.gz: 9f27a5392e2d1c1ebf90d58c9f6ca22ea4a051224ad2c5577ac143e66de54e70dccb407c1ecd836e470a7e5bae88b1d7203e8e800738e6f87706d16358f35e2b
6
+ metadata.gz: 20b148bdaf3420f5958d0056e6ffd5c07bdb32afdf7e47161f524b46b5cac4865bc960b752d31b05fbbb2ef05e7a17ca1e754b1b2ef38d49af1840ef91fbc673
7
+ data.tar.gz: 41096dd760d13ec1be83418bd6e00ded008cfbf18dda533f182683544d8d2aae92eef3fbf558ebc4fb12e6d043b83ec5327654bc3d6aed2aef88042134dfdd26
data/CHANGES.txt CHANGED
@@ -1,7 +1,10 @@
1
- 7.0.1 (Sep 13, 2019)
1
+ 7.0.1 (Oct 25, 2019)
2
2
  - Updated localhost mode so that parsing of test files results in JSON data for splits analogous to that returned by the Split backend.
3
3
  - Resulting localhost data is now used indifferently from actual backend data by the SDK code.
4
4
  - Removed specific spare code dealing with localhost operations.
5
+ - Removed the disable_impressions configuration param.
6
+ - Fixed an issue about Event properties were not sent to be.
7
+ - Added ip_addresses_enabled to enable/disable sending MachineName and MachineIP headers when data is posted to Split Servers.
5
8
 
6
9
  7.0.0 (Aug 23, 2019)
7
10
  - BREAKING CHANGE: block_until_ready is now a method in both split_client and split_manager that needs to be explicitly called. The block_until_ready parameter is now ignored if passed in the configuration, and defaults to 15s unless passed as a parameter of the block_until_ready method.
@@ -30,6 +30,9 @@ module SplitIoClient
30
30
  req.headers = common_headers(api_key)
31
31
  .merge('Content-Type' => 'application/json')
32
32
  .merge(headers)
33
+
34
+ req.headers = req.headers.merge('SplitSDKMachineIP' => @config.machine_ip) unless @config.machine_ip.empty?
35
+ req.headers = req.headers.merge('SplitSDKMachineName' => @config.machine_name) unless @config.machine_name.empty?
33
36
 
34
37
  req.body = data.to_json
35
38
 
@@ -78,19 +81,8 @@ module SplitIoClient
78
81
  {
79
82
  'Authorization' => "Bearer #{api_key}",
80
83
  'SplitSDKVersion' => "#{@config.language}-#{@config.version}",
81
- 'SplitSDKMachineName' => @config.machine_name,
82
- 'SplitSDKMachineIP' => @config.machine_ip,
83
- 'Referer' => referer
84
84
  }
85
85
  end
86
-
87
- def referer
88
- result = "#{@config.language}-#{@config.version}"
89
-
90
- result = "#{result}::#{SplitIoClient::SplitConfig.machine_hostname}" unless SplitIoClient::SplitConfig.machine_hostname == 'localhost'
91
-
92
- result
93
- end
94
86
  end
95
87
  end
96
88
  end
@@ -18,10 +18,7 @@ module SplitIoClient
18
18
  response = post_api(
19
19
  "#{@config.events_uri}/events/bulk",
20
20
  @api_key,
21
- events_slice.map { |event| formatted_event(event[:e]) },
22
- 'SplitSDKMachineIP' => events_slice[0][:m][:i],
23
- 'SplitSDKMachineName' => events_slice[0][:m][:n],
24
- 'SplitSDKVersion' => events_slice[0][:m][:s]
21
+ events_slice.map { |event| formatted_event(event[:e]) }
25
22
  )
26
23
 
27
24
  if response.success?
@@ -15,7 +15,7 @@ module SplitIoClient
15
15
  end
16
16
 
17
17
  impressions_by_ip(impressions).each do |ip, impressions_ip|
18
- response = post_api("#{@config.events_uri}/testImpressions/bulk", @api_key, impressions_ip, 'SplitSDKMachineIP' => ip)
18
+ response = post_api("#{@config.events_uri}/testImpressions/bulk", @api_key, impressions_ip)
19
19
 
20
20
  if response.success?
21
21
  @config.split_logger.log_if_debug("Impressions reported: #{total_impressions(impressions)}")
@@ -69,8 +69,10 @@ module SplitIoClient
69
69
  @transport_debug_enabled = opts[:transport_debug_enabled] || SplitConfig.default_debug
70
70
  @block_until_ready = SplitConfig.default_block_until_ready
71
71
 
72
- @machine_name = opts[:machine_name] || SplitConfig.machine_hostname
73
- @machine_ip = opts[:machine_ip] || SplitConfig.machine_ip
72
+ @ip_addresses_enabled = opts[:ip_addresses_enabled].nil? ? SplitConfig.default_ip_addresses_enabled : opts[:ip_addresses_enabled]
73
+
74
+ @machine_name = SplitConfig.machine_hostname(@ip_addresses_enabled, opts[:machine_name], opts[:cache_adapter] || SplitConfig.default_cache_adapter)
75
+ @machine_ip = SplitConfig.machine_ip(@ip_addresses_enabled, opts[:machine_ip], opts[:cache_adapter] || SplitConfig.default_cache_adapter)
74
76
 
75
77
  @cache_ttl = opts[:cache_ttl] || SplitConfig.cache_ttl
76
78
  @max_cache_size = opts[:max_cache_size] || SplitConfig.max_cache_size
@@ -251,6 +253,8 @@ module SplitIoClient
251
253
 
252
254
  attr_accessor :localhost_mode
253
255
 
256
+ attr_accessor :ip_addresses_enabled
257
+
254
258
  #
255
259
  # The default split client configuration
256
260
  #
@@ -412,6 +416,14 @@ module SplitIoClient
412
416
  15
413
417
  end
414
418
 
419
+ #
420
+ # The default ip addresses enabled value
421
+ #
422
+ # @return [boolean]
423
+ def self.default_ip_addresses_enabled
424
+ true
425
+ end
426
+
415
427
  #
416
428
  # The default transport_debug_enabled value
417
429
  #
@@ -478,23 +490,49 @@ module SplitIoClient
478
490
  # gets the hostname where the sdk gem is running
479
491
  #
480
492
  # @return [string]
481
- def self.machine_hostname
482
- Socket.gethostname
483
- rescue
484
- 'localhost'.freeze
493
+ def self.machine_hostname(ip_addresses_enabled, machine_name, adapter)
494
+ if ip_addresses_enabled
495
+ begin
496
+ return machine_name || Socket.gethostname
497
+ rescue
498
+ return 'unknown'.freeze
499
+ end
500
+ else
501
+ case adapter
502
+ when :redis
503
+ return 'NA'.freeze
504
+ end
505
+ end
506
+
507
+ return ''.freeze
485
508
  end
486
509
 
487
510
  #
488
511
  # gets the ip where the sdk gem is running
489
512
  #
490
513
  # @return [string]
491
- def self.machine_ip
492
- loopback_ip = Socket.ip_address_list.find { |ip| ip.ipv4_loopback? }
493
- private_ip = Socket.ip_address_list.find { |ip| ip.ipv4_private? }
514
+ def self.machine_ip(ip_addresses_enabled, machine_ip, adapter)
515
+ if ip_addresses_enabled
516
+ begin
517
+ return machine_ip unless machine_ip.blank?
518
+
519
+ loopback_ip = Socket.ip_address_list.find { |ip| ip.ipv4_loopback? }
520
+ private_ip = Socket.ip_address_list.find { |ip| ip.ipv4_private? }
494
521
 
495
- addr_info = private_ip || loopback_ip
522
+ addr_info = private_ip || loopback_ip
523
+
524
+ return addr_info.ip_address
525
+ rescue
526
+ return 'unknown'.freeze
527
+ end
528
+ else
529
+ case adapter
530
+ when :redis
531
+ return 'NA'.freeze
532
+ end
533
+ end
496
534
 
497
- addr_info.ip_address
535
+ return ''.freeze
498
536
  end
499
537
  end
500
538
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '7.0.1.pre.rc3'
2
+ VERSION = '7.0.1.pre.rc4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1.pre.rc3
4
+ version: 7.0.1.pre.rc4
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement