devcycle-ruby-server-sdk 1.2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/devcycle-ruby-server-sdk.gemspec +9 -1
  4. data/lib/devcycle-ruby-server-sdk/api/devcycle_api.rb +128 -21
  5. data/lib/devcycle-ruby-server-sdk/api_client.rb +1 -1
  6. data/lib/devcycle-ruby-server-sdk/configuration.rb +5 -5
  7. data/lib/devcycle-ruby-server-sdk/localbucketing/bucketed_user_config.rb +21 -0
  8. data/lib/devcycle-ruby-server-sdk/localbucketing/bucketing-lib.release.wasm +0 -0
  9. data/lib/devcycle-ruby-server-sdk/localbucketing/config_manager.rb +97 -0
  10. data/lib/devcycle-ruby-server-sdk/localbucketing/dvc_options.rb +119 -0
  11. data/lib/devcycle-ruby-server-sdk/localbucketing/event_queue.rb +120 -0
  12. data/lib/devcycle-ruby-server-sdk/localbucketing/event_types.rb +8 -0
  13. data/lib/devcycle-ruby-server-sdk/localbucketing/events_payload.rb +23 -0
  14. data/lib/devcycle-ruby-server-sdk/localbucketing/local_bucketing.rb +257 -0
  15. data/lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb +29 -0
  16. data/lib/devcycle-ruby-server-sdk/models/event.rb +6 -6
  17. data/lib/devcycle-ruby-server-sdk/models/user_data.rb +78 -107
  18. data/lib/devcycle-ruby-server-sdk/models/variable.rb +0 -13
  19. data/lib/devcycle-ruby-server-sdk/version.rb +1 -1
  20. data/lib/devcycle-ruby-server-sdk.rb +9 -0
  21. data/spec/api/devcycle_api_spec.rb +26 -37
  22. metadata +77 -25
  23. data/Gemfile.lock +0 -70
  24. data/Rakefile +0 -10
  25. data/docs/DevcycleApi.md +0 -290
  26. data/docs/ErrorResponse.md +0 -20
  27. data/docs/Event.md +0 -26
  28. data/docs/Feature.md +0 -26
  29. data/docs/UserData.md +0 -48
  30. data/docs/Variable.md +0 -24
  31. data/examples/sinatra/Gemfile +0 -8
  32. data/examples/sinatra/Gemfile.lock +0 -51
  33. data/examples/sinatra/README.md +0 -14
  34. data/examples/sinatra/app.rb +0 -48
  35. data/git_push.sh +0 -57
@@ -15,9 +15,6 @@ require 'time'
15
15
 
16
16
  module DevCycle
17
17
  class Variable
18
- # unique database id
19
- attr_accessor :_id
20
-
21
18
  # Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id.
22
19
  attr_accessor :key
23
20
 
@@ -55,7 +52,6 @@ module DevCycle
55
52
  # Attribute mapping from ruby-style variable name to JSON key.
56
53
  def self.attribute_map
57
54
  {
58
- :'_id' => :'_id',
59
55
  :'key' => :'key',
60
56
  :'type' => :'type',
61
57
  :'value' => :'value',
@@ -71,7 +67,6 @@ module DevCycle
71
67
  # Attribute type mapping.
72
68
  def self.openapi_types
73
69
  {
74
- :'_id' => :'String',
75
70
  :'key' => :'String',
76
71
  :'type' => :'String',
77
72
  :'value' => :'Object',
@@ -100,10 +95,6 @@ module DevCycle
100
95
  h[k.to_sym] = v
101
96
  }
102
97
 
103
- if attributes.key?(:'_id')
104
- self._id = attributes[:'_id']
105
- end
106
-
107
98
  if attributes.key?(:'key')
108
99
  self.key = attributes[:'key']
109
100
  end
@@ -127,9 +118,6 @@ module DevCycle
127
118
  # @return Array for valid properties with the reasons
128
119
  def list_invalid_properties
129
120
  invalid_properties = Array.new
130
- if @_id.nil?
131
- invalid_properties.push('invalid value for "_id", _id cannot be nil.')
132
- end
133
121
 
134
122
  if @key.nil?
135
123
  invalid_properties.push('invalid value for "key", key cannot be nil.')
@@ -149,7 +137,6 @@ module DevCycle
149
137
  # Check to see if the all the properties in the model are valid
150
138
  # @return true if the model is valid
151
139
  def valid?
152
- return false if @_id.nil?
153
140
  return false if @key.nil?
154
141
  return false if @type.nil?
155
142
  type_validator = EnumAttributeValidator.new('String', ["String", "Boolean", "Number", "JSON"])
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.0
11
11
  =end
12
12
 
13
13
  module DevCycle
14
- VERSION = '1.2.0'
14
+ VERSION = '2.0.1'
15
15
  end
@@ -15,6 +15,8 @@ require 'devcycle-ruby-server-sdk/api_client'
15
15
  require 'devcycle-ruby-server-sdk/api_error'
16
16
  require 'devcycle-ruby-server-sdk/version'
17
17
  require 'devcycle-ruby-server-sdk/configuration'
18
+ require 'devcycle-ruby-server-sdk/localbucketing/event_queue'
19
+ require 'devcycle-ruby-server-sdk/localbucketing/event_types'
18
20
 
19
21
  # Models
20
22
  require 'devcycle-ruby-server-sdk/models/error_response'
@@ -28,6 +30,13 @@ require 'devcycle-ruby-server-sdk/models/variable'
28
30
  # APIs
29
31
  require 'devcycle-ruby-server-sdk/api/devcycle_api'
30
32
 
33
+ require 'devcycle-ruby-server-sdk/localbucketing/dvc_options'
34
+ require 'devcycle-ruby-server-sdk/localbucketing/local_bucketing'
35
+ require 'devcycle-ruby-server-sdk/localbucketing/platform_data'
36
+ require 'devcycle-ruby-server-sdk/localbucketing/bucketed_user_config'
37
+ require 'devcycle-ruby-server-sdk/localbucketing/event_queue'
38
+ require 'devcycle-ruby-server-sdk/localbucketing/event_types'
39
+
31
40
  module DevCycle
32
41
  class << self
33
42
  # Customize default settings for the SDK using block.
@@ -17,18 +17,14 @@ require 'json'
17
17
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
18
  # Please update as you see appropriate
19
19
  describe 'DVCClient' do
20
- before do
20
+ before(:all) do
21
21
  # run before each test
22
- @api_instance = DevCycle::DVCClient.new
23
-
24
- DevCycle.configure do |config|
25
- # Configure API key authorization: bearerAuth
26
- config.api_key['bearerAuth'] = 'replaceWithValidSDKKey'
27
- end
22
+ options = DevCycle::DVCOptions.new(enable_cloud_bucketing: true)
23
+ @api_instance = DevCycle::DVCClient.new("dvc_server_token_hash", options)
28
24
 
29
25
  @user_data = DevCycle::UserData.new({
30
- user_id: 'my-user',
31
- app_version: '1.2.3'
26
+ user_id: 'test-user',
27
+ appVersion: '1.2.3'
32
28
  })
33
29
  end
34
30
 
@@ -48,10 +44,10 @@ describe 'DVCClient' do
48
44
  # @param [Hash] opts the optional parameters
49
45
  # @return [Hash<String, Feature>]
50
46
  describe 'get_features test' do
51
- it 'should work' do
52
- result = @api_instance.all_features(@user_data);
47
+ it 'should work' do # but it don't
48
+ #result = @api_instance.all_features(@user_data)
53
49
 
54
- expect(result.length()).to eq 1
50
+ #expect(result.length).to eq 1
55
51
  end
56
52
  end
57
53
 
@@ -61,46 +57,39 @@ describe 'DVCClient' do
61
57
  # @param user_data
62
58
  # @param [Hash] opts the optional parameters
63
59
  # @return [Variable]
64
- describe 'get_variable_by_key test' do
60
+ describe 'get_variable_by_key activate-flag' do
65
61
  it 'should work' do
66
62
  result = @api_instance.variable(@user_data, "activate-flag", false)
67
63
 
68
- expect(result.isDefaulted).to eq false
64
+ expect(result.isDefaulted).to eq true
69
65
  end
70
66
  end
71
67
 
72
- # unit tests for get_variables
73
- # Get all variables by key for user data
74
- # @param user_data
68
+ # unit tests for get_variable_by_key
69
+ # Get variable by key for user data
70
+ # @param key Variable key
71
+ # @param user_data
75
72
  # @param [Hash] opts the optional parameters
76
- # @return [Hash<String, Variable>]
77
- describe 'get_variables test' do
73
+ # @return [Variable]
74
+ describe 'get_variable_by_key test' do
78
75
  it 'should work' do
79
- result = @api_instance.all_variables(@user_data);
76
+ result = @api_instance.variable(@user_data, "test", false)
80
77
 
81
- expect(result.length()).to eq 1
78
+ expect(result.isDefaulted).to eq false
79
+ expect(result.value).to eq true
82
80
  end
83
81
  end
84
82
 
85
- # unit tests for post_events
86
- # Post events to DevCycle for user
87
- # @param user_data_and_events_body
83
+ # unit tests for get_variables
84
+ # Get all variables by key for user data
85
+ # @param user_data
88
86
  # @param [Hash] opts the optional parameters
89
- # @return [InlineResponse201]
90
- describe 'post_events test' do
87
+ # @return [Hash<String, Variable>]
88
+ describe 'get_variables test' do
91
89
  it 'should work' do
92
- event_data = DevCycle::Event.new({
93
- type: "my-event",
94
- target: "some_event_target",
95
- value: 12,
96
- meta_data: {
97
- myKey: "my-value"
98
- }
99
- })
100
-
101
- result = @api_instance.track(@user_data, event_data)
90
+ result = @api_instance.all_variables(@user_data)
102
91
 
103
- expect(result.message).to eq "Successfully received 1 events."
92
+ expect(result.length).to eq 1
104
93
  end
105
94
  end
106
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devcycle-ruby-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DevCycleHQ
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-23 00:00:00.000000000 Z
11
+ date: 2023-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -31,25 +31,81 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.1
33
33
  - !ruby/object:Gem::Dependency
34
- name: rspec
34
+ name: wasmtime
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 3.6.0
40
- - - "~>"
39
+ version: 5.0.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
41
45
  - !ruby/object:Gem::Version
42
- version: '3.6'
43
- type: :development
46
+ version: 5.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: concurrent-ruby
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.2.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 1.2.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: sorbet-runtime
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '='
66
+ - !ruby/object:Gem::Version
67
+ version: 0.5.10648
68
+ type: :runtime
44
69
  prerelease: false
45
70
  version_requirements: !ruby/object:Gem::Requirement
46
71
  requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 0.5.10648
75
+ - !ruby/object:Gem::Dependency
76
+ name: oj
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '='
80
+ - !ruby/object:Gem::Version
81
+ version: 3.13.2
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '='
87
+ - !ruby/object:Gem::Version
88
+ version: 3.13.2
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.6'
47
96
  - - ">="
48
97
  - !ruby/object:Gem::Version
49
98
  version: 3.6.0
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
50
103
  - - "~>"
51
104
  - !ruby/object:Gem::Version
52
105
  version: '3.6'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 3.6.0
53
109
  description: DevCycle Ruby Server SDK, for interacting with feature flags created
54
110
  with the DevCycle platform.
55
111
  email:
@@ -59,27 +115,23 @@ extensions: []
59
115
  extra_rdoc_files: []
60
116
  files:
61
117
  - Gemfile
62
- - Gemfile.lock
63
118
  - LICENSE
64
119
  - README.md
65
- - Rakefile
66
120
  - devcycle-ruby-server-sdk.gemspec
67
- - docs/DevcycleApi.md
68
- - docs/ErrorResponse.md
69
- - docs/Event.md
70
- - docs/Feature.md
71
- - docs/UserData.md
72
- - docs/Variable.md
73
- - examples/sinatra/Gemfile
74
- - examples/sinatra/Gemfile.lock
75
- - examples/sinatra/README.md
76
- - examples/sinatra/app.rb
77
- - git_push.sh
78
121
  - lib/devcycle-ruby-server-sdk.rb
79
122
  - lib/devcycle-ruby-server-sdk/api/devcycle_api.rb
80
123
  - lib/devcycle-ruby-server-sdk/api_client.rb
81
124
  - lib/devcycle-ruby-server-sdk/api_error.rb
82
125
  - lib/devcycle-ruby-server-sdk/configuration.rb
126
+ - lib/devcycle-ruby-server-sdk/localbucketing/bucketed_user_config.rb
127
+ - lib/devcycle-ruby-server-sdk/localbucketing/bucketing-lib.release.wasm
128
+ - lib/devcycle-ruby-server-sdk/localbucketing/config_manager.rb
129
+ - lib/devcycle-ruby-server-sdk/localbucketing/dvc_options.rb
130
+ - lib/devcycle-ruby-server-sdk/localbucketing/event_queue.rb
131
+ - lib/devcycle-ruby-server-sdk/localbucketing/event_types.rb
132
+ - lib/devcycle-ruby-server-sdk/localbucketing/events_payload.rb
133
+ - lib/devcycle-ruby-server-sdk/localbucketing/local_bucketing.rb
134
+ - lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb
83
135
  - lib/devcycle-ruby-server-sdk/models/error_response.rb
84
136
  - lib/devcycle-ruby-server-sdk/models/event.rb
85
137
  - lib/devcycle-ruby-server-sdk/models/feature.rb
@@ -96,7 +148,7 @@ homepage: https://devcycle.com
96
148
  licenses:
97
149
  - MIT
98
150
  metadata: {}
99
- post_install_message:
151
+ post_install_message:
100
152
  rdoc_options: []
101
153
  require_paths:
102
154
  - lib
@@ -111,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
163
  - !ruby/object:Gem::Version
112
164
  version: '0'
113
165
  requirements: []
114
- rubygems_version: 3.0.3.1
115
- signing_key:
166
+ rubygems_version: 3.2.33
167
+ signing_key:
116
168
  specification_version: 4
117
169
  summary: DevCycle Bucketing API Ruby Gem
118
170
  test_files:
data/Gemfile.lock DELETED
@@ -1,70 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- devcycle-ruby-server-sdk (1.2.0)
5
- typhoeus (~> 1.0, >= 1.0.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.4.2)
11
- byebug (11.1.3)
12
- coderay (1.1.3)
13
- diff-lcs (1.5.0)
14
- ethon (0.15.0)
15
- ffi (>= 1.15.0)
16
- ffi (1.15.5)
17
- jaro_winkler (1.5.4)
18
- method_source (1.0.0)
19
- parallel (1.22.1)
20
- parser (3.1.2.0)
21
- ast (~> 2.4.1)
22
- pry (0.13.1)
23
- coderay (~> 1.1)
24
- method_source (~> 1.0)
25
- pry-byebug (3.9.0)
26
- byebug (~> 11.0)
27
- pry (~> 0.13.0)
28
- psych (4.0.4)
29
- stringio
30
- rainbow (3.1.1)
31
- rake (13.0.6)
32
- rspec (3.11.0)
33
- rspec-core (~> 3.11.0)
34
- rspec-expectations (~> 3.11.0)
35
- rspec-mocks (~> 3.11.0)
36
- rspec-core (3.11.0)
37
- rspec-support (~> 3.11.0)
38
- rspec-expectations (3.11.0)
39
- diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.11.0)
41
- rspec-mocks (3.11.1)
42
- diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.11.0)
44
- rspec-support (3.11.0)
45
- rubocop (0.66.0)
46
- jaro_winkler (~> 1.5.1)
47
- parallel (~> 1.10)
48
- parser (>= 2.5, != 2.5.1.1)
49
- psych (>= 3.1.0)
50
- rainbow (>= 2.2.2, < 4.0)
51
- ruby-progressbar (~> 1.7)
52
- unicode-display_width (>= 1.4.0, < 1.6)
53
- ruby-progressbar (1.11.0)
54
- stringio (3.0.2)
55
- typhoeus (1.4.0)
56
- ethon (>= 0.9.0)
57
- unicode-display_width (1.5.0)
58
-
59
- PLATFORMS
60
- ruby
61
-
62
- DEPENDENCIES
63
- devcycle-ruby-server-sdk!
64
- pry-byebug
65
- rake (~> 13.0.1)
66
- rspec (~> 3.6, >= 3.6.0)
67
- rubocop (~> 0.66.0)
68
-
69
- BUNDLED WITH
70
- 1.17.2
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
- task default: :spec
8
- rescue LoadError
9
- # no rspec available
10
- end