splitapi-rb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +79 -0
- data/NEWS +3 -0
- data/README.md +216 -0
- data/lib/splitapi-rb.rb +18 -0
- data/lib/splitapi-rb/client.rb +14 -0
- data/lib/splitapi-rb/config.rb +13 -0
- data/lib/splitapi-rb/exceptions/splitapi_exception.rb +4 -0
- data/lib/splitapi-rb/exceptions/splitapi_not_found_exception.rb +4 -0
- data/lib/splitapi-rb/models/attributes.rb +46 -0
- data/lib/splitapi-rb/models/base_model.rb +19 -0
- data/lib/splitapi-rb/models/environments.rb +19 -0
- data/lib/splitapi-rb/models/identities.rb +58 -0
- data/lib/splitapi-rb/models/traffic_types.rb +19 -0
- data/lib/splitapi-rb/version.rb +3 -0
- data/splitapi-rb.gemspec +31 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a1eb207ee1935989e0fe0c5d4577922667a5c98
|
4
|
+
data.tar.gz: 3a36139c534cedff98a4953872172d4f0470188b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd68391a7c70338900949f4f3e54f2f85509948b129c1c7dc15db7a09ee71c5acb44c73b99e600a7f82e78c46c14fb21d208849ae9019b5091a47931519cceb6
|
7
|
+
data.tar.gz: fe8e6f39a25c6e63f284b1eeadd2ebe7e15f0c3c9e931dcf58b3537154e547b9e9e6f83e1d2d704cff013c315bfb10e8bae8546ba719890baa850f9c36d199c2
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
splitapi-rb (1.0.0)
|
5
|
+
json (~> 1.8)
|
6
|
+
rest-client (~> 2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.5.1)
|
12
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
13
|
+
byebug (9.0.6)
|
14
|
+
coderay (1.1.1)
|
15
|
+
crack (0.4.3)
|
16
|
+
safe_yaml (~> 1.0.0)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
domain_name (0.5.20170404)
|
19
|
+
unf (>= 0.0.5, < 1.0.0)
|
20
|
+
hashdiff (0.3.2)
|
21
|
+
http-cookie (1.0.3)
|
22
|
+
domain_name (~> 0.5)
|
23
|
+
json (1.8.6)
|
24
|
+
method_source (0.8.2)
|
25
|
+
mime-types (3.1)
|
26
|
+
mime-types-data (~> 3.2015)
|
27
|
+
mime-types-data (3.2016.0521)
|
28
|
+
netrc (0.11.0)
|
29
|
+
pry (0.10.4)
|
30
|
+
coderay (~> 1.1.0)
|
31
|
+
method_source (~> 0.8.1)
|
32
|
+
slop (~> 3.4)
|
33
|
+
pry-byebug (3.4.2)
|
34
|
+
byebug (~> 9.0)
|
35
|
+
pry (~> 0.10)
|
36
|
+
public_suffix (2.0.5)
|
37
|
+
rake (10.5.0)
|
38
|
+
rest-client (2.0.2)
|
39
|
+
http-cookie (>= 1.0.2, < 2.0)
|
40
|
+
mime-types (>= 1.16, < 4.0)
|
41
|
+
netrc (~> 0.8)
|
42
|
+
rspec (3.6.0)
|
43
|
+
rspec-core (~> 3.6.0)
|
44
|
+
rspec-expectations (~> 3.6.0)
|
45
|
+
rspec-mocks (~> 3.6.0)
|
46
|
+
rspec-core (3.6.0)
|
47
|
+
rspec-support (~> 3.6.0)
|
48
|
+
rspec-expectations (3.6.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.6.0)
|
51
|
+
rspec-mocks (3.6.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.6.0)
|
54
|
+
rspec-support (3.6.0)
|
55
|
+
safe_yaml (1.0.4)
|
56
|
+
slop (3.6.0)
|
57
|
+
unf (0.1.4)
|
58
|
+
unf_ext
|
59
|
+
unf_ext (0.0.7.4)
|
60
|
+
webmock (2.3.2)
|
61
|
+
addressable (>= 2.3.6)
|
62
|
+
crack (>= 0.3.2)
|
63
|
+
hashdiff
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
ruby
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
bundler (~> 1.11)
|
70
|
+
byebug (~> 9)
|
71
|
+
pry (~> 0.10)
|
72
|
+
pry-byebug (~> 3.4)
|
73
|
+
rake (~> 10.0)
|
74
|
+
rspec (~> 3.0)
|
75
|
+
splitapi-rb!
|
76
|
+
webmock (~> 2.3)
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
1.14.6
|
data/README.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/lib/splitapi-rb.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'splitapi-rb/exceptions/splitapi_exception'
|
2
|
+
require 'splitapi-rb/exceptions/splitapi_not_found_exception'
|
3
|
+
|
4
|
+
require 'splitapi-rb/version'
|
5
|
+
require 'splitapi-rb/client'
|
6
|
+
require 'splitapi-rb/config'
|
7
|
+
|
8
|
+
require 'splitapi-rb/models/base_model'
|
9
|
+
require 'splitapi-rb/models/attributes'
|
10
|
+
require 'splitapi-rb/models/environments'
|
11
|
+
require 'splitapi-rb/models/identities'
|
12
|
+
require 'splitapi-rb/models/traffic_types'
|
13
|
+
|
14
|
+
module SplitApi
|
15
|
+
def self.root
|
16
|
+
File.dirname(__dir__)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SplitApi
|
2
|
+
class Client
|
3
|
+
attr_reader :attributes, :environments, :identities, :traffic_types
|
4
|
+
|
5
|
+
def initialize(params)
|
6
|
+
@config = SplitApi::Config.new(params)
|
7
|
+
|
8
|
+
@attributes = SplitApi::Models::Attributes.new(@config)
|
9
|
+
@environments = SplitApi::Models::Environments.new(@config)
|
10
|
+
@identities = SplitApi::Models::Identities.new(@config)
|
11
|
+
@traffic_types = SplitApi::Models::TrafficTypes.new(@config)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SplitApi
|
5
|
+
module Models
|
6
|
+
class Attributes < BaseModel
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /trafficTypes/{traffic_type_id}/schema
|
12
|
+
def list(traffic_type_id)
|
13
|
+
JSON.parse(
|
14
|
+
RestClient.get(
|
15
|
+
"#{@config.base_uri}/trafficTypes/#{traffic_type_id}/schema", auth_headers
|
16
|
+
).body
|
17
|
+
).map do |identity|
|
18
|
+
identity.map { |k, v| [to_underscore(k), v] }.to_h
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# PUT /trafficTypes/{traffic_type_id}/schema
|
23
|
+
def save(attribute)
|
24
|
+
JSON.parse(
|
25
|
+
RestClient.put(
|
26
|
+
"#{@config.base_uri}/trafficTypes/#{attribute[:traffic_type_id]}/schema",
|
27
|
+
{
|
28
|
+
'id' => attribute[:id],
|
29
|
+
'trafficTypeId' => attribute[:traffic_type_id],
|
30
|
+
'displayName' => attribute[:display_name],
|
31
|
+
'description' => attribute[:description],
|
32
|
+
'dataType' => attribute[:data_type]
|
33
|
+
}.to_json, auth_headers).body
|
34
|
+
).map { |k, v| [to_underscore(k), v] }.to_h
|
35
|
+
end
|
36
|
+
|
37
|
+
# DELETE /trafficTypes/{traffic_type_id}/schema/{attribute_id}
|
38
|
+
def delete(traffic_type_id, attribute_id)
|
39
|
+
RestClient.delete(
|
40
|
+
"#{@config.base_uri}/trafficTypes/#{traffic_type_id}" \
|
41
|
+
"/schema/#{attribute_id}",
|
42
|
+
auth_headers) == 'true'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SplitApi
|
2
|
+
module Models
|
3
|
+
class BaseModel
|
4
|
+
protected
|
5
|
+
|
6
|
+
def to_underscore(str)
|
7
|
+
str.gsub(/::/, '/').
|
8
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
9
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
10
|
+
tr("-", "_").
|
11
|
+
downcase
|
12
|
+
end
|
13
|
+
|
14
|
+
def auth_headers
|
15
|
+
{ Authorization: "Bearer #{@config.api_key}", content_type: :json, accept: :json }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SplitApi
|
5
|
+
module Models
|
6
|
+
class Environments < BaseModel
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /environments
|
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
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SplitApi
|
5
|
+
module Models
|
6
|
+
class Identities < BaseModel
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
# PUT /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities/{key}
|
12
|
+
def save(identity)
|
13
|
+
JSON.parse(RestClient.put(
|
14
|
+
"#{@config.base_uri}/trafficTypes/#{identity[:traffic_type_id]}" \
|
15
|
+
"/environments/#{identity[:environment_id]}/identities/#{identity[:key]}",
|
16
|
+
{
|
17
|
+
'key' => identity[:key],
|
18
|
+
'trafficTypeId' => identity[:traffic_type_id],
|
19
|
+
'environmentId' => identity[:environment_id],
|
20
|
+
'values' => identity[:values]
|
21
|
+
}.to_json, auth_headers).body).map { |k, v| [to_underscore(k), v] }.to_h
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities
|
25
|
+
def save_all(traffic_type_id, environment_id, identities)
|
26
|
+
JSON.parse(RestClient.post(
|
27
|
+
"#{@config.base_uri}/trafficTypes/#{traffic_type_id}" \
|
28
|
+
"/environments/#{environment_id}" \
|
29
|
+
"/identities",
|
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
|
34
|
+
end
|
35
|
+
|
36
|
+
# PATCH /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities/{key}
|
37
|
+
def update(identity)
|
38
|
+
JSON.parse(RestClient.patch(
|
39
|
+
"#{@config.base_uri}/trafficTypes/#{identity[:traffic_type_id]}" \
|
40
|
+
"/environments/#{identity[:environment_id]}/identities/#{identity[:key]}",
|
41
|
+
{
|
42
|
+
'key' => identity[:key],
|
43
|
+
'trafficTypeId' => identity[:traffic_type_id],
|
44
|
+
'environmentId' => identity[:environment_id],
|
45
|
+
'values' => identity[:values]
|
46
|
+
}.to_json, auth_headers).body).map { |k, v| [to_underscore(k), v] }.to_h
|
47
|
+
end
|
48
|
+
|
49
|
+
# DELETE /trafficTypes/{traffic_type_id}/environments/{environment_id}/identities/{key}
|
50
|
+
def delete(traffic_type_id, environment_id, key)
|
51
|
+
RestClient.delete(
|
52
|
+
"#{@config.base_uri}/trafficTypes/#{traffic_type_id}/environments/" \
|
53
|
+
"#{environment_id}/identities/#{key}",
|
54
|
+
auth_headers) == 'true'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SplitApi
|
5
|
+
module Models
|
6
|
+
class TrafficTypes < BaseModel
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /trafficTypes
|
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
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/splitapi-rb.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'splitapi-rb/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'splitapi-rb'
|
7
|
+
spec.version = SplitApi::VERSION
|
8
|
+
spec.authors = ['Split Software']
|
9
|
+
spec.email = ['pato@split.io']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby API wrapper around Split API'
|
12
|
+
spec.description = 'Provides simple interface to the Split Identify API'
|
13
|
+
spec.homepage = 'https://github.com/splitio/ruby-api'
|
14
|
+
spec.license = 'Apache-2.0'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'byebug', '~> 9'
|
25
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
26
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.4'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 2.3'
|
28
|
+
|
29
|
+
spec.add_runtime_dependency 'json', '~> 1.8'
|
30
|
+
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: splitapi-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Split Software
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: json
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.8'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.8'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rest-client
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.0'
|
139
|
+
description: Provides simple interface to the Split Identify API
|
140
|
+
email:
|
141
|
+
- pato@split.io
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- Gemfile
|
149
|
+
- Gemfile.lock
|
150
|
+
- NEWS
|
151
|
+
- README.md
|
152
|
+
- lib/splitapi-rb.rb
|
153
|
+
- lib/splitapi-rb/client.rb
|
154
|
+
- lib/splitapi-rb/config.rb
|
155
|
+
- lib/splitapi-rb/exceptions/splitapi_exception.rb
|
156
|
+
- lib/splitapi-rb/exceptions/splitapi_not_found_exception.rb
|
157
|
+
- lib/splitapi-rb/models/attributes.rb
|
158
|
+
- lib/splitapi-rb/models/base_model.rb
|
159
|
+
- lib/splitapi-rb/models/environments.rb
|
160
|
+
- lib/splitapi-rb/models/identities.rb
|
161
|
+
- lib/splitapi-rb/models/traffic_types.rb
|
162
|
+
- lib/splitapi-rb/version.rb
|
163
|
+
- splitapi-rb.gemspec
|
164
|
+
homepage: https://github.com/splitio/ruby-api
|
165
|
+
licenses:
|
166
|
+
- Apache-2.0
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 2.5.2
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: Ruby API wrapper around Split API
|
188
|
+
test_files: []
|