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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9e8ced8272ff8af84bff37888fa388901c59304
4
- data.tar.gz: 6ce3fd691a9672b809fa561dd3e38d63fad509e8
3
+ metadata.gz: dde1928ad4eddf2d5e0d485476c318ca4944cb5b
4
+ data.tar.gz: 753fa3a304dfed18da1820375f4071e1f7783efc
5
5
  SHA512:
6
- metadata.gz: 27e35704774d40d32e0d0c2a334c131711a571cac58c7718e0ea536680ef2b21f901dbadf4faf1dd21b4d67b6fab7904e15172652cffc28eebf446f36c45bdf1
7
- data.tar.gz: d8249bcb7e494061d864eff9fe5aaf8e3db6dbd5eb589c9ce540f2856be89fa881c550cacd45da8e3a7bd71b7c8b441df30eec49687f2cc12e05494352b95760
6
+ metadata.gz: '08abb04c5d063ce28654f665b302a36acce2a2f265c8ccbd1402a9885163a77d2e2c690576b6ef4ca5a891fdf3e5f46586abe3b74d84bed1a0839d4de23bdeba'
7
+ data.tar.gz: 6f2fb60a7fb1c6609090b8cea1857ab29643f4d1ca3b27f9beac7f3a36ac14e6514eaac2429475ca8310b6d818a74fc23fc76a78afc0a4287bf7e9b58a1421d3
@@ -38,10 +38,14 @@ module SplitIoClient
38
38
  end
39
39
 
40
40
  def post_events
41
- SplitIoClient::Api::Events.new(@api_key, @events_repository.clear).post
41
+ events_api.post(@events_repository.clear)
42
42
  rescue StandardError => error
43
43
  SplitIoClient.configuration.log_found_exception(__method__.to_s, error)
44
44
  end
45
+
46
+ def events_api
47
+ @events_api ||= SplitIoClient::Api::Events.new(@api_key)
48
+ end
45
49
  end
46
50
  end
47
51
  end
@@ -49,7 +49,7 @@ module SplitIoClient
49
49
  end
50
50
 
51
51
  def post_impressions
52
- impressions_client.post
52
+ impressions_api.post(formatted_impressions)
53
53
  rescue StandardError => error
54
54
  SplitIoClient.configuration.log_found_exception(__method__.to_s, error)
55
55
  end
@@ -58,8 +58,8 @@ module SplitIoClient
58
58
  ImpressionsFormatter.new(@impressions_repository).call(raw_impressions)
59
59
  end
60
60
 
61
- def impressions_client
62
- SplitIoClient::Api::Impressions.new(@api_key, formatted_impressions)
61
+ def impressions_api
62
+ @impressions_api ||= SplitIoClient::Api::Impressions.new(@api_key)
63
63
  end
64
64
  end
65
65
  end
@@ -36,13 +36,13 @@ module SplitIoClient
36
36
  end
37
37
 
38
38
  def post_metrics
39
- metrics_client.post
39
+ metrics_api.post
40
40
  rescue StandardError => error
41
41
  SplitIoClient.configuration.log_found_exception(__method__.to_s, error)
42
42
  end
43
43
 
44
- def metrics_client
45
- SplitIoClient::Api::Metrics.new(@api_key, @metrics_repository)
44
+ def metrics_api
45
+ @metrics_api ||= SplitIoClient::Api::Metrics.new(@api_key, @metrics_repository)
46
46
  end
47
47
  end
48
48
  end
@@ -73,7 +73,7 @@ module SplitIoClient
73
73
  end
74
74
 
75
75
  def segments_api
76
- SplitIoClient::Api::Segments.new(@api_key, @metrics, @segments_repository)
76
+ @segments_api ||= SplitIoClient::Api::Segments.new(@api_key, @metrics, @segments_repository)
77
77
  end
78
78
  end
79
79
  end
@@ -66,7 +66,7 @@ module SplitIoClient
66
66
  end
67
67
 
68
68
  def splits_since(since)
69
- SplitIoClient::Api::Splits.new(@api_key, @metrics).since(since)
69
+ splits_api.since(since)
70
70
  end
71
71
 
72
72
  def add_split_unless_archived(split)
@@ -90,6 +90,12 @@ module SplitIoClient
90
90
 
91
91
  @splits_repository.add_split(split)
92
92
  end
93
+
94
+ private
95
+
96
+ def splits_api
97
+ @splits_api ||= SplitIoClient::Api::Splits.new(@api_key, @metrics)
98
+ end
93
99
  end
94
100
  end
95
101
  end
@@ -1,29 +1,28 @@
1
1
  module SplitIoClient
2
2
  module Api
3
3
  class Events < Client
4
- def initialize(api_key, events)
4
+ def initialize(api_key)
5
5
  @api_key = api_key
6
- @events = events
7
6
  end
8
7
 
9
- def post
10
- if @events.empty?
8
+ def post(events)
9
+ if events.empty?
11
10
  SplitIoClient.configuration.logger.debug('No events to report') if SplitIoClient.configuration.debug_enabled
12
11
  return
13
12
  end
14
13
 
15
- @events.each_slice(SplitIoClient.configuration.events_queue_size) do |event_slice|
16
- response = post_api(
14
+ events.each_slice(SplitIoClient.configuration.events_queue_size) do |events_slice|
15
+ result = post_api(
17
16
  "#{SplitIoClient.configuration.events_uri}/events/bulk",
18
17
  @api_key,
19
- event_slice.map { |event| formatted_event(event[:e]) },
20
- 'SplitSDKMachineIP' => event_slice[0][:m][:i],
21
- 'SplitSDKMachineName' => event_slice[0][:m][:n],
22
- 'SplitSDKVersion' => event_slice[0][:m][:s]
18
+ events_slice.map { |event| formatted_event(event[:e]) },
19
+ 'SplitSDKMachineIP' => events_slice[0][:m][:i],
20
+ 'SplitSDKMachineName' => events_slice[0][:m][:n],
21
+ 'SplitSDKVersion' => events_slice[0][:m][:s]
23
22
  )
24
23
 
25
24
  if response.success?
26
- SplitLogger.log_if_debug("Events reported: #{event_slice.size}")
25
+ SplitLogger.log_if_debug("Events reported: #{events_slice.size}")
27
26
  else
28
27
  SplitLogger.log_error("Unexpected status code while posting events: #{response.status}." \
29
28
  " - Check your API key and base URI")
@@ -1,22 +1,21 @@
1
1
  module SplitIoClient
2
2
  module Api
3
3
  class Impressions < Client
4
- def initialize(api_key, impressions)
4
+ def initialize(api_key)
5
5
  @api_key = api_key
6
- @impressions = impressions
7
6
  end
8
7
 
9
- def post
10
- if @impressions.empty?
8
+ def post(impressions)
9
+ if impressions.empty?
11
10
  SplitIoClient.configuration.logger.debug('No impressions to report') if SplitIoClient.configuration.debug_enabled
12
11
  return
13
12
  end
14
13
 
15
- impressions_by_ip.each do |ip, impressions|
16
- response = post_api("#{SplitIoClient.configuration.events_uri}/testImpressions/bulk", @api_key, impressions, 'SplitSDKMachineIP' => ip)
14
+ impressions_by_ip(impressions).each do |ip, impressions_ip|
15
+ result = post_api("#{SplitIoClient.configuration.events_uri}/testImpressions/bulk", @api_key, impressions_ip, 'SplitSDKMachineIP' => ip)
17
16
 
18
17
  if response.success?
19
- SplitLogger.log_if_debug("Impressions reported: #{total_impressions(@impressions)}")
18
+ SplitLogger.log_if_debug("Impressions reported: #{total_impressions(impressions)}")
20
19
  else
21
20
  SplitLogger.log_error("Unexpected status code while posting impressions: #{response.status}." \
22
21
  " - Check your API key and base URI")
@@ -35,8 +34,8 @@ module SplitIoClient
35
34
 
36
35
  private
37
36
 
38
- def impressions_by_ip
39
- @impressions.group_by { |impression| impression[:ip] }
37
+ def impressions_by_ip(impressions)
38
+ impressions.group_by { |impression| impression[:ip] }
40
39
  end
41
40
  end
42
41
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '5.1.3.pre.rc3'
2
+ VERSION = '5.1.3.pre.rc4'
3
3
  end
@@ -51,7 +51,7 @@ Gem::Specification.new do |spec|
51
51
  spec.add_runtime_dependency 'faraday', '>= 0.8'
52
52
  spec.add_runtime_dependency 'json', '>= 1.8'
53
53
  spec.add_runtime_dependency 'lru_redux'
54
- spec.add_runtime_dependency 'net-http-persistent', '~> 2.9'
54
+ spec.add_runtime_dependency 'net-http-persistent', '>= 2.9'
55
55
  spec.add_runtime_dependency 'redis', '>= 3.2'
56
56
  spec.add_runtime_dependency 'thread_safe', '>= 0.3'
57
57
  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: 5.1.3.pre.rc3
4
+ version: 5.1.3.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: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -223,7 +223,7 @@ dependencies:
223
223
  - !ruby/object:Gem::Dependency
224
224
  requirement: !ruby/object:Gem::Requirement
225
225
  requirements:
226
- - - "~>"
226
+ - - ">="
227
227
  - !ruby/object:Gem::Version
228
228
  version: '2.9'
229
229
  name: net-http-persistent
@@ -231,7 +231,7 @@ dependencies:
231
231
  type: :runtime
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - "~>"
234
+ - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '2.9'
237
237
  - !ruby/object:Gem::Dependency