sixpack-client 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,22 +1,9 @@
1
- Copyright (c) 2013 SeatGeek
1
+ Copyright (c) 2013, SeatGeek, Inc.
2
+ All rights reserved.
2
3
 
3
- MIT License
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
5
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
6
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12
7
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+ Neither the name of the SeatGeek nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,3 +1,3 @@
1
1
  module Sixpack
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/sixpack.rb CHANGED
@@ -71,13 +71,13 @@ module Sixpack
71
71
  :alternatives => alternatives
72
72
  }
73
73
  if !force.nil? && alternatives.include?(force)
74
- params[:force] = force
74
+ return {"status" => "ok", "alternative" => {"name" => force}, "experiment" => {"version" => 0, "name" => experiment_name}, "client_id" => @client_id}
75
75
  end
76
76
 
77
77
  res = self.get_response("/participate", params)
78
78
  # On server failure use control
79
79
  if res["status"] == "failed"
80
- res["alternative"] = {:name => alternatives[0]}
80
+ res["alternative"] = {"name" => alternatives[0]}
81
81
  end
82
82
  res
83
83
  end
@@ -15,6 +15,14 @@ describe Sixpack do
15
15
  ['trolled', 'not-trolled'].should include(alternative)
16
16
  end
17
17
 
18
+ it "should return the correct alternative for simple_participate with force" do
19
+ alternative = Sixpack.simple_participate('show-bieber', ['trolled', 'not-trolled'], "mike", "trolled")
20
+ alternative.should == "trolled"
21
+
22
+ alternative = Sixpack.simple_participate('show-bieber', ['trolled', 'not-trolled'], "mike", "not-trolled")
23
+ alternative.should == "not-trolled"
24
+ end
25
+
18
26
  it "should allow ip and user agent to be passed to a session" do
19
27
  params = {:ip_address => '8.8.8.8', :user_agent => 'FirChromari'}
20
28
  session = Sixpack::Session.new('client_id', {}, params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixpack-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
12
+ date: 2013-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 1.8.24
131
+ rubygems_version: 1.8.23
132
132
  signing_key:
133
133
  specification_version: 3
134
134
  summary: Ruby library for interacting with SeatGeek's sixpack.