devcycle-ruby-server-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +171 -0
- data/Rakefile +10 -0
- data/devcycle-ruby-server-sdk.gemspec +34 -0
- data/docs/DevcycleApi.md +290 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/Event.md +26 -0
- data/docs/Feature.md +26 -0
- data/docs/UserData.md +48 -0
- data/docs/Variable.md +24 -0
- data/examples/sinatra/Gemfile +6 -0
- data/examples/sinatra/Gemfile.lock +48 -0
- data/examples/sinatra/README.md +14 -0
- data/examples/sinatra/app.rb +47 -0
- data/git_push.sh +57 -0
- data/lib/devcycle-ruby-server-sdk/api/devcycle_api.rb +349 -0
- data/lib/devcycle-ruby-server-sdk/api_client.rb +390 -0
- data/lib/devcycle-ruby-server-sdk/api_error.rb +57 -0
- data/lib/devcycle-ruby-server-sdk/configuration.rb +278 -0
- data/lib/devcycle-ruby-server-sdk/models/error_response.rb +234 -0
- data/lib/devcycle-ruby-server-sdk/models/event.rb +264 -0
- data/lib/devcycle-ruby-server-sdk/models/feature.rb +313 -0
- data/lib/devcycle-ruby-server-sdk/models/inline_response201.rb +218 -0
- data/lib/devcycle-ruby-server-sdk/models/user_data.rb +447 -0
- data/lib/devcycle-ruby-server-sdk/models/user_data_and_events_body.rb +229 -0
- data/lib/devcycle-ruby-server-sdk/models/variable.rb +315 -0
- data/lib/devcycle-ruby-server-sdk/version.rb +15 -0
- data/lib/devcycle-ruby-server-sdk.rb +47 -0
- data/spec/api/devcycle_api_spec.rb +107 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 568a1d631763d70e2ab7588459b8db1383e53495a10c35baf55e1e5f0f733a12
|
4
|
+
data.tar.gz: 5f68fba2022de817bed7a35287003578b736c0c35d82b766062a3a1ad8983daa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c72105c1f5646f22adfb9e3b80851fafc91e3f712702a1acf7032b5d0034ca8c96cad02c657a18d03a9125ceaed0caf0d4d325f26a8633d8343212c7c8220b3
|
7
|
+
data.tar.gz: 404abbde5b200a05cab28052cf762714f328068e7f4a7336271b5115b9249d515e3f7c3de4f9ba35860726ebdbf723d4af483ef74512cd9b892dd921bb38b647
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Taplytics Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
# devcycle-ruby-server-sdk
|
2
|
+
|
3
|
+
DevCycle - the Ruby gem for the DevCycle Bucketing API
|
4
|
+
|
5
|
+
Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
|
+
|
9
|
+
- API version: 1.0.0
|
10
|
+
- Package version: 1.0.0
|
11
|
+
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Install the gem
|
16
|
+
|
17
|
+
`gem install devcycle-ruby-server-sdk`
|
18
|
+
|
19
|
+
|
20
|
+
## Getting Started
|
21
|
+
|
22
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# Load the gem
|
26
|
+
require 'devcycle-server-sdk'
|
27
|
+
|
28
|
+
# Setup authorization
|
29
|
+
DevCycle.configure do |config|
|
30
|
+
# Configure API key authorization
|
31
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
32
|
+
end
|
33
|
+
|
34
|
+
api_instance = DevCycle::DVCClient.new
|
35
|
+
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
36
|
+
|
37
|
+
begin
|
38
|
+
#Get all features for user data
|
39
|
+
result = api_instance.all_features(user_data)
|
40
|
+
p result
|
41
|
+
rescue DevCycle::ApiError => e
|
42
|
+
puts "Exception when calling DVCClient->all_features: #{e}"
|
43
|
+
end
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
### Configure SDK
|
50
|
+
```ruby
|
51
|
+
# Load the gem
|
52
|
+
require 'devcycle-server-sdk'
|
53
|
+
|
54
|
+
# Setup authorization
|
55
|
+
DevCycle.configure do |config|
|
56
|
+
# Configure API key authorization
|
57
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
58
|
+
end
|
59
|
+
|
60
|
+
api_instance = DevCycle::DVCClient.new
|
61
|
+
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
62
|
+
```
|
63
|
+
|
64
|
+
### Get all features
|
65
|
+
```ruby
|
66
|
+
begin
|
67
|
+
#Get all features for user data
|
68
|
+
result = api_instance.all_features(user_data)
|
69
|
+
p result
|
70
|
+
rescue DevCycle::ApiError => e
|
71
|
+
puts "Exception when calling DVCClient->all_features: #{e}"
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
### Get variable by key
|
76
|
+
```ruby
|
77
|
+
begin
|
78
|
+
# Get value of given variable by key, using default value if segmentation is not passed or variable does not exit
|
79
|
+
result = api_instance.variable("variable-key", user_data, true)
|
80
|
+
p "Received value for #{result.key}: #{result.value}"
|
81
|
+
rescue DevCycle::ApiError => e
|
82
|
+
puts "Exception when calling DVCClient->variable: #{e}"
|
83
|
+
end
|
84
|
+
```
|
85
|
+
|
86
|
+
### Get all variables
|
87
|
+
```ruby
|
88
|
+
begin
|
89
|
+
#Get all variables for user data
|
90
|
+
result = api_instance.all_variables(user_data)
|
91
|
+
p result
|
92
|
+
rescue DevCycle::ApiError => e
|
93
|
+
puts "Exception when calling DVCClient->all_variables: #{e}"
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
### Send events
|
98
|
+
```ruby
|
99
|
+
|
100
|
+
event_data = DevCycle::Event.new({
|
101
|
+
type: "my-event",
|
102
|
+
target: "some_event_target",
|
103
|
+
value: 12,
|
104
|
+
meta_data: {
|
105
|
+
myKey: "my-value"
|
106
|
+
}
|
107
|
+
})
|
108
|
+
|
109
|
+
begin
|
110
|
+
# Post events for given user data
|
111
|
+
result = api_instance.track(user_data, event_data)
|
112
|
+
p result
|
113
|
+
rescue DevCycle::ApiError => e
|
114
|
+
puts "Exception when calling DVCClient->track: #{e}"
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
### Override Logger
|
119
|
+
To provide a custom logger, override the `logger` property of the SDK configuration.
|
120
|
+
```ruby
|
121
|
+
DevCycle.configure do |config|
|
122
|
+
# Configure API key authorization
|
123
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
124
|
+
|
125
|
+
# Override the default logger
|
126
|
+
config.logger = MyLogger
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
### Troubleshooting
|
131
|
+
To see a detailed log of the requests being made to the DevCycle API, enable SDK debug logging:
|
132
|
+
```ruby
|
133
|
+
DevCycle.configure do |config|
|
134
|
+
# Configure API key authorization
|
135
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
136
|
+
|
137
|
+
# Enable detailed debug logs of requests being sent to the DevCycle API
|
138
|
+
config.debugging = true
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
|
143
|
+
## Documentation for Models
|
144
|
+
|
145
|
+
- [DevCycle::ErrorResponse](docs/ErrorResponse.md)
|
146
|
+
- [DevCycle::Event](docs/Event.md)
|
147
|
+
- [DevCycle::Feature](docs/Feature.md)
|
148
|
+
- [DevCycle::UserData](docs/UserData.md)
|
149
|
+
- [DevCycle::Variable](docs/Variable.md)
|
150
|
+
|
151
|
+
### Development
|
152
|
+
|
153
|
+
To build the Ruby code into a gem:
|
154
|
+
|
155
|
+
```shell
|
156
|
+
gem build devcycle-ruby-server-sdk.gemspec
|
157
|
+
```
|
158
|
+
|
159
|
+
Then either install the gem locally:
|
160
|
+
|
161
|
+
```shell
|
162
|
+
gem install ./devcycle-ruby-server-sdk-1.0.0.gem
|
163
|
+
```
|
164
|
+
|
165
|
+
(for development, run `gem install --dev ./devcycle-ruby-server-sdk-1.0.0.gem` to install the development dependencies)
|
166
|
+
|
167
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
168
|
+
|
169
|
+
Finally add this to the Gemfile:
|
170
|
+
|
171
|
+
gem 'ruby-server-sdk', '~> 1.0.0'
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#DevCycle Bucketing API
|
5
|
+
#Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 5.3.0
|
9
|
+
=end
|
10
|
+
|
11
|
+
$:.push File.expand_path("../lib", __FILE__)
|
12
|
+
require "devcycle-ruby-server-sdk/version"
|
13
|
+
|
14
|
+
Gem::Specification.new do |s|
|
15
|
+
s.name = "devcycle-ruby-server-sdk"
|
16
|
+
s.version = DevCycle::VERSION
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.authors = ["DevCycleHQ"]
|
19
|
+
s.email = ["support@devcycle.com"]
|
20
|
+
s.homepage = "https://devcycle.com"
|
21
|
+
s.summary = "DevCycle Bucketing API Ruby Gem"
|
22
|
+
s.description = "DevCycle Ruby Server SDK, for interacting with feature flags created with the DevCycle platform."
|
23
|
+
s.license = "MIT"
|
24
|
+
s.required_ruby_version = ">= 2.4"
|
25
|
+
|
26
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
27
|
+
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
29
|
+
|
30
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
31
|
+
s.test_files = `find spec/*`.split("\n")
|
32
|
+
s.executables = []
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
end
|
data/docs/DevcycleApi.md
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
# DevCycle::DevcycleApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://bucketing-api.devcycle.com*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**all_features**](DevcycleApi.md#all_features) | **POST** /v1/features | Get all features by key for user data |
|
8
|
+
| [**variable**](DevcycleApi.md#variable) | **POST** /v1/variables/{key} | Get variable by key for user data |
|
9
|
+
| [**all_variables**](DevcycleApi.md#all_variables) | **POST** /v1/variables | Get all variables by key for user data |
|
10
|
+
| [**track**](DevcycleApi.md#track) | **POST** /v1/track | Post events to DevCycle for user |
|
11
|
+
|
12
|
+
|
13
|
+
## all_features
|
14
|
+
|
15
|
+
> <Hash<String, Feature>> all_features(user_data)
|
16
|
+
|
17
|
+
Get all features by key for user data
|
18
|
+
|
19
|
+
### Examples
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'time'
|
23
|
+
require 'devcycle-server-sdk'
|
24
|
+
# setup authorization
|
25
|
+
DevCycle.configure do |config|
|
26
|
+
# Configure API key authorization: bearerAuth
|
27
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
28
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
29
|
+
# config.api_key_prefix['bearerAuth'] = 'Bearer'
|
30
|
+
end
|
31
|
+
|
32
|
+
api_instance = DevCycle::DevcycleApi.new
|
33
|
+
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
34
|
+
|
35
|
+
begin
|
36
|
+
# Get all features by key for user data
|
37
|
+
result = api_instance.all_features(user_data)
|
38
|
+
p result
|
39
|
+
rescue DevCycle::ApiError => e
|
40
|
+
puts "Error when calling DevcycleApi->all_features: #{e}"
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Using the all_features_with_http_info variant
|
45
|
+
|
46
|
+
This returns an Array which contains the response data, status code and headers.
|
47
|
+
|
48
|
+
> <Array(<Hash<String, Feature>>, Integer, Hash)> all_features_with_http_info(user_data)
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
begin
|
52
|
+
# Get all features by key for user data
|
53
|
+
data, status_code, headers = api_instance.all_features_with_http_info(user_data)
|
54
|
+
p status_code # => 2xx
|
55
|
+
p headers # => { ... }
|
56
|
+
p data # => <Hash<String, Feature>>
|
57
|
+
rescue DevCycle::ApiError => e
|
58
|
+
puts "Error when calling DevcycleApi->all_features_with_http_info: #{e}"
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
### Parameters
|
63
|
+
|
64
|
+
| Name | Type | Description | Notes |
|
65
|
+
| ---- | ---- | ----------- | ----- |
|
66
|
+
| **user_data** | [**UserData**](UserData.md) | | |
|
67
|
+
|
68
|
+
### Return type
|
69
|
+
|
70
|
+
[**Hash<String, Feature>**](Feature.md)
|
71
|
+
|
72
|
+
### Authorization
|
73
|
+
|
74
|
+
[bearerAuth](../README.md#bearerAuth)
|
75
|
+
|
76
|
+
### HTTP request headers
|
77
|
+
|
78
|
+
- **Content-Type**: application/json
|
79
|
+
- **Accept**: application/json
|
80
|
+
|
81
|
+
|
82
|
+
## variable
|
83
|
+
|
84
|
+
> <Variable> variable(key, user_data)
|
85
|
+
|
86
|
+
Get variable by key for user data
|
87
|
+
|
88
|
+
### Examples
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
require 'time'
|
92
|
+
require 'devcycle-server-sdk'
|
93
|
+
# setup authorization
|
94
|
+
DevCycle.configure do |config|
|
95
|
+
# Configure API key authorization: bearerAuth
|
96
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
97
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
98
|
+
# config.api_key_prefix['bearerAuth'] = 'Bearer'
|
99
|
+
end
|
100
|
+
|
101
|
+
api_instance = DevCycle::DevcycleApi.new
|
102
|
+
key = 'key_example' # String | Variable key
|
103
|
+
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
104
|
+
|
105
|
+
begin
|
106
|
+
# Get variable by key for user data
|
107
|
+
result = api_instance.variable(key, user_data)
|
108
|
+
p result
|
109
|
+
rescue DevCycle::ApiError => e
|
110
|
+
puts "Error when calling DevcycleApi->variable: #{e}"
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
#### Using the variable_with_http_info variant
|
115
|
+
|
116
|
+
This returns an Array which contains the response data, status code and headers.
|
117
|
+
|
118
|
+
> <Array(<Variable>, Integer, Hash)> variable_with_http_info(key, user_data)
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
begin
|
122
|
+
# Get variable by key for user data
|
123
|
+
data, status_code, headers = api_instance.variable_with_http_info(key, user_data)
|
124
|
+
p status_code # => 2xx
|
125
|
+
p headers # => { ... }
|
126
|
+
p data # => <Variable>
|
127
|
+
rescue DevCycle::ApiError => e
|
128
|
+
puts "Error when calling DevcycleApi->variable_with_http_info: #{e}"
|
129
|
+
end
|
130
|
+
```
|
131
|
+
|
132
|
+
### Parameters
|
133
|
+
|
134
|
+
| Name | Type | Description | Notes |
|
135
|
+
| ---- | ---- | ----------- | ----- |
|
136
|
+
| **key** | **String** | Variable key | |
|
137
|
+
| **user_data** | [**UserData**](UserData.md) | | |
|
138
|
+
|
139
|
+
### Return type
|
140
|
+
|
141
|
+
[**Variable**](Variable.md)
|
142
|
+
|
143
|
+
### Authorization
|
144
|
+
|
145
|
+
[bearerAuth](../README.md#bearerAuth)
|
146
|
+
|
147
|
+
### HTTP request headers
|
148
|
+
|
149
|
+
- **Content-Type**: application/json
|
150
|
+
- **Accept**: application/json
|
151
|
+
|
152
|
+
|
153
|
+
## all_variables
|
154
|
+
|
155
|
+
> <Hash<String, Variable>> all_variables(user_data)
|
156
|
+
|
157
|
+
Get all variables by key for user data
|
158
|
+
|
159
|
+
### Examples
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
require 'time'
|
163
|
+
require 'devcycle-server-sdk'
|
164
|
+
# setup authorization
|
165
|
+
DevCycle.configure do |config|
|
166
|
+
# Configure API key authorization: bearerAuth
|
167
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
168
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
169
|
+
# config.api_key_prefix['bearerAuth'] = 'Bearer'
|
170
|
+
end
|
171
|
+
|
172
|
+
api_instance = DevCycle::DevcycleApi.new
|
173
|
+
user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
174
|
+
|
175
|
+
begin
|
176
|
+
# Get all variables by key for user data
|
177
|
+
result = api_instance.all_variables(user_data)
|
178
|
+
p result
|
179
|
+
rescue DevCycle::ApiError => e
|
180
|
+
puts "Error when calling DevcycleApi->all_variables: #{e}"
|
181
|
+
end
|
182
|
+
```
|
183
|
+
|
184
|
+
#### Using the all_variables_with_http_info variant
|
185
|
+
|
186
|
+
This returns an Array which contains the response data, status code and headers.
|
187
|
+
|
188
|
+
> <Array(<Hash<String, Variable>>, Integer, Hash)> all_variables_with_http_info(user_data)
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
begin
|
192
|
+
# Get all variables by key for user data
|
193
|
+
data, status_code, headers = api_instance.all_variables_with_http_info(user_data)
|
194
|
+
p status_code # => 2xx
|
195
|
+
p headers # => { ... }
|
196
|
+
p data # => <Hash<String, Variable>>
|
197
|
+
rescue DevCycle::ApiError => e
|
198
|
+
puts "Error when calling DevcycleApi->all_variables_with_http_info: #{e}"
|
199
|
+
end
|
200
|
+
```
|
201
|
+
|
202
|
+
### Parameters
|
203
|
+
|
204
|
+
| Name | Type | Description | Notes |
|
205
|
+
| ---- | ---- | ----------- | ----- |
|
206
|
+
| **user_data** | [**UserData**](UserData.md) | | |
|
207
|
+
|
208
|
+
### Return type
|
209
|
+
|
210
|
+
[**Hash<String, Variable>**](Variable.md)
|
211
|
+
|
212
|
+
### Authorization
|
213
|
+
|
214
|
+
[bearerAuth](../README.md#bearerAuth)
|
215
|
+
|
216
|
+
### HTTP request headers
|
217
|
+
|
218
|
+
- **Content-Type**: application/json
|
219
|
+
- **Accept**: application/json
|
220
|
+
|
221
|
+
|
222
|
+
## track
|
223
|
+
|
224
|
+
> <InlineResponse201> track(user_data, event_data)
|
225
|
+
|
226
|
+
Post events to DevCycle for user
|
227
|
+
|
228
|
+
### Examples
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
require 'time'
|
232
|
+
require 'devcycle-server-sdk'
|
233
|
+
# setup authorization
|
234
|
+
DevCycle.configure do |config|
|
235
|
+
# Configure API key authorization: bearerAuth
|
236
|
+
config.api_key['bearerAuth'] = 'YOUR API KEY'
|
237
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
238
|
+
# config.api_key_prefix['bearerAuth'] = 'Bearer'
|
239
|
+
end
|
240
|
+
|
241
|
+
api_instance = DevCycle::DevcycleApi.new
|
242
|
+
user_data = DevCycle::UserData.new # UserData |
|
243
|
+
event_data = DevCycle::Event.new # Event |
|
244
|
+
|
245
|
+
begin
|
246
|
+
# Post events to DevCycle for user
|
247
|
+
result = api_instance.track(user_data, event_data)
|
248
|
+
p result
|
249
|
+
rescue DevCycle::ApiError => e
|
250
|
+
puts "Error when calling DevcycleApi->track: #{e}"
|
251
|
+
end
|
252
|
+
```
|
253
|
+
|
254
|
+
#### Using the track_with_http_info variant
|
255
|
+
|
256
|
+
This returns an Array which contains the response data, status code and headers.
|
257
|
+
|
258
|
+
> <Array(<InlineResponse201>, Integer, Hash)> track_with_http_info(user_data_and_events_body)
|
259
|
+
|
260
|
+
```ruby
|
261
|
+
begin
|
262
|
+
# Post events to DevCycle for user
|
263
|
+
data, status_code, headers = api_instance.track_with_http_info(user_data_and_events_body)
|
264
|
+
p status_code # => 2xx
|
265
|
+
p headers # => { ... }
|
266
|
+
p data # => <InlineResponse201>
|
267
|
+
rescue DevCycle::ApiError => e
|
268
|
+
puts "Error when calling DevcycleApi->track_with_http_info: #{e}"
|
269
|
+
end
|
270
|
+
```
|
271
|
+
|
272
|
+
### Parameters
|
273
|
+
|
274
|
+
| Name | Type | Description | Notes |
|
275
|
+
| ---- | ---- | ----------- | ----- |
|
276
|
+
| **user_data_and_events_body** | [**UserDataAndEventsBody**](UserDataAndEventsBody.md) | | |
|
277
|
+
|
278
|
+
### Return type
|
279
|
+
|
280
|
+
[**InlineResponse201**](InlineResponse201.md)
|
281
|
+
|
282
|
+
### Authorization
|
283
|
+
|
284
|
+
[bearerAuth](../README.md#bearerAuth)
|
285
|
+
|
286
|
+
### HTTP request headers
|
287
|
+
|
288
|
+
- **Content-Type**: application/json
|
289
|
+
- **Accept**: application/json
|
290
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# DevCycle::ErrorResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **message** | **String** | Error message | |
|
8
|
+
| **data** | **Object** | Additional error information detailing the error reasoning | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'devcycle-server-sdk'
|
14
|
+
|
15
|
+
instance = DevCycle::ErrorResponse.new(
|
16
|
+
message: null,
|
17
|
+
data: null
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
data/docs/Event.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# DevCycle::Event
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **type** | **String** | Custom event type | |
|
8
|
+
| **target** | **String** | Custom event target / subject of event. Contextual to event type | [optional] |
|
9
|
+
| **date** | **Float** | Unix epoch time the event occurred according to client | [optional] |
|
10
|
+
| **value** | **Float** | Value for numerical events. Contextual to event type | [optional] |
|
11
|
+
| **meta_data** | **Object** | Extra JSON metadata for event. Contextual to event type | [optional] |
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'devcycle-server-sdk'
|
17
|
+
|
18
|
+
instance = DevCycle::Event.new(
|
19
|
+
type: null,
|
20
|
+
target: null,
|
21
|
+
date: null,
|
22
|
+
value: null,
|
23
|
+
meta_data: null
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
data/docs/Feature.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# DevCycle::Feature
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **_id** | **String** | unique database id | |
|
8
|
+
| **key** | **String** | Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id. | |
|
9
|
+
| **type** | **String** | Feature type | |
|
10
|
+
| **_variation** | **String** | Bucketed feature variation | |
|
11
|
+
| **eval_reason** | **String** | Evaluation reasoning | [optional] |
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'devcycle-server-sdk'
|
17
|
+
|
18
|
+
instance = DevCycle::Feature.new(
|
19
|
+
_id: null,
|
20
|
+
key: null,
|
21
|
+
type: null,
|
22
|
+
_variation: null,
|
23
|
+
eval_reason: null
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
data/docs/UserData.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# DevCycle::UserData
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **user_id** | **String** | Unique id to identify the user | |
|
8
|
+
| **email** | **String** | User's email used to identify the user on the dashboard / target audiences | [optional] |
|
9
|
+
| **name** | **String** | User's name used to identify the user on the dashboard / target audiences | [optional] |
|
10
|
+
| **language** | **String** | User's language in ISO 639-1 format | [optional] |
|
11
|
+
| **country** | **String** | User's country in ISO 3166 alpha-2 format | [optional] |
|
12
|
+
| **app_version** | **String** | App Version of the running application | [optional] |
|
13
|
+
| **app_build** | **String** | App Build number of the running application | [optional] |
|
14
|
+
| **custom_data** | **Object** | User's custom data to target the user with, data will be logged to DevCycle for use in dashboard. | [optional] |
|
15
|
+
| **private_custom_data** | **Object** | User's custom data to target the user with, data will not be logged to DevCycle only used for feature bucketing. | [optional] |
|
16
|
+
| **created_date** | **Float** | Date the user was created, Unix epoch timestamp format | [optional] |
|
17
|
+
| **last_seen_date** | **Float** | Date the user was created, Unix epoch timestamp format | [optional] |
|
18
|
+
| **platform** | **String** | Platform the Client SDK is running on | [optional] |
|
19
|
+
| **platform_version** | **String** | Version of the platform the Client SDK is running on | [optional] |
|
20
|
+
| **device_model** | **String** | User's device model | [optional] |
|
21
|
+
| **sdk_type** | **String** | DevCycle SDK type | [optional] |
|
22
|
+
| **sdk_version** | **String** | DevCycle SDK Version | [optional] |
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'ruby-server-sdk'
|
28
|
+
|
29
|
+
instance = DevCycle::UserData.new(
|
30
|
+
user_id: null,
|
31
|
+
email: null,
|
32
|
+
name: null,
|
33
|
+
language: null,
|
34
|
+
country: null,
|
35
|
+
app_version: null,
|
36
|
+
app_build: null,
|
37
|
+
custom_data: null,
|
38
|
+
private_custom_data: null,
|
39
|
+
created_date: null,
|
40
|
+
last_seen_date: null,
|
41
|
+
platform: null,
|
42
|
+
platform_version: null,
|
43
|
+
device_model: null,
|
44
|
+
sdk_type: null,
|
45
|
+
sdk_version: null
|
46
|
+
)
|
47
|
+
```
|
48
|
+
|
data/docs/Variable.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# DevCycle::Variable
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **_id** | **String** | unique database id | |
|
8
|
+
| **key** | **String** | Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id. | |
|
9
|
+
| **type** | **String** | Variable type | |
|
10
|
+
| **value** | **Object** | Variable value can be a string, number, boolean, or JSON | |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'devcycle-server-sdk'
|
16
|
+
|
17
|
+
instance = DevCycle::Variable.new(
|
18
|
+
_id: null,
|
19
|
+
key: null,
|
20
|
+
type: null,
|
21
|
+
value: null
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|