Class: FluidFeatures::App
- Inherits:
-
Object
- Object
- FluidFeatures::App
- Defined in:
- lib/fluidfeatures/app.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#client ⇒ Object
Returns the value of attribute client.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #feature_version(feature_name, version_name) ⇒ Object
-
#features ⇒ Object
Returns all the features that FluidFeatures knows about for your application.
- #get(path, params = nil, cache = false) ⇒ Object
-
#initialize(client, app_id, secret, logger) ⇒ App
constructor
A new instance of App.
- #post(path, payload) ⇒ Object
- #put(path, payload) ⇒ Object
- #user(user_id, display_name, is_anonymous, unique_attrs, cohort_attrs) ⇒ Object
- #user_transaction(user_id, url, display_name, is_anonymous, unique_attrs, cohort_attrs) ⇒ Object
Constructor Details
#initialize(client, app_id, secret, logger) ⇒ App
Returns a new instance of App.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fluidfeatures/app.rb', line 12 def initialize(client, app_id, secret, logger) raise "client invalid : #{client}" unless client.is_a? FluidFeatures::Client raise "app_id invalid : #{app_id}" unless app_id.is_a? String raise "secret invalid : #{secret}" unless secret.is_a? String @client = client @app_id = app_id @secret = secret @logger = logger @state = ::FluidFeatures::AppState.new(self) @reporter = ::FluidFeatures::AppReporter.new(self) end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def app_id @app_id end |
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def client @client end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def logger @logger end |
#reporter ⇒ Object
Returns the value of attribute reporter.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def reporter @reporter end |
#secret ⇒ Object
Returns the value of attribute secret.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def secret @secret end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/fluidfeatures/app.rb', line 10 def state @state end |
Instance Method Details
#feature_version(feature_name, version_name) ⇒ Object
56 57 58 |
# File 'lib/fluidfeatures/app.rb', line 56 def feature_version(feature_name, version_name) ::FluidFeatures::AppFeatureVersion.new(self, feature_name, version_name) end |
#features ⇒ Object
Returns all the features that FluidFeatures knows about for your application. The enabled percentage (how much of your user-base) sees each feature is also provided.
44 45 46 |
# File 'lib/fluidfeatures/app.rb', line 44 def features get("/features") end |
#get(path, params = nil, cache = false) ⇒ Object
27 28 29 |
# File 'lib/fluidfeatures/app.rb', line 27 def get(path, params=nil, cache=false) client.get("/app/#{app_id}#{path}", secret, params, cache) end |
#post(path, payload) ⇒ Object
35 36 37 |
# File 'lib/fluidfeatures/app.rb', line 35 def post(path, payload) client.post("/app/#{app_id}#{path}", secret, payload) end |
#put(path, payload) ⇒ Object
31 32 33 |
# File 'lib/fluidfeatures/app.rb', line 31 def put(path, payload) client.put("/app/#{app_id}#{path}", secret, payload) end |
#user(user_id, display_name, is_anonymous, unique_attrs, cohort_attrs) ⇒ Object
48 49 50 |
# File 'lib/fluidfeatures/app.rb', line 48 def user(user_id, display_name, is_anonymous, unique_attrs, cohort_attrs) ::FluidFeatures::AppUser.new(self, user_id, display_name, is_anonymous, unique_attrs, cohort_attrs) end |
#user_transaction(user_id, url, display_name, is_anonymous, unique_attrs, cohort_attrs) ⇒ Object
52 53 54 |
# File 'lib/fluidfeatures/app.rb', line 52 def user_transaction(user_id, url, display_name, is_anonymous, unique_attrs, cohort_attrs) user(user_id, display_name, is_anonymous, unique_attrs, cohort_attrs).transaction(url) end |