├── .swagger-codegen └── VERSION ├── .rspec ├── Gemfile ├── swagger_ruby.json ├── Rakefile ├── docs ├── Error.md ├── Health.md ├── CreateTagRequest.md ├── SetFlagEnabledRequest.md ├── Tag.md ├── PutSegmentReorderRequest.md ├── PutDistributionsRequest.md ├── PutVariantRequest.md ├── CreateVariantRequest.md ├── EvaluationBatchResponse.md ├── PutSegmentRequest.md ├── CreateSegmentRequest.md ├── SegmentDebugLog.md ├── Variant.md ├── CreateConstraintRequest.md ├── Constraint.md ├── EvalDebugLog.md ├── Distribution.md ├── EvaluationEntity.md ├── FlagSnapshot.md ├── CreateFlagRequest.md ├── Segment.md ├── PutFlagRequest.md ├── EvalResult.md ├── EvaluationBatchRequest.md ├── EvalContext.md ├── HealthApi.md ├── Flag.md ├── ExportApi.md ├── EvaluationApi.md ├── DistributionApi.md ├── TagApi.md ├── VariantApi.md ├── ConstraintApi.md └── SegmentApi.md ├── lib ├── rbflagr │ ├── version.rb │ ├── api_error.rb │ ├── api │ │ ├── health_api.rb │ │ ├── export_api.rb │ │ └── evaluation_api.rb │ ├── models │ │ ├── health.rb │ │ ├── set_flag_enabled_request.rb │ │ ├── put_segment_reorder_request.rb │ │ ├── put_distributions_request.rb │ │ ├── eval_debug_log.rb │ │ ├── evaluation_batch_response.rb │ │ ├── evaluation_entity.rb │ │ ├── create_tag_request.rb │ │ ├── error.rb │ │ ├── segment_debug_log.rb │ │ └── put_variant_request.rb │ └── configuration.rb └── rbflagr.rb ├── Makefile ├── .github └── workflows │ └── gem-push.yml ├── .gitignore ├── .swagger-codegen-ignore ├── spec ├── models │ ├── error_spec.rb │ ├── health_spec.rb │ ├── put_flag_request_spec.rb │ ├── create_flag_request_spec.rb │ ├── create_tag_request_spec.rb │ ├── set_flag_enabled_request_spec.rb │ ├── put_distributions_request_spec.rb │ ├── evaluation_batch_response_spec.rb │ ├── put_segment_reorder_request_spec.rb │ ├── tag_spec.rb │ ├── eval_debug_log_spec.rb │ ├── segment_debug_log_spec.rb │ ├── put_variant_request_spec.rb │ ├── put_segment_request_spec.rb │ ├── create_variant_request_spec.rb │ ├── create_segment_request_spec.rb │ ├── variant_spec.rb │ ├── evaluation_entity_spec.rb │ ├── create_constraint_request_spec.rb │ ├── evaluation_batch_request_spec.rb │ ├── flag_snapshot_spec.rb │ ├── flag_spec.rb │ ├── distribution_spec.rb │ ├── eval_context_spec.rb │ ├── constraint_spec.rb │ ├── segment_spec.rb │ └── eval_result_spec.rb ├── api │ ├── health_api_spec.rb │ ├── evaluation_api_spec.rb │ ├── export_api_spec.rb │ ├── distribution_api_spec.rb │ ├── variant_api_spec.rb │ ├── segment_api_spec.rb │ ├── tag_api_spec.rb │ ├── constraint_api_spec.rb │ └── flag_api_spec.rb ├── configuration_spec.rb └── spec_helper.rb ├── rbflagr.gemspec ├── git_push.sh └── .rubocop.yml /.swagger-codegen/VERSION: -------------------------------------------------------------------------------- 1 | 2.4.21 -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development, :test do 6 | gem 'rake', '~> 12.3.3' 7 | end 8 | -------------------------------------------------------------------------------- /swagger_ruby.json: -------------------------------------------------------------------------------- 1 | { 2 | "gemName": "rbflagr", 3 | "moduleName": "Flagr", 4 | "gemVersion": "1.1.12", 5 | "gemLicense": "Apache 2.0" 6 | } 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | begin 2 | require 'rspec/core/rake_task' 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | task default: :spec 6 | rescue LoadError 7 | # no rspec available 8 | end 9 | -------------------------------------------------------------------------------- /docs/Error.md: -------------------------------------------------------------------------------- 1 | # Flagr::Error 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **message** | **String** | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/Health.md: -------------------------------------------------------------------------------- 1 | # Flagr::Health 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **status** | **String** | | [optional] 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/CreateTagRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::CreateTagRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **value** | **String** | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/SetFlagEnabledRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::SetFlagEnabledRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **enabled** | **BOOLEAN** | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/Tag.md: -------------------------------------------------------------------------------- 1 | # Flagr::Tag 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **value** | **String** | | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/PutSegmentReorderRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::PutSegmentReorderRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **segment_i_ds** | **Array<Integer>** | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/PutDistributionsRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::PutDistributionsRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **distributions** | [**Array<Distribution>**](Distribution.md) | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/PutVariantRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::PutVariantRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **key** | **String** | | 7 | **attachment** | **Object** | | [optional] 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/CreateVariantRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::CreateVariantRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **key** | **String** | | 7 | **attachment** | **Object** | | [optional] 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/EvaluationBatchResponse.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvaluationBatchResponse 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **evaluation_results** | [**Array<EvalResult>**](EvalResult.md) | | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/PutSegmentRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::PutSegmentRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **description** | **String** | | 7 | **rollout_percent** | **Integer** | | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/CreateSegmentRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::CreateSegmentRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **description** | **String** | | 7 | **rollout_percent** | **Integer** | | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/SegmentDebugLog.md: -------------------------------------------------------------------------------- 1 | # Flagr::SegmentDebugLog 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **segment_id** | **Integer** | | [optional] 7 | **msg** | **String** | | [optional] 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/Variant.md: -------------------------------------------------------------------------------- 1 | # Flagr::Variant 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **key** | **String** | | 8 | **attachment** | **Object** | | [optional] 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/CreateConstraintRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::CreateConstraintRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **property** | **String** | | 7 | **operator** | **String** | | 8 | **value** | **String** | | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/Constraint.md: -------------------------------------------------------------------------------- 1 | # Flagr::Constraint 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **property** | **String** | | 8 | **operator** | **String** | | 9 | **value** | **String** | | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/EvalDebugLog.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvalDebugLog 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **segment_debug_logs** | [**Array<SegmentDebugLog>**](SegmentDebugLog.md) | | [optional] 7 | **msg** | **String** | | [optional] 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/Distribution.md: -------------------------------------------------------------------------------- 1 | # Flagr::Distribution 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **percent** | **Integer** | | 8 | **variant_key** | **String** | | 9 | **variant_id** | **Integer** | | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/EvaluationEntity.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvaluationEntity 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **entity_id** | **String** | | [optional] 7 | **entity_type** | **String** | | [optional] 8 | **entity_context** | **Object** | | [optional] 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/FlagSnapshot.md: -------------------------------------------------------------------------------- 1 | # Flagr::FlagSnapshot 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | 7 | **updated_by** | **String** | | [optional] 8 | **flag** | [**Flag**](Flag.md) | | 9 | **updated_at** | **String** | | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/CreateFlagRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::CreateFlagRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **description** | **String** | | 7 | **key** | **String** | unique key representation of the flag | [optional] 8 | **template** | **String** | template for flag creation | [optional] 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/rbflagr/version.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | module Flagr 14 | VERSION = '1.1.12' 15 | end 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # make sure swagger.yaml and swagger_ruby.json is update-to-date 2 | gen: 3 | docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ 4 | -i /local/swagger.yaml \ 5 | -l ruby \ 6 | -o /local/ -c /local/swagger_ruby.json 7 | find ./rbflagr.gemspec -type f -exec sed -i "" "s/'json', '~> 2.1', '>= 2.1.0'/'json'/g" {} + 8 | find ./.gitignore -type f -exec sed -i "" "s/# Gemfile.lock/Gemfile.lock/g" {} + 9 | echo "\n## Use Makefile\n\`make gen\`\n" >> ./README.md 10 | -------------------------------------------------------------------------------- /docs/Segment.md: -------------------------------------------------------------------------------- 1 | # Flagr::Segment 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **description** | **String** | | 8 | **constraints** | [**Array<Constraint>**](Constraint.md) | | [optional] 9 | **distributions** | [**Array<Distribution>**](Distribution.md) | | [optional] 10 | **rank** | **Integer** | | 11 | **rollout_percent** | **Integer** | | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/PutFlagRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::PutFlagRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **description** | **String** | | [optional] 7 | **data_records_enabled** | **BOOLEAN** | enabled data records will get data logging in the metrics pipeline, for example, kafka. | [optional] 8 | **entity_type** | **String** | it will overwrite entityType into evaluation logs if it's not empty | [optional] 9 | **enabled** | **BOOLEAN** | | [optional] 10 | **key** | **String** | | [optional] 11 | **notes** | **String** | | [optional] 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/EvalResult.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvalResult 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **flag_id** | **Integer** | | [optional] 7 | **flag_key** | **String** | | [optional] 8 | **flag_snapshot_id** | **Integer** | | [optional] 9 | **segment_id** | **Integer** | | [optional] 10 | **variant_id** | **Integer** | | [optional] 11 | **variant_key** | **String** | | [optional] 12 | **variant_attachment** | **Object** | | [optional] 13 | **eval_context** | [**EvalContext**](EvalContext.md) | | [optional] 14 | **timestamp** | **String** | | [optional] 15 | **eval_debug_log** | [**EvalDebugLog**](EvalDebugLog.md) | | [optional] 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/EvaluationBatchRequest.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvaluationBatchRequest 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **entities** | [**Array<EvaluationEntity>**](EvaluationEntity.md) | | 7 | **enable_debug** | **BOOLEAN** | | [optional] 8 | **flag_i_ds** | **Array<Integer>** | flagIDs | [optional] 9 | **flag_keys** | **Array<String>** | flagKeys. Either flagIDs, flagKeys or flagTags works. If pass in multiples, Flagr may return duplicate results. | [optional] 10 | **flag_tags** | **Array<String>** | flagTags. Either flagIDs, flagKeys or flagTags works. If pass in multiples, Flagr may return duplicate results. | [optional] 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/gem-push.yml: -------------------------------------------------------------------------------- 1 | name: Ruby Gem 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | build: 9 | name: Build + Publish 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Set up Ruby 2.6 15 | uses: actions/setup-ruby@v1 16 | with: 17 | ruby-version: 2.6.x 18 | - name: Publish to RubyGems 19 | run: | 20 | mkdir -p $HOME/.gem 21 | touch $HOME/.gem/credentials 22 | chmod 0600 $HOME/.gem/credentials 23 | printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials 24 | gem build *.gemspec 25 | gem push *.gem 26 | env: 27 | GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" 28 | -------------------------------------------------------------------------------- /docs/EvalContext.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvalContext 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **entity_id** | **String** | entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one. | [optional] 7 | **entity_type** | **String** | | [optional] 8 | **entity_context** | **Object** | | [optional] 9 | **enable_debug** | **BOOLEAN** | | [optional] 10 | **flag_id** | **Integer** | flagID | [optional] 11 | **flag_key** | **String** | flagKey. flagID or flagKey will resolve to the same flag. Either works. | [optional] 12 | **flag_tags** | **Array<String>** | flagTags. flagTags looks up flags by tag. Either works. | [optional] 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 2 | # 3 | 4 | *.gem 5 | *.rbc 6 | /.config 7 | /coverage/ 8 | /InstalledFiles 9 | /pkg/ 10 | /spec/reports/ 11 | /spec/examples.txt 12 | /test/tmp/ 13 | /test/version_tmp/ 14 | /tmp/ 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | 21 | ## Documentation cache and generated files: 22 | /.yardoc/ 23 | /_yardoc/ 24 | /doc/ 25 | /rdoc/ 26 | 27 | ## Environment normalization: 28 | /.bundle/ 29 | /vendor/bundle 30 | /lib/bundler/man/ 31 | 32 | # for a library or gem, you might want to ignore these files since the code is 33 | # intended to run in multiple environments; otherwise, check them in: 34 | Gemfile.lock 35 | # .ruby-version 36 | # .ruby-gemset 37 | 38 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 39 | .rvmrc 40 | -------------------------------------------------------------------------------- /docs/HealthApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::HealthApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**get_health**](HealthApi.md#get_health) | **GET** /health | 8 | 9 | 10 | # **get_health** 11 | > Health get_health 12 | 13 | 14 | 15 | Check if Flagr is healthy 16 | 17 | ### Example 18 | ```ruby 19 | # load the gem 20 | require 'rbflagr' 21 | 22 | api_instance = Flagr::HealthApi.new 23 | 24 | begin 25 | result = api_instance.get_health 26 | p result 27 | rescue Flagr::ApiError => e 28 | puts "Exception when calling HealthApi->get_health: #{e}" 29 | end 30 | ``` 31 | 32 | ### Parameters 33 | This endpoint does not need any parameter. 34 | 35 | ### Return type 36 | 37 | [**Health**](Health.md) 38 | 39 | ### Authorization 40 | 41 | No authorization required 42 | 43 | ### HTTP request headers 44 | 45 | - **Content-Type**: application/json 46 | - **Accept**: application/json 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/Flag.md: -------------------------------------------------------------------------------- 1 | # Flagr::Flag 2 | 3 | ## Properties 4 | Name | Type | Description | Notes 5 | ------------ | ------------- | ------------- | ------------- 6 | **id** | **Integer** | | [optional] 7 | **key** | **String** | unique key representation of the flag | [optional] 8 | **description** | **String** | | 9 | **enabled** | **BOOLEAN** | | 10 | **tags** | [**Array<Tag>**](Tag.md) | | [optional] 11 | **segments** | [**Array<Segment>**](Segment.md) | | [optional] 12 | **variants** | [**Array<Variant>**](Variant.md) | | [optional] 13 | **data_records_enabled** | **BOOLEAN** | enabled data records will get data logging in the metrics pipeline, for example, kafka. | 14 | **entity_type** | **String** | it will override the entityType in the evaluation logs if it's not empty | [optional] 15 | **notes** | **String** | flag usage details in markdown format | [optional] 16 | **created_by** | **String** | | [optional] 17 | **updated_by** | **String** | | [optional] 18 | **updated_at** | **DateTime** | | [optional] 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/rbflagr/api_error.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | module Flagr 14 | class ApiError < StandardError 15 | attr_reader :code, :response_headers, :response_body 16 | 17 | # Usage examples: 18 | # ApiError.new 19 | # ApiError.new("message") 20 | # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") 21 | # ApiError.new(:code => 404, :message => "Not Found") 22 | def initialize(arg = nil) 23 | if arg.is_a? Hash 24 | if arg.key?(:message) || arg.key?('message') 25 | super(arg[:message] || arg['message']) 26 | else 27 | super arg 28 | end 29 | 30 | arg.each do |k, v| 31 | instance_variable_set "@#{k}", v 32 | end 33 | else 34 | super arg 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | -------------------------------------------------------------------------------- /spec/models/error_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Error 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Error' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Error.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Error' do 31 | it 'should create an instance of Error' do 32 | expect(@instance).to be_instance_of(Flagr::Error) 33 | end 34 | end 35 | describe 'test attribute "message"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/models/health_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.10 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.14 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Health 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Health' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Health.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Health' do 31 | it 'should create an instance of Health' do 32 | expect(@instance).to be_instance_of(Flagr::Health) 33 | end 34 | end 35 | describe 'test attribute "status"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | -------------------------------------------------------------------------------- /spec/models/put_flag_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::PutFlagRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'PutFlagRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::PutFlagRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of PutFlagRequest' do 31 | it 'should create an instance of PutFlagRequest' do 32 | expect(@instance).to be_instance_of(Flagr::PutFlagRequest) 33 | end 34 | end 35 | describe 'test attribute "description"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/models/create_flag_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::CreateFlagRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'CreateFlagRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::CreateFlagRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of CreateFlagRequest' do 31 | it 'should create an instance of CreateFlagRequest' do 32 | expect(@instance).to be_instance_of(Flagr::CreateFlagRequest) 33 | end 34 | end 35 | describe 'test attribute "description"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/api/health_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.8 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::HealthApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'HealthApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::HealthApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of HealthApi' do 30 | it 'should create an instance of HealthApi' do 31 | expect(@instance).to be_instance_of(Flagr::HealthApi) 32 | end 33 | end 34 | 35 | # unit tests for health_get 36 | # @param [Hash] opts the optional parameters 37 | # @return [nil] 38 | describe 'health_get test' do 39 | it 'should work' do 40 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 41 | end 42 | end 43 | 44 | end 45 | -------------------------------------------------------------------------------- /spec/models/create_tag_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.10 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.14 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::CreateTagRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'CreateTagRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::CreateTagRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of CreateTagRequest' do 31 | it 'should create an instance of CreateTagRequest' do 32 | expect(@instance).to be_instance_of(Flagr::CreateTagRequest) 33 | end 34 | end 35 | describe 'test attribute "value"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | -------------------------------------------------------------------------------- /spec/models/set_flag_enabled_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::SetFlagEnabledRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'SetFlagEnabledRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::SetFlagEnabledRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of SetFlagEnabledRequest' do 31 | it 'should create an instance of SetFlagEnabledRequest' do 32 | expect(@instance).to be_instance_of(Flagr::SetFlagEnabledRequest) 33 | end 34 | end 35 | describe 'test attribute "enabled"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/configuration_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | 15 | describe Flagr::Configuration do 16 | let(:config) { Flagr::Configuration.default } 17 | 18 | before(:each) do 19 | # uncomment below to setup host and base_path 20 | #require 'URI' 21 | #uri = URI.parse("http://localhost/api/v1") 22 | #Flagr.configure do |c| 23 | # c.host = uri.host 24 | # c.base_path = uri.path 25 | #end 26 | end 27 | 28 | describe '#base_url' do 29 | it 'should have the default value' do 30 | # uncomment below to test default value of the base path 31 | #expect(config.base_url).to eq("http://localhost/api/v1") 32 | end 33 | 34 | it 'should remove trailing slashes' do 35 | [nil, '', '/', '//'].each do |base_path| 36 | config.base_path = base_path 37 | # uncomment below to test trailing slashes 38 | #expect(config.base_url).to eq("http://localhost/api/v1") 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/models/put_distributions_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::PutDistributionsRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'PutDistributionsRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::PutDistributionsRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of PutDistributionsRequest' do 31 | it 'should create an instance of PutDistributionsRequest' do 32 | expect(@instance).to be_instance_of(Flagr::PutDistributionsRequest) 33 | end 34 | end 35 | describe 'test attribute "distributions"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/models/evaluation_batch_response_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvaluationBatchResponse 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvaluationBatchResponse' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvaluationBatchResponse.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvaluationBatchResponse' do 31 | it 'should create an instance of EvaluationBatchResponse' do 32 | expect(@instance).to be_instance_of(Flagr::EvaluationBatchResponse) 33 | end 34 | end 35 | describe 'test attribute "evaluation_results"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/models/put_segment_reorder_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::PutSegmentReorderRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'PutSegmentReorderRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::PutSegmentReorderRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of PutSegmentReorderRequest' do 31 | it 'should create an instance of PutSegmentReorderRequest' do 32 | expect(@instance).to be_instance_of(Flagr::PutSegmentReorderRequest) 33 | end 34 | end 35 | describe 'test attribute "segment_i_ds"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /spec/api/evaluation_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::EvaluationApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'EvaluationApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::EvaluationApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of EvaluationApi' do 30 | it 'should create an instance of EvaluationApi' do 31 | expect(@instance).to be_instance_of(Flagr::EvaluationApi) 32 | end 33 | end 34 | 35 | # unit tests for post_evaluation 36 | # 37 | # 38 | # @param body evalution context 39 | # @param [Hash] opts the optional parameters 40 | # @return [EvalResult] 41 | describe 'post_evaluation test' do 42 | it "should work" do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /spec/models/tag_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.10 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.14 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Tag 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Tag' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Tag.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Tag' do 31 | it 'should create an instance of Tag' do 32 | expect(@instance).to be_instance_of(Flagr::Tag) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "value"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /spec/api/export_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.0.13 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::ExportApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'ExportApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::ExportApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of ExportApi' do 30 | it 'should create an instance of ExportApi' do 31 | expect(@instance).to be_instance_of(Flagr::ExportApi) 32 | end 33 | end 34 | 35 | # unit tests for get_export_sq_lite 36 | # Export sqlite3 format of the db dump, which is converted from the main database. 37 | # @param [Hash] opts the optional parameters 38 | # @return [File] 39 | describe 'get_export_sq_lite test' do 40 | it 'should work' do 41 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 42 | end 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /spec/models/eval_debug_log_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvalDebugLog 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvalDebugLog' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvalDebugLog.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvalDebugLog' do 31 | it 'should create an instance of EvalDebugLog' do 32 | expect(@instance).to be_instance_of(Flagr::EvalDebugLog) 33 | end 34 | end 35 | describe 'test attribute "segment_debug_logs"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "msg"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/segment_debug_log_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::SegmentDebugLog 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'SegmentDebugLog' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::SegmentDebugLog.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of SegmentDebugLog' do 31 | it 'should create an instance of SegmentDebugLog' do 32 | expect(@instance).to be_instance_of(Flagr::SegmentDebugLog) 33 | end 34 | end 35 | describe 'test attribute "segment_id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "msg"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/put_variant_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::PutVariantRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'PutVariantRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::PutVariantRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of PutVariantRequest' do 31 | it 'should create an instance of PutVariantRequest' do 32 | expect(@instance).to be_instance_of(Flagr::PutVariantRequest) 33 | end 34 | end 35 | describe 'test attribute "key"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "attachment"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/put_segment_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::PutSegmentRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'PutSegmentRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::PutSegmentRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of PutSegmentRequest' do 31 | it 'should create an instance of PutSegmentRequest' do 32 | expect(@instance).to be_instance_of(Flagr::PutSegmentRequest) 33 | end 34 | end 35 | describe 'test attribute "description"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "rollout_percent"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/create_variant_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::CreateVariantRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'CreateVariantRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::CreateVariantRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of CreateVariantRequest' do 31 | it 'should create an instance of CreateVariantRequest' do 32 | expect(@instance).to be_instance_of(Flagr::CreateVariantRequest) 33 | end 34 | end 35 | describe 'test attribute "key"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "attachment"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/create_segment_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::CreateSegmentRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'CreateSegmentRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::CreateSegmentRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of CreateSegmentRequest' do 31 | it 'should create an instance of CreateSegmentRequest' do 32 | expect(@instance).to be_instance_of(Flagr::CreateSegmentRequest) 33 | end 34 | end 35 | describe 'test attribute "description"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "rollout_percent"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /spec/models/variant_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Variant 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Variant' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Variant.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Variant' do 31 | it 'should create an instance of Variant' do 32 | expect(@instance).to be_instance_of(Flagr::Variant) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "key"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "attachment"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | end 54 | 55 | -------------------------------------------------------------------------------- /spec/models/evaluation_entity_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvaluationEntity 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvaluationEntity' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvaluationEntity.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvaluationEntity' do 31 | it 'should create an instance of EvaluationEntity' do 32 | expect(@instance).to be_instance_of(Flagr::EvaluationEntity) 33 | end 34 | end 35 | describe 'test attribute "entity_id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "entity_type"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "entity_context"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | end 54 | 55 | -------------------------------------------------------------------------------- /spec/models/create_constraint_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::CreateConstraintRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'CreateConstraintRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::CreateConstraintRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of CreateConstraintRequest' do 31 | it 'should create an instance of CreateConstraintRequest' do 32 | expect(@instance).to be_instance_of(Flagr::CreateConstraintRequest) 33 | end 34 | end 35 | describe 'test attribute "property"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "operator"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "value"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | end 54 | 55 | -------------------------------------------------------------------------------- /spec/models/evaluation_batch_request_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvaluationBatchRequest 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvaluationBatchRequest' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvaluationBatchRequest.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvaluationBatchRequest' do 31 | it 'should create an instance of EvaluationBatchRequest' do 32 | expect(@instance).to be_instance_of(Flagr::EvaluationBatchRequest) 33 | end 34 | end 35 | describe 'test attribute "entities"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "enable_debug"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "flag_i_ds"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | end 54 | 55 | -------------------------------------------------------------------------------- /spec/models/flag_snapshot_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::FlagSnapshot 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'FlagSnapshot' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::FlagSnapshot.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of FlagSnapshot' do 31 | it 'should create an instance of FlagSnapshot' do 32 | expect(@instance).to be_instance_of(Flagr::FlagSnapshot) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "updated_by"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "flag"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "updated_at"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | end 60 | 61 | -------------------------------------------------------------------------------- /rbflagr.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | 3 | =begin 4 | #Flagr 5 | 6 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 7 | 8 | OpenAPI spec version: 1.1.12 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | Swagger Codegen version: 2.4.21 12 | 13 | =end 14 | 15 | $:.push File.expand_path("../lib", __FILE__) 16 | require "rbflagr/version" 17 | 18 | Gem::Specification.new do |s| 19 | s.name = "rbflagr" 20 | s.version = Flagr::VERSION 21 | s.platform = Gem::Platform::RUBY 22 | s.authors = ["Swagger-Codegen"] 23 | s.email = [""] 24 | s.homepage = "https://checkr.github.io/flagr" 25 | s.summary = "Flagr Ruby Gem" 26 | s.description = "Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". " 27 | s.license = 'Apache 2.0' 28 | s.required_ruby_version = ">= 1.9" 29 | 30 | s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' 31 | s.add_runtime_dependency 'json' 32 | s.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.0' 33 | 34 | s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' 35 | s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' 36 | s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3' 37 | s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' 38 | s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' 39 | s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' 40 | s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' 41 | 42 | s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } 43 | s.test_files = `find spec/*`.split("\n") 44 | s.executables = [] 45 | s.require_paths = ["lib"] 46 | end 47 | -------------------------------------------------------------------------------- /git_push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Generated by: https://github.com/swagger-api/swagger-codegen.git 4 | # 5 | # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ 6 | # 7 | # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" 8 | 9 | git_user_id=$1 10 | git_repo_id=$2 11 | release_note=$3 12 | 13 | if [ "$git_user_id" = "" ]; then 14 | git_user_id="GIT_USER_ID" 15 | echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" 16 | fi 17 | 18 | if [ "$git_repo_id" = "" ]; then 19 | git_repo_id="GIT_REPO_ID" 20 | echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" 21 | fi 22 | 23 | if [ "$release_note" = "" ]; then 24 | release_note="Minor update" 25 | echo "[INFO] No command line input provided. Set \$release_note to $release_note" 26 | fi 27 | 28 | # Initialize the local directory as a Git repository 29 | git init 30 | 31 | # Adds the files in the local repository and stages them for commit. 32 | git add . 33 | 34 | # Commits the tracked changes and prepares them to be pushed to a remote repository. 35 | git commit -m "$release_note" 36 | 37 | # Sets the new remote 38 | git_remote=`git remote` 39 | if [ "$git_remote" = "" ]; then # git remote not defined 40 | 41 | if [ "$GIT_TOKEN" = "" ]; then 42 | echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." 43 | git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git 44 | else 45 | git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git 46 | fi 47 | 48 | fi 49 | 50 | git pull origin master 51 | 52 | # Pushes (Forces) the changes in the local repository up to the remote repository 53 | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" 54 | git push origin master 2>&1 | grep -v 'To https' 55 | 56 | -------------------------------------------------------------------------------- /spec/models/flag_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Flag 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Flag' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Flag.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Flag' do 31 | it 'should create an instance of Flag' do 32 | expect(@instance).to be_instance_of(Flagr::Flag) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "description"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "enabled"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "segments"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | describe 'test attribute "variants"' do 60 | it 'should work' do 61 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 62 | end 63 | end 64 | 65 | end 66 | 67 | -------------------------------------------------------------------------------- /spec/api/distribution_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::DistributionApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'DistributionApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::DistributionApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of DistributionApi' do 30 | it 'should create an instance of DistributionApi' do 31 | expect(@instance).to be_instance_of(Flagr::DistributionApi) 32 | end 33 | end 34 | 35 | # unit tests for find_distributions 36 | # 37 | # 38 | # @param flag_id numeric ID of the flag 39 | # @param segment_id numeric ID of the segment 40 | # @param [Hash] opts the optional parameters 41 | # @return [Array] 42 | describe 'find_distributions test' do 43 | it "should work" do 44 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 45 | end 46 | end 47 | 48 | # unit tests for put_distributions 49 | # 50 | # replace the distribution with the new setting 51 | # @param flag_id numeric ID of the flag 52 | # @param segment_id numeric ID of the segment 53 | # @param body array of distributions 54 | # @param [Hash] opts the optional parameters 55 | # @return [Array] 56 | describe 'put_distributions test' do 57 | it "should work" do 58 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 59 | end 60 | end 61 | 62 | end 63 | -------------------------------------------------------------------------------- /spec/models/distribution_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Distribution 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Distribution' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Distribution.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Distribution' do 31 | it 'should create an instance of Distribution' do 32 | expect(@instance).to be_instance_of(Flagr::Distribution) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "percent"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "bitmap"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "variant_key"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | describe 'test attribute "variant_id"' do 60 | it 'should work' do 61 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 62 | end 63 | end 64 | 65 | end 66 | 67 | -------------------------------------------------------------------------------- /spec/models/eval_context_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvalContext 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvalContext' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvalContext.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvalContext' do 31 | it 'should create an instance of EvalContext' do 32 | expect(@instance).to be_instance_of(Flagr::EvalContext) 33 | end 34 | end 35 | describe 'test attribute "entity_id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "entity_type"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "entity_context"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "enable_debug"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | describe 'test attribute "flag_id"' do 60 | it 'should work' do 61 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 62 | end 63 | end 64 | 65 | end 66 | 67 | -------------------------------------------------------------------------------- /spec/models/constraint_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Constraint 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Constraint' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Constraint.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Constraint' do 31 | it 'should create an instance of Constraint' do 32 | expect(@instance).to be_instance_of(Flagr::Constraint) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "property"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "operator"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | #validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EQ", "NEQ", "LT", "LTE", "GT", "GTE", "EREG", "NEREG", "IN", "NOTIN", "CONTAINS", "NOTCONTAINS"]) 51 | #validator.allowable_values.each do |value| 52 | # expect { @instance.operator = value }.not_to raise_error 53 | #end 54 | end 55 | end 56 | 57 | describe 'test attribute "value"' do 58 | it 'should work' do 59 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 60 | end 61 | end 62 | 63 | end 64 | 65 | -------------------------------------------------------------------------------- /spec/models/segment_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::Segment 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'Segment' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::Segment.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of Segment' do 31 | it 'should create an instance of Segment' do 32 | expect(@instance).to be_instance_of(Flagr::Segment) 33 | end 34 | end 35 | describe 'test attribute "id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "description"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "constraints"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "distributions"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | describe 'test attribute "rank"' do 60 | it 'should work' do 61 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 62 | end 63 | end 64 | 65 | describe 'test attribute "rollout_percent"' do 66 | it 'should work' do 67 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 68 | end 69 | end 70 | 71 | end 72 | 73 | -------------------------------------------------------------------------------- /docs/ExportApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::ExportApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**get_export_eval_cache_json**](ExportApi.md#get_export_eval_cache_json) | **GET** /export/eval_cache/json | 8 | [**get_export_sqlite**](ExportApi.md#get_export_sqlite) | **GET** /export/sqlite | 9 | 10 | 11 | # **get_export_eval_cache_json** 12 | > Object get_export_eval_cache_json 13 | 14 | 15 | 16 | Export JSON format of the eval cache dump 17 | 18 | ### Example 19 | ```ruby 20 | # load the gem 21 | require 'rbflagr' 22 | 23 | api_instance = Flagr::ExportApi.new 24 | 25 | begin 26 | result = api_instance.get_export_eval_cache_json 27 | p result 28 | rescue Flagr::ApiError => e 29 | puts "Exception when calling ExportApi->get_export_eval_cache_json: #{e}" 30 | end 31 | ``` 32 | 33 | ### Parameters 34 | This endpoint does not need any parameter. 35 | 36 | ### Return type 37 | 38 | **Object** 39 | 40 | ### Authorization 41 | 42 | No authorization required 43 | 44 | ### HTTP request headers 45 | 46 | - **Content-Type**: application/json 47 | - **Accept**: application/json 48 | 49 | 50 | 51 | # **get_export_sqlite** 52 | > File get_export_sqlite(opts) 53 | 54 | 55 | 56 | Export sqlite3 format of the db dump, which is converted from the main database. 57 | 58 | ### Example 59 | ```ruby 60 | # load the gem 61 | require 'rbflagr' 62 | 63 | api_instance = Flagr::ExportApi.new 64 | 65 | opts = { 66 | exclude_snapshots: true # BOOLEAN | export without snapshots data - useful for smaller db without snapshots 67 | } 68 | 69 | begin 70 | result = api_instance.get_export_sqlite(opts) 71 | p result 72 | rescue Flagr::ApiError => e 73 | puts "Exception when calling ExportApi->get_export_sqlite: #{e}" 74 | end 75 | ``` 76 | 77 | ### Parameters 78 | 79 | Name | Type | Description | Notes 80 | ------------- | ------------- | ------------- | ------------- 81 | **exclude_snapshots** | **BOOLEAN**| export without snapshots data - useful for smaller db without snapshots | [optional] 82 | 83 | ### Return type 84 | 85 | **File** 86 | 87 | ### Authorization 88 | 89 | No authorization required 90 | 91 | ### HTTP request headers 92 | 93 | - **Content-Type**: application/json 94 | - **Accept**: application/octet-stream 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /lib/rbflagr/api/health_api.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'uri' 14 | 15 | module Flagr 16 | class HealthApi 17 | attr_accessor :api_client 18 | 19 | def initialize(api_client = ApiClient.default) 20 | @api_client = api_client 21 | end 22 | # Check if Flagr is healthy 23 | # @param [Hash] opts the optional parameters 24 | # @return [Health] 25 | def get_health(opts = {}) 26 | data, _status_code, _headers = get_health_with_http_info(opts) 27 | data 28 | end 29 | 30 | # Check if Flagr is healthy 31 | # @param [Hash] opts the optional parameters 32 | # @return [Array<(Health, Fixnum, Hash)>] Health data, response status code and response headers 33 | def get_health_with_http_info(opts = {}) 34 | if @api_client.config.debugging 35 | @api_client.config.logger.debug 'Calling API: HealthApi.get_health ...' 36 | end 37 | # resource path 38 | local_var_path = '/health' 39 | 40 | # query parameters 41 | query_params = {} 42 | 43 | # header parameters 44 | header_params = {} 45 | # HTTP header 'Accept' (if needed) 46 | header_params['Accept'] = @api_client.select_header_accept(['application/json']) 47 | # HTTP header 'Content-Type' 48 | header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) 49 | 50 | # form parameters 51 | form_params = {} 52 | 53 | # http body (model) 54 | post_body = nil 55 | auth_names = [] 56 | data, status_code, headers = @api_client.call_api(:GET, local_var_path, 57 | :header_params => header_params, 58 | :query_params => query_params, 59 | :form_params => form_params, 60 | :body => post_body, 61 | :auth_names => auth_names, 62 | :return_type => 'Health') 63 | if @api_client.config.debugging 64 | @api_client.config.logger.debug "API called: HealthApi#get_health\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" 65 | end 66 | return data, status_code, headers 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /docs/EvaluationApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::EvaluationApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**post_evaluation**](EvaluationApi.md#post_evaluation) | **POST** /evaluation | 8 | [**post_evaluation_batch**](EvaluationApi.md#post_evaluation_batch) | **POST** /evaluation/batch | 9 | 10 | 11 | # **post_evaluation** 12 | > EvalResult post_evaluation(body) 13 | 14 | 15 | 16 | ### Example 17 | ```ruby 18 | # load the gem 19 | require 'rbflagr' 20 | 21 | api_instance = Flagr::EvaluationApi.new 22 | 23 | body = Flagr::EvalContext.new # EvalContext | evalution context 24 | 25 | 26 | begin 27 | result = api_instance.post_evaluation(body) 28 | p result 29 | rescue Flagr::ApiError => e 30 | puts "Exception when calling EvaluationApi->post_evaluation: #{e}" 31 | end 32 | ``` 33 | 34 | ### Parameters 35 | 36 | Name | Type | Description | Notes 37 | ------------- | ------------- | ------------- | ------------- 38 | **body** | [**EvalContext**](EvalContext.md)| evalution context | 39 | 40 | ### Return type 41 | 42 | [**EvalResult**](EvalResult.md) 43 | 44 | ### Authorization 45 | 46 | No authorization required 47 | 48 | ### HTTP request headers 49 | 50 | - **Content-Type**: application/json 51 | - **Accept**: application/json 52 | 53 | 54 | 55 | # **post_evaluation_batch** 56 | > EvaluationBatchResponse post_evaluation_batch(body) 57 | 58 | 59 | 60 | ### Example 61 | ```ruby 62 | # load the gem 63 | require 'rbflagr' 64 | 65 | api_instance = Flagr::EvaluationApi.new 66 | 67 | body = Flagr::EvaluationBatchRequest.new # EvaluationBatchRequest | evalution batch request 68 | 69 | 70 | begin 71 | result = api_instance.post_evaluation_batch(body) 72 | p result 73 | rescue Flagr::ApiError => e 74 | puts "Exception when calling EvaluationApi->post_evaluation_batch: #{e}" 75 | end 76 | ``` 77 | 78 | ### Parameters 79 | 80 | Name | Type | Description | Notes 81 | ------------- | ------------- | ------------- | ------------- 82 | **body** | [**EvaluationBatchRequest**](EvaluationBatchRequest.md)| evalution batch request | 83 | 84 | ### Return type 85 | 86 | [**EvaluationBatchResponse**](EvaluationBatchResponse.md) 87 | 88 | ### Authorization 89 | 90 | No authorization required 91 | 92 | ### HTTP request headers 93 | 94 | - **Content-Type**: application/json 95 | - **Accept**: application/json 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /spec/models/eval_result_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | require 'date' 16 | 17 | # Unit tests for Flagr::EvalResult 18 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 19 | # Please update as you see appropriate 20 | describe 'EvalResult' do 21 | before do 22 | # run before each test 23 | @instance = Flagr::EvalResult.new 24 | end 25 | 26 | after do 27 | # run after each test 28 | end 29 | 30 | describe 'test an instance of EvalResult' do 31 | it 'should create an instance of EvalResult' do 32 | expect(@instance).to be_instance_of(Flagr::EvalResult) 33 | end 34 | end 35 | describe 'test attribute "flag_id"' do 36 | it 'should work' do 37 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 38 | end 39 | end 40 | 41 | describe 'test attribute "segment_id"' do 42 | it 'should work' do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | describe 'test attribute "variant_id"' do 48 | it 'should work' do 49 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 50 | end 51 | end 52 | 53 | describe 'test attribute "eval_context"' do 54 | it 'should work' do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | describe 'test attribute "timestamp"' do 60 | it 'should work' do 61 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 62 | end 63 | end 64 | 65 | describe 'test attribute "eval_debug_log"' do 66 | it 'should work' do 67 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 68 | end 69 | end 70 | 71 | describe 'test attribute "variant_attachment"' do 72 | it 'should work' do 73 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 74 | end 75 | end 76 | 77 | end 78 | 79 | -------------------------------------------------------------------------------- /lib/rbflagr.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | # Common files 14 | require 'rbflagr/api_client' 15 | require 'rbflagr/api_error' 16 | require 'rbflagr/version' 17 | require 'rbflagr/configuration' 18 | 19 | # Models 20 | require 'rbflagr/models/constraint' 21 | require 'rbflagr/models/create_constraint_request' 22 | require 'rbflagr/models/create_flag_request' 23 | require 'rbflagr/models/create_segment_request' 24 | require 'rbflagr/models/create_tag_request' 25 | require 'rbflagr/models/create_variant_request' 26 | require 'rbflagr/models/distribution' 27 | require 'rbflagr/models/error' 28 | require 'rbflagr/models/eval_context' 29 | require 'rbflagr/models/eval_debug_log' 30 | require 'rbflagr/models/eval_result' 31 | require 'rbflagr/models/evaluation_batch_request' 32 | require 'rbflagr/models/evaluation_batch_response' 33 | require 'rbflagr/models/evaluation_entity' 34 | require 'rbflagr/models/flag' 35 | require 'rbflagr/models/flag_snapshot' 36 | require 'rbflagr/models/health' 37 | require 'rbflagr/models/put_distributions_request' 38 | require 'rbflagr/models/put_flag_request' 39 | require 'rbflagr/models/put_segment_reorder_request' 40 | require 'rbflagr/models/put_segment_request' 41 | require 'rbflagr/models/put_variant_request' 42 | require 'rbflagr/models/segment' 43 | require 'rbflagr/models/segment_debug_log' 44 | require 'rbflagr/models/set_flag_enabled_request' 45 | require 'rbflagr/models/tag' 46 | require 'rbflagr/models/variant' 47 | 48 | # APIs 49 | require 'rbflagr/api/constraint_api' 50 | require 'rbflagr/api/distribution_api' 51 | require 'rbflagr/api/evaluation_api' 52 | require 'rbflagr/api/export_api' 53 | require 'rbflagr/api/flag_api' 54 | require 'rbflagr/api/health_api' 55 | require 'rbflagr/api/segment_api' 56 | require 'rbflagr/api/tag_api' 57 | require 'rbflagr/api/variant_api' 58 | 59 | module Flagr 60 | class << self 61 | # Customize default settings for the SDK using block. 62 | # Flagr.configure do |config| 63 | # config.username = "xxx" 64 | # config.password = "xxx" 65 | # end 66 | # If no block given, return the default Configuration object. 67 | def configure 68 | if block_given? 69 | yield(Configuration.default) 70 | else 71 | Configuration.default 72 | end 73 | end 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /spec/api/variant_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::VariantApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'VariantApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::VariantApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of VariantApi' do 30 | it 'should create an instance of VariantApi' do 31 | expect(@instance).to be_instance_of(Flagr::VariantApi) 32 | end 33 | end 34 | 35 | # unit tests for create_variant 36 | # 37 | # 38 | # @param flag_id numeric ID of the flag 39 | # @param body create a variant 40 | # @param [Hash] opts the optional parameters 41 | # @return [Variant] 42 | describe 'create_variant test' do 43 | it "should work" do 44 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 45 | end 46 | end 47 | 48 | # unit tests for delete_variant 49 | # 50 | # 51 | # @param flag_id numeric ID of the flag 52 | # @param variant_id numeric ID of the variant 53 | # @param [Hash] opts the optional parameters 54 | # @return [nil] 55 | describe 'delete_variant test' do 56 | it "should work" do 57 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 58 | end 59 | end 60 | 61 | # unit tests for find_variants 62 | # 63 | # 64 | # @param flag_id numeric ID of the flag 65 | # @param [Hash] opts the optional parameters 66 | # @return [Array] 67 | describe 'find_variants test' do 68 | it "should work" do 69 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 70 | end 71 | end 72 | 73 | # unit tests for put_variant 74 | # 75 | # 76 | # @param flag_id numeric ID of the flag 77 | # @param variant_id numeric ID of the variant 78 | # @param body update a variant 79 | # @param [Hash] opts the optional parameters 80 | # @return [Variant] 81 | describe 'put_variant test' do 82 | it "should work" do 83 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 84 | end 85 | end 86 | 87 | end 88 | -------------------------------------------------------------------------------- /spec/api/segment_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::SegmentApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'SegmentApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::SegmentApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of SegmentApi' do 30 | it 'should create an instance of SegmentApi' do 31 | expect(@instance).to be_instance_of(Flagr::SegmentApi) 32 | end 33 | end 34 | 35 | # unit tests for create_segment 36 | # 37 | # 38 | # @param flag_id numeric ID of the flag to get 39 | # @param body create a segment under a flag 40 | # @param [Hash] opts the optional parameters 41 | # @return [Segment] 42 | describe 'create_segment test' do 43 | it "should work" do 44 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 45 | end 46 | end 47 | 48 | # unit tests for delete_segment 49 | # 50 | # 51 | # @param flag_id numeric ID of the flag 52 | # @param segment_id numeric ID of the segment 53 | # @param [Hash] opts the optional parameters 54 | # @return [nil] 55 | describe 'delete_segment test' do 56 | it "should work" do 57 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 58 | end 59 | end 60 | 61 | # unit tests for find_segments 62 | # 63 | # 64 | # @param flag_id numeric ID of the flag to get 65 | # @param [Hash] opts the optional parameters 66 | # @return [Array] 67 | describe 'find_segments test' do 68 | it "should work" do 69 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 70 | end 71 | end 72 | 73 | # unit tests for put_segment 74 | # 75 | # 76 | # @param flag_id numeric ID of the flag 77 | # @param segment_id numeric ID of the segment 78 | # @param body update a segment 79 | # @param [Hash] opts the optional parameters 80 | # @return [Segment] 81 | describe 'put_segment test' do 82 | it "should work" do 83 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 84 | end 85 | end 86 | 87 | end 88 | -------------------------------------------------------------------------------- /spec/api/tag_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.10 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.14 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::TagApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'TagApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::TagApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of TagApi' do 30 | it 'should create an instance of TagApi' do 31 | expect(@instance).to be_instance_of(Flagr::TagApi) 32 | end 33 | end 34 | 35 | # unit tests for create_tag 36 | # @param flag_id numeric ID of the flag 37 | # @param body create a tag 38 | # @param [Hash] opts the optional parameters 39 | # @return [Tag] 40 | describe 'create_tag test' do 41 | it 'should work' do 42 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 43 | end 44 | end 45 | 46 | # unit tests for delete_tag 47 | # @param flag_id numeric ID of the flag 48 | # @param tag_id numeric ID of the tag 49 | # @param [Hash] opts the optional parameters 50 | # @return [nil] 51 | describe 'delete_tag test' do 52 | it 'should work' do 53 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 54 | end 55 | end 56 | 57 | # unit tests for find_all_tags 58 | # @param [Hash] opts the optional parameters 59 | # @option opts [Integer] :limit the numbers of tags to return 60 | # @option opts [Integer] :offset return tags given the offset, it should usually set together with limit 61 | # @option opts [String] :value_like return tags partially matching given value 62 | # @return [Array] 63 | describe 'find_all_tags test' do 64 | it 'should work' do 65 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 66 | end 67 | end 68 | 69 | # unit tests for find_tags 70 | # @param flag_id numeric ID of the flag 71 | # @param [Hash] opts the optional parameters 72 | # @return [Array] 73 | describe 'find_tags test' do 74 | it 'should work' do 75 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 76 | end 77 | end 78 | 79 | end 80 | -------------------------------------------------------------------------------- /spec/api/constraint_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::ConstraintApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'ConstraintApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::ConstraintApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of ConstraintApi' do 30 | it 'should create an instance of ConstraintApi' do 31 | expect(@instance).to be_instance_of(Flagr::ConstraintApi) 32 | end 33 | end 34 | 35 | # unit tests for create_constraint 36 | # 37 | # 38 | # @param flag_id numeric ID of the flag 39 | # @param segment_id numeric ID of the segment 40 | # @param body create a constraint 41 | # @param [Hash] opts the optional parameters 42 | # @return [Constraint] 43 | describe 'create_constraint test' do 44 | it "should work" do 45 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 46 | end 47 | end 48 | 49 | # unit tests for delete_constraint 50 | # 51 | # 52 | # @param flag_id numeric ID of the flag 53 | # @param segment_id numeric ID of the segment 54 | # @param constraint_id numeric ID of the constraint 55 | # @param [Hash] opts the optional parameters 56 | # @return [nil] 57 | describe 'delete_constraint test' do 58 | it "should work" do 59 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 60 | end 61 | end 62 | 63 | # unit tests for find_constraints 64 | # 65 | # 66 | # @param flag_id numeric ID of the flag 67 | # @param segment_id numeric ID of the segment 68 | # @param [Hash] opts the optional parameters 69 | # @return [Array] 70 | describe 'find_constraints test' do 71 | it "should work" do 72 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 73 | end 74 | end 75 | 76 | # unit tests for put_constraint 77 | # 78 | # 79 | # @param flag_id numeric ID of the flag 80 | # @param segment_id numeric ID of the segment 81 | # @param constraint_id numeric ID of the constraint 82 | # @param body create a constraint 83 | # @param [Hash] opts the optional parameters 84 | # @return [Constraint] 85 | describe 'put_constraint test' do 86 | it "should work" do 87 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 88 | end 89 | end 90 | 91 | end 92 | -------------------------------------------------------------------------------- /docs/DistributionApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::DistributionApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**find_distributions**](DistributionApi.md#find_distributions) | **GET** /flags/{flagID}/segments/{segmentID}/distributions | 8 | [**put_distributions**](DistributionApi.md#put_distributions) | **PUT** /flags/{flagID}/segments/{segmentID}/distributions | 9 | 10 | 11 | # **find_distributions** 12 | > Array<Distribution> find_distributions(flag_id, segment_id) 13 | 14 | 15 | 16 | ### Example 17 | ```ruby 18 | # load the gem 19 | require 'rbflagr' 20 | 21 | api_instance = Flagr::DistributionApi.new 22 | 23 | flag_id = 789 # Integer | numeric ID of the flag 24 | 25 | segment_id = 789 # Integer | numeric ID of the segment 26 | 27 | 28 | begin 29 | result = api_instance.find_distributions(flag_id, segment_id) 30 | p result 31 | rescue Flagr::ApiError => e 32 | puts "Exception when calling DistributionApi->find_distributions: #{e}" 33 | end 34 | ``` 35 | 36 | ### Parameters 37 | 38 | Name | Type | Description | Notes 39 | ------------- | ------------- | ------------- | ------------- 40 | **flag_id** | **Integer**| numeric ID of the flag | 41 | **segment_id** | **Integer**| numeric ID of the segment | 42 | 43 | ### Return type 44 | 45 | [**Array<Distribution>**](Distribution.md) 46 | 47 | ### Authorization 48 | 49 | No authorization required 50 | 51 | ### HTTP request headers 52 | 53 | - **Content-Type**: application/json 54 | - **Accept**: application/json 55 | 56 | 57 | 58 | # **put_distributions** 59 | > Array<Distribution> put_distributions(flag_id, segment_id, body) 60 | 61 | 62 | 63 | replace the distribution with the new setting 64 | 65 | ### Example 66 | ```ruby 67 | # load the gem 68 | require 'rbflagr' 69 | 70 | api_instance = Flagr::DistributionApi.new 71 | 72 | flag_id = 789 # Integer | numeric ID of the flag 73 | 74 | segment_id = 789 # Integer | numeric ID of the segment 75 | 76 | body = Flagr::PutDistributionsRequest.new # PutDistributionsRequest | array of distributions 77 | 78 | 79 | begin 80 | result = api_instance.put_distributions(flag_id, segment_id, body) 81 | p result 82 | rescue Flagr::ApiError => e 83 | puts "Exception when calling DistributionApi->put_distributions: #{e}" 84 | end 85 | ``` 86 | 87 | ### Parameters 88 | 89 | Name | Type | Description | Notes 90 | ------------- | ------------- | ------------- | ------------- 91 | **flag_id** | **Integer**| numeric ID of the flag | 92 | **segment_id** | **Integer**| numeric ID of the segment | 93 | **body** | [**PutDistributionsRequest**](PutDistributionsRequest.md)| array of distributions | 94 | 95 | ### Return type 96 | 97 | [**Array<Distribution>**](Distribution.md) 98 | 99 | ### Authorization 100 | 101 | No authorization required 102 | 103 | ### HTTP request headers 104 | 105 | - **Content-Type**: application/json 106 | - **Accept**: application/json 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /spec/api/flag_api_spec.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | require 'spec_helper' 14 | require 'json' 15 | 16 | # Unit tests for Flagr::FlagApi 17 | # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) 18 | # Please update as you see appropriate 19 | describe 'FlagApi' do 20 | before do 21 | # run before each test 22 | @instance = Flagr::FlagApi.new 23 | end 24 | 25 | after do 26 | # run after each test 27 | end 28 | 29 | describe 'test an instance of FlagApi' do 30 | it 'should create an instance of FlagApi' do 31 | expect(@instance).to be_instance_of(Flagr::FlagApi) 32 | end 33 | end 34 | 35 | # unit tests for create_flag 36 | # 37 | # 38 | # @param body create a flag 39 | # @param [Hash] opts the optional parameters 40 | # @return [Flag] 41 | describe 'create_flag test' do 42 | it "should work" do 43 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 44 | end 45 | end 46 | 47 | # unit tests for delete_flag 48 | # 49 | # 50 | # @param flag_id numeric ID of the flag 51 | # @param [Hash] opts the optional parameters 52 | # @return [nil] 53 | describe 'delete_flag test' do 54 | it "should work" do 55 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 56 | end 57 | end 58 | 59 | # unit tests for find_flags 60 | # 61 | # 62 | # @param [Hash] opts the optional parameters 63 | # @return [Array] 64 | describe 'find_flags test' do 65 | it "should work" do 66 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 67 | end 68 | end 69 | 70 | # unit tests for get_flag 71 | # 72 | # 73 | # @param flag_id numeric ID of the flag to get 74 | # @param [Hash] opts the optional parameters 75 | # @return [Flag] 76 | describe 'get_flag test' do 77 | it "should work" do 78 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 79 | end 80 | end 81 | 82 | # unit tests for put_flag 83 | # 84 | # 85 | # @param flag_id numeric ID of the flag to get 86 | # @param body update a flag 87 | # @param [Hash] opts the optional parameters 88 | # @return [Flag] 89 | describe 'put_flag test' do 90 | it "should work" do 91 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 92 | end 93 | end 94 | 95 | # unit tests for set_flag_enabled 96 | # 97 | # 98 | # @param flag_id numeric ID of the flag to get 99 | # @param body set flag enabled state 100 | # @param [Hash] opts the optional parameters 101 | # @return [Flag] 102 | describe 'set_flag_enabled test' do 103 | it "should work" do 104 | # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers 105 | end 106 | end 107 | 108 | end 109 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) 2 | # Automatically generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) 3 | AllCops: 4 | TargetRubyVersion: 2.2 5 | # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop 6 | # to ignore them, so only the ones explicitly set in this file are enabled. 7 | DisabledByDefault: true 8 | Exclude: 9 | - '**/templates/**/*' 10 | - '**/vendor/**/*' 11 | - 'actionpack/lib/action_dispatch/journey/parser.rb' 12 | 13 | # Prefer &&/|| over and/or. 14 | Style/AndOr: 15 | Enabled: true 16 | 17 | # Do not use braces for hash literals when they are the last argument of a 18 | # method call. 19 | Style/BracesAroundHashParameters: 20 | Enabled: true 21 | EnforcedStyle: context_dependent 22 | 23 | # Align `when` with `case`. 24 | Layout/CaseIndentation: 25 | Enabled: true 26 | 27 | # Align comments with method definitions. 28 | Layout/CommentIndentation: 29 | Enabled: true 30 | 31 | Layout/ElseAlignment: 32 | Enabled: true 33 | 34 | Layout/EmptyLineAfterMagicComment: 35 | Enabled: true 36 | 37 | # In a regular class definition, no empty lines around the body. 38 | Layout/EmptyLinesAroundClassBody: 39 | Enabled: true 40 | 41 | # In a regular method definition, no empty lines around the body. 42 | Layout/EmptyLinesAroundMethodBody: 43 | Enabled: true 44 | 45 | # In a regular module definition, no empty lines around the body. 46 | Layout/EmptyLinesAroundModuleBody: 47 | Enabled: true 48 | 49 | Layout/FirstParameterIndentation: 50 | Enabled: true 51 | 52 | # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. 53 | Style/HashSyntax: 54 | Enabled: false 55 | 56 | # Method definitions after `private` or `protected` isolated calls need one 57 | # extra level of indentation. 58 | Layout/IndentationConsistency: 59 | Enabled: true 60 | EnforcedStyle: rails 61 | 62 | # Two spaces, no tabs (for indentation). 63 | Layout/IndentationWidth: 64 | Enabled: true 65 | 66 | Layout/LeadingCommentSpace: 67 | Enabled: true 68 | 69 | Layout/SpaceAfterColon: 70 | Enabled: true 71 | 72 | Layout/SpaceAfterComma: 73 | Enabled: true 74 | 75 | Layout/SpaceAroundEqualsInParameterDefault: 76 | Enabled: true 77 | 78 | Layout/SpaceAroundKeyword: 79 | Enabled: true 80 | 81 | Layout/SpaceAroundOperators: 82 | Enabled: true 83 | 84 | Layout/SpaceBeforeComma: 85 | Enabled: true 86 | 87 | Layout/SpaceBeforeFirstArg: 88 | Enabled: true 89 | 90 | Style/DefWithParentheses: 91 | Enabled: true 92 | 93 | # Defining a method with parameters needs parentheses. 94 | Style/MethodDefParentheses: 95 | Enabled: true 96 | 97 | Style/FrozenStringLiteralComment: 98 | Enabled: false 99 | EnforcedStyle: always 100 | 101 | # Use `foo {}` not `foo{}`. 102 | Layout/SpaceBeforeBlockBraces: 103 | Enabled: true 104 | 105 | # Use `foo { bar }` not `foo {bar}`. 106 | Layout/SpaceInsideBlockBraces: 107 | Enabled: true 108 | 109 | # Use `{ a: 1 }` not `{a:1}`. 110 | Layout/SpaceInsideHashLiteralBraces: 111 | Enabled: true 112 | 113 | Layout/SpaceInsideParens: 114 | Enabled: true 115 | 116 | # Check quotes usage according to lint rule below. 117 | #Style/StringLiterals: 118 | # Enabled: true 119 | # EnforcedStyle: single_quotes 120 | 121 | # Detect hard tabs, no hard tabs. 122 | Layout/Tab: 123 | Enabled: true 124 | 125 | # Blank lines should not have any spaces. 126 | Layout/TrailingBlankLines: 127 | Enabled: true 128 | 129 | # No trailing whitespace. 130 | Layout/TrailingWhitespace: 131 | Enabled: false 132 | 133 | # Use quotes for string literals when they are enough. 134 | Style/UnneededPercentQ: 135 | Enabled: true 136 | 137 | # Align `end` with the matching keyword or starting expression except for 138 | # assignments, where it should be aligned with the LHS. 139 | Lint/EndAlignment: 140 | Enabled: true 141 | EnforcedStyleAlignWith: variable 142 | AutoCorrect: true 143 | 144 | # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. 145 | Lint/RequireParentheses: 146 | Enabled: true 147 | 148 | Style/RedundantReturn: 149 | Enabled: true 150 | AllowMultipleReturnValues: true 151 | 152 | Style/Semicolon: 153 | Enabled: true 154 | AllowAsExpressionSeparator: true 155 | -------------------------------------------------------------------------------- /lib/rbflagr/api/export_api.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'uri' 14 | 15 | module Flagr 16 | class ExportApi 17 | attr_accessor :api_client 18 | 19 | def initialize(api_client = ApiClient.default) 20 | @api_client = api_client 21 | end 22 | # Export JSON format of the eval cache dump 23 | # @param [Hash] opts the optional parameters 24 | # @return [Object] 25 | def get_export_eval_cache_json(opts = {}) 26 | data, _status_code, _headers = get_export_eval_cache_json_with_http_info(opts) 27 | data 28 | end 29 | 30 | # Export JSON format of the eval cache dump 31 | # @param [Hash] opts the optional parameters 32 | # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers 33 | def get_export_eval_cache_json_with_http_info(opts = {}) 34 | if @api_client.config.debugging 35 | @api_client.config.logger.debug 'Calling API: ExportApi.get_export_eval_cache_json ...' 36 | end 37 | # resource path 38 | local_var_path = '/export/eval_cache/json' 39 | 40 | # query parameters 41 | query_params = {} 42 | 43 | # header parameters 44 | header_params = {} 45 | # HTTP header 'Accept' (if needed) 46 | header_params['Accept'] = @api_client.select_header_accept(['application/json']) 47 | # HTTP header 'Content-Type' 48 | header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) 49 | 50 | # form parameters 51 | form_params = {} 52 | 53 | # http body (model) 54 | post_body = nil 55 | auth_names = [] 56 | data, status_code, headers = @api_client.call_api(:GET, local_var_path, 57 | :header_params => header_params, 58 | :query_params => query_params, 59 | :form_params => form_params, 60 | :body => post_body, 61 | :auth_names => auth_names, 62 | :return_type => 'Object') 63 | if @api_client.config.debugging 64 | @api_client.config.logger.debug "API called: ExportApi#get_export_eval_cache_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" 65 | end 66 | return data, status_code, headers 67 | end 68 | # Export sqlite3 format of the db dump, which is converted from the main database. 69 | # @param [Hash] opts the optional parameters 70 | # @option opts [BOOLEAN] :exclude_snapshots export without snapshots data - useful for smaller db without snapshots 71 | # @return [File] 72 | def get_export_sqlite(opts = {}) 73 | data, _status_code, _headers = get_export_sqlite_with_http_info(opts) 74 | data 75 | end 76 | 77 | # Export sqlite3 format of the db dump, which is converted from the main database. 78 | # @param [Hash] opts the optional parameters 79 | # @option opts [BOOLEAN] :exclude_snapshots export without snapshots data - useful for smaller db without snapshots 80 | # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers 81 | def get_export_sqlite_with_http_info(opts = {}) 82 | if @api_client.config.debugging 83 | @api_client.config.logger.debug 'Calling API: ExportApi.get_export_sqlite ...' 84 | end 85 | # resource path 86 | local_var_path = '/export/sqlite' 87 | 88 | # query parameters 89 | query_params = {} 90 | query_params[:'exclude_snapshots'] = opts[:'exclude_snapshots'] if !opts[:'exclude_snapshots'].nil? 91 | 92 | # header parameters 93 | header_params = {} 94 | # HTTP header 'Accept' (if needed) 95 | header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) 96 | # HTTP header 'Content-Type' 97 | header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) 98 | 99 | # form parameters 100 | form_params = {} 101 | 102 | # http body (model) 103 | post_body = nil 104 | auth_names = [] 105 | data, status_code, headers = @api_client.call_api(:GET, local_var_path, 106 | :header_params => header_params, 107 | :query_params => query_params, 108 | :form_params => form_params, 109 | :body => post_body, 110 | :auth_names => auth_names, 111 | :return_type => 'File') 112 | if @api_client.config.debugging 113 | @api_client.config.logger.debug "API called: ExportApi#get_export_sqlite\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" 114 | end 115 | return data, status_code, headers 116 | end 117 | end 118 | end 119 | -------------------------------------------------------------------------------- /docs/TagApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::TagApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**create_tag**](TagApi.md#create_tag) | **POST** /flags/{flagID}/tags | 8 | [**delete_tag**](TagApi.md#delete_tag) | **DELETE** /flags/{flagID}/tags/{tagID} | 9 | [**find_all_tags**](TagApi.md#find_all_tags) | **GET** /tags | 10 | [**find_tags**](TagApi.md#find_tags) | **GET** /flags/{flagID}/tags | 11 | 12 | 13 | # **create_tag** 14 | > Tag create_tag(flag_id, body) 15 | 16 | 17 | 18 | ### Example 19 | ```ruby 20 | # load the gem 21 | require 'rbflagr' 22 | 23 | api_instance = Flagr::TagApi.new 24 | 25 | flag_id = 789 # Integer | numeric ID of the flag 26 | 27 | body = Flagr::CreateTagRequest.new # CreateTagRequest | create a tag 28 | 29 | 30 | begin 31 | result = api_instance.create_tag(flag_id, body) 32 | p result 33 | rescue Flagr::ApiError => e 34 | puts "Exception when calling TagApi->create_tag: #{e}" 35 | end 36 | ``` 37 | 38 | ### Parameters 39 | 40 | Name | Type | Description | Notes 41 | ------------- | ------------- | ------------- | ------------- 42 | **flag_id** | **Integer**| numeric ID of the flag | 43 | **body** | [**CreateTagRequest**](CreateTagRequest.md)| create a tag | 44 | 45 | ### Return type 46 | 47 | [**Tag**](Tag.md) 48 | 49 | ### Authorization 50 | 51 | No authorization required 52 | 53 | ### HTTP request headers 54 | 55 | - **Content-Type**: application/json 56 | - **Accept**: application/json 57 | 58 | 59 | 60 | # **delete_tag** 61 | > delete_tag(flag_id, tag_id) 62 | 63 | 64 | 65 | ### Example 66 | ```ruby 67 | # load the gem 68 | require 'rbflagr' 69 | 70 | api_instance = Flagr::TagApi.new 71 | 72 | flag_id = 789 # Integer | numeric ID of the flag 73 | 74 | tag_id = 789 # Integer | numeric ID of the tag 75 | 76 | 77 | begin 78 | api_instance.delete_tag(flag_id, tag_id) 79 | rescue Flagr::ApiError => e 80 | puts "Exception when calling TagApi->delete_tag: #{e}" 81 | end 82 | ``` 83 | 84 | ### Parameters 85 | 86 | Name | Type | Description | Notes 87 | ------------- | ------------- | ------------- | ------------- 88 | **flag_id** | **Integer**| numeric ID of the flag | 89 | **tag_id** | **Integer**| numeric ID of the tag | 90 | 91 | ### Return type 92 | 93 | nil (empty response body) 94 | 95 | ### Authorization 96 | 97 | No authorization required 98 | 99 | ### HTTP request headers 100 | 101 | - **Content-Type**: application/json 102 | - **Accept**: application/json 103 | 104 | 105 | 106 | # **find_all_tags** 107 | > Array<Tag> find_all_tags(opts) 108 | 109 | 110 | 111 | ### Example 112 | ```ruby 113 | # load the gem 114 | require 'rbflagr' 115 | 116 | api_instance = Flagr::TagApi.new 117 | 118 | opts = { 119 | limit: 789, # Integer | the numbers of tags to return 120 | offset: 789, # Integer | return tags given the offset, it should usually set together with limit 121 | value_like: 'value_like_example' # String | return tags partially matching given value 122 | } 123 | 124 | begin 125 | result = api_instance.find_all_tags(opts) 126 | p result 127 | rescue Flagr::ApiError => e 128 | puts "Exception when calling TagApi->find_all_tags: #{e}" 129 | end 130 | ``` 131 | 132 | ### Parameters 133 | 134 | Name | Type | Description | Notes 135 | ------------- | ------------- | ------------- | ------------- 136 | **limit** | **Integer**| the numbers of tags to return | [optional] 137 | **offset** | **Integer**| return tags given the offset, it should usually set together with limit | [optional] 138 | **value_like** | **String**| return tags partially matching given value | [optional] 139 | 140 | ### Return type 141 | 142 | [**Array<Tag>**](Tag.md) 143 | 144 | ### Authorization 145 | 146 | No authorization required 147 | 148 | ### HTTP request headers 149 | 150 | - **Content-Type**: application/json 151 | - **Accept**: application/json 152 | 153 | 154 | 155 | # **find_tags** 156 | > Array<Tag> find_tags(flag_id) 157 | 158 | 159 | 160 | ### Example 161 | ```ruby 162 | # load the gem 163 | require 'rbflagr' 164 | 165 | api_instance = Flagr::TagApi.new 166 | 167 | flag_id = 789 # Integer | numeric ID of the flag 168 | 169 | 170 | begin 171 | result = api_instance.find_tags(flag_id) 172 | p result 173 | rescue Flagr::ApiError => e 174 | puts "Exception when calling TagApi->find_tags: #{e}" 175 | end 176 | ``` 177 | 178 | ### Parameters 179 | 180 | Name | Type | Description | Notes 181 | ------------- | ------------- | ------------- | ------------- 182 | **flag_id** | **Integer**| numeric ID of the flag | 183 | 184 | ### Return type 185 | 186 | [**Array<Tag>**](Tag.md) 187 | 188 | ### Authorization 189 | 190 | No authorization required 191 | 192 | ### HTTP request headers 193 | 194 | - **Content-Type**: application/json 195 | - **Accept**: application/json 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /docs/VariantApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::VariantApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**create_variant**](VariantApi.md#create_variant) | **POST** /flags/{flagID}/variants | 8 | [**delete_variant**](VariantApi.md#delete_variant) | **DELETE** /flags/{flagID}/variants/{variantID} | 9 | [**find_variants**](VariantApi.md#find_variants) | **GET** /flags/{flagID}/variants | 10 | [**put_variant**](VariantApi.md#put_variant) | **PUT** /flags/{flagID}/variants/{variantID} | 11 | 12 | 13 | # **create_variant** 14 | > Variant create_variant(flag_id, body) 15 | 16 | 17 | 18 | ### Example 19 | ```ruby 20 | # load the gem 21 | require 'rbflagr' 22 | 23 | api_instance = Flagr::VariantApi.new 24 | 25 | flag_id = 789 # Integer | numeric ID of the flag 26 | 27 | body = Flagr::CreateVariantRequest.new # CreateVariantRequest | create a variant 28 | 29 | 30 | begin 31 | result = api_instance.create_variant(flag_id, body) 32 | p result 33 | rescue Flagr::ApiError => e 34 | puts "Exception when calling VariantApi->create_variant: #{e}" 35 | end 36 | ``` 37 | 38 | ### Parameters 39 | 40 | Name | Type | Description | Notes 41 | ------------- | ------------- | ------------- | ------------- 42 | **flag_id** | **Integer**| numeric ID of the flag | 43 | **body** | [**CreateVariantRequest**](CreateVariantRequest.md)| create a variant | 44 | 45 | ### Return type 46 | 47 | [**Variant**](Variant.md) 48 | 49 | ### Authorization 50 | 51 | No authorization required 52 | 53 | ### HTTP request headers 54 | 55 | - **Content-Type**: application/json 56 | - **Accept**: application/json 57 | 58 | 59 | 60 | # **delete_variant** 61 | > delete_variant(flag_id, variant_id) 62 | 63 | 64 | 65 | ### Example 66 | ```ruby 67 | # load the gem 68 | require 'rbflagr' 69 | 70 | api_instance = Flagr::VariantApi.new 71 | 72 | flag_id = 789 # Integer | numeric ID of the flag 73 | 74 | variant_id = 789 # Integer | numeric ID of the variant 75 | 76 | 77 | begin 78 | api_instance.delete_variant(flag_id, variant_id) 79 | rescue Flagr::ApiError => e 80 | puts "Exception when calling VariantApi->delete_variant: #{e}" 81 | end 82 | ``` 83 | 84 | ### Parameters 85 | 86 | Name | Type | Description | Notes 87 | ------------- | ------------- | ------------- | ------------- 88 | **flag_id** | **Integer**| numeric ID of the flag | 89 | **variant_id** | **Integer**| numeric ID of the variant | 90 | 91 | ### Return type 92 | 93 | nil (empty response body) 94 | 95 | ### Authorization 96 | 97 | No authorization required 98 | 99 | ### HTTP request headers 100 | 101 | - **Content-Type**: application/json 102 | - **Accept**: application/json 103 | 104 | 105 | 106 | # **find_variants** 107 | > Array<Variant> find_variants(flag_id) 108 | 109 | 110 | 111 | ### Example 112 | ```ruby 113 | # load the gem 114 | require 'rbflagr' 115 | 116 | api_instance = Flagr::VariantApi.new 117 | 118 | flag_id = 789 # Integer | numeric ID of the flag 119 | 120 | 121 | begin 122 | result = api_instance.find_variants(flag_id) 123 | p result 124 | rescue Flagr::ApiError => e 125 | puts "Exception when calling VariantApi->find_variants: #{e}" 126 | end 127 | ``` 128 | 129 | ### Parameters 130 | 131 | Name | Type | Description | Notes 132 | ------------- | ------------- | ------------- | ------------- 133 | **flag_id** | **Integer**| numeric ID of the flag | 134 | 135 | ### Return type 136 | 137 | [**Array<Variant>**](Variant.md) 138 | 139 | ### Authorization 140 | 141 | No authorization required 142 | 143 | ### HTTP request headers 144 | 145 | - **Content-Type**: application/json 146 | - **Accept**: application/json 147 | 148 | 149 | 150 | # **put_variant** 151 | > Variant put_variant(flag_id, variant_id, body) 152 | 153 | 154 | 155 | ### Example 156 | ```ruby 157 | # load the gem 158 | require 'rbflagr' 159 | 160 | api_instance = Flagr::VariantApi.new 161 | 162 | flag_id = 789 # Integer | numeric ID of the flag 163 | 164 | variant_id = 789 # Integer | numeric ID of the variant 165 | 166 | body = Flagr::PutVariantRequest.new # PutVariantRequest | update a variant 167 | 168 | 169 | begin 170 | result = api_instance.put_variant(flag_id, variant_id, body) 171 | p result 172 | rescue Flagr::ApiError => e 173 | puts "Exception when calling VariantApi->put_variant: #{e}" 174 | end 175 | ``` 176 | 177 | ### Parameters 178 | 179 | Name | Type | Description | Notes 180 | ------------- | ------------- | ------------- | ------------- 181 | **flag_id** | **Integer**| numeric ID of the flag | 182 | **variant_id** | **Integer**| numeric ID of the variant | 183 | **body** | [**PutVariantRequest**](PutVariantRequest.md)| update a variant | 184 | 185 | ### Return type 186 | 187 | [**Variant**](Variant.md) 188 | 189 | ### Authorization 190 | 191 | No authorization required 192 | 193 | ### HTTP request headers 194 | 195 | - **Content-Type**: application/json 196 | - **Accept**: application/json 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /lib/rbflagr/api/evaluation_api.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'uri' 14 | 15 | module Flagr 16 | class EvaluationApi 17 | attr_accessor :api_client 18 | 19 | def initialize(api_client = ApiClient.default) 20 | @api_client = api_client 21 | end 22 | # @param body evalution context 23 | # @param [Hash] opts the optional parameters 24 | # @return [EvalResult] 25 | def post_evaluation(body, opts = {}) 26 | data, _status_code, _headers = post_evaluation_with_http_info(body, opts) 27 | data 28 | end 29 | 30 | # @param body evalution context 31 | # @param [Hash] opts the optional parameters 32 | # @return [Array<(EvalResult, Fixnum, Hash)>] EvalResult data, response status code and response headers 33 | def post_evaluation_with_http_info(body, opts = {}) 34 | if @api_client.config.debugging 35 | @api_client.config.logger.debug 'Calling API: EvaluationApi.post_evaluation ...' 36 | end 37 | # verify the required parameter 'body' is set 38 | if @api_client.config.client_side_validation && body.nil? 39 | fail ArgumentError, "Missing the required parameter 'body' when calling EvaluationApi.post_evaluation" 40 | end 41 | # resource path 42 | local_var_path = '/evaluation' 43 | 44 | # query parameters 45 | query_params = {} 46 | 47 | # header parameters 48 | header_params = {} 49 | # HTTP header 'Accept' (if needed) 50 | header_params['Accept'] = @api_client.select_header_accept(['application/json']) 51 | # HTTP header 'Content-Type' 52 | header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) 53 | 54 | # form parameters 55 | form_params = {} 56 | 57 | # http body (model) 58 | post_body = @api_client.object_to_http_body(body) 59 | auth_names = [] 60 | data, status_code, headers = @api_client.call_api(:POST, local_var_path, 61 | :header_params => header_params, 62 | :query_params => query_params, 63 | :form_params => form_params, 64 | :body => post_body, 65 | :auth_names => auth_names, 66 | :return_type => 'EvalResult') 67 | if @api_client.config.debugging 68 | @api_client.config.logger.debug "API called: EvaluationApi#post_evaluation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" 69 | end 70 | return data, status_code, headers 71 | end 72 | # @param body evalution batch request 73 | # @param [Hash] opts the optional parameters 74 | # @return [EvaluationBatchResponse] 75 | def post_evaluation_batch(body, opts = {}) 76 | data, _status_code, _headers = post_evaluation_batch_with_http_info(body, opts) 77 | data 78 | end 79 | 80 | # @param body evalution batch request 81 | # @param [Hash] opts the optional parameters 82 | # @return [Array<(EvaluationBatchResponse, Fixnum, Hash)>] EvaluationBatchResponse data, response status code and response headers 83 | def post_evaluation_batch_with_http_info(body, opts = {}) 84 | if @api_client.config.debugging 85 | @api_client.config.logger.debug 'Calling API: EvaluationApi.post_evaluation_batch ...' 86 | end 87 | # verify the required parameter 'body' is set 88 | if @api_client.config.client_side_validation && body.nil? 89 | fail ArgumentError, "Missing the required parameter 'body' when calling EvaluationApi.post_evaluation_batch" 90 | end 91 | # resource path 92 | local_var_path = '/evaluation/batch' 93 | 94 | # query parameters 95 | query_params = {} 96 | 97 | # header parameters 98 | header_params = {} 99 | # HTTP header 'Accept' (if needed) 100 | header_params['Accept'] = @api_client.select_header_accept(['application/json']) 101 | # HTTP header 'Content-Type' 102 | header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) 103 | 104 | # form parameters 105 | form_params = {} 106 | 107 | # http body (model) 108 | post_body = @api_client.object_to_http_body(body) 109 | auth_names = [] 110 | data, status_code, headers = @api_client.call_api(:POST, local_var_path, 111 | :header_params => header_params, 112 | :query_params => query_params, 113 | :form_params => form_params, 114 | :body => post_body, 115 | :auth_names => auth_names, 116 | :return_type => 'EvaluationBatchResponse') 117 | if @api_client.config.debugging 118 | @api_client.config.logger.debug "API called: EvaluationApi#post_evaluation_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" 119 | end 120 | return data, status_code, headers 121 | end 122 | end 123 | end 124 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice 5 | 6 | OpenAPI spec version: 1.0.0 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.3.0-SNAPSHOT 10 | 11 | =end 12 | 13 | # load the gem 14 | require 'rbflagr' 15 | 16 | # The following was generated by the `rspec --init` command. Conventionally, all 17 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 18 | # The generated `.rspec` file contains `--require spec_helper` which will cause 19 | # this file to always be loaded, without a need to explicitly require it in any 20 | # files. 21 | # 22 | # Given that it is always loaded, you are encouraged to keep this file as 23 | # light-weight as possible. Requiring heavyweight dependencies from this file 24 | # will add to the boot time of your test suite on EVERY test run, even for an 25 | # individual file that may not need all of that loaded. Instead, consider making 26 | # a separate helper file that requires the additional dependencies and performs 27 | # the additional setup, and require it from the spec files that actually need 28 | # it. 29 | # 30 | # The `.rspec` file also contains a few flags that are not defaults but that 31 | # users commonly want. 32 | # 33 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 34 | RSpec.configure do |config| 35 | # rspec-expectations config goes here. You can use an alternate 36 | # assertion/expectation library such as wrong or the stdlib/minitest 37 | # assertions if you prefer. 38 | config.expect_with :rspec do |expectations| 39 | # This option will default to `true` in RSpec 4. It makes the `description` 40 | # and `failure_message` of custom matchers include text for helper methods 41 | # defined using `chain`, e.g.: 42 | # be_bigger_than(2).and_smaller_than(4).description 43 | # # => "be bigger than 2 and smaller than 4" 44 | # ...rather than: 45 | # # => "be bigger than 2" 46 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 47 | end 48 | 49 | # rspec-mocks config goes here. You can use an alternate test double 50 | # library (such as bogus or mocha) by changing the `mock_with` option here. 51 | config.mock_with :rspec do |mocks| 52 | # Prevents you from mocking or stubbing a method that does not exist on 53 | # a real object. This is generally recommended, and will default to 54 | # `true` in RSpec 4. 55 | mocks.verify_partial_doubles = true 56 | end 57 | 58 | # The settings below are suggested to provide a good initial experience 59 | # with RSpec, but feel free to customize to your heart's content. 60 | =begin 61 | # These two settings work together to allow you to limit a spec run 62 | # to individual examples or groups you care about by tagging them with 63 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 64 | # get run. 65 | config.filter_run :focus 66 | config.run_all_when_everything_filtered = true 67 | 68 | # Allows RSpec to persist some state between runs in order to support 69 | # the `--only-failures` and `--next-failure` CLI options. We recommend 70 | # you configure your source control system to ignore this file. 71 | config.example_status_persistence_file_path = "spec/examples.txt" 72 | 73 | # Limits the available syntax to the non-monkey patched syntax that is 74 | # recommended. For more details, see: 75 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 76 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 77 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 78 | config.disable_monkey_patching! 79 | 80 | # This setting enables warnings. It's recommended, but in some cases may 81 | # be too noisy due to issues in dependencies. 82 | config.warnings = true 83 | 84 | # Many RSpec users commonly either run the entire suite or an individual 85 | # file, and it's useful to allow more verbose output when running an 86 | # individual spec file. 87 | if config.files_to_run.one? 88 | # Use the documentation formatter for detailed output, 89 | # unless a formatter has already been configured 90 | # (e.g. via a command-line flag). 91 | config.default_formatter = 'doc' 92 | end 93 | 94 | # Print the 10 slowest examples and example groups at the 95 | # end of the spec run, to help surface which specs are running 96 | # particularly slow. 97 | config.profile_examples = 10 98 | 99 | # Run specs in random order to surface order dependencies. If you find an 100 | # order dependency and want to debug it, you can fix the order by providing 101 | # the seed, which is printed after each run. 102 | # --seed 1234 103 | config.order = :random 104 | 105 | # Seed global randomization in this process using the `--seed` CLI option. 106 | # Setting this allows you to use `--seed` to deterministically reproduce 107 | # test failures related to randomization by passing the same `--seed` value 108 | # as the one that triggered the failure. 109 | Kernel.srand config.seed 110 | =end 111 | end 112 | -------------------------------------------------------------------------------- /docs/ConstraintApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::ConstraintApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**create_constraint**](ConstraintApi.md#create_constraint) | **POST** /flags/{flagID}/segments/{segmentID}/constraints | 8 | [**delete_constraint**](ConstraintApi.md#delete_constraint) | **DELETE** /flags/{flagID}/segments/{segmentID}/constraints/{constraintID} | 9 | [**find_constraints**](ConstraintApi.md#find_constraints) | **GET** /flags/{flagID}/segments/{segmentID}/constraints | 10 | [**put_constraint**](ConstraintApi.md#put_constraint) | **PUT** /flags/{flagID}/segments/{segmentID}/constraints/{constraintID} | 11 | 12 | 13 | # **create_constraint** 14 | > Constraint create_constraint(flag_id, segment_id, body) 15 | 16 | 17 | 18 | ### Example 19 | ```ruby 20 | # load the gem 21 | require 'rbflagr' 22 | 23 | api_instance = Flagr::ConstraintApi.new 24 | 25 | flag_id = 789 # Integer | numeric ID of the flag 26 | 27 | segment_id = 789 # Integer | numeric ID of the segment 28 | 29 | body = Flagr::CreateConstraintRequest.new # CreateConstraintRequest | create a constraint 30 | 31 | 32 | begin 33 | result = api_instance.create_constraint(flag_id, segment_id, body) 34 | p result 35 | rescue Flagr::ApiError => e 36 | puts "Exception when calling ConstraintApi->create_constraint: #{e}" 37 | end 38 | ``` 39 | 40 | ### Parameters 41 | 42 | Name | Type | Description | Notes 43 | ------------- | ------------- | ------------- | ------------- 44 | **flag_id** | **Integer**| numeric ID of the flag | 45 | **segment_id** | **Integer**| numeric ID of the segment | 46 | **body** | [**CreateConstraintRequest**](CreateConstraintRequest.md)| create a constraint | 47 | 48 | ### Return type 49 | 50 | [**Constraint**](Constraint.md) 51 | 52 | ### Authorization 53 | 54 | No authorization required 55 | 56 | ### HTTP request headers 57 | 58 | - **Content-Type**: application/json 59 | - **Accept**: application/json 60 | 61 | 62 | 63 | # **delete_constraint** 64 | > delete_constraint(flag_id, segment_id, constraint_id) 65 | 66 | 67 | 68 | ### Example 69 | ```ruby 70 | # load the gem 71 | require 'rbflagr' 72 | 73 | api_instance = Flagr::ConstraintApi.new 74 | 75 | flag_id = 789 # Integer | numeric ID of the flag 76 | 77 | segment_id = 789 # Integer | numeric ID of the segment 78 | 79 | constraint_id = 789 # Integer | numeric ID of the constraint 80 | 81 | 82 | begin 83 | api_instance.delete_constraint(flag_id, segment_id, constraint_id) 84 | rescue Flagr::ApiError => e 85 | puts "Exception when calling ConstraintApi->delete_constraint: #{e}" 86 | end 87 | ``` 88 | 89 | ### Parameters 90 | 91 | Name | Type | Description | Notes 92 | ------------- | ------------- | ------------- | ------------- 93 | **flag_id** | **Integer**| numeric ID of the flag | 94 | **segment_id** | **Integer**| numeric ID of the segment | 95 | **constraint_id** | **Integer**| numeric ID of the constraint | 96 | 97 | ### Return type 98 | 99 | nil (empty response body) 100 | 101 | ### Authorization 102 | 103 | No authorization required 104 | 105 | ### HTTP request headers 106 | 107 | - **Content-Type**: application/json 108 | - **Accept**: application/json 109 | 110 | 111 | 112 | # **find_constraints** 113 | > Array<Constraint> find_constraints(flag_id, segment_id) 114 | 115 | 116 | 117 | ### Example 118 | ```ruby 119 | # load the gem 120 | require 'rbflagr' 121 | 122 | api_instance = Flagr::ConstraintApi.new 123 | 124 | flag_id = 789 # Integer | numeric ID of the flag 125 | 126 | segment_id = 789 # Integer | numeric ID of the segment 127 | 128 | 129 | begin 130 | result = api_instance.find_constraints(flag_id, segment_id) 131 | p result 132 | rescue Flagr::ApiError => e 133 | puts "Exception when calling ConstraintApi->find_constraints: #{e}" 134 | end 135 | ``` 136 | 137 | ### Parameters 138 | 139 | Name | Type | Description | Notes 140 | ------------- | ------------- | ------------- | ------------- 141 | **flag_id** | **Integer**| numeric ID of the flag | 142 | **segment_id** | **Integer**| numeric ID of the segment | 143 | 144 | ### Return type 145 | 146 | [**Array<Constraint>**](Constraint.md) 147 | 148 | ### Authorization 149 | 150 | No authorization required 151 | 152 | ### HTTP request headers 153 | 154 | - **Content-Type**: application/json 155 | - **Accept**: application/json 156 | 157 | 158 | 159 | # **put_constraint** 160 | > Constraint put_constraint(flag_id, segment_id, constraint_id, body) 161 | 162 | 163 | 164 | ### Example 165 | ```ruby 166 | # load the gem 167 | require 'rbflagr' 168 | 169 | api_instance = Flagr::ConstraintApi.new 170 | 171 | flag_id = 789 # Integer | numeric ID of the flag 172 | 173 | segment_id = 789 # Integer | numeric ID of the segment 174 | 175 | constraint_id = 789 # Integer | numeric ID of the constraint 176 | 177 | body = Flagr::CreateConstraintRequest.new # CreateConstraintRequest | create a constraint 178 | 179 | 180 | begin 181 | result = api_instance.put_constraint(flag_id, segment_id, constraint_id, body) 182 | p result 183 | rescue Flagr::ApiError => e 184 | puts "Exception when calling ConstraintApi->put_constraint: #{e}" 185 | end 186 | ``` 187 | 188 | ### Parameters 189 | 190 | Name | Type | Description | Notes 191 | ------------- | ------------- | ------------- | ------------- 192 | **flag_id** | **Integer**| numeric ID of the flag | 193 | **segment_id** | **Integer**| numeric ID of the segment | 194 | **constraint_id** | **Integer**| numeric ID of the constraint | 195 | **body** | [**CreateConstraintRequest**](CreateConstraintRequest.md)| create a constraint | 196 | 197 | ### Return type 198 | 199 | [**Constraint**](Constraint.md) 200 | 201 | ### Authorization 202 | 203 | No authorization required 204 | 205 | ### HTTP request headers 206 | 207 | - **Content-Type**: application/json 208 | - **Accept**: application/json 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /lib/rbflagr/models/health.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class Health 17 | attr_accessor :status 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'status' => :'status' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'status' => :'String' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'status') 42 | self.status = attributes[:'status'] 43 | end 44 | end 45 | 46 | # Show invalid properties with the reasons. Usually used together with valid? 47 | # @return Array for valid properties with the reasons 48 | def list_invalid_properties 49 | invalid_properties = Array.new 50 | invalid_properties 51 | end 52 | 53 | # Check to see if the all the properties in the model are valid 54 | # @return true if the model is valid 55 | def valid? 56 | true 57 | end 58 | 59 | # Checks equality by comparing each attribute. 60 | # @param [Object] Object to be compared 61 | def ==(o) 62 | return true if self.equal?(o) 63 | self.class == o.class && 64 | status == o.status 65 | end 66 | 67 | # @see the `==` method 68 | # @param [Object] Object to be compared 69 | def eql?(o) 70 | self == o 71 | end 72 | 73 | # Calculates hash code according to all attributes. 74 | # @return [Fixnum] Hash code 75 | def hash 76 | [status].hash 77 | end 78 | 79 | # Builds the object from hash 80 | # @param [Hash] attributes Model attributes in the form of hash 81 | # @return [Object] Returns the model itself 82 | def build_from_hash(attributes) 83 | return nil unless attributes.is_a?(Hash) 84 | self.class.swagger_types.each_pair do |key, type| 85 | if type =~ /\AArray<(.*)>/i 86 | # check to ensure the input is an array given that the attribute 87 | # is documented as an array but the input is not 88 | if attributes[self.class.attribute_map[key]].is_a?(Array) 89 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 90 | end 91 | elsif !attributes[self.class.attribute_map[key]].nil? 92 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 93 | end # or else data not found in attributes(hash), not an issue as the data can be optional 94 | end 95 | 96 | self 97 | end 98 | 99 | # Deserializes the data based on type 100 | # @param string type Data type 101 | # @param string value Value to be deserialized 102 | # @return [Object] Deserialized data 103 | def _deserialize(type, value) 104 | case type.to_sym 105 | when :DateTime 106 | DateTime.parse(value) 107 | when :Date 108 | Date.parse(value) 109 | when :String 110 | value.to_s 111 | when :Integer 112 | value.to_i 113 | when :Float 114 | value.to_f 115 | when :BOOLEAN 116 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 117 | true 118 | else 119 | false 120 | end 121 | when :Object 122 | # generic object (usually a Hash), return directly 123 | value 124 | when /\AArray<(?.+)>\z/ 125 | inner_type = Regexp.last_match[:inner_type] 126 | value.map { |v| _deserialize(inner_type, v) } 127 | when /\AHash<(?.+?), (?.+)>\z/ 128 | k_type = Regexp.last_match[:k_type] 129 | v_type = Regexp.last_match[:v_type] 130 | {}.tap do |hash| 131 | value.each do |k, v| 132 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 133 | end 134 | end 135 | else # model 136 | temp_model = Flagr.const_get(type).new 137 | temp_model.build_from_hash(value) 138 | end 139 | end 140 | 141 | # Returns the string representation of the object 142 | # @return [String] String presentation of the object 143 | def to_s 144 | to_hash.to_s 145 | end 146 | 147 | # to_body is an alias to to_hash (backward compatibility) 148 | # @return [Hash] Returns the object in the form of hash 149 | def to_body 150 | to_hash 151 | end 152 | 153 | # Returns the object in the form of hash 154 | # @return [Hash] Returns the object in the form of hash 155 | def to_hash 156 | hash = {} 157 | self.class.attribute_map.each_pair do |attr, param| 158 | value = self.send(attr) 159 | next if value.nil? 160 | hash[param] = _to_hash(value) 161 | end 162 | hash 163 | end 164 | 165 | # Outputs non-array value in the form of hash 166 | # For object, use to_hash. Otherwise, just return the value 167 | # @param [Object] value Any valid value 168 | # @return [Hash] Returns the value in the form of hash 169 | def _to_hash(value) 170 | if value.is_a?(Array) 171 | value.compact.map { |v| _to_hash(v) } 172 | elsif value.is_a?(Hash) 173 | {}.tap do |hash| 174 | value.each { |k, v| hash[k] = _to_hash(v) } 175 | end 176 | elsif value.respond_to? :to_hash 177 | value.to_hash 178 | else 179 | value 180 | end 181 | end 182 | 183 | end 184 | end 185 | -------------------------------------------------------------------------------- /lib/rbflagr/models/set_flag_enabled_request.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class SetFlagEnabledRequest 17 | attr_accessor :enabled 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'enabled' => :'enabled' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'enabled' => :'BOOLEAN' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'enabled') 42 | self.enabled = attributes[:'enabled'] 43 | end 44 | end 45 | 46 | # Show invalid properties with the reasons. Usually used together with valid? 47 | # @return Array for valid properties with the reasons 48 | def list_invalid_properties 49 | invalid_properties = Array.new 50 | if @enabled.nil? 51 | invalid_properties.push('invalid value for "enabled", enabled cannot be nil.') 52 | end 53 | 54 | invalid_properties 55 | end 56 | 57 | # Check to see if the all the properties in the model are valid 58 | # @return true if the model is valid 59 | def valid? 60 | return false if @enabled.nil? 61 | true 62 | end 63 | 64 | # Checks equality by comparing each attribute. 65 | # @param [Object] Object to be compared 66 | def ==(o) 67 | return true if self.equal?(o) 68 | self.class == o.class && 69 | enabled == o.enabled 70 | end 71 | 72 | # @see the `==` method 73 | # @param [Object] Object to be compared 74 | def eql?(o) 75 | self == o 76 | end 77 | 78 | # Calculates hash code according to all attributes. 79 | # @return [Fixnum] Hash code 80 | def hash 81 | [enabled].hash 82 | end 83 | 84 | # Builds the object from hash 85 | # @param [Hash] attributes Model attributes in the form of hash 86 | # @return [Object] Returns the model itself 87 | def build_from_hash(attributes) 88 | return nil unless attributes.is_a?(Hash) 89 | self.class.swagger_types.each_pair do |key, type| 90 | if type =~ /\AArray<(.*)>/i 91 | # check to ensure the input is an array given that the attribute 92 | # is documented as an array but the input is not 93 | if attributes[self.class.attribute_map[key]].is_a?(Array) 94 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 95 | end 96 | elsif !attributes[self.class.attribute_map[key]].nil? 97 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 98 | end # or else data not found in attributes(hash), not an issue as the data can be optional 99 | end 100 | 101 | self 102 | end 103 | 104 | # Deserializes the data based on type 105 | # @param string type Data type 106 | # @param string value Value to be deserialized 107 | # @return [Object] Deserialized data 108 | def _deserialize(type, value) 109 | case type.to_sym 110 | when :DateTime 111 | DateTime.parse(value) 112 | when :Date 113 | Date.parse(value) 114 | when :String 115 | value.to_s 116 | when :Integer 117 | value.to_i 118 | when :Float 119 | value.to_f 120 | when :BOOLEAN 121 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 122 | true 123 | else 124 | false 125 | end 126 | when :Object 127 | # generic object (usually a Hash), return directly 128 | value 129 | when /\AArray<(?.+)>\z/ 130 | inner_type = Regexp.last_match[:inner_type] 131 | value.map { |v| _deserialize(inner_type, v) } 132 | when /\AHash<(?.+?), (?.+)>\z/ 133 | k_type = Regexp.last_match[:k_type] 134 | v_type = Regexp.last_match[:v_type] 135 | {}.tap do |hash| 136 | value.each do |k, v| 137 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 138 | end 139 | end 140 | else # model 141 | temp_model = Flagr.const_get(type).new 142 | temp_model.build_from_hash(value) 143 | end 144 | end 145 | 146 | # Returns the string representation of the object 147 | # @return [String] String presentation of the object 148 | def to_s 149 | to_hash.to_s 150 | end 151 | 152 | # to_body is an alias to to_hash (backward compatibility) 153 | # @return [Hash] Returns the object in the form of hash 154 | def to_body 155 | to_hash 156 | end 157 | 158 | # Returns the object in the form of hash 159 | # @return [Hash] Returns the object in the form of hash 160 | def to_hash 161 | hash = {} 162 | self.class.attribute_map.each_pair do |attr, param| 163 | value = self.send(attr) 164 | next if value.nil? 165 | hash[param] = _to_hash(value) 166 | end 167 | hash 168 | end 169 | 170 | # Outputs non-array value in the form of hash 171 | # For object, use to_hash. Otherwise, just return the value 172 | # @param [Object] value Any valid value 173 | # @return [Hash] Returns the value in the form of hash 174 | def _to_hash(value) 175 | if value.is_a?(Array) 176 | value.compact.map { |v| _to_hash(v) } 177 | elsif value.is_a?(Hash) 178 | {}.tap do |hash| 179 | value.each { |k, v| hash[k] = _to_hash(v) } 180 | end 181 | elsif value.respond_to? :to_hash 182 | value.to_hash 183 | else 184 | value 185 | end 186 | end 187 | 188 | end 189 | end 190 | -------------------------------------------------------------------------------- /docs/SegmentApi.md: -------------------------------------------------------------------------------- 1 | # Flagr::SegmentApi 2 | 3 | All URIs are relative to *http://localhost/api/v1* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**create_segment**](SegmentApi.md#create_segment) | **POST** /flags/{flagID}/segments | 8 | [**delete_segment**](SegmentApi.md#delete_segment) | **DELETE** /flags/{flagID}/segments/{segmentID} | 9 | [**find_segments**](SegmentApi.md#find_segments) | **GET** /flags/{flagID}/segments | 10 | [**put_segment**](SegmentApi.md#put_segment) | **PUT** /flags/{flagID}/segments/{segmentID} | 11 | [**put_segments_reorder**](SegmentApi.md#put_segments_reorder) | **PUT** /flags/{flagID}/segments/reorder | 12 | 13 | 14 | # **create_segment** 15 | > Segment create_segment(flag_id, body) 16 | 17 | 18 | 19 | ### Example 20 | ```ruby 21 | # load the gem 22 | require 'rbflagr' 23 | 24 | api_instance = Flagr::SegmentApi.new 25 | 26 | flag_id = 789 # Integer | numeric ID of the flag to get 27 | 28 | body = Flagr::CreateSegmentRequest.new # CreateSegmentRequest | create a segment under a flag 29 | 30 | 31 | begin 32 | result = api_instance.create_segment(flag_id, body) 33 | p result 34 | rescue Flagr::ApiError => e 35 | puts "Exception when calling SegmentApi->create_segment: #{e}" 36 | end 37 | ``` 38 | 39 | ### Parameters 40 | 41 | Name | Type | Description | Notes 42 | ------------- | ------------- | ------------- | ------------- 43 | **flag_id** | **Integer**| numeric ID of the flag to get | 44 | **body** | [**CreateSegmentRequest**](CreateSegmentRequest.md)| create a segment under a flag | 45 | 46 | ### Return type 47 | 48 | [**Segment**](Segment.md) 49 | 50 | ### Authorization 51 | 52 | No authorization required 53 | 54 | ### HTTP request headers 55 | 56 | - **Content-Type**: application/json 57 | - **Accept**: application/json 58 | 59 | 60 | 61 | # **delete_segment** 62 | > delete_segment(flag_id, segment_id) 63 | 64 | 65 | 66 | ### Example 67 | ```ruby 68 | # load the gem 69 | require 'rbflagr' 70 | 71 | api_instance = Flagr::SegmentApi.new 72 | 73 | flag_id = 789 # Integer | numeric ID of the flag 74 | 75 | segment_id = 789 # Integer | numeric ID of the segment 76 | 77 | 78 | begin 79 | api_instance.delete_segment(flag_id, segment_id) 80 | rescue Flagr::ApiError => e 81 | puts "Exception when calling SegmentApi->delete_segment: #{e}" 82 | end 83 | ``` 84 | 85 | ### Parameters 86 | 87 | Name | Type | Description | Notes 88 | ------------- | ------------- | ------------- | ------------- 89 | **flag_id** | **Integer**| numeric ID of the flag | 90 | **segment_id** | **Integer**| numeric ID of the segment | 91 | 92 | ### Return type 93 | 94 | nil (empty response body) 95 | 96 | ### Authorization 97 | 98 | No authorization required 99 | 100 | ### HTTP request headers 101 | 102 | - **Content-Type**: application/json 103 | - **Accept**: application/json 104 | 105 | 106 | 107 | # **find_segments** 108 | > Array<Segment> find_segments(flag_id) 109 | 110 | 111 | 112 | ### Example 113 | ```ruby 114 | # load the gem 115 | require 'rbflagr' 116 | 117 | api_instance = Flagr::SegmentApi.new 118 | 119 | flag_id = 789 # Integer | numeric ID of the flag to get 120 | 121 | 122 | begin 123 | result = api_instance.find_segments(flag_id) 124 | p result 125 | rescue Flagr::ApiError => e 126 | puts "Exception when calling SegmentApi->find_segments: #{e}" 127 | end 128 | ``` 129 | 130 | ### Parameters 131 | 132 | Name | Type | Description | Notes 133 | ------------- | ------------- | ------------- | ------------- 134 | **flag_id** | **Integer**| numeric ID of the flag to get | 135 | 136 | ### Return type 137 | 138 | [**Array<Segment>**](Segment.md) 139 | 140 | ### Authorization 141 | 142 | No authorization required 143 | 144 | ### HTTP request headers 145 | 146 | - **Content-Type**: application/json 147 | - **Accept**: application/json 148 | 149 | 150 | 151 | # **put_segment** 152 | > Segment put_segment(flag_id, segment_id, body) 153 | 154 | 155 | 156 | ### Example 157 | ```ruby 158 | # load the gem 159 | require 'rbflagr' 160 | 161 | api_instance = Flagr::SegmentApi.new 162 | 163 | flag_id = 789 # Integer | numeric ID of the flag 164 | 165 | segment_id = 789 # Integer | numeric ID of the segment 166 | 167 | body = Flagr::PutSegmentRequest.new # PutSegmentRequest | update a segment 168 | 169 | 170 | begin 171 | result = api_instance.put_segment(flag_id, segment_id, body) 172 | p result 173 | rescue Flagr::ApiError => e 174 | puts "Exception when calling SegmentApi->put_segment: #{e}" 175 | end 176 | ``` 177 | 178 | ### Parameters 179 | 180 | Name | Type | Description | Notes 181 | ------------- | ------------- | ------------- | ------------- 182 | **flag_id** | **Integer**| numeric ID of the flag | 183 | **segment_id** | **Integer**| numeric ID of the segment | 184 | **body** | [**PutSegmentRequest**](PutSegmentRequest.md)| update a segment | 185 | 186 | ### Return type 187 | 188 | [**Segment**](Segment.md) 189 | 190 | ### Authorization 191 | 192 | No authorization required 193 | 194 | ### HTTP request headers 195 | 196 | - **Content-Type**: application/json 197 | - **Accept**: application/json 198 | 199 | 200 | 201 | # **put_segments_reorder** 202 | > put_segments_reorder(flag_id, body) 203 | 204 | 205 | 206 | ### Example 207 | ```ruby 208 | # load the gem 209 | require 'rbflagr' 210 | 211 | api_instance = Flagr::SegmentApi.new 212 | 213 | flag_id = 789 # Integer | numeric ID of the flag 214 | 215 | body = Flagr::PutSegmentReorderRequest.new # PutSegmentReorderRequest | reorder segments 216 | 217 | 218 | begin 219 | api_instance.put_segments_reorder(flag_id, body) 220 | rescue Flagr::ApiError => e 221 | puts "Exception when calling SegmentApi->put_segments_reorder: #{e}" 222 | end 223 | ``` 224 | 225 | ### Parameters 226 | 227 | Name | Type | Description | Notes 228 | ------------- | ------------- | ------------- | ------------- 229 | **flag_id** | **Integer**| numeric ID of the flag | 230 | **body** | [**PutSegmentReorderRequest**](PutSegmentReorderRequest.md)| reorder segments | 231 | 232 | ### Return type 233 | 234 | nil (empty response body) 235 | 236 | ### Authorization 237 | 238 | No authorization required 239 | 240 | ### HTTP request headers 241 | 242 | - **Content-Type**: application/json 243 | - **Accept**: application/json 244 | 245 | 246 | 247 | -------------------------------------------------------------------------------- /lib/rbflagr/models/put_segment_reorder_request.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class PutSegmentReorderRequest 17 | attr_accessor :segment_i_ds 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'segment_i_ds' => :'segmentIDs' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'segment_i_ds' => :'Array' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'segmentIDs') 42 | if (value = attributes[:'segmentIDs']).is_a?(Array) 43 | self.segment_i_ds = value 44 | end 45 | end 46 | end 47 | 48 | # Show invalid properties with the reasons. Usually used together with valid? 49 | # @return Array for valid properties with the reasons 50 | def list_invalid_properties 51 | invalid_properties = Array.new 52 | if @segment_i_ds.nil? 53 | invalid_properties.push('invalid value for "segment_i_ds", segment_i_ds cannot be nil.') 54 | end 55 | 56 | invalid_properties 57 | end 58 | 59 | # Check to see if the all the properties in the model are valid 60 | # @return true if the model is valid 61 | def valid? 62 | return false if @segment_i_ds.nil? 63 | true 64 | end 65 | 66 | # Checks equality by comparing each attribute. 67 | # @param [Object] Object to be compared 68 | def ==(o) 69 | return true if self.equal?(o) 70 | self.class == o.class && 71 | segment_i_ds == o.segment_i_ds 72 | end 73 | 74 | # @see the `==` method 75 | # @param [Object] Object to be compared 76 | def eql?(o) 77 | self == o 78 | end 79 | 80 | # Calculates hash code according to all attributes. 81 | # @return [Fixnum] Hash code 82 | def hash 83 | [segment_i_ds].hash 84 | end 85 | 86 | # Builds the object from hash 87 | # @param [Hash] attributes Model attributes in the form of hash 88 | # @return [Object] Returns the model itself 89 | def build_from_hash(attributes) 90 | return nil unless attributes.is_a?(Hash) 91 | self.class.swagger_types.each_pair do |key, type| 92 | if type =~ /\AArray<(.*)>/i 93 | # check to ensure the input is an array given that the attribute 94 | # is documented as an array but the input is not 95 | if attributes[self.class.attribute_map[key]].is_a?(Array) 96 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 97 | end 98 | elsif !attributes[self.class.attribute_map[key]].nil? 99 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 100 | end # or else data not found in attributes(hash), not an issue as the data can be optional 101 | end 102 | 103 | self 104 | end 105 | 106 | # Deserializes the data based on type 107 | # @param string type Data type 108 | # @param string value Value to be deserialized 109 | # @return [Object] Deserialized data 110 | def _deserialize(type, value) 111 | case type.to_sym 112 | when :DateTime 113 | DateTime.parse(value) 114 | when :Date 115 | Date.parse(value) 116 | when :String 117 | value.to_s 118 | when :Integer 119 | value.to_i 120 | when :Float 121 | value.to_f 122 | when :BOOLEAN 123 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 124 | true 125 | else 126 | false 127 | end 128 | when :Object 129 | # generic object (usually a Hash), return directly 130 | value 131 | when /\AArray<(?.+)>\z/ 132 | inner_type = Regexp.last_match[:inner_type] 133 | value.map { |v| _deserialize(inner_type, v) } 134 | when /\AHash<(?.+?), (?.+)>\z/ 135 | k_type = Regexp.last_match[:k_type] 136 | v_type = Regexp.last_match[:v_type] 137 | {}.tap do |hash| 138 | value.each do |k, v| 139 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 140 | end 141 | end 142 | else # model 143 | temp_model = Flagr.const_get(type).new 144 | temp_model.build_from_hash(value) 145 | end 146 | end 147 | 148 | # Returns the string representation of the object 149 | # @return [String] String presentation of the object 150 | def to_s 151 | to_hash.to_s 152 | end 153 | 154 | # to_body is an alias to to_hash (backward compatibility) 155 | # @return [Hash] Returns the object in the form of hash 156 | def to_body 157 | to_hash 158 | end 159 | 160 | # Returns the object in the form of hash 161 | # @return [Hash] Returns the object in the form of hash 162 | def to_hash 163 | hash = {} 164 | self.class.attribute_map.each_pair do |attr, param| 165 | value = self.send(attr) 166 | next if value.nil? 167 | hash[param] = _to_hash(value) 168 | end 169 | hash 170 | end 171 | 172 | # Outputs non-array value in the form of hash 173 | # For object, use to_hash. Otherwise, just return the value 174 | # @param [Object] value Any valid value 175 | # @return [Hash] Returns the value in the form of hash 176 | def _to_hash(value) 177 | if value.is_a?(Array) 178 | value.compact.map { |v| _to_hash(v) } 179 | elsif value.is_a?(Hash) 180 | {}.tap do |hash| 181 | value.each { |k, v| hash[k] = _to_hash(v) } 182 | end 183 | elsif value.respond_to? :to_hash 184 | value.to_hash 185 | else 186 | value 187 | end 188 | end 189 | 190 | end 191 | end 192 | -------------------------------------------------------------------------------- /lib/rbflagr/models/put_distributions_request.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class PutDistributionsRequest 17 | attr_accessor :distributions 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'distributions' => :'distributions' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'distributions' => :'Array' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'distributions') 42 | if (value = attributes[:'distributions']).is_a?(Array) 43 | self.distributions = value 44 | end 45 | end 46 | end 47 | 48 | # Show invalid properties with the reasons. Usually used together with valid? 49 | # @return Array for valid properties with the reasons 50 | def list_invalid_properties 51 | invalid_properties = Array.new 52 | if @distributions.nil? 53 | invalid_properties.push('invalid value for "distributions", distributions cannot be nil.') 54 | end 55 | 56 | invalid_properties 57 | end 58 | 59 | # Check to see if the all the properties in the model are valid 60 | # @return true if the model is valid 61 | def valid? 62 | return false if @distributions.nil? 63 | true 64 | end 65 | 66 | # Checks equality by comparing each attribute. 67 | # @param [Object] Object to be compared 68 | def ==(o) 69 | return true if self.equal?(o) 70 | self.class == o.class && 71 | distributions == o.distributions 72 | end 73 | 74 | # @see the `==` method 75 | # @param [Object] Object to be compared 76 | def eql?(o) 77 | self == o 78 | end 79 | 80 | # Calculates hash code according to all attributes. 81 | # @return [Fixnum] Hash code 82 | def hash 83 | [distributions].hash 84 | end 85 | 86 | # Builds the object from hash 87 | # @param [Hash] attributes Model attributes in the form of hash 88 | # @return [Object] Returns the model itself 89 | def build_from_hash(attributes) 90 | return nil unless attributes.is_a?(Hash) 91 | self.class.swagger_types.each_pair do |key, type| 92 | if type =~ /\AArray<(.*)>/i 93 | # check to ensure the input is an array given that the attribute 94 | # is documented as an array but the input is not 95 | if attributes[self.class.attribute_map[key]].is_a?(Array) 96 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 97 | end 98 | elsif !attributes[self.class.attribute_map[key]].nil? 99 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 100 | end # or else data not found in attributes(hash), not an issue as the data can be optional 101 | end 102 | 103 | self 104 | end 105 | 106 | # Deserializes the data based on type 107 | # @param string type Data type 108 | # @param string value Value to be deserialized 109 | # @return [Object] Deserialized data 110 | def _deserialize(type, value) 111 | case type.to_sym 112 | when :DateTime 113 | DateTime.parse(value) 114 | when :Date 115 | Date.parse(value) 116 | when :String 117 | value.to_s 118 | when :Integer 119 | value.to_i 120 | when :Float 121 | value.to_f 122 | when :BOOLEAN 123 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 124 | true 125 | else 126 | false 127 | end 128 | when :Object 129 | # generic object (usually a Hash), return directly 130 | value 131 | when /\AArray<(?.+)>\z/ 132 | inner_type = Regexp.last_match[:inner_type] 133 | value.map { |v| _deserialize(inner_type, v) } 134 | when /\AHash<(?.+?), (?.+)>\z/ 135 | k_type = Regexp.last_match[:k_type] 136 | v_type = Regexp.last_match[:v_type] 137 | {}.tap do |hash| 138 | value.each do |k, v| 139 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 140 | end 141 | end 142 | else # model 143 | temp_model = Flagr.const_get(type).new 144 | temp_model.build_from_hash(value) 145 | end 146 | end 147 | 148 | # Returns the string representation of the object 149 | # @return [String] String presentation of the object 150 | def to_s 151 | to_hash.to_s 152 | end 153 | 154 | # to_body is an alias to to_hash (backward compatibility) 155 | # @return [Hash] Returns the object in the form of hash 156 | def to_body 157 | to_hash 158 | end 159 | 160 | # Returns the object in the form of hash 161 | # @return [Hash] Returns the object in the form of hash 162 | def to_hash 163 | hash = {} 164 | self.class.attribute_map.each_pair do |attr, param| 165 | value = self.send(attr) 166 | next if value.nil? 167 | hash[param] = _to_hash(value) 168 | end 169 | hash 170 | end 171 | 172 | # Outputs non-array value in the form of hash 173 | # For object, use to_hash. Otherwise, just return the value 174 | # @param [Object] value Any valid value 175 | # @return [Hash] Returns the value in the form of hash 176 | def _to_hash(value) 177 | if value.is_a?(Array) 178 | value.compact.map { |v| _to_hash(v) } 179 | elsif value.is_a?(Hash) 180 | {}.tap do |hash| 181 | value.each { |k, v| hash[k] = _to_hash(v) } 182 | end 183 | elsif value.respond_to? :to_hash 184 | value.to_hash 185 | else 186 | value 187 | end 188 | end 189 | 190 | end 191 | end 192 | -------------------------------------------------------------------------------- /lib/rbflagr/models/eval_debug_log.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class EvalDebugLog 17 | attr_accessor :segment_debug_logs 18 | 19 | attr_accessor :msg 20 | 21 | # Attribute mapping from ruby-style variable name to JSON key. 22 | def self.attribute_map 23 | { 24 | :'segment_debug_logs' => :'segmentDebugLogs', 25 | :'msg' => :'msg' 26 | } 27 | end 28 | 29 | # Attribute type mapping. 30 | def self.swagger_types 31 | { 32 | :'segment_debug_logs' => :'Array', 33 | :'msg' => :'String' 34 | } 35 | end 36 | 37 | # Initializes the object 38 | # @param [Hash] attributes Model attributes in the form of hash 39 | def initialize(attributes = {}) 40 | return unless attributes.is_a?(Hash) 41 | 42 | # convert string to symbol for hash key 43 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 44 | 45 | if attributes.has_key?(:'segmentDebugLogs') 46 | if (value = attributes[:'segmentDebugLogs']).is_a?(Array) 47 | self.segment_debug_logs = value 48 | end 49 | end 50 | 51 | if attributes.has_key?(:'msg') 52 | self.msg = attributes[:'msg'] 53 | end 54 | end 55 | 56 | # Show invalid properties with the reasons. Usually used together with valid? 57 | # @return Array for valid properties with the reasons 58 | def list_invalid_properties 59 | invalid_properties = Array.new 60 | invalid_properties 61 | end 62 | 63 | # Check to see if the all the properties in the model are valid 64 | # @return true if the model is valid 65 | def valid? 66 | true 67 | end 68 | 69 | # Checks equality by comparing each attribute. 70 | # @param [Object] Object to be compared 71 | def ==(o) 72 | return true if self.equal?(o) 73 | self.class == o.class && 74 | segment_debug_logs == o.segment_debug_logs && 75 | msg == o.msg 76 | end 77 | 78 | # @see the `==` method 79 | # @param [Object] Object to be compared 80 | def eql?(o) 81 | self == o 82 | end 83 | 84 | # Calculates hash code according to all attributes. 85 | # @return [Fixnum] Hash code 86 | def hash 87 | [segment_debug_logs, msg].hash 88 | end 89 | 90 | # Builds the object from hash 91 | # @param [Hash] attributes Model attributes in the form of hash 92 | # @return [Object] Returns the model itself 93 | def build_from_hash(attributes) 94 | return nil unless attributes.is_a?(Hash) 95 | self.class.swagger_types.each_pair do |key, type| 96 | if type =~ /\AArray<(.*)>/i 97 | # check to ensure the input is an array given that the attribute 98 | # is documented as an array but the input is not 99 | if attributes[self.class.attribute_map[key]].is_a?(Array) 100 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 101 | end 102 | elsif !attributes[self.class.attribute_map[key]].nil? 103 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 104 | end # or else data not found in attributes(hash), not an issue as the data can be optional 105 | end 106 | 107 | self 108 | end 109 | 110 | # Deserializes the data based on type 111 | # @param string type Data type 112 | # @param string value Value to be deserialized 113 | # @return [Object] Deserialized data 114 | def _deserialize(type, value) 115 | case type.to_sym 116 | when :DateTime 117 | DateTime.parse(value) 118 | when :Date 119 | Date.parse(value) 120 | when :String 121 | value.to_s 122 | when :Integer 123 | value.to_i 124 | when :Float 125 | value.to_f 126 | when :BOOLEAN 127 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 128 | true 129 | else 130 | false 131 | end 132 | when :Object 133 | # generic object (usually a Hash), return directly 134 | value 135 | when /\AArray<(?.+)>\z/ 136 | inner_type = Regexp.last_match[:inner_type] 137 | value.map { |v| _deserialize(inner_type, v) } 138 | when /\AHash<(?.+?), (?.+)>\z/ 139 | k_type = Regexp.last_match[:k_type] 140 | v_type = Regexp.last_match[:v_type] 141 | {}.tap do |hash| 142 | value.each do |k, v| 143 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 144 | end 145 | end 146 | else # model 147 | temp_model = Flagr.const_get(type).new 148 | temp_model.build_from_hash(value) 149 | end 150 | end 151 | 152 | # Returns the string representation of the object 153 | # @return [String] String presentation of the object 154 | def to_s 155 | to_hash.to_s 156 | end 157 | 158 | # to_body is an alias to to_hash (backward compatibility) 159 | # @return [Hash] Returns the object in the form of hash 160 | def to_body 161 | to_hash 162 | end 163 | 164 | # Returns the object in the form of hash 165 | # @return [Hash] Returns the object in the form of hash 166 | def to_hash 167 | hash = {} 168 | self.class.attribute_map.each_pair do |attr, param| 169 | value = self.send(attr) 170 | next if value.nil? 171 | hash[param] = _to_hash(value) 172 | end 173 | hash 174 | end 175 | 176 | # Outputs non-array value in the form of hash 177 | # For object, use to_hash. Otherwise, just return the value 178 | # @param [Object] value Any valid value 179 | # @return [Hash] Returns the value in the form of hash 180 | def _to_hash(value) 181 | if value.is_a?(Array) 182 | value.compact.map { |v| _to_hash(v) } 183 | elsif value.is_a?(Hash) 184 | {}.tap do |hash| 185 | value.each { |k, v| hash[k] = _to_hash(v) } 186 | end 187 | elsif value.respond_to? :to_hash 188 | value.to_hash 189 | else 190 | value 191 | end 192 | end 193 | 194 | end 195 | end 196 | -------------------------------------------------------------------------------- /lib/rbflagr/models/evaluation_batch_response.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class EvaluationBatchResponse 17 | attr_accessor :evaluation_results 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'evaluation_results' => :'evaluationResults' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'evaluation_results' => :'Array' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'evaluationResults') 42 | if (value = attributes[:'evaluationResults']).is_a?(Array) 43 | self.evaluation_results = value 44 | end 45 | end 46 | end 47 | 48 | # Show invalid properties with the reasons. Usually used together with valid? 49 | # @return Array for valid properties with the reasons 50 | def list_invalid_properties 51 | invalid_properties = Array.new 52 | if @evaluation_results.nil? 53 | invalid_properties.push('invalid value for "evaluation_results", evaluation_results cannot be nil.') 54 | end 55 | 56 | invalid_properties 57 | end 58 | 59 | # Check to see if the all the properties in the model are valid 60 | # @return true if the model is valid 61 | def valid? 62 | return false if @evaluation_results.nil? 63 | true 64 | end 65 | 66 | # Checks equality by comparing each attribute. 67 | # @param [Object] Object to be compared 68 | def ==(o) 69 | return true if self.equal?(o) 70 | self.class == o.class && 71 | evaluation_results == o.evaluation_results 72 | end 73 | 74 | # @see the `==` method 75 | # @param [Object] Object to be compared 76 | def eql?(o) 77 | self == o 78 | end 79 | 80 | # Calculates hash code according to all attributes. 81 | # @return [Fixnum] Hash code 82 | def hash 83 | [evaluation_results].hash 84 | end 85 | 86 | # Builds the object from hash 87 | # @param [Hash] attributes Model attributes in the form of hash 88 | # @return [Object] Returns the model itself 89 | def build_from_hash(attributes) 90 | return nil unless attributes.is_a?(Hash) 91 | self.class.swagger_types.each_pair do |key, type| 92 | if type =~ /\AArray<(.*)>/i 93 | # check to ensure the input is an array given that the attribute 94 | # is documented as an array but the input is not 95 | if attributes[self.class.attribute_map[key]].is_a?(Array) 96 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 97 | end 98 | elsif !attributes[self.class.attribute_map[key]].nil? 99 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 100 | end # or else data not found in attributes(hash), not an issue as the data can be optional 101 | end 102 | 103 | self 104 | end 105 | 106 | # Deserializes the data based on type 107 | # @param string type Data type 108 | # @param string value Value to be deserialized 109 | # @return [Object] Deserialized data 110 | def _deserialize(type, value) 111 | case type.to_sym 112 | when :DateTime 113 | DateTime.parse(value) 114 | when :Date 115 | Date.parse(value) 116 | when :String 117 | value.to_s 118 | when :Integer 119 | value.to_i 120 | when :Float 121 | value.to_f 122 | when :BOOLEAN 123 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 124 | true 125 | else 126 | false 127 | end 128 | when :Object 129 | # generic object (usually a Hash), return directly 130 | value 131 | when /\AArray<(?.+)>\z/ 132 | inner_type = Regexp.last_match[:inner_type] 133 | value.map { |v| _deserialize(inner_type, v) } 134 | when /\AHash<(?.+?), (?.+)>\z/ 135 | k_type = Regexp.last_match[:k_type] 136 | v_type = Regexp.last_match[:v_type] 137 | {}.tap do |hash| 138 | value.each do |k, v| 139 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 140 | end 141 | end 142 | else # model 143 | temp_model = Flagr.const_get(type).new 144 | temp_model.build_from_hash(value) 145 | end 146 | end 147 | 148 | # Returns the string representation of the object 149 | # @return [String] String presentation of the object 150 | def to_s 151 | to_hash.to_s 152 | end 153 | 154 | # to_body is an alias to to_hash (backward compatibility) 155 | # @return [Hash] Returns the object in the form of hash 156 | def to_body 157 | to_hash 158 | end 159 | 160 | # Returns the object in the form of hash 161 | # @return [Hash] Returns the object in the form of hash 162 | def to_hash 163 | hash = {} 164 | self.class.attribute_map.each_pair do |attr, param| 165 | value = self.send(attr) 166 | next if value.nil? 167 | hash[param] = _to_hash(value) 168 | end 169 | hash 170 | end 171 | 172 | # Outputs non-array value in the form of hash 173 | # For object, use to_hash. Otherwise, just return the value 174 | # @param [Object] value Any valid value 175 | # @return [Hash] Returns the value in the form of hash 176 | def _to_hash(value) 177 | if value.is_a?(Array) 178 | value.compact.map { |v| _to_hash(v) } 179 | elsif value.is_a?(Hash) 180 | {}.tap do |hash| 181 | value.each { |k, v| hash[k] = _to_hash(v) } 182 | end 183 | elsif value.respond_to? :to_hash 184 | value.to_hash 185 | else 186 | value 187 | end 188 | end 189 | 190 | end 191 | end 192 | -------------------------------------------------------------------------------- /lib/rbflagr/models/evaluation_entity.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class EvaluationEntity 17 | attr_accessor :entity_id 18 | 19 | attr_accessor :entity_type 20 | 21 | attr_accessor :entity_context 22 | 23 | # Attribute mapping from ruby-style variable name to JSON key. 24 | def self.attribute_map 25 | { 26 | :'entity_id' => :'entityID', 27 | :'entity_type' => :'entityType', 28 | :'entity_context' => :'entityContext' 29 | } 30 | end 31 | 32 | # Attribute type mapping. 33 | def self.swagger_types 34 | { 35 | :'entity_id' => :'String', 36 | :'entity_type' => :'String', 37 | :'entity_context' => :'Object' 38 | } 39 | end 40 | 41 | # Initializes the object 42 | # @param [Hash] attributes Model attributes in the form of hash 43 | def initialize(attributes = {}) 44 | return unless attributes.is_a?(Hash) 45 | 46 | # convert string to symbol for hash key 47 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 48 | 49 | if attributes.has_key?(:'entityID') 50 | self.entity_id = attributes[:'entityID'] 51 | end 52 | 53 | if attributes.has_key?(:'entityType') 54 | self.entity_type = attributes[:'entityType'] 55 | end 56 | 57 | if attributes.has_key?(:'entityContext') 58 | self.entity_context = attributes[:'entityContext'] 59 | end 60 | end 61 | 62 | # Show invalid properties with the reasons. Usually used together with valid? 63 | # @return Array for valid properties with the reasons 64 | def list_invalid_properties 65 | invalid_properties = Array.new 66 | invalid_properties 67 | end 68 | 69 | # Check to see if the all the properties in the model are valid 70 | # @return true if the model is valid 71 | def valid? 72 | true 73 | end 74 | 75 | # Checks equality by comparing each attribute. 76 | # @param [Object] Object to be compared 77 | def ==(o) 78 | return true if self.equal?(o) 79 | self.class == o.class && 80 | entity_id == o.entity_id && 81 | entity_type == o.entity_type && 82 | entity_context == o.entity_context 83 | end 84 | 85 | # @see the `==` method 86 | # @param [Object] Object to be compared 87 | def eql?(o) 88 | self == o 89 | end 90 | 91 | # Calculates hash code according to all attributes. 92 | # @return [Fixnum] Hash code 93 | def hash 94 | [entity_id, entity_type, entity_context].hash 95 | end 96 | 97 | # Builds the object from hash 98 | # @param [Hash] attributes Model attributes in the form of hash 99 | # @return [Object] Returns the model itself 100 | def build_from_hash(attributes) 101 | return nil unless attributes.is_a?(Hash) 102 | self.class.swagger_types.each_pair do |key, type| 103 | if type =~ /\AArray<(.*)>/i 104 | # check to ensure the input is an array given that the attribute 105 | # is documented as an array but the input is not 106 | if attributes[self.class.attribute_map[key]].is_a?(Array) 107 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 108 | end 109 | elsif !attributes[self.class.attribute_map[key]].nil? 110 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 111 | end # or else data not found in attributes(hash), not an issue as the data can be optional 112 | end 113 | 114 | self 115 | end 116 | 117 | # Deserializes the data based on type 118 | # @param string type Data type 119 | # @param string value Value to be deserialized 120 | # @return [Object] Deserialized data 121 | def _deserialize(type, value) 122 | case type.to_sym 123 | when :DateTime 124 | DateTime.parse(value) 125 | when :Date 126 | Date.parse(value) 127 | when :String 128 | value.to_s 129 | when :Integer 130 | value.to_i 131 | when :Float 132 | value.to_f 133 | when :BOOLEAN 134 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 135 | true 136 | else 137 | false 138 | end 139 | when :Object 140 | # generic object (usually a Hash), return directly 141 | value 142 | when /\AArray<(?.+)>\z/ 143 | inner_type = Regexp.last_match[:inner_type] 144 | value.map { |v| _deserialize(inner_type, v) } 145 | when /\AHash<(?.+?), (?.+)>\z/ 146 | k_type = Regexp.last_match[:k_type] 147 | v_type = Regexp.last_match[:v_type] 148 | {}.tap do |hash| 149 | value.each do |k, v| 150 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 151 | end 152 | end 153 | else # model 154 | temp_model = Flagr.const_get(type).new 155 | temp_model.build_from_hash(value) 156 | end 157 | end 158 | 159 | # Returns the string representation of the object 160 | # @return [String] String presentation of the object 161 | def to_s 162 | to_hash.to_s 163 | end 164 | 165 | # to_body is an alias to to_hash (backward compatibility) 166 | # @return [Hash] Returns the object in the form of hash 167 | def to_body 168 | to_hash 169 | end 170 | 171 | # Returns the object in the form of hash 172 | # @return [Hash] Returns the object in the form of hash 173 | def to_hash 174 | hash = {} 175 | self.class.attribute_map.each_pair do |attr, param| 176 | value = self.send(attr) 177 | next if value.nil? 178 | hash[param] = _to_hash(value) 179 | end 180 | hash 181 | end 182 | 183 | # Outputs non-array value in the form of hash 184 | # For object, use to_hash. Otherwise, just return the value 185 | # @param [Object] value Any valid value 186 | # @return [Hash] Returns the value in the form of hash 187 | def _to_hash(value) 188 | if value.is_a?(Array) 189 | value.compact.map { |v| _to_hash(v) } 190 | elsif value.is_a?(Hash) 191 | {}.tap do |hash| 192 | value.each { |k, v| hash[k] = _to_hash(v) } 193 | end 194 | elsif value.respond_to? :to_hash 195 | value.to_hash 196 | else 197 | value 198 | end 199 | end 200 | 201 | end 202 | end 203 | -------------------------------------------------------------------------------- /lib/rbflagr/configuration.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'addressable/uri' 14 | 15 | module Flagr 16 | class Configuration 17 | # Defines url scheme 18 | attr_accessor :scheme 19 | 20 | # Defines url host 21 | attr_accessor :host 22 | 23 | # Defines url base path 24 | attr_accessor :base_path 25 | 26 | # Defines API keys used with API Key authentications. 27 | # 28 | # @return [Hash] key: parameter name, value: parameter value (API key) 29 | # 30 | # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) 31 | # config.api_key['api_key'] = 'xxx' 32 | attr_accessor :api_key 33 | 34 | # Defines API key prefixes used with API Key authentications. 35 | # 36 | # @return [Hash] key: parameter name, value: API key prefix 37 | # 38 | # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) 39 | # config.api_key_prefix['api_key'] = 'Token' 40 | attr_accessor :api_key_prefix 41 | 42 | # Defines the username used with HTTP basic authentication. 43 | # 44 | # @return [String] 45 | attr_accessor :username 46 | 47 | # Defines the password used with HTTP basic authentication. 48 | # 49 | # @return [String] 50 | attr_accessor :password 51 | 52 | # Defines the access token (Bearer) used with OAuth2. 53 | attr_accessor :access_token 54 | 55 | # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response 56 | # details will be logged with `logger.debug` (see the `logger` attribute). 57 | # Default to false. 58 | # 59 | # @return [true, false] 60 | attr_accessor :debugging 61 | 62 | # Defines the logger used for debugging. 63 | # Default to `Rails.logger` (when in Rails) or logging to STDOUT. 64 | # 65 | # @return [#debug] 66 | attr_accessor :logger 67 | 68 | # Defines the temporary folder to store downloaded files 69 | # (for API endpoints that have file response). 70 | # Default to use `Tempfile`. 71 | # 72 | # @return [String] 73 | attr_accessor :temp_folder_path 74 | 75 | # The time limit for HTTP request in seconds. 76 | # Default to 0 (never times out). 77 | attr_accessor :timeout 78 | 79 | # Set this to false to skip client side validation in the operation. 80 | # Default to true. 81 | # @return [true, false] 82 | attr_accessor :client_side_validation 83 | 84 | ### TLS/SSL setting 85 | # Set this to false to skip verifying SSL certificate when calling API from https server. 86 | # Default to true. 87 | # 88 | # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. 89 | # 90 | # @return [true, false] 91 | attr_accessor :verify_ssl 92 | 93 | ### TLS/SSL setting 94 | # Set this to false to skip verifying SSL host name 95 | # Default to true. 96 | # 97 | # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. 98 | # 99 | # @return [true, false] 100 | attr_accessor :verify_ssl_host 101 | 102 | ### TLS/SSL setting 103 | # Set this to customize the certificate file to verify the peer. 104 | # 105 | # @return [String] the path to the certificate file 106 | # 107 | # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: 108 | # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 109 | attr_accessor :ssl_ca_cert 110 | 111 | ### TLS/SSL setting 112 | # Client certificate file (for client certificate) 113 | attr_accessor :cert_file 114 | 115 | ### TLS/SSL setting 116 | # Client private key file (for client certificate) 117 | attr_accessor :key_file 118 | 119 | # Set this to customize parameters encoding of array parameter with multi collectionFormat. 120 | # Default to nil. 121 | # 122 | # @see The params_encoding option of Ethon. Related source code: 123 | # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 124 | attr_accessor :params_encoding 125 | 126 | attr_accessor :inject_format 127 | 128 | attr_accessor :force_ending_format 129 | 130 | def initialize 131 | @scheme = 'http' 132 | @host = '' 133 | @base_path = '/api/v1' 134 | @api_key = {} 135 | @api_key_prefix = {} 136 | @timeout = 0 137 | @client_side_validation = true 138 | @verify_ssl = true 139 | @verify_ssl_host = true 140 | @params_encoding = nil 141 | @cert_file = nil 142 | @key_file = nil 143 | @debugging = false 144 | @inject_format = false 145 | @force_ending_format = false 146 | @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) 147 | 148 | yield(self) if block_given? 149 | end 150 | 151 | # The default Configuration object. 152 | def self.default 153 | @@default ||= Configuration.new 154 | end 155 | 156 | def configure 157 | yield(self) if block_given? 158 | end 159 | 160 | def scheme=(scheme) 161 | # remove :// from scheme 162 | @scheme = scheme.sub(/:\/\//, '') 163 | end 164 | 165 | def host=(host) 166 | # remove http(s):// and anything after a slash 167 | @host = host.sub(/https?:\/\//, '').split('/').first 168 | end 169 | 170 | def base_path=(base_path) 171 | # Add leading and trailing slashes to base_path 172 | @base_path = "/#{base_path}".gsub(/\/+/, '/') 173 | @base_path = '' if @base_path == '/' 174 | end 175 | 176 | def base_url 177 | url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') 178 | Addressable::URI.encode(url) 179 | end 180 | 181 | # Gets API key (with prefix if set). 182 | # @param [String] param_name the parameter name of API key auth 183 | def api_key_with_prefix(param_name) 184 | if @api_key_prefix[param_name] 185 | "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" 186 | else 187 | @api_key[param_name] 188 | end 189 | end 190 | 191 | # Gets Basic Auth token string 192 | def basic_auth_token 193 | 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") 194 | end 195 | 196 | # Returns Auth Settings hash for api client. 197 | def auth_settings 198 | { 199 | } 200 | end 201 | end 202 | end 203 | -------------------------------------------------------------------------------- /lib/rbflagr/models/create_tag_request.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class CreateTagRequest 17 | attr_accessor :value 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'value' => :'value' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'value' => :'String' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'value') 42 | self.value = attributes[:'value'] 43 | end 44 | end 45 | 46 | # Show invalid properties with the reasons. Usually used together with valid? 47 | # @return Array for valid properties with the reasons 48 | def list_invalid_properties 49 | invalid_properties = Array.new 50 | if @value.nil? 51 | invalid_properties.push('invalid value for "value", value cannot be nil.') 52 | end 53 | 54 | if @value.to_s.length < 1 55 | invalid_properties.push('invalid value for "value", the character length must be great than or equal to 1.') 56 | end 57 | 58 | invalid_properties 59 | end 60 | 61 | # Check to see if the all the properties in the model are valid 62 | # @return true if the model is valid 63 | def valid? 64 | return false if @value.nil? 65 | return false if @value.to_s.length < 1 66 | true 67 | end 68 | 69 | # Custom attribute writer method with validation 70 | # @param [Object] value Value to be assigned 71 | def value=(value) 72 | if value.nil? 73 | fail ArgumentError, 'value cannot be nil' 74 | end 75 | 76 | if value.to_s.length < 1 77 | fail ArgumentError, 'invalid value for "value", the character length must be great than or equal to 1.' 78 | end 79 | 80 | @value = value 81 | end 82 | 83 | # Checks equality by comparing each attribute. 84 | # @param [Object] Object to be compared 85 | def ==(o) 86 | return true if self.equal?(o) 87 | self.class == o.class && 88 | value == o.value 89 | end 90 | 91 | # @see the `==` method 92 | # @param [Object] Object to be compared 93 | def eql?(o) 94 | self == o 95 | end 96 | 97 | # Calculates hash code according to all attributes. 98 | # @return [Fixnum] Hash code 99 | def hash 100 | [value].hash 101 | end 102 | 103 | # Builds the object from hash 104 | # @param [Hash] attributes Model attributes in the form of hash 105 | # @return [Object] Returns the model itself 106 | def build_from_hash(attributes) 107 | return nil unless attributes.is_a?(Hash) 108 | self.class.swagger_types.each_pair do |key, type| 109 | if type =~ /\AArray<(.*)>/i 110 | # check to ensure the input is an array given that the attribute 111 | # is documented as an array but the input is not 112 | if attributes[self.class.attribute_map[key]].is_a?(Array) 113 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 114 | end 115 | elsif !attributes[self.class.attribute_map[key]].nil? 116 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 117 | end # or else data not found in attributes(hash), not an issue as the data can be optional 118 | end 119 | 120 | self 121 | end 122 | 123 | # Deserializes the data based on type 124 | # @param string type Data type 125 | # @param string value Value to be deserialized 126 | # @return [Object] Deserialized data 127 | def _deserialize(type, value) 128 | case type.to_sym 129 | when :DateTime 130 | DateTime.parse(value) 131 | when :Date 132 | Date.parse(value) 133 | when :String 134 | value.to_s 135 | when :Integer 136 | value.to_i 137 | when :Float 138 | value.to_f 139 | when :BOOLEAN 140 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 141 | true 142 | else 143 | false 144 | end 145 | when :Object 146 | # generic object (usually a Hash), return directly 147 | value 148 | when /\AArray<(?.+)>\z/ 149 | inner_type = Regexp.last_match[:inner_type] 150 | value.map { |v| _deserialize(inner_type, v) } 151 | when /\AHash<(?.+?), (?.+)>\z/ 152 | k_type = Regexp.last_match[:k_type] 153 | v_type = Regexp.last_match[:v_type] 154 | {}.tap do |hash| 155 | value.each do |k, v| 156 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 157 | end 158 | end 159 | else # model 160 | temp_model = Flagr.const_get(type).new 161 | temp_model.build_from_hash(value) 162 | end 163 | end 164 | 165 | # Returns the string representation of the object 166 | # @return [String] String presentation of the object 167 | def to_s 168 | to_hash.to_s 169 | end 170 | 171 | # to_body is an alias to to_hash (backward compatibility) 172 | # @return [Hash] Returns the object in the form of hash 173 | def to_body 174 | to_hash 175 | end 176 | 177 | # Returns the object in the form of hash 178 | # @return [Hash] Returns the object in the form of hash 179 | def to_hash 180 | hash = {} 181 | self.class.attribute_map.each_pair do |attr, param| 182 | value = self.send(attr) 183 | next if value.nil? 184 | hash[param] = _to_hash(value) 185 | end 186 | hash 187 | end 188 | 189 | # Outputs non-array value in the form of hash 190 | # For object, use to_hash. Otherwise, just return the value 191 | # @param [Object] value Any valid value 192 | # @return [Hash] Returns the value in the form of hash 193 | def _to_hash(value) 194 | if value.is_a?(Array) 195 | value.compact.map { |v| _to_hash(v) } 196 | elsif value.is_a?(Hash) 197 | {}.tap do |hash| 198 | value.each { |k, v| hash[k] = _to_hash(v) } 199 | end 200 | elsif value.respond_to? :to_hash 201 | value.to_hash 202 | else 203 | value 204 | end 205 | end 206 | 207 | end 208 | end 209 | -------------------------------------------------------------------------------- /lib/rbflagr/models/error.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class Error 17 | attr_accessor :message 18 | 19 | # Attribute mapping from ruby-style variable name to JSON key. 20 | def self.attribute_map 21 | { 22 | :'message' => :'message' 23 | } 24 | end 25 | 26 | # Attribute type mapping. 27 | def self.swagger_types 28 | { 29 | :'message' => :'String' 30 | } 31 | end 32 | 33 | # Initializes the object 34 | # @param [Hash] attributes Model attributes in the form of hash 35 | def initialize(attributes = {}) 36 | return unless attributes.is_a?(Hash) 37 | 38 | # convert string to symbol for hash key 39 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 40 | 41 | if attributes.has_key?(:'message') 42 | self.message = attributes[:'message'] 43 | end 44 | end 45 | 46 | # Show invalid properties with the reasons. Usually used together with valid? 47 | # @return Array for valid properties with the reasons 48 | def list_invalid_properties 49 | invalid_properties = Array.new 50 | if @message.nil? 51 | invalid_properties.push('invalid value for "message", message cannot be nil.') 52 | end 53 | 54 | if @message.to_s.length < 1 55 | invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.') 56 | end 57 | 58 | invalid_properties 59 | end 60 | 61 | # Check to see if the all the properties in the model are valid 62 | # @return true if the model is valid 63 | def valid? 64 | return false if @message.nil? 65 | return false if @message.to_s.length < 1 66 | true 67 | end 68 | 69 | # Custom attribute writer method with validation 70 | # @param [Object] message Value to be assigned 71 | def message=(message) 72 | if message.nil? 73 | fail ArgumentError, 'message cannot be nil' 74 | end 75 | 76 | if message.to_s.length < 1 77 | fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.' 78 | end 79 | 80 | @message = message 81 | end 82 | 83 | # Checks equality by comparing each attribute. 84 | # @param [Object] Object to be compared 85 | def ==(o) 86 | return true if self.equal?(o) 87 | self.class == o.class && 88 | message == o.message 89 | end 90 | 91 | # @see the `==` method 92 | # @param [Object] Object to be compared 93 | def eql?(o) 94 | self == o 95 | end 96 | 97 | # Calculates hash code according to all attributes. 98 | # @return [Fixnum] Hash code 99 | def hash 100 | [message].hash 101 | end 102 | 103 | # Builds the object from hash 104 | # @param [Hash] attributes Model attributes in the form of hash 105 | # @return [Object] Returns the model itself 106 | def build_from_hash(attributes) 107 | return nil unless attributes.is_a?(Hash) 108 | self.class.swagger_types.each_pair do |key, type| 109 | if type =~ /\AArray<(.*)>/i 110 | # check to ensure the input is an array given that the attribute 111 | # is documented as an array but the input is not 112 | if attributes[self.class.attribute_map[key]].is_a?(Array) 113 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 114 | end 115 | elsif !attributes[self.class.attribute_map[key]].nil? 116 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 117 | end # or else data not found in attributes(hash), not an issue as the data can be optional 118 | end 119 | 120 | self 121 | end 122 | 123 | # Deserializes the data based on type 124 | # @param string type Data type 125 | # @param string value Value to be deserialized 126 | # @return [Object] Deserialized data 127 | def _deserialize(type, value) 128 | case type.to_sym 129 | when :DateTime 130 | DateTime.parse(value) 131 | when :Date 132 | Date.parse(value) 133 | when :String 134 | value.to_s 135 | when :Integer 136 | value.to_i 137 | when :Float 138 | value.to_f 139 | when :BOOLEAN 140 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 141 | true 142 | else 143 | false 144 | end 145 | when :Object 146 | # generic object (usually a Hash), return directly 147 | value 148 | when /\AArray<(?.+)>\z/ 149 | inner_type = Regexp.last_match[:inner_type] 150 | value.map { |v| _deserialize(inner_type, v) } 151 | when /\AHash<(?.+?), (?.+)>\z/ 152 | k_type = Regexp.last_match[:k_type] 153 | v_type = Regexp.last_match[:v_type] 154 | {}.tap do |hash| 155 | value.each do |k, v| 156 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 157 | end 158 | end 159 | else # model 160 | temp_model = Flagr.const_get(type).new 161 | temp_model.build_from_hash(value) 162 | end 163 | end 164 | 165 | # Returns the string representation of the object 166 | # @return [String] String presentation of the object 167 | def to_s 168 | to_hash.to_s 169 | end 170 | 171 | # to_body is an alias to to_hash (backward compatibility) 172 | # @return [Hash] Returns the object in the form of hash 173 | def to_body 174 | to_hash 175 | end 176 | 177 | # Returns the object in the form of hash 178 | # @return [Hash] Returns the object in the form of hash 179 | def to_hash 180 | hash = {} 181 | self.class.attribute_map.each_pair do |attr, param| 182 | value = self.send(attr) 183 | next if value.nil? 184 | hash[param] = _to_hash(value) 185 | end 186 | hash 187 | end 188 | 189 | # Outputs non-array value in the form of hash 190 | # For object, use to_hash. Otherwise, just return the value 191 | # @param [Object] value Any valid value 192 | # @return [Hash] Returns the value in the form of hash 193 | def _to_hash(value) 194 | if value.is_a?(Array) 195 | value.compact.map { |v| _to_hash(v) } 196 | elsif value.is_a?(Hash) 197 | {}.tap do |hash| 198 | value.each { |k, v| hash[k] = _to_hash(v) } 199 | end 200 | elsif value.respond_to? :to_hash 201 | value.to_hash 202 | else 203 | value 204 | end 205 | end 206 | 207 | end 208 | end 209 | -------------------------------------------------------------------------------- /lib/rbflagr/models/segment_debug_log.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class SegmentDebugLog 17 | attr_accessor :segment_id 18 | 19 | attr_accessor :msg 20 | 21 | # Attribute mapping from ruby-style variable name to JSON key. 22 | def self.attribute_map 23 | { 24 | :'segment_id' => :'segmentID', 25 | :'msg' => :'msg' 26 | } 27 | end 28 | 29 | # Attribute type mapping. 30 | def self.swagger_types 31 | { 32 | :'segment_id' => :'Integer', 33 | :'msg' => :'String' 34 | } 35 | end 36 | 37 | # Initializes the object 38 | # @param [Hash] attributes Model attributes in the form of hash 39 | def initialize(attributes = {}) 40 | return unless attributes.is_a?(Hash) 41 | 42 | # convert string to symbol for hash key 43 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 44 | 45 | if attributes.has_key?(:'segmentID') 46 | self.segment_id = attributes[:'segmentID'] 47 | end 48 | 49 | if attributes.has_key?(:'msg') 50 | self.msg = attributes[:'msg'] 51 | end 52 | end 53 | 54 | # Show invalid properties with the reasons. Usually used together with valid? 55 | # @return Array for valid properties with the reasons 56 | def list_invalid_properties 57 | invalid_properties = Array.new 58 | if !@segment_id.nil? && @segment_id < 1 59 | invalid_properties.push('invalid value for "segment_id", must be greater than or equal to 1.') 60 | end 61 | 62 | invalid_properties 63 | end 64 | 65 | # Check to see if the all the properties in the model are valid 66 | # @return true if the model is valid 67 | def valid? 68 | return false if !@segment_id.nil? && @segment_id < 1 69 | true 70 | end 71 | 72 | # Custom attribute writer method with validation 73 | # @param [Object] segment_id Value to be assigned 74 | def segment_id=(segment_id) 75 | if !segment_id.nil? && segment_id < 1 76 | fail ArgumentError, 'invalid value for "segment_id", must be greater than or equal to 1.' 77 | end 78 | 79 | @segment_id = segment_id 80 | end 81 | 82 | # Checks equality by comparing each attribute. 83 | # @param [Object] Object to be compared 84 | def ==(o) 85 | return true if self.equal?(o) 86 | self.class == o.class && 87 | segment_id == o.segment_id && 88 | msg == o.msg 89 | end 90 | 91 | # @see the `==` method 92 | # @param [Object] Object to be compared 93 | def eql?(o) 94 | self == o 95 | end 96 | 97 | # Calculates hash code according to all attributes. 98 | # @return [Fixnum] Hash code 99 | def hash 100 | [segment_id, msg].hash 101 | end 102 | 103 | # Builds the object from hash 104 | # @param [Hash] attributes Model attributes in the form of hash 105 | # @return [Object] Returns the model itself 106 | def build_from_hash(attributes) 107 | return nil unless attributes.is_a?(Hash) 108 | self.class.swagger_types.each_pair do |key, type| 109 | if type =~ /\AArray<(.*)>/i 110 | # check to ensure the input is an array given that the attribute 111 | # is documented as an array but the input is not 112 | if attributes[self.class.attribute_map[key]].is_a?(Array) 113 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 114 | end 115 | elsif !attributes[self.class.attribute_map[key]].nil? 116 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 117 | end # or else data not found in attributes(hash), not an issue as the data can be optional 118 | end 119 | 120 | self 121 | end 122 | 123 | # Deserializes the data based on type 124 | # @param string type Data type 125 | # @param string value Value to be deserialized 126 | # @return [Object] Deserialized data 127 | def _deserialize(type, value) 128 | case type.to_sym 129 | when :DateTime 130 | DateTime.parse(value) 131 | when :Date 132 | Date.parse(value) 133 | when :String 134 | value.to_s 135 | when :Integer 136 | value.to_i 137 | when :Float 138 | value.to_f 139 | when :BOOLEAN 140 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 141 | true 142 | else 143 | false 144 | end 145 | when :Object 146 | # generic object (usually a Hash), return directly 147 | value 148 | when /\AArray<(?.+)>\z/ 149 | inner_type = Regexp.last_match[:inner_type] 150 | value.map { |v| _deserialize(inner_type, v) } 151 | when /\AHash<(?.+?), (?.+)>\z/ 152 | k_type = Regexp.last_match[:k_type] 153 | v_type = Regexp.last_match[:v_type] 154 | {}.tap do |hash| 155 | value.each do |k, v| 156 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 157 | end 158 | end 159 | else # model 160 | temp_model = Flagr.const_get(type).new 161 | temp_model.build_from_hash(value) 162 | end 163 | end 164 | 165 | # Returns the string representation of the object 166 | # @return [String] String presentation of the object 167 | def to_s 168 | to_hash.to_s 169 | end 170 | 171 | # to_body is an alias to to_hash (backward compatibility) 172 | # @return [Hash] Returns the object in the form of hash 173 | def to_body 174 | to_hash 175 | end 176 | 177 | # Returns the object in the form of hash 178 | # @return [Hash] Returns the object in the form of hash 179 | def to_hash 180 | hash = {} 181 | self.class.attribute_map.each_pair do |attr, param| 182 | value = self.send(attr) 183 | next if value.nil? 184 | hash[param] = _to_hash(value) 185 | end 186 | hash 187 | end 188 | 189 | # Outputs non-array value in the form of hash 190 | # For object, use to_hash. Otherwise, just return the value 191 | # @param [Object] value Any valid value 192 | # @return [Hash] Returns the value in the form of hash 193 | def _to_hash(value) 194 | if value.is_a?(Array) 195 | value.compact.map { |v| _to_hash(v) } 196 | elsif value.is_a?(Hash) 197 | {}.tap do |hash| 198 | value.each { |k, v| hash[k] = _to_hash(v) } 199 | end 200 | elsif value.respond_to? :to_hash 201 | value.to_hash 202 | else 203 | value 204 | end 205 | end 206 | 207 | end 208 | end 209 | -------------------------------------------------------------------------------- /lib/rbflagr/models/put_variant_request.rb: -------------------------------------------------------------------------------- 1 | =begin 2 | #Flagr 3 | 4 | #Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". 5 | 6 | OpenAPI spec version: 1.1.12 7 | 8 | Generated by: https://github.com/swagger-api/swagger-codegen.git 9 | Swagger Codegen version: 2.4.21 10 | 11 | =end 12 | 13 | require 'date' 14 | 15 | module Flagr 16 | class PutVariantRequest 17 | attr_accessor :key 18 | 19 | attr_accessor :attachment 20 | 21 | # Attribute mapping from ruby-style variable name to JSON key. 22 | def self.attribute_map 23 | { 24 | :'key' => :'key', 25 | :'attachment' => :'attachment' 26 | } 27 | end 28 | 29 | # Attribute type mapping. 30 | def self.swagger_types 31 | { 32 | :'key' => :'String', 33 | :'attachment' => :'Object' 34 | } 35 | end 36 | 37 | # Initializes the object 38 | # @param [Hash] attributes Model attributes in the form of hash 39 | def initialize(attributes = {}) 40 | return unless attributes.is_a?(Hash) 41 | 42 | # convert string to symbol for hash key 43 | attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } 44 | 45 | if attributes.has_key?(:'key') 46 | self.key = attributes[:'key'] 47 | end 48 | 49 | if attributes.has_key?(:'attachment') 50 | self.attachment = attributes[:'attachment'] 51 | end 52 | end 53 | 54 | # Show invalid properties with the reasons. Usually used together with valid? 55 | # @return Array for valid properties with the reasons 56 | def list_invalid_properties 57 | invalid_properties = Array.new 58 | if @key.nil? 59 | invalid_properties.push('invalid value for "key", key cannot be nil.') 60 | end 61 | 62 | if @key.to_s.length < 1 63 | invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.') 64 | end 65 | 66 | invalid_properties 67 | end 68 | 69 | # Check to see if the all the properties in the model are valid 70 | # @return true if the model is valid 71 | def valid? 72 | return false if @key.nil? 73 | return false if @key.to_s.length < 1 74 | true 75 | end 76 | 77 | # Custom attribute writer method with validation 78 | # @param [Object] key Value to be assigned 79 | def key=(key) 80 | if key.nil? 81 | fail ArgumentError, 'key cannot be nil' 82 | end 83 | 84 | if key.to_s.length < 1 85 | fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.' 86 | end 87 | 88 | @key = key 89 | end 90 | 91 | # Checks equality by comparing each attribute. 92 | # @param [Object] Object to be compared 93 | def ==(o) 94 | return true if self.equal?(o) 95 | self.class == o.class && 96 | key == o.key && 97 | attachment == o.attachment 98 | end 99 | 100 | # @see the `==` method 101 | # @param [Object] Object to be compared 102 | def eql?(o) 103 | self == o 104 | end 105 | 106 | # Calculates hash code according to all attributes. 107 | # @return [Fixnum] Hash code 108 | def hash 109 | [key, attachment].hash 110 | end 111 | 112 | # Builds the object from hash 113 | # @param [Hash] attributes Model attributes in the form of hash 114 | # @return [Object] Returns the model itself 115 | def build_from_hash(attributes) 116 | return nil unless attributes.is_a?(Hash) 117 | self.class.swagger_types.each_pair do |key, type| 118 | if type =~ /\AArray<(.*)>/i 119 | # check to ensure the input is an array given that the attribute 120 | # is documented as an array but the input is not 121 | if attributes[self.class.attribute_map[key]].is_a?(Array) 122 | self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) 123 | end 124 | elsif !attributes[self.class.attribute_map[key]].nil? 125 | self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) 126 | end # or else data not found in attributes(hash), not an issue as the data can be optional 127 | end 128 | 129 | self 130 | end 131 | 132 | # Deserializes the data based on type 133 | # @param string type Data type 134 | # @param string value Value to be deserialized 135 | # @return [Object] Deserialized data 136 | def _deserialize(type, value) 137 | case type.to_sym 138 | when :DateTime 139 | DateTime.parse(value) 140 | when :Date 141 | Date.parse(value) 142 | when :String 143 | value.to_s 144 | when :Integer 145 | value.to_i 146 | when :Float 147 | value.to_f 148 | when :BOOLEAN 149 | if value.to_s =~ /\A(true|t|yes|y|1)\z/i 150 | true 151 | else 152 | false 153 | end 154 | when :Object 155 | # generic object (usually a Hash), return directly 156 | value 157 | when /\AArray<(?.+)>\z/ 158 | inner_type = Regexp.last_match[:inner_type] 159 | value.map { |v| _deserialize(inner_type, v) } 160 | when /\AHash<(?.+?), (?.+)>\z/ 161 | k_type = Regexp.last_match[:k_type] 162 | v_type = Regexp.last_match[:v_type] 163 | {}.tap do |hash| 164 | value.each do |k, v| 165 | hash[_deserialize(k_type, k)] = _deserialize(v_type, v) 166 | end 167 | end 168 | else # model 169 | temp_model = Flagr.const_get(type).new 170 | temp_model.build_from_hash(value) 171 | end 172 | end 173 | 174 | # Returns the string representation of the object 175 | # @return [String] String presentation of the object 176 | def to_s 177 | to_hash.to_s 178 | end 179 | 180 | # to_body is an alias to to_hash (backward compatibility) 181 | # @return [Hash] Returns the object in the form of hash 182 | def to_body 183 | to_hash 184 | end 185 | 186 | # Returns the object in the form of hash 187 | # @return [Hash] Returns the object in the form of hash 188 | def to_hash 189 | hash = {} 190 | self.class.attribute_map.each_pair do |attr, param| 191 | value = self.send(attr) 192 | next if value.nil? 193 | hash[param] = _to_hash(value) 194 | end 195 | hash 196 | end 197 | 198 | # Outputs non-array value in the form of hash 199 | # For object, use to_hash. Otherwise, just return the value 200 | # @param [Object] value Any valid value 201 | # @return [Hash] Returns the value in the form of hash 202 | def _to_hash(value) 203 | if value.is_a?(Array) 204 | value.compact.map { |v| _to_hash(v) } 205 | elsif value.is_a?(Hash) 206 | {}.tap do |hash| 207 | value.each { |k, v| hash[k] = _to_hash(v) } 208 | end 209 | elsif value.respond_to? :to_hash 210 | value.to_hash 211 | else 212 | value 213 | end 214 | end 215 | 216 | end 217 | end 218 | --------------------------------------------------------------------------------