optimizely 1.1.0 → 1.1.1
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 +4 -4
- data/README.md +3 -0
- data/lib/optimizely/audience.rb +9 -0
- data/lib/optimizely/engine.rb +40 -9
- data/lib/optimizely/experiment.rb +10 -0
- data/lib/optimizely/project.rb +9 -0
- data/lib/optimizely/variation.rb +16 -0
- data/lib/optimizely/version.rb +1 -1
- data/lib/optimizely.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25fe019e21c9088598a3a9cc36b1d3618d29706a
|
|
4
|
+
data.tar.gz: ee6fd98c0d6b9313f6845f35763050ebad09b320
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75e1beb277260bf1dde76c43a93c501ba30318a15032ae21aff410a99a3284992f40263d390d2314d8bd6c15b73f921713c6a031f5c1addaeaea8e8237036eff
|
|
7
|
+
data.tar.gz: 59dc6604a0aa66a855be43bf7d300e547ae0fa896ef6340d29da008d4e0d3dfff3ce7f302c89280a28b1c2ea068051878a05f2df93086c83b3a82b8bb0f932e5
|
data/README.md
CHANGED
|
@@ -60,6 +60,9 @@ Don't forget to bundle install:
|
|
|
60
60
|
|
|
61
61
|
### Changelog
|
|
62
62
|
|
|
63
|
+
#### 1.1.1
|
|
64
|
+
* Return a hash object for the data you've just requested.
|
|
65
|
+
|
|
63
66
|
#### 1.1
|
|
64
67
|
* Fix some typos in the errors for having no variable in a function and added extra documentation.
|
|
65
68
|
* Add support for reading specific projects, experiments, variations and audiences.
|
data/lib/optimizely/audience.rb
CHANGED
data/lib/optimizely/engine.rb
CHANGED
|
@@ -28,7 +28,10 @@ module Optimizely
|
|
|
28
28
|
# projects = optimizely.projects # Look up all projects.
|
|
29
29
|
#
|
|
30
30
|
def projects
|
|
31
|
-
|
|
31
|
+
if @projects.nil?
|
|
32
|
+
response = self.get("projects")
|
|
33
|
+
@projects = response.collect { |project_json| Project.new(project_json) }
|
|
34
|
+
end
|
|
32
35
|
@projects
|
|
33
36
|
end
|
|
34
37
|
|
|
@@ -40,7 +43,11 @@ module Optimizely
|
|
|
40
43
|
#
|
|
41
44
|
def project(id)
|
|
42
45
|
raise OptimizelyError::NoProjectID, "A Project ID is required to retrieve the project." if id.nil?
|
|
43
|
-
|
|
46
|
+
|
|
47
|
+
if @project.nil?
|
|
48
|
+
response = self.get("projects/#{id}")
|
|
49
|
+
@project = Project.new(response)
|
|
50
|
+
end
|
|
44
51
|
@project
|
|
45
52
|
end
|
|
46
53
|
|
|
@@ -52,7 +59,11 @@ module Optimizely
|
|
|
52
59
|
#
|
|
53
60
|
def experiments(project_id)
|
|
54
61
|
raise OptimizelyError::NoProjectID, "A Project ID is required to retrieve experiments." if project_id.nil?
|
|
55
|
-
|
|
62
|
+
|
|
63
|
+
if @experiments.nil?
|
|
64
|
+
response = self.get("projects/#{project_id}/experiments")
|
|
65
|
+
@experiments = response.collect { |response_json| Experiment.new(response_json) }
|
|
66
|
+
end
|
|
56
67
|
@experiments
|
|
57
68
|
end
|
|
58
69
|
|
|
@@ -64,7 +75,11 @@ module Optimizely
|
|
|
64
75
|
#
|
|
65
76
|
def experiment(id)
|
|
66
77
|
raise OptimizelyError::NoExperimentID, "An Experiment ID is required to retrieve the experiment." if id.nil?
|
|
67
|
-
|
|
78
|
+
|
|
79
|
+
if @experiment.nil?
|
|
80
|
+
response = self.get("experiments/#{id}")
|
|
81
|
+
@experiment = Experiment.new(response)
|
|
82
|
+
end
|
|
68
83
|
@experiment
|
|
69
84
|
end
|
|
70
85
|
|
|
@@ -76,8 +91,12 @@ module Optimizely
|
|
|
76
91
|
#
|
|
77
92
|
def variations(experiment_id)
|
|
78
93
|
raise OptimizelyError::NoExperimentID, "An Experiment ID is required to retrieve variations." if experiment_id.nil?
|
|
79
|
-
|
|
80
|
-
@
|
|
94
|
+
|
|
95
|
+
if @variations.nil?
|
|
96
|
+
response = self.get("projects/#{experiment_id}/variations")
|
|
97
|
+
@variations = response.collect { |variation_json| Variation.new(variation_json) }
|
|
98
|
+
end
|
|
99
|
+
@variations
|
|
81
100
|
end
|
|
82
101
|
|
|
83
102
|
# Returns the details for a specific variation.
|
|
@@ -88,7 +107,11 @@ module Optimizely
|
|
|
88
107
|
#
|
|
89
108
|
def variation(id)
|
|
90
109
|
raise OptimizelyError::NoVariationID, "A Variation ID is required to retrieve the variation." if id.nil?
|
|
91
|
-
|
|
110
|
+
|
|
111
|
+
if @variation.nil?
|
|
112
|
+
response = self.get("variations/#{id}")
|
|
113
|
+
@variation = Variation.new(response)
|
|
114
|
+
end
|
|
92
115
|
@variation
|
|
93
116
|
end
|
|
94
117
|
|
|
@@ -100,7 +123,11 @@ module Optimizely
|
|
|
100
123
|
#
|
|
101
124
|
def audiences(project_id)
|
|
102
125
|
raise OptimizelyError::NoProjectID, "A Project ID is required to retrieve audiences." if project_id.nil?
|
|
103
|
-
|
|
126
|
+
|
|
127
|
+
if @audiences.nil?
|
|
128
|
+
response = self.get("projects/#{project_id}/audiences")
|
|
129
|
+
@audiences = response.collect { |audience_json| Audience.new(audience_json) }
|
|
130
|
+
end
|
|
104
131
|
@audiences
|
|
105
132
|
end
|
|
106
133
|
|
|
@@ -112,7 +139,11 @@ module Optimizely
|
|
|
112
139
|
#
|
|
113
140
|
def audience(id)
|
|
114
141
|
raise OptimizelyError::NoAudienceID, "An Audience ID is required to retrieve the audience." if id.nil?
|
|
115
|
-
|
|
142
|
+
|
|
143
|
+
if @audience.nil?
|
|
144
|
+
response = self.get("audiences/#{id}")
|
|
145
|
+
@audience = Audience.new(response)
|
|
146
|
+
end
|
|
116
147
|
@audience
|
|
117
148
|
end
|
|
118
149
|
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
module Optimizely
|
|
2
2
|
class Experiment
|
|
3
3
|
|
|
4
|
+
attr_reader :id, :project_id, :variation_ids, :edit_url, :status
|
|
5
|
+
|
|
6
|
+
def initialize(json)
|
|
7
|
+
@id = json['id']
|
|
8
|
+
@project_id = json['project_id']
|
|
9
|
+
@variation_ids = json['variation_ids']
|
|
10
|
+
@edit_url = json['edit_url']
|
|
11
|
+
@status = json['status']
|
|
12
|
+
end
|
|
13
|
+
|
|
4
14
|
end
|
|
5
15
|
end
|
data/lib/optimizely/project.rb
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
module Optimizely
|
|
2
2
|
class Project
|
|
3
3
|
|
|
4
|
+
attr_reader :project_name, :project_status, :id, :account_id
|
|
5
|
+
|
|
6
|
+
def initialize(json)
|
|
7
|
+
@project_name = json['project_name']
|
|
8
|
+
@project_status = json['project_status']
|
|
9
|
+
@id = json['id']
|
|
10
|
+
@account_id = json['account_id']
|
|
11
|
+
end
|
|
12
|
+
|
|
4
13
|
end
|
|
5
14
|
end
|
data/lib/optimizely/variation.rb
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
module Optimizely
|
|
2
2
|
class Variation
|
|
3
3
|
|
|
4
|
+
attr_reader :is_paused, :description, :weight, :created, :variation_id,
|
|
5
|
+
:section_id, :js_component, :experiment_id, :project_id, :id
|
|
6
|
+
|
|
7
|
+
def initialize(json)
|
|
8
|
+
@is_paused = json['is_paused']
|
|
9
|
+
@description = json['description']
|
|
10
|
+
@weight = json['weight']
|
|
11
|
+
@created = json['created']
|
|
12
|
+
@variation_id = json['variation_id']
|
|
13
|
+
@section_id = json['section_id']
|
|
14
|
+
@js_component = json['js_component']
|
|
15
|
+
@experiment_id = json['experiment_id']
|
|
16
|
+
@project_id = json['project_id']
|
|
17
|
+
@id = json['id']
|
|
18
|
+
end
|
|
19
|
+
|
|
4
20
|
end
|
|
5
21
|
end
|
data/lib/optimizely/version.rb
CHANGED
data/lib/optimizely.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: optimizely
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martijn Scheijbeler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-05-
|
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A Ruby gem to communicate with the Optimizely Experiments API, it lets
|
|
14
14
|
you create and manage Optimizely projects and the experiments inside of them.
|
|
@@ -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: 2.0.
|
|
55
|
+
rubygems_version: 2.0.3
|
|
56
56
|
signing_key:
|
|
57
57
|
specification_version: 4
|
|
58
58
|
summary: The Optimizely Experiment API lets you create and manage Optimizely projects
|