optimizely 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25fe019e21c9088598a3a9cc36b1d3618d29706a
4
- data.tar.gz: ee6fd98c0d6b9313f6845f35763050ebad09b320
3
+ metadata.gz: 353677dc79d930155be9437cc63a12a7ba3c391d
4
+ data.tar.gz: 66b1d065a85d78a1183046c022790c30f641ecb6
5
5
  SHA512:
6
- metadata.gz: 75e1beb277260bf1dde76c43a93c501ba30318a15032ae21aff410a99a3284992f40263d390d2314d8bd6c15b73f921713c6a031f5c1addaeaea8e8237036eff
7
- data.tar.gz: 59dc6604a0aa66a855be43bf7d300e547ae0fa896ef6340d29da008d4e0d3dfff3ce7f302c89280a28b1c2ea068051878a05f2df93086c83b3a82b8bb0f932e5
6
+ metadata.gz: ce6dc54c863482f83787581be88d357166517992dbabf9f1a2eaa5de0ba46fcab8b8945915667c68e7a3dcdccca2db70c98fa93d54a1e579fbf1e354272e7b01
7
+ data.tar.gz: 5f24a35dd0a980f03ecb208cfd763d3c9b0524bbb0ea20e7c16651aa88272c3764e8d8a7055c62bd5e18fac0bc450a90c784567d900cd5a723c152596dd2522f
data/Gemfile.lock CHANGED
@@ -1,17 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Optimizely (1.0.0)
4
+ optimizely (1.1.2)
5
5
 
6
6
  GEM
7
7
  remote: http://www.rubygems.org/
8
8
  specs:
9
9
  json (1.8.1)
10
+ rake (10.3.1)
10
11
 
11
12
  PLATFORMS
12
13
  ruby
13
14
 
14
15
  DEPENDENCIES
15
- Optimizely!
16
16
  bundler
17
17
  json
18
+ optimizely!
19
+ rake
data/README.md CHANGED
@@ -26,6 +26,8 @@ Don't forget to bundle install:
26
26
 
27
27
  ## Projects
28
28
 
29
+ The fields that are available for a project: project_name, project_status, id and account_id.
30
+
29
31
  Retrieve all projects:
30
32
  projects = optimizely.projects
31
33
 
@@ -33,6 +35,8 @@ Don't forget to bundle install:
33
35
  project = optimizely.project(12345)
34
36
 
35
37
  ## Experiments
38
+
39
+ The fields that are available for an experiment: id, project_id, variation_ids, edit_url and status.
36
40
 
37
41
  Retrieve all experiments for a project:
38
42
  experiments = optimizely.experiments(12345)
@@ -42,6 +46,8 @@ Don't forget to bundle install:
42
46
 
43
47
  ## Variations
44
48
 
49
+ The fields that are available for a varation: is_paused, description, weight, created, variation_id, section_id, js_component, experiment_id, project_id and id.
50
+
45
51
  Retrieve all variations for an experiment:
46
52
  variations = optimizely.variations(12345)
47
53
 
@@ -50,6 +56,8 @@ Don't forget to bundle install:
50
56
 
51
57
  ## Audiences
52
58
 
59
+ The fields that are available for an audience: id, name, project_id and description.
60
+
53
61
  Retrieve all audiences for an project:
54
62
  audiences = optimizely.audiences(12345)
55
63
 
@@ -60,6 +68,9 @@ Don't forget to bundle install:
60
68
 
61
69
  ### Changelog
62
70
 
71
+ #### 1.1.2
72
+ * Write tests to check what happens if data is not available.
73
+
63
74
  #### 1.1.1
64
75
  * Return a hash object for the data you've just requested.
65
76
 
data/Rakefile CHANGED
@@ -0,0 +1,8 @@
1
+ require "rake/testtask"
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << "test"
5
+ end
6
+
7
+ desc "Run all tests for the Optimizely gem"
8
+ task default: :test
@@ -8,7 +8,7 @@ module Optimizely
8
8
  @is_paused = json['is_paused']
9
9
  @description = json['description']
10
10
  @weight = json['weight']
11
- @created = json['created']
11
+ @created = DateTime.parse(json['created'])
12
12
  @variation_id = json['variation_id']
13
13
  @section_id = json['section_id']
14
14
  @js_component = json['js_component']
@@ -1,3 +1,3 @@
1
1
  module Optimizely
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
data/optimizely.gemspec CHANGED
@@ -11,9 +11,11 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "https://github.com/martijnsch/optimizely-gem/"
12
12
  s.summary = %q{The Optimizely Experiment API lets you create and manage Optimizely projects and the experiments inside of them.}
13
13
  s.description = %q{A Ruby gem to communicate with the Optimizely Experiments API, it lets you create and manage Optimizely projects and the experiments inside of them.}
14
+
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
18
  s.require_paths = ["lib"]
18
19
  s.extra_rdoc_files = ["README.md"]
20
+ s.add_development_dependency 'rake'
19
21
  end
@@ -0,0 +1,69 @@
1
+ require 'test/unit'
2
+ require 'optimizely'
3
+
4
+ class OptimizelyTest < Test::Unit::TestCase
5
+
6
+ TEST_API_KEY = ''
7
+
8
+ def test_initialize_without_api_key
9
+ assert_raise OptimizelyError::NoAPIToken do
10
+ Optimizely.new({ api_token: nil })
11
+ end
12
+ end
13
+
14
+ def test_retrieve_project_without_id
15
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
16
+ assert_raise OptimizelyError::NoProjectID do
17
+ optimizely.project(nil)
18
+ end
19
+ end
20
+
21
+ def test_retrieve_experiment_without_project_id
22
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
23
+ assert_raise OptimizelyError::NoProjectID do
24
+ optimizely.experiments(nil)
25
+ end
26
+ end
27
+
28
+ def test_retrieve_experiment_without_id
29
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
30
+ assert_raise OptimizelyError::NoExperimentID do
31
+ optimizely.experiment(nil)
32
+ end
33
+ end
34
+
35
+ def test_retrieve_variations_without_experiment_id
36
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
37
+ assert_raise OptimizelyError::NoExperimentID do
38
+ optimizely.variations(nil)
39
+ end
40
+ end
41
+
42
+ def test_retrieve_variation_without_id
43
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
44
+ assert_raise OptimizelyError::NoVariationID do
45
+ optimizely.variation(nil)
46
+ end
47
+ end
48
+
49
+ def test_retrieve_audiences_without_project_id
50
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
51
+ assert_raise OptimizelyError::NoProjectID do
52
+ optimizely.audiences(nil)
53
+ end
54
+ end
55
+
56
+ def test_retrieve_audience_without_id
57
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
58
+ assert_raise OptimizelyError::NoAudienceID do
59
+ optimizely.audience(nil)
60
+ end
61
+ end
62
+
63
+ def test_retrieve_projects_forbidden
64
+ optimizely = Optimizely.new({ api_token: '1234567890:xxxxx' })
65
+ assert_raise OptimizelyError::Forbidden do
66
+ optimizely.projects
67
+ end
68
+ end
69
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimizely
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martijn Scheijbeler
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-05-06 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: A Ruby gem to communicate with the Optimizely Experiments API, it lets
14
28
  you create and manage Optimizely projects and the experiments inside of them.
15
29
  email: martijn@marusem.com
@@ -33,6 +47,7 @@ files:
33
47
  - lib/optimizely/variation.rb
34
48
  - lib/optimizely/version.rb
35
49
  - optimizely.gemspec
50
+ - test/test_optimizely.rb
36
51
  homepage: https://github.com/martijnsch/optimizely-gem/
37
52
  licenses: []
38
53
  metadata: {}
@@ -57,4 +72,5 @@ signing_key:
57
72
  specification_version: 4
58
73
  summary: The Optimizely Experiment API lets you create and manage Optimizely projects
59
74
  and the experiments inside of them.
60
- test_files: []
75
+ test_files:
76
+ - test/test_optimizely.rb