Skip to content

openflagr/rbflagr

Repository files navigation

rbflagr

Flagr - the Ruby gem for the Flagr

Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1".

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.1.10
  • Package version: 1.1.10
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build rbflagr.gemspec

Then either install the gem locally:

gem install ./rbflagr-1.1.10.gem

(for development, run gem install --dev ./rbflagr-1.1.10.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'rbflagr', '~> 1.1.10'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'rbflagr', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'rbflagr'

api_instance = Flagr::ConstraintApi.new

flag_id = 789 # Integer | numeric ID of the flag

segment_id = 789 # Integer | numeric ID of the segment

body = Flagr::CreateConstraintRequest.new # CreateConstraintRequest | create a constraint


begin
  result = api_instance.create_constraint(flag_id, segment_id, body)
  p result
rescue Flagr::ApiError => e
  puts "Exception when calling ConstraintApi->create_constraint: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://localhost/api/v1

Class Method HTTP request Description
Flagr::ConstraintApi create_constraint POST /flags/{flagID}/segments/{segmentID}/constraints
Flagr::ConstraintApi delete_constraint DELETE /flags/{flagID}/segments/{segmentID}/constraints/{constraintID}
Flagr::ConstraintApi find_constraints GET /flags/{flagID}/segments/{segmentID}/constraints
Flagr::ConstraintApi put_constraint PUT /flags/{flagID}/segments/{segmentID}/constraints/{constraintID}
Flagr::DistributionApi find_distributions GET /flags/{flagID}/segments/{segmentID}/distributions
Flagr::DistributionApi put_distributions PUT /flags/{flagID}/segments/{segmentID}/distributions
Flagr::EvaluationApi post_evaluation POST /evaluation
Flagr::EvaluationApi post_evaluation_batch POST /evaluation/batch
Flagr::ExportApi get_export_eval_cache_json GET /export/eval_cache/json
Flagr::ExportApi get_export_sqlite GET /export/sqlite
Flagr::FlagApi create_flag POST /flags
Flagr::FlagApi delete_flag DELETE /flags/{flagID}
Flagr::FlagApi find_flags GET /flags
Flagr::FlagApi get_flag GET /flags/{flagID}
Flagr::FlagApi get_flag_entity_types GET /flags/entity_types
Flagr::FlagApi get_flag_snapshots GET /flags/{flagID}/snapshots
Flagr::FlagApi put_flag PUT /flags/{flagID}
Flagr::FlagApi set_flag_enabled PUT /flags/{flagID}/enabled
Flagr::HealthApi get_health GET /health
Flagr::SegmentApi create_segment