myna_eventmachine 1.1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/myna/future.rb +0 -3
- data/lib/myna/myna.rb +14 -4
- data/lib/myna/response.rb +0 -3
- data/lib/myna/version.rb +1 -4
- data/lib/myna.rb +0 -3
- data/test/test_authorized.rb +31 -5
- data/test/test_future.rb +0 -3
- data/test/test_response.rb +0 -3
- data/test/test_suggest.rb +0 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -41,7 +41,7 @@ Rake commands:
|
|
41
41
|
- `test` to run the tests.
|
42
42
|
- `build` to build a Gem
|
43
43
|
- `install` to install the Gem locally
|
44
|
-
- `release` to push the Gem to RubyGems
|
44
|
+
- `release` to push the Gem to RubyGems. The version number comes from `lib/myna/version.rb`
|
45
45
|
|
46
46
|
|
47
47
|
## TODO
|
data/lib/myna/future.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/lib/myna/myna.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -101,6 +98,10 @@ module Myna
|
|
101
98
|
build_uri("/v1/experiment/#{uuid}/reward")
|
102
99
|
end
|
103
100
|
|
101
|
+
def reset(uuid)
|
102
|
+
build_uri("/v1/experiment/#{uuid}/reset")
|
103
|
+
end
|
104
|
+
|
104
105
|
def delete(uuid)
|
105
106
|
build_uri("/v1/experiment/#{uuid}/delete")
|
106
107
|
end
|
@@ -171,7 +172,7 @@ module Myna
|
|
171
172
|
end
|
172
173
|
|
173
174
|
future.map do |response|
|
174
|
-
if response.kind_of? Response::
|
175
|
+
if response.kind_of? Response::Experiment
|
175
176
|
AuthorizedExperiment.new(response.uuid, @email, @password, @host)
|
176
177
|
else
|
177
178
|
response
|
@@ -191,6 +192,15 @@ module Myna
|
|
191
192
|
@password = password
|
192
193
|
end
|
193
194
|
|
195
|
+
def reset
|
196
|
+
@api.make_request(@api.reset(@uuid)) do |client|
|
197
|
+
client.get(:head => {
|
198
|
+
'Accept' => 'application/json',
|
199
|
+
'Authorization' => [@email, @password]
|
200
|
+
})
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
194
204
|
def delete
|
195
205
|
@api.make_request(@api.delete(@uuid)) do |client|
|
196
206
|
client.get(:head => {
|
data/lib/myna/response.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/lib/myna/version.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -23,5 +20,5 @@
|
|
23
20
|
#
|
24
21
|
|
25
22
|
module Myna
|
26
|
-
VERSION = "1.
|
23
|
+
VERSION = "1.2"
|
27
24
|
end
|
data/lib/myna.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/test/test_authorized.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -48,6 +45,31 @@ describe Myna do
|
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
48
|
+
describe "reset" do
|
49
|
+
it "must reset variants to zero" do
|
50
|
+
myna = Myna.authorize("test@example.com", "themostsecretpassword")
|
51
|
+
|
52
|
+
expt = myna.create("reseto").get
|
53
|
+
expt.must_be_kind_of Myna::AuthorizedExperiment
|
54
|
+
|
55
|
+
expt.create_variant("Best variant evar").get.must_be_kind_of Response::Ok
|
56
|
+
suggestion = expt.suggest().get
|
57
|
+
expt.reward(suggestion.token, 1.0)
|
58
|
+
|
59
|
+
info = expt.info().get
|
60
|
+
info.variants[0].totalReward.must_equal 1.0
|
61
|
+
info.variants[0].views.must_equal 1
|
62
|
+
|
63
|
+
expt.reset().get.must_be_kind_of Response::Ok
|
64
|
+
|
65
|
+
info = expt.info().get
|
66
|
+
info.variants[0].totalReward.must_equal 0
|
67
|
+
info.variants[0].views.must_equal 0
|
68
|
+
|
69
|
+
expt.delete().get
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
51
73
|
describe "create_variant and delete_variant" do
|
52
74
|
it "must create and delete variants" do
|
53
75
|
myna = Myna.authorize("test@example.com", "themostsecretpassword")
|
@@ -71,8 +93,12 @@ describe Myna do
|
|
71
93
|
info.name.must_equal "test"
|
72
94
|
info.uuid.must_equal '45923780-80ed-47c6-aa46-15e2ae7a0e8c'
|
73
95
|
info.variants.length.must_equal 2
|
74
|
-
info.variants[0].name
|
75
|
-
|
96
|
+
if info.variants[0].name == 'variant1'
|
97
|
+
info.variants[1].name.must_equal 'variant2'
|
98
|
+
else
|
99
|
+
info.variants[0].name.must_equal 'variant2'
|
100
|
+
info.variants[1].name.must_equal 'variant1'
|
101
|
+
end
|
76
102
|
end
|
77
103
|
end
|
78
104
|
end
|
data/test/test_future.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/test/test_response.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
data/test/test_suggest.rb
CHANGED
@@ -10,9 +10,6 @@
|
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
12
|
#
|
13
|
-
# No portion of this Software shall be used in any application which does not
|
14
|
-
# use the ReportGrid platform to provide some subset of its functionality.
|
15
|
-
#
|
16
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myna_eventmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
54
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
55
|
+
rubygems_version: 1.8.6
|
56
56
|
signing_key:
|
57
57
|
specification_version: 3
|
58
58
|
summary: Ruby/EventMachine client library for Myna (http://www.mynaweb.com)
|