Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ruby-server-sdk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ruby-server-sdk

  • 1.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

devcycle-server-sdk

DevCycle - the Ruby gem for the DevCycle Bucketing API

Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Install the gem

gem install devcycle-server-sdk

Getting Started

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

# Load the gem
require 'devcycle-server-sdk'

# Setup authorization
DevCycle.configure do |config|
  # Configure API key authorization
  config.api_key['bearerAuth'] = 'YOUR API KEY'
end

api_instance = DevCycle::DVCClient.new
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData | 

begin
  #Get all features for user data
  result = api_instance.all_features(user_data)
  p result
rescue DevCycle::ApiError => e
  puts "Exception when calling DVCClient->all_features: #{e}"
end

Usage

Configure SDK

# Load the gem
require 'devcycle-server-sdk'

# Setup authorization
DevCycle.configure do |config|
  # Configure API key authorization
  config.api_key['bearerAuth'] = 'YOUR API KEY'
end

api_instance = DevCycle::DVCClient.new
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData | 

Get all features

begin
  #Get all features for user data
  result = api_instance.all_features(user_data)
  p result
rescue DevCycle::ApiError => e
  puts "Exception when calling DVCClient->all_features: #{e}"
end

Get variable by key

begin
  # Get value of given variable by key, using default value if segmentation is not passed or variable does not exit
  result = api_instance.variable("variable-key", user_data, true)
  p "Received value for #{result.key}: #{result.value}"
rescue DevCycle::ApiError => e
  puts "Exception when calling DVCClient->variable: #{e}"
end

Get all variables

begin
  #Get all variables for user data
  result = api_instance.all_variables(user_data)
  p result
rescue DevCycle::ApiError => e
  puts "Exception when calling DVCClient->all_variables: #{e}"
end

Send events


event_data = DevCycle::Event.new({
  type: "my-event",
  target: "some_event_target",
  value: 12,
  meta_data: {
    myKey: "my-value"
  }
})

begin
  # Post events for given user data
  result = api_instance.track(user_data, event_data)
  p result
rescue DevCycle::ApiError => e
  puts "Exception when calling DVCClient->track: #{e}"
end

Override Logger

To provide a custom logger, override the logger property of the SDK configuration.

DevCycle.configure do |config|
  # Configure API key authorization
  config.api_key['bearerAuth'] = 'YOUR API KEY'

  # Override the default logger
  config.logger = MyLogger
end

Troubleshooting

To see a detailed log of the requests being made to the DevCycle API, enable SDK debug logging:

DevCycle.configure do |config|
  # Configure API key authorization
  config.api_key['bearerAuth'] = 'YOUR API KEY'

  # Enable detailed debug logs of requests being sent to the DevCycle API
  config.debugging = true
end

Documentation for Models

Development

To build the Ruby code into a gem:

gem build ruby-server-sdk.gemspec

Then either install the gem locally:

gem install ./ruby-server-sdk-1.0.0.gem

(for development, run gem install --dev ./ruby-server-sdk-1.0.0.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 'ruby-server-sdk', '~> 1.0.0'

FAQs

Package last updated on 06 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc