sixpack-client 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzUyMTk0MjllOGI1MGIyYmRiYmY4OTQxOGZjOWFjYjViODNiOGRhNQ==
5
- data.tar.gz: !binary |-
6
- ZjM0MjFhYzlmNTAzYTE0MGJhNTIxZjgxMTZlMWEyZDY2MzUxNGI3OA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MDkzZTc0MzI5NTEwOTVmMWQ0NmIyMTJmMWQ0MjRkMGJkMTdjYWQ3NWQ0YWNm
10
- MTQxZDVjYzVlODQ2ZGFiZmQ0YzRmNjIyMzI4YTA5NTdmODBmZTAyMDgwMWJi
11
- MDg4YTZlZjhmOTk0YzVhNzdiNjRkN2IwNzYwNTk2MzE3ZDk0MGM=
12
- data.tar.gz: !binary |-
13
- ZTE0ODFkODkxMDg3YTNlYWFjMTRiYmIzZTFkNGQ1MDg0ODYwYzAwM2M1Yzgy
14
- YzMwYjk2MGY3MTg4YWVjZGRjNGYxZTQxNTA3MmEwNDhhZDZjZWUyMzc2OWNk
15
- NTEyMjYxZDQzY2NjMzliMmViZDlmMWFhODM3ZDNkYTgxYjZmYzk=
2
+ SHA1:
3
+ metadata.gz: 3ac1b81e827471f08af10f2689d620f557da4433
4
+ data.tar.gz: 485581e22b9d195173e61cb72c98f314e456aa53
5
+ SHA512:
6
+ metadata.gz: bf7d70fc22b10161bf830649aa5210935e787098640c4a6ca2645e9027c9a70f845aa529117147690a4c8d1239161c91fbaced93fb742a260f70ee3a11750d89
7
+ data.tar.gz: 4b8352e66c843fe0c0c43b5515bdd0bb19056968c338b414093768f65b370c3f12d5b2763e05fe8e1d7bd53f6e5ed995e90c77d28cdc8af5d3d4dd6f3cd8f8eb
data/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  Ruby client library for SeatGeek's Sixpack ab testing framework.
6
6
 
7
+ ## Requirements
8
+
9
+ - Ruby 1.9.3+ (2.x tested via travis)
10
+
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
@@ -49,7 +49,7 @@ module Sixpack
49
49
  end
50
50
  end
51
51
 
52
- def participate(experiment_name, alternatives, force=nil)
52
+ def participate(experiment_name, alternatives, force=nil, kpi=nil)
53
53
  if !(experiment_name =~ /^[a-z0-9][a-z0-9\-_ ]*$/)
54
54
  raise ArgumentError, "Bad experiment_name, must be lowercase, start with an alphanumeric and contain alphanumerics, dashes and underscores"
55
55
  end
@@ -69,6 +69,7 @@ module Sixpack
69
69
  :experiment => experiment_name,
70
70
  :alternatives => alternatives
71
71
  }
72
+ params = params.merge(kpi: kpi) if kpi
72
73
  if !force.nil? && alternatives.include?(force)
73
74
  return {"status" => "ok", "alternative" => {"name" => force}, "experiment" => {"version" => 0, "name" => experiment_name}, "client_id" => @client_id}
74
75
  end
@@ -81,11 +82,12 @@ module Sixpack
81
82
  res
82
83
  end
83
84
 
84
- def convert(experiment_name)
85
+ def convert(experiment_name, kpi = nil)
85
86
  params = {
86
87
  :client_id => @client_id,
87
88
  :experiment => experiment_name
88
89
  }
90
+ params = params.merge(kpi: kpi) if kpi
89
91
  self.get_response("/convert", params)
90
92
  end
91
93
 
@@ -100,7 +102,7 @@ module Sixpack
100
102
  end
101
103
 
102
104
  def get_response(endpoint, params)
103
- uri = URI.parse(@base_url)
105
+ uri = URI.parse(@base_url)
104
106
  http = Net::HTTP.new(uri.host, uri.port)
105
107
 
106
108
  if uri.scheme == "https"
@@ -108,8 +110,8 @@ module Sixpack
108
110
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
109
111
  end
110
112
 
111
- http.open_timeout = 0.25
112
- http.read_timeout = 0.25
113
+ http.open_timeout = 1.0
114
+ http.read_timeout = 1.0
113
115
  query = Addressable::URI.form_encode(self.build_params(params))
114
116
 
115
117
  begin
@@ -1,3 +1,3 @@
1
1
  module Sixpack
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -89,5 +89,20 @@ RSpec.describe Sixpack do
89
89
  sess.participate('show-bieber', ['trolled', '%%'], nil)
90
90
  }.to raise_error
91
91
  end
92
+
93
+ context 'KPI' do
94
+
95
+ it 'should convert w/out a KPI' do
96
+ sess = Sixpack::Session.new
97
+ sess.participate('show-bieber', ['trolled', 'not-trolled'])
98
+ sess.convert('show-bieber')
99
+ end
100
+
101
+ it 'should allow setting a KPI when converting' do
102
+ sess = Sixpack::Session.new
103
+ sess.participate('show-bieber', ['trolled', 'not-trolled'])
104
+ sess.convert('show-bieber', kpi = 'sales')
105
+ end
106
+ end
92
107
 
93
108
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixpack-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SeatGeek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: redis
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: addressable
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Ruby library for interacting with SeatGeek's sixpack.
@@ -87,9 +87,9 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
92
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
93
  - Gemfile
94
94
  - LICENSE
95
95
  - README.md
@@ -109,17 +109,17 @@ require_paths:
109
109
  - lib
110
110
  required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - ! '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ! '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.0.7
122
+ rubygems_version: 2.4.8
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Ruby library for interacting with SeatGeek's sixpack.