splitapi-rb 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a1eb207ee1935989e0fe0c5d4577922667a5c98
4
- data.tar.gz: 3a36139c534cedff98a4953872172d4f0470188b
3
+ metadata.gz: 9c47e3c424787193e33b8e2c0a9136f14ae3a948
4
+ data.tar.gz: e8246c77acd22d24cf5068dcfa6f8e0c8e193eb7
5
5
  SHA512:
6
- metadata.gz: bd68391a7c70338900949f4f3e54f2f85509948b129c1c7dc15db7a09ee71c5acb44c73b99e600a7f82e78c46c14fb21d208849ae9019b5091a47931519cceb6
7
- data.tar.gz: fe8e6f39a25c6e63f284b1eeadd2ebe7e15f0c3c9e931dcf58b3537154e547b9e9e6f83e1d2d704cff013c315bfb10e8bae8546ba719890baa850f9c36d199c2
6
+ metadata.gz: 90890cef468d26fffec054497d5b0a36773c199581cc171f86699edb647f3673276224038c15d7064c28398db29921a498181b6fb563f24586320ceb3c882d42
7
+ data.tar.gz: 15d89da26203e89d1c842c36dda9b6f4cd677158dc9b23cc02aed9ce53830f250b6b41dd108281012be2aefa6f87c79018f03ba0b0e35d9f63d3e0c84dc6bb01
data/CHANGES ADDED
@@ -0,0 +1,7 @@
1
+ 1.0.1
2
+
3
+ Use camel case instead of snake case in JSON response.
4
+
5
+ 1.0.0
6
+
7
+ Initial release
data/DetailedReadme.md ADDED
@@ -0,0 +1,216 @@
1
+ # Identify API Ruby
2
+
3
+ This gem provides simple API to make requests to the Split's Identify API.
4
+
5
+ ## Installation
6
+
7
+ Add this gem to your Gemfile as usual:
8
+
9
+ ```ruby
10
+ gem 'splitapi-rb'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ **Initialize client**
16
+
17
+ ```ruby
18
+ client = SplitApi::Client.new(api_key: 'SPLIT_ADMIN_TOKEN', base_uri: 'SPLIT_IDENTIFY_BASE_URI')
19
+ ```
20
+
21
+ **Make requests**
22
+
23
+ Now we have following models `Attributes`, `Environments`, `Identities`, `TrafficTypes`.
24
+
25
+ ### Attributes
26
+
27
+ Available methods:
28
+
29
+ **list**: fetch all known attributes for traffic type
30
+
31
+ _arguments_: `traffic_type_id`
32
+
33
+ ```ruby
34
+ client.attributes.list('traffic_type_id')
35
+ # example response:
36
+ [
37
+ {
38
+ "id" => "string",
39
+ "traffic_type_id" => "string",
40
+ "display_name" => "string",
41
+ "description" => "string",
42
+ "dataType" => "string"
43
+ },
44
+ # ...
45
+ ]
46
+ ```
47
+
48
+ **save**: create new attribute for traffic type
49
+
50
+ _arguments_: `attribute_hash`
51
+
52
+ ```ruby
53
+ client.attributes.save(
54
+ id: "string",
55
+ traffic_type_id: "string",
56
+ display_name: "string",
57
+ description: "string",
58
+ data_type: "string"
59
+ )
60
+ # example response:
61
+ {
62
+ "id" => "string",
63
+ "organization_id" => "string",
64
+ "traffic_type_id" => "string",
65
+ "display_name" => "string",
66
+ "description" => "string",
67
+ "data_type" => "string"
68
+ }
69
+ ```
70
+
71
+ **delete**: delete attribute by key
72
+
73
+ _arguments_: `traffic_type_id`, `attribute_id`
74
+
75
+ ```ruby
76
+ client.attributes.delete('traffic_type_id', 'attribute_id')
77
+ # example response:
78
+ true
79
+ ```
80
+
81
+ ### Environments
82
+
83
+ Available methods:
84
+
85
+ **list**: fetch environments
86
+
87
+ _arguments_: none
88
+
89
+ ```ruby
90
+ client.environments.list
91
+ # example response
92
+ [
93
+ {
94
+ "id" => "string",
95
+ "name" => "string"
96
+ },
97
+ # ...
98
+ ]
99
+ ```
100
+
101
+ ### Identities
102
+
103
+ Available methods:
104
+
105
+ **save**: add identity
106
+
107
+ _arguments_: `identity_hash`
108
+
109
+ ```ruby
110
+ client.identities.save(
111
+ traffic_type_id: "string",
112
+ environment_id: "string",
113
+ key: "string",
114
+ values: {
115
+ key: "value"
116
+ }
117
+ )
118
+ # example response:
119
+ {
120
+ "traffic_type_id" => "string",
121
+ "environment_id" => "string",
122
+ "key" => "string",
123
+ "values" => {
124
+ "key" => "value"
125
+ }
126
+ }
127
+ ```
128
+
129
+ **update**: update identity
130
+
131
+ _arguments_: `identity_hash`
132
+
133
+ ```ruby
134
+ client.identities.update(
135
+ traffic_type_id: "string",
136
+ environment_id: "string",
137
+ key: "string",
138
+ values: {
139
+ key: "value"
140
+ }
141
+ )
142
+ # example response:
143
+ {
144
+ "traffic_type_id" => "string",
145
+ "environment_id" => "string",
146
+ "key" => "string",
147
+ "values" => {
148
+ "key" => "value"
149
+ }
150
+ }
151
+ ```
152
+
153
+ **save_all**: save multiple identities
154
+
155
+ _arguments_: `traffic_type_id`, `environment_id`, `identity_array`
156
+
157
+ ```ruby
158
+ client.identities.save_all("string", "string",
159
+ [
160
+ {
161
+ "traffic_type_id" => "string",
162
+ "environment_id" => "string",
163
+ "key" => "string",
164
+ "values" => {
165
+ "foo" => "bar"
166
+ }
167
+ },
168
+ # ...
169
+ ]
170
+ )
171
+ # example response:
172
+ {
173
+ [
174
+ {
175
+ "values" => { "foo" => "bar" },
176
+ "key" => "string",
177
+ "environment_id" => "string",
178
+ "traffic_type_id" => "string",
179
+ "organization_id" => "string",
180
+ "timestamp" => "integer"
181
+ },
182
+ # ...
183
+ ]
184
+ }
185
+ ```
186
+
187
+ **delete**: delete all attributes of a specific key
188
+
189
+ _arguments_: `traffic_type_id`, `environment_id`, `key`
190
+
191
+ ```ruby
192
+ client.identities.delete(`traffic_type_id`, `environment_id`, `key`)
193
+ # example response:
194
+ true
195
+ ```
196
+
197
+ ### Traffic Types
198
+
199
+ Available methods:
200
+
201
+ **list**: list traffic types
202
+
203
+ _arguments_: none
204
+
205
+ ```ruby
206
+ client.traffic_types.list
207
+ # example response:
208
+ [
209
+ {
210
+ "id": "string",
211
+ "name": "string",
212
+ "display_attribute_id": "string"
213
+ },
214
+ # ...
215
+ ]
216
+ ```
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- splitapi-rb (1.0.0)
4
+ splitapi-rb (1.0.1)
5
5
  json (~> 1.8)
6
6
  rest-client (~> 2.0)
7
7
 
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2016 Split Software, Co.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md CHANGED
@@ -1,216 +1,38 @@
1
- # Identify API Ruby
1
+ # Split Ruby API
2
2
 
3
- This gem provides simple API to make requests to the Split's Identify API.
3
+ This API wrapper is designed to work with [Split](https://www.split.io), the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience.
4
4
 
5
- ## Installation
5
+ ### Quick setup
6
6
 
7
- Add this gem to your Gemfile as usual:
7
+ For specific instructions on how to use this API refer to our [Detailed Readme](DetailedReadme.md) or our [official API documentation](https://docs.split.io/reference).
8
8
 
9
- ```ruby
10
- gem 'splitapi-rb'
11
- ```
9
+ ### Commitment to Quality:
12
10
 
13
- ## Usage
11
+ Split’s APIs are in active development and are constantly tested for quality. Unit tests are developed for each wrapper based on the unique needs of that language, and integration tests, load and performance tests, and behavior consistency tests are running 24/7 via automated bots. In addition, monitoring instrumentation ensures that these wrappers behave under the expected parameters of memory, CPU, and I/O.
14
12
 
15
- **Initialize client**
13
+ ### About Split:
16
14
 
17
- ```ruby
18
- client = SplitApi::Client.new(api_key: 'SPLIT_ADMIN_TOKEN', base_uri: 'SPLIT_IDENTIFY_BASE_URI')
19
- ```
15
+ Split is the leading platform for intelligent software delivery, helping businesses of all sizes deliver exceptional user experiences, and mitigate risk, by providing an easy, secure way to target features to customers. Companies like WePay, LendingTree and thredUP rely on Split to safely launch and test new features and derive insights on their use. Founded in 2015, Split's team comes from some of the most innovative enterprises in Silicon Valley, including Google, LinkedIn, Salesforce and Splunk. Split is based in Redwood City, California and backed by Accel Partners and Lightspeed Venture Partners. To learn more about Split, contact hello@split.io, or start a 14-day free trial at www.split.io/trial.
20
16
 
21
- **Make requests**
17
+ Split has built and maintains a API wrappers for:
22
18
 
23
- Now we have following models `Attributes`, `Environments`, `Identities`, `TrafficTypes`.
24
-
25
- ### Attributes
26
-
27
- Available methods:
28
-
29
- **list**: fetch all known attributes for traffic type
19
+ * Java [Github](https://github.com/splitio/java-api)
20
+ * Node [Github](https://github.com/splitio/javascript-api)
21
+ * .NET [Github](https://github.com/splitio/net-api)
22
+ * Ruby [Github](https://github.com/splitio/ruby-api)
23
+ * PHP [Github](https://github.com/splitio/php-api)
24
+ * Python [Github](https://github.com/splitio/python-api)
30
25
 
31
- _arguments_: `traffic_type_id`
26
+ For a comprehensive list of opensource projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
32
27
 
33
- ```ruby
34
- client.attributes.list('traffic_type_id')
35
- # example response:
36
- [
37
- {
38
- "id" => "string",
39
- "traffic_type_id" => "string",
40
- "display_name" => "string",
41
- "description" => "string",
42
- "dataType" => "string"
43
- },
44
- # ...
45
- ]
46
- ```
47
-
48
- **save**: create new attribute for traffic type
49
-
50
- _arguments_: `attribute_hash`
51
-
52
- ```ruby
53
- client.attributes.save(
54
- id: "string",
55
- traffic_type_id: "string",
56
- display_name: "string",
57
- description: "string",
58
- data_type: "string"
59
- )
60
- # example response:
61
- {
62
- "id" => "string",
63
- "organization_id" => "string",
64
- "traffic_type_id" => "string",
65
- "display_name" => "string",
66
- "description" => "string",
67
- "data_type" => "string"
68
- }
69
- ```
70
-
71
- **delete**: delete attribute by key
72
-
73
- _arguments_: `traffic_type_id`, `attribute_id`
74
-
75
- ```ruby
76
- client.attributes.delete('traffic_type_id', 'attribute_id')
77
- # example response:
78
- true
79
- ```
80
-
81
- ### Environments
82
-
83
- Available methods:
84
-
85
- **list**: fetch environments
86
-
87
- _arguments_: none
88
-
89
- ```ruby
90
- client.environments.list
91
- # example response
92
- [
93
- {
94
- "id" => "string",
95
- "name" => "string"
96
- },
97
- # ...
98
- ]
99
- ```
100
-
101
- ### Identities
102
-
103
- Available methods:
104
-
105
- **save**: add identity
106
-
107
- _arguments_: `identity_hash`
108
-
109
- ```ruby
110
- client.identities.save(
111
- traffic_type_id: "string",
112
- environment_id: "string",
113
- key: "string",
114
- values: {
115
- key: "value"
116
- }
117
- )
118
- # example response:
119
- {
120
- "traffic_type_id" => "string",
121
- "environment_id" => "string",
122
- "key" => "string",
123
- "values" => {
124
- "key" => "value"
125
- }
126
- }
127
- ```
128
-
129
- **update**: update identity
130
-
131
- _arguments_: `identity_hash`
132
-
133
- ```ruby
134
- client.identities.update(
135
- traffic_type_id: "string",
136
- environment_id: "string",
137
- key: "string",
138
- values: {
139
- key: "value"
140
- }
141
- )
142
- # example response:
143
- {
144
- "traffic_type_id" => "string",
145
- "environment_id" => "string",
146
- "key" => "string",
147
- "values" => {
148
- "key" => "value"
149
- }
150
- }
151
- ```
152
-
153
- **save_all**: save multiple identities
154
-
155
- _arguments_: `traffic_type_id`, `environment_id`, `identity_array`
156
-
157
- ```ruby
158
- client.identities.save_all("string", "string",
159
- [
160
- {
161
- "traffic_type_id" => "string",
162
- "environment_id" => "string",
163
- "key" => "string",
164
- "values" => {
165
- "foo" => "bar"
166
- }
167
- },
168
- # ...
169
- ]
170
- )
171
- # example response:
172
- {
173
- [
174
- {
175
- "values" => { "foo" => "bar" },
176
- "key" => "string",
177
- "environment_id" => "string",
178
- "traffic_type_id" => "string",
179
- "organization_id" => "string",
180
- "timestamp" => "integer"
181
- },
182
- # ...
183
- ]
184
- }
185
- ```
186
-
187
- **delete**: delete all attributes of a specific key
188
-
189
- _arguments_: `traffic_type_id`, `environment_id`, `key`
190
-
191
- ```ruby
192
- client.identities.delete(`traffic_type_id`, `environment_id`, `key`)
193
- # example response:
194
- true
195
- ```
196
-
197
- ### Traffic Types
198
-
199
- Available methods:
200
-
201
- **list**: list traffic types
202
-
203
- _arguments_: none
204
-
205
- ```ruby
206
- client.traffic_types.list
207
- # example response:
208
- [
209
- {
210
- "id": "string",
211
- "name": "string",
212
- "display_attribute_id": "string"
213
- },
214
- # ...
215
- ]
216
- ```
28
+ **Try Split for Free:**
29
+
30
+ Split is available as a 14-day free trial. To create an account, visit [split.io/trial](https://www.split.io/trial).
31
+
32
+ **Learn more about Split:**
33
+
34
+ Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [docs.split.io](http://docs.split.io) for more detailed information.
35
+
36
+ **System Status:**
37
+
38
+ We use a status page to monitor the availability of Split’s various services. You can check the current status at [status.split.io](http://status.split.io).
@@ -14,9 +14,7 @@ module SplitApi
14
14
  RestClient.get(
15
15
  "#{@config.base_uri}/trafficTypes/#{traffic_type_id}/schema", auth_headers
16
16
  ).body
17
- ).map do |identity|
18
- identity.map { |k, v| [to_underscore(k), v] }.to_h
19
- end
17
+ )
20
18
  end
21
19
 
22
20
  # PUT /trafficTypes/{traffic_type_id}/schema
@@ -31,7 +29,7 @@ module SplitApi
31
29
  'description' => attribute[:description],
32
30
  'dataType' => attribute[:data_type]
33
31
  }.to_json, auth_headers).body
34
- ).map { |k, v| [to_underscore(k), v] }.to_h
32
+ )
35
33
  end
36
34
 
37
35
  # DELETE /trafficTypes/{traffic_type_id}/schema/{attribute_id}
@@ -10,9 +10,7 @@ module SplitApi
10
10
 
11
11
  # GET /environments
12
12
  def list
13
- JSON.parse(RestClient.get("#{@config.base_uri}/environments", auth_headers).body).map do |identity|
14
- identity.map { |k, v| [to_underscore(k), v] }.to_h
15
- end
13
+ JSON.parse(RestClient.get("#{@config.base_uri}/environments", auth_headers).body)
16
14
  end
17
15
  end
18
16
  end
@@ -18,7 +18,7 @@ module SplitApi
18
18
  'trafficTypeId' => identity[:traffic_type_id],
19
19
  'environmentId' => identity[:environment_id],
20
20
  'values' => identity[:values]
21
- }.to_json, auth_headers).body).map { |k, v| [to_underscore(k), v] }.to_h
21
+ }.to_json, auth_headers).body)
22
22
  end
23
23
 
24
24
  # POST /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities
@@ -28,9 +28,7 @@ module SplitApi
28
28
  "/environments/#{environment_id}" \
29
29
  "/identities",
30
30
  identities.to_json, auth_headers).body
31
- )['objects'].map do |identity|
32
- identity.map { |k, v| [to_underscore(k), v] }.to_h
33
- end
31
+ )['objects']
34
32
  end
35
33
 
36
34
  # PATCH /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities/{key}
@@ -43,7 +41,7 @@ module SplitApi
43
41
  'trafficTypeId' => identity[:traffic_type_id],
44
42
  'environmentId' => identity[:environment_id],
45
43
  'values' => identity[:values]
46
- }.to_json, auth_headers).body).map { |k, v| [to_underscore(k), v] }.to_h
44
+ }.to_json, auth_headers).body)
47
45
  end
48
46
 
49
47
  # DELETE /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities/{key}
@@ -10,9 +10,7 @@ module SplitApi
10
10
 
11
11
  # GET /trafficTypes
12
12
  def list
13
- JSON.parse(RestClient.get("#{@config.base_uri}/trafficTypes", auth_headers).body).map do |identity|
14
- identity.map { |k, v| [to_underscore(k), v] }.to_h
15
- end
13
+ JSON.parse(RestClient.get("#{@config.base_uri}/trafficTypes", auth_headers).body)
16
14
  end
17
15
  end
18
16
  end
@@ -1,3 +1,3 @@
1
1
  module SplitApi
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitapi-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-27 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -145,8 +145,11 @@ extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
147
  - ".rspec"
148
+ - CHANGES
149
+ - DetailedReadme.md
148
150
  - Gemfile
149
151
  - Gemfile.lock
152
+ - LICENSE
150
153
  - NEWS
151
154
  - README.md
152
155
  - lib/splitapi-rb.rb