sixpack-client 0.4.0 → 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 +15 -0
- data/.travis.yml +3 -0
- data/README.md +9 -8
- data/lib/sixpack/version.rb +1 -1
- data/lib/sixpack.rb +0 -11
- data/sixpack.gemspec +1 -1
- data/spec/lib/sixpack_spec.rb +32 -25
- metadata +7 -20
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
ZTJlYzVkNmZlMDI0ZjNiMmIwMTA5NmQ1OTY0ZThhN2ZlOTg2ZmI5Nw==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
YmFmMDIxOTU2ZWE3ZDBlYmE0OWRmOWM5NTA5OTE3YzczZTVmMzc0Mg==
|
|
7
|
+
!binary "U0hBNTEy":
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
YmM0ZDdhYWY5NTAwZTA3ZmM4MGU4Y2ZmZDg3MzMwYWQ0M2JhOWEwNzkyMWEz
|
|
10
|
+
OTYzZDFhNTZlMGM4MWUyZDg4ZmZhZWVmYTczYmE3ZmQ0NzNmODJlM2MxN2E4
|
|
11
|
+
MzA5NzlmOGU3YWRlODY2Y2I4Njc0NjYwOTBlMmI4M2U2M2Y5M2M=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
NTJhMGE1YjNhYmY1YzFhZWJjNjA3MjMxMDAyZGNiZDU4ZjY1YjlkODE0NmI1
|
|
14
|
+
NjVmZTIzMDc4ZDAyYzdlYjNlZWYyOWJmMjJiMjY4NzlmODM5ZDMxZWY0MTZj
|
|
15
|
+
ZTUzOTM4YWE4YWYzZDA3YjExYzBjOGQ2NGM0M2U4MDRmODM5MzI=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
|
@@ -48,18 +48,19 @@ session = Sixpack::Session.new client_id
|
|
|
48
48
|
session.convert("new-test")
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Sessions can take an optional `options` dictionary that takes `host` and `timeout` as keys. This allows you to customize Sixpack's location.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
options = {'host': 'http://mysixpacklocation.com'}
|
|
54
|
+
session = Session(client_id="123", options=options)
|
|
55
|
+
|
|
56
|
+
If Sixpack is unreachable or other errors occur, sixpack-py will provide the control alternative.
|
|
55
57
|
|
|
56
|
-
Sixpack::simple_convert("new-test", client_id)
|
|
57
|
-
```
|
|
58
58
|
|
|
59
59
|
## Contributing
|
|
60
60
|
|
|
61
61
|
1. Fork it
|
|
62
62
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
63
|
-
3.
|
|
64
|
-
4.
|
|
65
|
-
5.
|
|
63
|
+
3. Write and run some tests with `$ rake`
|
|
64
|
+
4. Commit your changes (`git commit -am 'Added some feature'`)
|
|
65
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
|
66
|
+
6. Create new Pull Request
|
data/lib/sixpack/version.rb
CHANGED
data/lib/sixpack.rb
CHANGED
|
@@ -13,17 +13,6 @@ module Sixpack
|
|
|
13
13
|
|
|
14
14
|
@base_url = "http://localhost:5000"
|
|
15
15
|
|
|
16
|
-
def simple_participate(experiment_name, alternatives, client_id=nil, force=nil)
|
|
17
|
-
session = Session.new(client_id)
|
|
18
|
-
res = session.participate(experiment_name, alternatives, force)
|
|
19
|
-
res["alternative"]["name"]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def simple_convert(experiment_name, client_id)
|
|
23
|
-
session = Session.new(client_id)
|
|
24
|
-
session.convert(experiment_name)["status"]
|
|
25
|
-
end
|
|
26
|
-
|
|
27
16
|
def generate_client_id
|
|
28
17
|
uuid = UUID.new
|
|
29
18
|
uuid.generate
|
data/sixpack.gemspec
CHANGED
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
|
|
|
18
18
|
gem.add_development_dependency 'rake'
|
|
19
19
|
gem.add_development_dependency 'rspec'
|
|
20
20
|
gem.add_development_dependency 'redis'
|
|
21
|
-
gem.add_development_dependency 'json'
|
|
22
21
|
|
|
22
|
+
gem.add_runtime_dependency 'json'
|
|
23
23
|
gem.add_runtime_dependency 'uuid'
|
|
24
24
|
gem.add_runtime_dependency 'addressable'
|
|
25
25
|
end
|
data/spec/lib/sixpack_spec.rb
CHANGED
|
@@ -10,16 +10,18 @@ describe Sixpack do
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
it "should return an alternative for
|
|
14
|
-
|
|
15
|
-
['trolled', 'not-trolled']
|
|
13
|
+
it "should return an alternative for participate" do
|
|
14
|
+
sess = Sixpack::Session.new("mike")
|
|
15
|
+
resp = sess.participate('show-bieber', ['trolled', 'not-trolled'])
|
|
16
|
+
['trolled', 'not-trolled'].should include(resp["alternative"]["name"])
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
it "should return the correct alternative for
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
it "should return the correct alternative for participate with force" do
|
|
20
|
+
sess = Sixpack::Session.new("mike")
|
|
21
|
+
alt = sess.participate('show-bieber', ['trolled', 'not-trolled'], "trolled")["alternative"]["name"]
|
|
22
|
+
alt.should == "trolled"
|
|
21
23
|
|
|
22
|
-
alternative =
|
|
24
|
+
alternative = sess.participate('show-bieber', ['trolled', 'not-trolled'], "not-trolled")["alternative"]["name"]
|
|
23
25
|
alternative.should == "not-trolled"
|
|
24
26
|
end
|
|
25
27
|
|
|
@@ -28,51 +30,56 @@ describe Sixpack do
|
|
|
28
30
|
session = Sixpack::Session.new('client_id', {}, params)
|
|
29
31
|
session.ip_address.should == '8.8.8.8'
|
|
30
32
|
session.user_agent.should == 'FirChromari'
|
|
31
|
-
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
it "should auto generate a client_id" do
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
sess = Sixpack::Session.new
|
|
37
|
+
sess.client_id.length.should == 36
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
it "should return ok for
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
it "should return ok for convert" do
|
|
41
|
+
sess = Sixpack::Session.new("mike")
|
|
42
|
+
alternative = sess.participate('show-bieber', ['trolled', 'not-trolled'])
|
|
43
|
+
sess.convert("show-bieber")["status"].should == "ok"
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
it "should return ok for multiple_converts" do
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
sess = Sixpack::Session.new("mike")
|
|
48
|
+
sess.participate('show-bieber', ['trolled', 'not-trolled'])
|
|
49
|
+
sess.convert("show-bieber")["status"].should == "ok"
|
|
50
|
+
sess.convert("show-bieber")["status"].should == "ok"
|
|
48
51
|
end
|
|
49
52
|
|
|
50
|
-
it "should not return ok for
|
|
51
|
-
Sixpack.
|
|
53
|
+
it "should not return ok for convert with new id" do
|
|
54
|
+
sess = Sixpack::Session.new("unknown_id")
|
|
55
|
+
sess.convert("show-bieber")["status"].should == "failed"
|
|
52
56
|
end
|
|
53
57
|
|
|
54
|
-
it "should not return ok for
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
it "should not return ok for convert with new experiment" do
|
|
59
|
+
sess = Sixpack::Session.new
|
|
60
|
+
sess.convert("show-blieber")['status'].should == "failed"
|
|
57
61
|
end
|
|
58
62
|
|
|
59
63
|
it "should not allow bad experiment names" do
|
|
60
64
|
expect {
|
|
61
|
-
Sixpack.
|
|
65
|
+
sess = Sixpack::Session.new
|
|
66
|
+
sess.participate('%%', ['trolled', 'not-trolled'], nil)
|
|
62
67
|
}.to raise_error
|
|
63
68
|
end
|
|
64
69
|
|
|
65
70
|
it "should not allow bad alternatives names" do
|
|
66
71
|
expect {
|
|
67
|
-
Sixpack.
|
|
72
|
+
sess = Sixpack::Session.new
|
|
73
|
+
sess.participate('show-bieber', ['trolled'], nil)
|
|
68
74
|
}.to raise_error
|
|
69
75
|
|
|
70
76
|
expect {
|
|
71
|
-
Sixpack.
|
|
77
|
+
sess = Sixpack::Session.new
|
|
78
|
+
sess.participate('show-bieber', ['trolled', '%%'], nil)
|
|
72
79
|
}.to raise_error
|
|
73
80
|
end
|
|
74
81
|
|
|
75
|
-
it "should work
|
|
82
|
+
it "should work" do
|
|
76
83
|
session = Sixpack::Session.new
|
|
77
84
|
session.convert("testing")["status"].should == "failed"
|
|
78
85
|
alt_one = session.participate("testing", ["one", "two"])["alternative"]
|
metadata
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sixpack-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- SeatGeek
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-08-
|
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rake
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
17
|
- - ! '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
@@ -22,7 +20,6 @@ dependencies:
|
|
|
22
20
|
type: :development
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
24
|
- - ! '>='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
@@ -30,7 +27,6 @@ dependencies:
|
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: rspec
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
31
|
- - ! '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
@@ -38,7 +34,6 @@ dependencies:
|
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
38
|
- - ! '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
@@ -46,7 +41,6 @@ dependencies:
|
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: redis
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
45
|
- - ! '>='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
@@ -54,7 +48,6 @@ dependencies:
|
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
52
|
- - ! '>='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
@@ -62,15 +55,13 @@ dependencies:
|
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: json
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
59
|
- - ! '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
|
-
type: :
|
|
62
|
+
type: :runtime
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
66
|
- - ! '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
@@ -78,7 +69,6 @@ dependencies:
|
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
|
79
70
|
name: uuid
|
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
72
|
requirements:
|
|
83
73
|
- - ! '>='
|
|
84
74
|
- !ruby/object:Gem::Version
|
|
@@ -86,7 +76,6 @@ dependencies:
|
|
|
86
76
|
type: :runtime
|
|
87
77
|
prerelease: false
|
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
79
|
requirements:
|
|
91
80
|
- - ! '>='
|
|
92
81
|
- !ruby/object:Gem::Version
|
|
@@ -94,7 +83,6 @@ dependencies:
|
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
|
95
84
|
name: addressable
|
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
86
|
requirements:
|
|
99
87
|
- - ! '>='
|
|
100
88
|
- !ruby/object:Gem::Version
|
|
@@ -102,7 +90,6 @@ dependencies:
|
|
|
102
90
|
type: :runtime
|
|
103
91
|
prerelease: false
|
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
93
|
requirements:
|
|
107
94
|
- - ! '>='
|
|
108
95
|
- !ruby/object:Gem::Version
|
|
@@ -115,6 +102,7 @@ extensions: []
|
|
|
115
102
|
extra_rdoc_files: []
|
|
116
103
|
files:
|
|
117
104
|
- .gitignore
|
|
105
|
+
- .travis.yml
|
|
118
106
|
- Gemfile
|
|
119
107
|
- LICENSE
|
|
120
108
|
- README.md
|
|
@@ -126,27 +114,26 @@ files:
|
|
|
126
114
|
- spec/spec_helper.rb
|
|
127
115
|
homepage: http://www.seatgeek.com
|
|
128
116
|
licenses: []
|
|
117
|
+
metadata: {}
|
|
129
118
|
post_install_message:
|
|
130
119
|
rdoc_options: []
|
|
131
120
|
require_paths:
|
|
132
121
|
- lib
|
|
133
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
|
-
none: false
|
|
135
123
|
requirements:
|
|
136
124
|
- - ! '>='
|
|
137
125
|
- !ruby/object:Gem::Version
|
|
138
126
|
version: '0'
|
|
139
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
|
-
none: false
|
|
141
128
|
requirements:
|
|
142
129
|
- - ! '>='
|
|
143
130
|
- !ruby/object:Gem::Version
|
|
144
131
|
version: '0'
|
|
145
132
|
requirements: []
|
|
146
133
|
rubyforge_project:
|
|
147
|
-
rubygems_version:
|
|
134
|
+
rubygems_version: 2.0.7
|
|
148
135
|
signing_key:
|
|
149
|
-
specification_version:
|
|
136
|
+
specification_version: 4
|
|
150
137
|
summary: Ruby library for interacting with SeatGeek's sixpack.
|
|
151
138
|
test_files:
|
|
152
139
|
- spec/lib/sixpack_spec.rb
|