flipper-api 0.17.2 → 0.20.0.beta2

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
  SHA256:
3
- metadata.gz: 533fb9e7433d3f7814bacde3ad0b6220b8b3e2de98a8fb12c4aaca0bdb8a0a6a
4
- data.tar.gz: c3f60449b27879ff0a208a2c0d73794a49aa10b8c30108867c675036107cd71a
3
+ metadata.gz: 0c91bdd989ce5bdcf239bd5bdbafacc7b6166eac0b7289635d95722a2d3dbefe
4
+ data.tar.gz: e764a17d9409dba17e1f81390f19d2ef83e341fa3e6599c90a7a87b28ca3a064
5
5
  SHA512:
6
- metadata.gz: e10df2495f86e7a3822d83a16e5c52e2c82d63b1d5ab6bf2c65393c4f8f864f8ee34c4fdcd200a0be6b3c24811635e42567efe2e6753de0abae6ed9b44937686
7
- data.tar.gz: 2d01fb79921999c2e3fa836ef88bf99166bc4f2f2a081918c1983cd48db854f37a0d2f8fa0b55699b98507fc85247f9c94f4e97bdc12e9a6745d2c375b92810b
6
+ metadata.gz: 8a3638e6d819a67053ea7359109b00d6ace341c315c89eb10ee84b8f191079e2b5567698ce46b45f6b0c0a1452ab751f7113b58c0dd9dd6a4a434e438ab5a9a3
7
+ data.tar.gz: 82e593b936a6d5604468e29e6cf27e85d2e6e7c37b8eada69bab801d30abd8f0aa551d17514668c32319a1f43fd0d993ae68c9dfc411e954c4bb504fd044cb49
@@ -10,11 +10,10 @@ Gem::Specification.new do |gem|
10
10
  gem.authors = ['John Nunemaker']
11
11
  gem.email = ['nunemaker@gmail.com']
12
12
  gem.summary = 'API for the Flipper gem'
13
- gem.description = 'Rack middleware that provides an API for the flipper gem.'
14
13
  gem.license = 'MIT'
15
14
  gem.homepage = 'https://github.com/jnunemaker/flipper'
16
- gem.files = `git ls-files`.split("\n").select(&flipper_api_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength
17
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_api_files) # rubocop:disable Layout/LineLength
15
+ gem.files = `git ls-files`.split("\n").select(&flipper_api_files) + ['lib/flipper/version.rb']
16
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_api_files)
18
17
  gem.name = 'flipper-api'
19
18
  gem.require_paths = ['lib']
20
19
  gem.version = Flipper::VERSION
@@ -9,12 +9,14 @@ module Flipper
9
9
 
10
10
  def self.app(flipper = nil, options = {})
11
11
  env_key = options.fetch(:env_key, 'flipper')
12
+ memoizer_options = options.fetch(:memoizer_options, {})
13
+
12
14
  app = ->(_) { [404, { 'Content-Type'.freeze => CONTENT_TYPE }, ['{}'.freeze]] }
13
15
  builder = Rack::Builder.new
14
16
  yield builder if block_given?
15
17
  builder.use Flipper::Api::JsonParams
16
18
  builder.use Flipper::Middleware::SetupEnv, flipper, env_key: env_key
17
- builder.use Flipper::Middleware::Memoizer, env_key: env_key
19
+ builder.use Flipper::Middleware::Memoizer, memoizer_options.merge(env_key: env_key)
18
20
  builder.use Flipper::Api::Middleware, env_key: env_key
19
21
  builder.run app
20
22
  klass = self
@@ -11,19 +11,19 @@ module Flipper
11
11
  def get
12
12
  keys = params['keys']
13
13
  features = if keys
14
- names = keys.split(',')
15
- if names.empty?
16
- []
17
- else
18
- existing_feature_names = names.keep_if do |feature_name|
19
- feature_exists?(feature_name)
20
- end
21
-
22
- flipper.preload(existing_feature_names)
23
- end
24
- else
25
- flipper.features
26
- end
14
+ names = keys.split(',')
15
+ if names.empty?
16
+ []
17
+ else
18
+ existing_feature_names = names.keep_if do |feature_name|
19
+ feature_exists?(feature_name)
20
+ end
21
+
22
+ flipper.preload(existing_feature_names)
23
+ end
24
+ else
25
+ flipper.features
26
+ end
27
27
 
28
28
  decorated_features = features.map do |feature|
29
29
  Decorators::Feature.new(feature).as_json
@@ -12,12 +12,14 @@ module Flipper
12
12
  # Public: Returns instance as hash that is ready to be json dumped.
13
13
  def as_json
14
14
  gate_values = feature.adapter.get(self)
15
+ gates_json = gates.map do |gate|
16
+ Decorators::Gate.new(gate, gate_values[gate.key]).as_json
17
+ end
18
+
15
19
  {
16
20
  'key' => key,
17
21
  'state' => state.to_s,
18
- 'gates' => gates.map do |gate|
19
- Decorators::Gate.new(gate, gate_values[gate.key]).as_json
20
- end,
22
+ 'gates' => gates_json,
21
23
  }
22
24
  end
23
25
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.17.2'.freeze
2
+ VERSION = '0.20.0.beta2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.20.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-04 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -36,15 +36,15 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.17.2
39
+ version: 0.20.0.beta2
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.17.2
47
- description: Rack middleware that provides an API for the flipper gem.
46
+ version: 0.20.0.beta2
47
+ description:
48
48
  email:
49
49
  - nunemaker@gmail.com
50
50
  executables: []
@@ -101,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">="
104
+ - - ">"
105
105
  - !ruby/object:Gem::Version
106
- version: '0'
106
+ version: 1.3.1
107
107
  requirements: []
108
108
  rubygems_version: 3.0.3
109
109
  signing_key: